diff --git a/reference.md b/reference.md
index 8e106cd1d1..9a2f725970 100644
--- a/reference.md
+++ b/reference.md
@@ -22030,6 +22030,320 @@ await client.organizations.clientGrants.delete("id", "grant_id");
+## Organizations Connections
+
+client.organizations.connections.list(id, { ...params }) -> core.Page<Management.OrganizationAllConnectionPost, Management.ListOrganizationAllConnectionsOffsetPaginatedResponseContent>
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+const pageableResponse = await client.organizations.connections.list("id", {
+ page: 1,
+ per_page: 1,
+ include_totals: true,
+ is_enabled: true,
+});
+for await (const item of pageableResponse) {
+ console.log(item);
+}
+
+// Or you can manually iterate page-by-page
+let page = await client.organizations.connections.list("id", {
+ page: 1,
+ per_page: 1,
+ include_totals: true,
+ is_enabled: true,
+});
+while (page.hasNextPage()) {
+ page = page.getNextPage();
+}
+
+// You can also access the underlying response
+const response = page.response;
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `string` — Organization identifier.
+
+
+
+
+
+-
+
+**request:** `Management.ListOrganizationAllConnectionsRequestParameters`
+
+
+
+
+
+-
+
+**requestOptions:** `ConnectionsClient.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.organizations.connections.create(id, { ...params }) -> Management.CreateOrganizationAllConnectionResponseContent
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.organizations.connections.create("id", {
+ connection_id: "connection_id",
+});
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `string` — Organization identifier.
+
+
+
+
+
+-
+
+**request:** `Management.CreateOrganizationAllConnectionRequestParameters`
+
+
+
+
+
+-
+
+**requestOptions:** `ConnectionsClient.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.organizations.connections.get(id, connection_id) -> Management.GetOrganizationAllConnectionResponseContent
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.organizations.connections.get("id", "connection_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `string` — Organization identifier.
+
+
+
+
+
+-
+
+**connection_id:** `string` — Connection identifier.
+
+
+
+
+
+-
+
+**requestOptions:** `ConnectionsClient.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.organizations.connections.delete(id, connection_id) -> void
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.organizations.connections.delete("id", "connection_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `string` — Organization identifier.
+
+
+
+
+
+-
+
+**connection_id:** `string` — Connection identifier.
+
+
+
+
+
+-
+
+**requestOptions:** `ConnectionsClient.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+client.organizations.connections.update(id, connection_id, { ...params }) -> Management.UpdateOrganizationAllConnectionResponseContent
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.organizations.connections.update("id", "connection_id");
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `string` — Organization identifier.
+
+
+
+
+
+-
+
+**connection_id:** `string` — Connection identifier.
+
+
+
+
+
+-
+
+**request:** `Management.UpdateOrganizationConnectionRequestParameters`
+
+
+
+
+
+-
+
+**requestOptions:** `ConnectionsClient.RequestOptions`
+
+
+
+
+
+
+
+
+
+
## Organizations DiscoveryDomains
client.organizations.discoveryDomains.list(id, { ...params }) -> core.Page<Management.OrganizationDiscoveryDomain, Management.ListOrganizationDiscoveryDomainsResponseContent>
diff --git a/src/management/api/requests/requests.ts b/src/management/api/requests/requests.ts
index cd0efd66c9..e4159ea6ee 100644
--- a/src/management/api/requests/requests.ts
+++ b/src/management/api/requests/requests.ts
@@ -3070,6 +3070,66 @@ export interface AssociateOrganizationClientGrantRequestContent {
grant_id: string;
}
+/**
+ * @example
+ * {
+ * page: 1,
+ * per_page: 1,
+ * include_totals: true,
+ * is_enabled: true
+ * }
+ */
+export interface ListOrganizationAllConnectionsRequestParameters {
+ /** Page index of the results to return. First page is 0. */
+ page?: number | null;
+ /** Number of results per page. Defaults to 50. */
+ per_page?: number | null;
+ /** Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). */
+ include_totals?: boolean | null;
+ /** Filter connections by enabled status. */
+ is_enabled?: boolean | null;
+}
+
+/**
+ * @example
+ * {
+ * connection_id: "connection_id"
+ * }
+ */
+export interface CreateOrganizationAllConnectionRequestParameters {
+ /** Name of the connection in the scope of this organization. */
+ organization_connection_name?: string;
+ /** When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. */
+ assign_membership_on_login?: boolean;
+ /** Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. */
+ show_as_button?: boolean;
+ /** Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. */
+ is_signup_enabled?: boolean;
+ organization_access_level?: Management.OrganizationAccessLevelEnum;
+ /** Whether the connection is enabled for the organization. */
+ is_enabled?: boolean;
+ /** Connection identifier. */
+ connection_id: string;
+}
+
+/**
+ * @example
+ * {}
+ */
+export interface UpdateOrganizationConnectionRequestParameters {
+ /** Name of the connection in the scope of this organization. */
+ organization_connection_name?: string | null;
+ /** When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. */
+ assign_membership_on_login?: boolean;
+ /** Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. */
+ show_as_button?: boolean;
+ /** Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. */
+ is_signup_enabled?: boolean;
+ organization_access_level?: Management.OrganizationAccessLevelEnumWithNull | null;
+ /** Whether the connection is enabled for the organization. */
+ is_enabled?: boolean | null;
+}
+
/**
* @example
* {
diff --git a/src/management/api/resources/organizations/client/Client.ts b/src/management/api/resources/organizations/client/Client.ts
index 8eb5bbdc6a..54d651b1ad 100644
--- a/src/management/api/resources/organizations/client/Client.ts
+++ b/src/management/api/resources/organizations/client/Client.ts
@@ -9,6 +9,7 @@ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCode
import * as errors from "../../../../errors/index.js";
import * as Management from "../../../index.js";
import { ClientGrantsClient } from "../resources/clientGrants/client/Client.js";
+import { ConnectionsClient } from "../resources/connections/client/Client.js";
import { DiscoveryDomainsClient } from "../resources/discoveryDomains/client/Client.js";
import { EnabledConnectionsClient } from "../resources/enabledConnections/client/Client.js";
import { InvitationsClient } from "../resources/invitations/client/Client.js";
@@ -23,6 +24,7 @@ export declare namespace OrganizationsClient {
export class OrganizationsClient {
protected readonly _options: NormalizedClientOptionsWithAuth;
protected _clientGrants: ClientGrantsClient | undefined;
+ protected _connections: ConnectionsClient | undefined;
protected _discoveryDomains: DiscoveryDomainsClient | undefined;
protected _enabledConnections: EnabledConnectionsClient | undefined;
protected _invitations: InvitationsClient | undefined;
@@ -36,6 +38,10 @@ export class OrganizationsClient {
return (this._clientGrants ??= new ClientGrantsClient(this._options));
}
+ public get connections(): ConnectionsClient {
+ return (this._connections ??= new ConnectionsClient(this._options));
+ }
+
public get discoveryDomains(): DiscoveryDomainsClient {
return (this._discoveryDomains ??= new DiscoveryDomainsClient(this._options));
}
diff --git a/src/management/api/resources/organizations/resources/connections/client/Client.ts b/src/management/api/resources/organizations/resources/connections/client/Client.ts
new file mode 100644
index 0000000000..376148938d
--- /dev/null
+++ b/src/management/api/resources/organizations/resources/connections/client/Client.ts
@@ -0,0 +1,486 @@
+// This file was auto-generated by Fern from our API Definition.
+
+import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
+import { normalizeClientOptionsWithAuth, type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
+import * as core from "../../../../../../core/index.js";
+import { mergeHeaders } from "../../../../../../core/headers.js";
+import * as environments from "../../../../../../environments.js";
+import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js";
+import * as errors from "../../../../../../errors/index.js";
+import * as Management from "../../../../../index.js";
+
+export declare namespace ConnectionsClient {
+ export type Options = BaseClientOptions;
+
+ export interface RequestOptions extends BaseRequestOptions {}
+}
+
+export class ConnectionsClient {
+ protected readonly _options: NormalizedClientOptionsWithAuth;
+
+ constructor(options: ConnectionsClient.Options) {
+ this._options = normalizeClientOptionsWithAuth(options);
+ }
+
+ /**
+ * @param {string} id - Organization identifier.
+ * @param {Management.ListOrganizationAllConnectionsRequestParameters} 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.organizations.connections.list("id", {
+ * page: 1,
+ * per_page: 1,
+ * include_totals: true,
+ * is_enabled: true
+ * })
+ */
+ public async list(
+ id: string,
+ request: Management.ListOrganizationAllConnectionsRequestParameters = {},
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): Promise<
+ core.Page<
+ Management.OrganizationAllConnectionPost,
+ Management.ListOrganizationAllConnectionsOffsetPaginatedResponseContent
+ >
+ > {
+ const list = core.HttpResponsePromise.interceptFunction(
+ async (
+ request: Management.ListOrganizationAllConnectionsRequestParameters,
+ ): Promise<
+ core.WithRawResponse
+ > => {
+ const {
+ page = 0,
+ per_page: perPage = 50,
+ include_totals: includeTotals = true,
+ is_enabled: isEnabled,
+ } = request;
+ const _queryParams: Record = {
+ page,
+ per_page: perPage,
+ include_totals: includeTotals,
+ is_enabled: isEnabled,
+ };
+ const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
+ _authRequest.headers,
+ this._options?.headers,
+ requestOptions?.headers,
+ );
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: core.url.join(
+ (await core.Supplier.get(this._options.baseUrl)) ??
+ (await core.Supplier.get(this._options.environment)) ??
+ environments.ManagementEnvironment.Default,
+ `organizations/${core.url.encodePathParam(id)}/connections`,
+ ),
+ method: "GET",
+ headers: _headers,
+ queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ fetchFn: this._options?.fetch,
+ logging: this._options.logging,
+ });
+ if (_response.ok) {
+ return {
+ data: _response.body as Management.ListOrganizationAllConnectionsOffsetPaginatedResponseContent,
+ rawResponse: _response.rawResponse,
+ };
+ }
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Management.BadRequestError(
+ _response.error.body as unknown,
+ _response.rawResponse,
+ );
+ case 401:
+ throw new Management.UnauthorizedError(
+ _response.error.body as unknown,
+ _response.rawResponse,
+ );
+ case 403:
+ throw new Management.ForbiddenError(_response.error.body as unknown, _response.rawResponse);
+ case 429:
+ throw new Management.TooManyRequestsError(
+ _response.error.body as unknown,
+ _response.rawResponse,
+ );
+ default:
+ throw new errors.ManagementError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ rawResponse: _response.rawResponse,
+ });
+ }
+ }
+ return handleNonStatusCodeError(
+ _response.error,
+ _response.rawResponse,
+ "GET",
+ "/organizations/{id}/connections",
+ );
+ },
+ );
+ let _offset = request?.page != null ? request?.page : 0;
+ const dataWithRawResponse = await list(request).withRawResponse();
+ return new core.Page<
+ Management.OrganizationAllConnectionPost,
+ Management.ListOrganizationAllConnectionsOffsetPaginatedResponseContent
+ >({
+ response: dataWithRawResponse.data,
+ rawResponse: dataWithRawResponse.rawResponse,
+ hasNextPage: (response) => (response?.connections ?? []).length >= Math.floor(request?.per_page ?? 50),
+ getItems: (response) => response?.connections ?? [],
+ loadPage: (_response) => {
+ _offset += 1;
+ return list(core.setObjectProperty(request, "page", _offset));
+ },
+ });
+ }
+
+ /**
+ * @param {string} id - Organization identifier.
+ * @param {Management.CreateOrganizationAllConnectionRequestParameters} 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.organizations.connections.create("id", {
+ * connection_id: "connection_id"
+ * })
+ */
+ public create(
+ id: string,
+ request: Management.CreateOrganizationAllConnectionRequestParameters,
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): core.HttpResponsePromise {
+ return core.HttpResponsePromise.fromPromise(this.__create(id, request, requestOptions));
+ }
+
+ private async __create(
+ id: string,
+ request: Management.CreateOrganizationAllConnectionRequestParameters,
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): Promise> {
+ const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
+ _authRequest.headers,
+ this._options?.headers,
+ requestOptions?.headers,
+ );
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: core.url.join(
+ (await core.Supplier.get(this._options.baseUrl)) ??
+ (await core.Supplier.get(this._options.environment)) ??
+ environments.ManagementEnvironment.Default,
+ `organizations/${core.url.encodePathParam(id)}/connections`,
+ ),
+ method: "POST",
+ headers: _headers,
+ contentType: "application/json",
+ queryParameters: requestOptions?.queryParams,
+ requestType: "json",
+ body: request,
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ fetchFn: this._options?.fetch,
+ logging: this._options.logging,
+ });
+ if (_response.ok) {
+ return {
+ data: _response.body as Management.CreateOrganizationAllConnectionResponseContent,
+ rawResponse: _response.rawResponse,
+ };
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Management.BadRequestError(_response.error.body as unknown, _response.rawResponse);
+ case 401:
+ throw new Management.UnauthorizedError(_response.error.body as unknown, _response.rawResponse);
+ case 403:
+ throw new Management.ForbiddenError(_response.error.body as unknown, _response.rawResponse);
+ case 409:
+ throw new Management.ConflictError(_response.error.body as unknown, _response.rawResponse);
+ case 429:
+ throw new Management.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse);
+ default:
+ throw new errors.ManagementError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ rawResponse: _response.rawResponse,
+ });
+ }
+ }
+
+ return handleNonStatusCodeError(
+ _response.error,
+ _response.rawResponse,
+ "POST",
+ "/organizations/{id}/connections",
+ );
+ }
+
+ /**
+ * @param {string} id - Organization identifier.
+ * @param {string} connection_id - Connection identifier.
+ * @param {ConnectionsClient.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Management.UnauthorizedError}
+ * @throws {@link Management.ForbiddenError}
+ * @throws {@link Management.NotFoundError}
+ * @throws {@link Management.TooManyRequestsError}
+ *
+ * @example
+ * await client.organizations.connections.get("id", "connection_id")
+ */
+ public get(
+ id: string,
+ connection_id: string,
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): core.HttpResponsePromise {
+ return core.HttpResponsePromise.fromPromise(this.__get(id, connection_id, requestOptions));
+ }
+
+ private async __get(
+ id: string,
+ connection_id: string,
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): Promise> {
+ const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
+ _authRequest.headers,
+ this._options?.headers,
+ requestOptions?.headers,
+ );
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: core.url.join(
+ (await core.Supplier.get(this._options.baseUrl)) ??
+ (await core.Supplier.get(this._options.environment)) ??
+ environments.ManagementEnvironment.Default,
+ `organizations/${core.url.encodePathParam(id)}/connections/${core.url.encodePathParam(connection_id)}`,
+ ),
+ method: "GET",
+ headers: _headers,
+ queryParameters: requestOptions?.queryParams,
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ fetchFn: this._options?.fetch,
+ logging: this._options.logging,
+ });
+ if (_response.ok) {
+ return {
+ data: _response.body as Management.GetOrganizationAllConnectionResponseContent,
+ rawResponse: _response.rawResponse,
+ };
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 401:
+ throw new Management.UnauthorizedError(_response.error.body as unknown, _response.rawResponse);
+ case 403:
+ throw new Management.ForbiddenError(_response.error.body as unknown, _response.rawResponse);
+ case 404:
+ throw new Management.NotFoundError(_response.error.body as unknown, _response.rawResponse);
+ case 429:
+ throw new Management.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse);
+ default:
+ throw new errors.ManagementError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ rawResponse: _response.rawResponse,
+ });
+ }
+ }
+
+ return handleNonStatusCodeError(
+ _response.error,
+ _response.rawResponse,
+ "GET",
+ "/organizations/{id}/connections/{connection_id}",
+ );
+ }
+
+ /**
+ * @param {string} id - Organization identifier.
+ * @param {string} connection_id - Connection identifier.
+ * @param {ConnectionsClient.RequestOptions} requestOptions - Request-specific configuration.
+ *
+ * @throws {@link Management.UnauthorizedError}
+ * @throws {@link Management.ForbiddenError}
+ * @throws {@link Management.TooManyRequestsError}
+ *
+ * @example
+ * await client.organizations.connections.delete("id", "connection_id")
+ */
+ public delete(
+ id: string,
+ connection_id: string,
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): core.HttpResponsePromise {
+ return core.HttpResponsePromise.fromPromise(this.__delete(id, connection_id, requestOptions));
+ }
+
+ private async __delete(
+ id: string,
+ connection_id: string,
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): Promise> {
+ const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
+ _authRequest.headers,
+ this._options?.headers,
+ requestOptions?.headers,
+ );
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: core.url.join(
+ (await core.Supplier.get(this._options.baseUrl)) ??
+ (await core.Supplier.get(this._options.environment)) ??
+ environments.ManagementEnvironment.Default,
+ `organizations/${core.url.encodePathParam(id)}/connections/${core.url.encodePathParam(connection_id)}`,
+ ),
+ method: "DELETE",
+ headers: _headers,
+ queryParameters: requestOptions?.queryParams,
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ fetchFn: this._options?.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 401:
+ throw new Management.UnauthorizedError(_response.error.body as unknown, _response.rawResponse);
+ case 403:
+ throw new Management.ForbiddenError(_response.error.body as unknown, _response.rawResponse);
+ case 429:
+ throw new Management.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse);
+ default:
+ throw new errors.ManagementError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ rawResponse: _response.rawResponse,
+ });
+ }
+ }
+
+ return handleNonStatusCodeError(
+ _response.error,
+ _response.rawResponse,
+ "DELETE",
+ "/organizations/{id}/connections/{connection_id}",
+ );
+ }
+
+ /**
+ * @param {string} id - Organization identifier.
+ * @param {string} connection_id - Connection identifier.
+ * @param {Management.UpdateOrganizationConnectionRequestParameters} 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.organizations.connections.update("id", "connection_id")
+ */
+ public update(
+ id: string,
+ connection_id: string,
+ request: Management.UpdateOrganizationConnectionRequestParameters = {},
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): core.HttpResponsePromise {
+ return core.HttpResponsePromise.fromPromise(this.__update(id, connection_id, request, requestOptions));
+ }
+
+ private async __update(
+ id: string,
+ connection_id: string,
+ request: Management.UpdateOrganizationConnectionRequestParameters = {},
+ requestOptions?: ConnectionsClient.RequestOptions,
+ ): Promise> {
+ const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest();
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
+ _authRequest.headers,
+ this._options?.headers,
+ requestOptions?.headers,
+ );
+ const _response = await (this._options.fetcher ?? core.fetcher)({
+ url: core.url.join(
+ (await core.Supplier.get(this._options.baseUrl)) ??
+ (await core.Supplier.get(this._options.environment)) ??
+ environments.ManagementEnvironment.Default,
+ `organizations/${core.url.encodePathParam(id)}/connections/${core.url.encodePathParam(connection_id)}`,
+ ),
+ method: "PATCH",
+ headers: _headers,
+ contentType: "application/json",
+ queryParameters: requestOptions?.queryParams,
+ requestType: "json",
+ body: request,
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
+ abortSignal: requestOptions?.abortSignal,
+ fetchFn: this._options?.fetch,
+ logging: this._options.logging,
+ });
+ if (_response.ok) {
+ return {
+ data: _response.body as Management.UpdateOrganizationAllConnectionResponseContent,
+ rawResponse: _response.rawResponse,
+ };
+ }
+
+ if (_response.error.reason === "status-code") {
+ switch (_response.error.statusCode) {
+ case 400:
+ throw new Management.BadRequestError(_response.error.body as unknown, _response.rawResponse);
+ case 401:
+ throw new Management.UnauthorizedError(_response.error.body as unknown, _response.rawResponse);
+ case 403:
+ throw new Management.ForbiddenError(_response.error.body as unknown, _response.rawResponse);
+ case 429:
+ throw new Management.TooManyRequestsError(_response.error.body as unknown, _response.rawResponse);
+ default:
+ throw new errors.ManagementError({
+ statusCode: _response.error.statusCode,
+ body: _response.error.body,
+ rawResponse: _response.rawResponse,
+ });
+ }
+ }
+
+ return handleNonStatusCodeError(
+ _response.error,
+ _response.rawResponse,
+ "PATCH",
+ "/organizations/{id}/connections/{connection_id}",
+ );
+ }
+}
diff --git a/src/management/api/resources/organizations/resources/connections/client/index.ts b/src/management/api/resources/organizations/resources/connections/client/index.ts
new file mode 100644
index 0000000000..cb0ff5c3b5
--- /dev/null
+++ b/src/management/api/resources/organizations/resources/connections/client/index.ts
@@ -0,0 +1 @@
+export {};
diff --git a/src/management/api/resources/organizations/resources/connections/index.ts b/src/management/api/resources/organizations/resources/connections/index.ts
new file mode 100644
index 0000000000..914b8c3c72
--- /dev/null
+++ b/src/management/api/resources/organizations/resources/connections/index.ts
@@ -0,0 +1 @@
+export * from "./client/index.js";
diff --git a/src/management/api/resources/organizations/resources/index.ts b/src/management/api/resources/organizations/resources/index.ts
index 1e597bf04c..407dd5cecb 100644
--- a/src/management/api/resources/organizations/resources/index.ts
+++ b/src/management/api/resources/organizations/resources/index.ts
@@ -1,4 +1,5 @@
export * as clientGrants from "./clientGrants/index.js";
+export * as connections from "./connections/index.js";
export * as discoveryDomains from "./discoveryDomains/index.js";
export * as enabledConnections from "./enabledConnections/index.js";
export * as invitations from "./invitations/index.js";
diff --git a/src/management/api/types/types.ts b/src/management/api/types/types.ts
index 4a03a606f7..b90d59c850 100644
--- a/src/management/api/types/types.ts
+++ b/src/management/api/types/types.ts
@@ -3964,7 +3964,6 @@ export const ConnectionIdentityProviderEnum = {
Exact: "exact",
Facebook: "facebook",
Fitbit: "fitbit",
- Flickr: "flickr",
Github: "github",
GoogleApps: "google-apps",
GoogleOauth2: "google-oauth2",
@@ -4682,14 +4681,6 @@ export interface ConnectionOptionsFitbit extends Management.ConnectionOptionsOAu
[key: string]: any;
}
-/**
- * Options for the 'flickr' connection
- */
-export interface ConnectionOptionsFlickr extends Management.ConnectionOptionsOAuth1Common {
- /** Accepts any additional properties */
- [key: string]: any;
-}
-
/**
* Array of custom OAuth 2.0 scopes to request from GitHub during authentication. Use this to request scopes not covered by the predefined scope options.
*/
@@ -6292,22 +6283,6 @@ export namespace ConnectionResponseContentFitbit {
export type Strategy = (typeof Strategy)[keyof typeof Strategy];
}
-/**
- * Response for connections with strategy=flickr
- */
-export interface ConnectionResponseContentFlickr
- extends Management.ConnectionPurposes, Management.ConnectionResponseCommon {
- strategy: ConnectionResponseContentFlickr.Strategy;
- options?: Management.ConnectionOptionsFlickr | undefined;
-}
-
-export namespace ConnectionResponseContentFlickr {
- export const Strategy = {
- Flickr: "flickr",
- } as const;
- export type Strategy = (typeof Strategy)[keyof typeof Strategy];
-}
-
/**
* Response for connections with strategy=github
*/
@@ -7111,7 +7086,6 @@ export const ConnectionStrategyEnum = {
Exact: "exact",
Facebook: "facebook",
Fitbit: "fitbit",
- Flickr: "flickr",
Github: "github",
GoogleApps: "google-apps",
GoogleOauth2: "google-oauth2",
@@ -8013,21 +7987,6 @@ export namespace CreateConnectionRequestContentFitbit {
export type Strategy = (typeof Strategy)[keyof typeof Strategy];
}
-/**
- * Create a connection with strategy=flickr
- */
-export interface CreateConnectionRequestContentFlickr extends Management.CreateConnectionCommon {
- strategy: CreateConnectionRequestContentFlickr.Strategy;
- options?: Management.ConnectionOptionsFlickr | undefined;
-}
-
-export namespace CreateConnectionRequestContentFlickr {
- export const Strategy = {
- Flickr: "flickr",
- } as const;
- export type Strategy = (typeof Strategy)[keyof typeof Strategy];
-}
-
/**
* Create a connection with strategy=github
*/
@@ -9455,6 +9414,23 @@ export interface CreateLogStreamSumoRequestBody {
startFrom?: string | undefined;
}
+export interface CreateOrganizationAllConnectionResponseContent {
+ /** Name of the connection in the scope of this organization. */
+ organization_connection_name?: string | undefined;
+ /** When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. */
+ assign_membership_on_login?: boolean | undefined;
+ /** Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. */
+ show_as_button?: boolean | undefined;
+ /** Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. */
+ is_signup_enabled?: boolean | undefined;
+ organization_access_level?: Management.OrganizationAccessLevelEnum | undefined;
+ /** Whether the connection is enabled for the organization. */
+ is_enabled?: boolean | undefined;
+ /** Connection identifier. */
+ connection_id: string;
+ connection?: Management.OrganizationConnectionInformation | undefined;
+}
+
export interface CreateOrganizationDiscoveryDomainResponseContent {
/** Organization discovery domain identifier. */
id: string;
@@ -15257,6 +15233,23 @@ export interface GetNetworkAclsResponseContent {
[key: string]: any;
}
+export interface GetOrganizationAllConnectionResponseContent {
+ /** Name of the connection in the scope of this organization. */
+ organization_connection_name?: string | undefined;
+ /** When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. */
+ assign_membership_on_login?: boolean | undefined;
+ /** Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. */
+ show_as_button?: boolean | undefined;
+ /** Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. */
+ is_signup_enabled?: boolean | undefined;
+ organization_access_level?: Management.OrganizationAccessLevelEnum | undefined;
+ /** Whether the connection is enabled for the organization. */
+ is_enabled?: boolean | undefined;
+ /** Connection identifier. */
+ connection_id: string;
+ connection?: Management.OrganizationConnectionInformation | undefined;
+}
+
export interface GetOrganizationByNameResponseContent {
/** Organization identifier. */
id?: string | undefined;
@@ -16004,7 +15997,6 @@ export const IdentityProviderEnum = {
Exact: "exact",
Facebook: "facebook",
Fitbit: "fitbit",
- Flickr: "flickr",
Github: "github",
GoogleApps: "google-apps",
GoogleOauth2: "google-oauth2",
@@ -16421,6 +16413,13 @@ export interface ListNetworkAclsOffsetPaginatedResponseContent {
total?: number | undefined;
}
+export interface ListOrganizationAllConnectionsOffsetPaginatedResponseContent {
+ start?: number | undefined;
+ limit?: number | undefined;
+ total?: number | undefined;
+ connections?: Management.OrganizationAllConnectionPost[] | undefined;
+}
+
export interface ListOrganizationClientGrantsOffsetPaginatedResponseContent {
start?: number | undefined;
limit?: number | undefined;
@@ -17368,6 +17367,43 @@ export interface Organization {
[key: string]: any;
}
+/** Access level for the organization (e.g., "none", "full"). */
+export const OrganizationAccessLevelEnum = {
+ None: "none",
+ Readonly: "readonly",
+ Limited: "limited",
+ Full: "full",
+} as const;
+export type OrganizationAccessLevelEnum =
+ (typeof OrganizationAccessLevelEnum)[keyof typeof OrganizationAccessLevelEnum];
+
+/** Access level for the organization (e.g., "none", "full"). */
+export const OrganizationAccessLevelEnumWithNull = {
+ None: "none",
+ Readonly: "readonly",
+ Limited: "limited",
+ Full: "full",
+} as const;
+export type OrganizationAccessLevelEnumWithNull =
+ (typeof OrganizationAccessLevelEnumWithNull)[keyof typeof OrganizationAccessLevelEnumWithNull];
+
+export interface OrganizationAllConnectionPost {
+ /** Name of the connection in the scope of this organization. */
+ organization_connection_name?: string | undefined;
+ /** When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. */
+ assign_membership_on_login?: boolean | undefined;
+ /** Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. */
+ show_as_button?: boolean | undefined;
+ /** Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. */
+ is_signup_enabled?: boolean | undefined;
+ organization_access_level?: Management.OrganizationAccessLevelEnum | undefined;
+ /** Whether the connection is enabled for the organization. */
+ is_enabled?: boolean | undefined;
+ /** Connection identifier. */
+ connection_id: string;
+ connection?: Management.OrganizationConnectionInformation | undefined;
+}
+
/**
* Theme defines how to style the login pages.
*/
@@ -19342,16 +19378,12 @@ export interface SuspiciousIpThrottlingStage {
"pre-user-registration"?: Management.SuspiciousIpThrottlingPreUserRegistrationStage | undefined;
}
-export const SynchronizeGroupsEaEnum = {
+/** Group synchronization configuration */
+export const SynchronizeGroupsEnum = {
All: "all",
Off: "off",
} as const;
-export type SynchronizeGroupsEaEnum = (typeof SynchronizeGroupsEaEnum)[keyof typeof SynchronizeGroupsEaEnum];
-
-/**
- * Group synchronization configuration
- */
-export type SynchronizeGroupsEnum = string;
+export type SynchronizeGroupsEnum = (typeof SynchronizeGroupsEnum)[keyof typeof SynchronizeGroupsEnum];
/**
* Settings related to OIDC RP-initiated Logout
@@ -20215,13 +20247,6 @@ export interface UpdateConnectionRequestContentFitbit extends Management.Connect
options?: Management.ConnectionOptionsFitbit | undefined;
}
-/**
- * Update a connection with strategy=flickr
- */
-export interface UpdateConnectionRequestContentFlickr extends Management.ConnectionCommon {
- options?: Management.ConnectionOptionsFlickr | undefined;
-}
-
/**
* Update a connection with strategy=github
*/
@@ -20764,6 +20789,23 @@ export interface UpdateNetworkAclResponseContent {
[key: string]: any;
}
+export interface UpdateOrganizationAllConnectionResponseContent {
+ /** Name of the connection in the scope of this organization. */
+ organization_connection_name?: string | undefined;
+ /** When true, all users that log in with this connection will be automatically granted membership in the organization. When false, users must be granted membership in the organization before logging in with this connection. */
+ assign_membership_on_login?: boolean | undefined;
+ /** Determines whether a connection should be displayed on this organization’s login prompt. Only applicable for enterprise connections. Default: true. */
+ show_as_button?: boolean | undefined;
+ /** Determines whether organization signup should be enabled for this organization connection. Only applicable for database connections. Default: false. */
+ is_signup_enabled?: boolean | undefined;
+ organization_access_level?: Management.OrganizationAccessLevelEnum | undefined;
+ /** Whether the connection is enabled for the organization. */
+ is_enabled?: boolean | undefined;
+ /** Connection identifier. */
+ connection_id: string;
+ connection?: Management.OrganizationConnectionInformation | undefined;
+}
+
export interface UpdateOrganizationConnectionResponseContent {
/** ID of the connection. */
connection_id?: string | undefined;
@@ -21477,7 +21519,6 @@ export const UserIdentityProviderEnum = {
Exact: "exact",
Facebook: "facebook",
Fitbit: "fitbit",
- Flickr: "flickr",
Github: "github",
GoogleApps: "google-apps",
GoogleOauth2: "google-oauth2",
diff --git a/src/management/tests/wire/connections/directoryProvisioning.test.ts b/src/management/tests/wire/connections/directoryProvisioning.test.ts
index f057642b37..a38279d47a 100644
--- a/src/management/tests/wire/connections/directoryProvisioning.test.ts
+++ b/src/management/tests/wire/connections/directoryProvisioning.test.ts
@@ -17,7 +17,7 @@ describe("DirectoryProvisioningClient", () => {
strategy: "strategy",
mapping: [{ auth0: "auth0", idp: "idp" }],
synchronize_automatically: true,
- synchronize_groups: "synchronize_groups",
+ synchronize_groups: "all",
created_at: "2024-01-15T09:30:00Z",
updated_at: "2024-01-15T09:30:00Z",
last_synchronization_at: "2024-01-15T09:30:00Z",
@@ -48,7 +48,7 @@ describe("DirectoryProvisioningClient", () => {
},
],
synchronize_automatically: true,
- synchronize_groups: "synchronize_groups",
+ synchronize_groups: "all",
created_at: "2024-01-15T09:30:00Z",
updated_at: "2024-01-15T09:30:00Z",
last_synchronization_at: "2024-01-15T09:30:00Z",
@@ -151,7 +151,7 @@ describe("DirectoryProvisioningClient", () => {
strategy: "strategy",
mapping: [{ auth0: "auth0", idp: "idp" }],
synchronize_automatically: true,
- synchronize_groups: "synchronize_groups",
+ synchronize_groups: "all",
created_at: "2024-01-15T09:30:00Z",
updated_at: "2024-01-15T09:30:00Z",
last_synchronization_at: "2024-01-15T09:30:00Z",
@@ -178,7 +178,7 @@ describe("DirectoryProvisioningClient", () => {
},
],
synchronize_automatically: true,
- synchronize_groups: "synchronize_groups",
+ synchronize_groups: "all",
created_at: "2024-01-15T09:30:00Z",
updated_at: "2024-01-15T09:30:00Z",
last_synchronization_at: "2024-01-15T09:30:00Z",
@@ -287,7 +287,7 @@ describe("DirectoryProvisioningClient", () => {
strategy: "strategy",
mapping: [{ auth0: "auth0", idp: "idp" }],
synchronize_automatically: true,
- synchronize_groups: "synchronize_groups",
+ synchronize_groups: "all",
created_at: "2024-01-15T09:30:00Z",
updated_at: "2024-01-15T09:30:00Z",
last_synchronization_at: "2024-01-15T09:30:00Z",
@@ -314,7 +314,7 @@ describe("DirectoryProvisioningClient", () => {
},
],
synchronize_automatically: true,
- synchronize_groups: "synchronize_groups",
+ synchronize_groups: "all",
created_at: "2024-01-15T09:30:00Z",
updated_at: "2024-01-15T09:30:00Z",
last_synchronization_at: "2024-01-15T09:30:00Z",
@@ -541,7 +541,7 @@ describe("DirectoryProvisioningClient", () => {
strategy: "strategy",
mapping: [{ auth0: "auth0", idp: "idp" }],
synchronize_automatically: true,
- synchronize_groups: "synchronize_groups",
+ synchronize_groups: "all",
created_at: "2024-01-15T09:30:00Z",
updated_at: "2024-01-15T09:30:00Z",
last_synchronization_at: "2024-01-15T09:30:00Z",
@@ -568,7 +568,7 @@ describe("DirectoryProvisioningClient", () => {
},
],
synchronize_automatically: true,
- synchronize_groups: "synchronize_groups",
+ synchronize_groups: "all",
created_at: "2024-01-15T09:30:00Z",
updated_at: "2024-01-15T09:30:00Z",
last_synchronization_at: "2024-01-15T09:30:00Z",
diff --git a/src/management/tests/wire/organizations/connections.test.ts b/src/management/tests/wire/organizations/connections.test.ts
new file mode 100644
index 0000000000..287aee4af7
--- /dev/null
+++ b/src/management/tests/wire/organizations/connections.test.ts
@@ -0,0 +1,576 @@
+// This file was auto-generated by Fern from our API Definition.
+
+import * as Management from "../../../api/index";
+import { ManagementClient } from "../../../Client";
+import { mockServerPool } from "../../mock-server/MockServerPool";
+
+describe("ConnectionsClient", () => {
+ test("list (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = {
+ start: 1.1,
+ limit: 1.1,
+ total: 1.1,
+ connections: [
+ {
+ organization_connection_name: "organization_connection_name",
+ assign_membership_on_login: true,
+ show_as_button: true,
+ is_signup_enabled: true,
+ organization_access_level: "none",
+ is_enabled: true,
+ connection_id: "connection_id",
+ },
+ ],
+ };
+ server
+ .mockEndpoint({ once: false })
+ .get("/organizations/id/connections")
+ .respondWith()
+ .statusCode(200)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ const expected = {
+ start: 1.1,
+ limit: 1.1,
+ total: 1.1,
+ connections: [
+ {
+ organization_connection_name: "organization_connection_name",
+ assign_membership_on_login: true,
+ show_as_button: true,
+ is_signup_enabled: true,
+ organization_access_level: "none",
+ is_enabled: true,
+ connection_id: "connection_id",
+ },
+ ],
+ };
+ const page = await client.organizations.connections.list("id", {
+ page: 1,
+ per_page: 1,
+ include_totals: true,
+ is_enabled: true,
+ });
+
+ expect(expected.connections).toEqual(page.data);
+ expect(page.hasNextPage()).toBe(true);
+ const nextPage = await page.getNextPage();
+ expect(expected.connections).toEqual(nextPage.data);
+ });
+
+ test("list (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint({ once: false })
+ .get("/organizations/id/connections")
+ .respondWith()
+ .statusCode(400)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.list("id");
+ }).rejects.toThrow(Management.BadRequestError);
+ });
+
+ test("list (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint({ once: false })
+ .get("/organizations/id/connections")
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.list("id");
+ }).rejects.toThrow(Management.UnauthorizedError);
+ });
+
+ test("list (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint({ once: false })
+ .get("/organizations/id/connections")
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.list("id");
+ }).rejects.toThrow(Management.ForbiddenError);
+ });
+
+ test("list (5)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint({ once: false })
+ .get("/organizations/id/connections")
+ .respondWith()
+ .statusCode(429)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.list("id");
+ }).rejects.toThrow(Management.TooManyRequestsError);
+ });
+
+ test("create (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = { connection_id: "connection_id" };
+ const rawResponseBody = {
+ organization_connection_name: "organization_connection_name",
+ assign_membership_on_login: true,
+ show_as_button: true,
+ is_signup_enabled: true,
+ organization_access_level: "none",
+ is_enabled: true,
+ connection_id: "connection_id",
+ connection: { name: "name", strategy: "strategy" },
+ };
+ server
+ .mockEndpoint()
+ .post("/organizations/id/connections")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(200)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ const response = await client.organizations.connections.create("id", {
+ connection_id: "connection_id",
+ });
+ expect(response).toEqual({
+ organization_connection_name: "organization_connection_name",
+ assign_membership_on_login: true,
+ show_as_button: true,
+ is_signup_enabled: true,
+ organization_access_level: "none",
+ is_enabled: true,
+ connection_id: "connection_id",
+ connection: {
+ name: "name",
+ strategy: "strategy",
+ },
+ });
+ });
+
+ test("create (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = { connection_id: "x" };
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .post("/organizations/id/connections")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(400)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.create("id", {
+ connection_id: "x",
+ });
+ }).rejects.toThrow(Management.BadRequestError);
+ });
+
+ test("create (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = { connection_id: "x" };
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .post("/organizations/id/connections")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.create("id", {
+ connection_id: "x",
+ });
+ }).rejects.toThrow(Management.UnauthorizedError);
+ });
+
+ test("create (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = { connection_id: "x" };
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .post("/organizations/id/connections")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.create("id", {
+ connection_id: "x",
+ });
+ }).rejects.toThrow(Management.ForbiddenError);
+ });
+
+ test("create (5)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = { connection_id: "x" };
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .post("/organizations/id/connections")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(409)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.create("id", {
+ connection_id: "x",
+ });
+ }).rejects.toThrow(Management.ConflictError);
+ });
+
+ test("create (6)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = { connection_id: "x" };
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .post("/organizations/id/connections")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(429)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.create("id", {
+ connection_id: "x",
+ });
+ }).rejects.toThrow(Management.TooManyRequestsError);
+ });
+
+ test("get (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = {
+ organization_connection_name: "organization_connection_name",
+ assign_membership_on_login: true,
+ show_as_button: true,
+ is_signup_enabled: true,
+ organization_access_level: "none",
+ is_enabled: true,
+ connection_id: "connection_id",
+ connection: { name: "name", strategy: "strategy" },
+ };
+ server
+ .mockEndpoint()
+ .get("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(200)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ const response = await client.organizations.connections.get("id", "connection_id");
+ expect(response).toEqual({
+ organization_connection_name: "organization_connection_name",
+ assign_membership_on_login: true,
+ show_as_button: true,
+ is_signup_enabled: true,
+ organization_access_level: "none",
+ is_enabled: true,
+ connection_id: "connection_id",
+ connection: {
+ name: "name",
+ strategy: "strategy",
+ },
+ });
+ });
+
+ test("get (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .get("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.get("id", "connection_id");
+ }).rejects.toThrow(Management.UnauthorizedError);
+ });
+
+ test("get (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .get("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.get("id", "connection_id");
+ }).rejects.toThrow(Management.ForbiddenError);
+ });
+
+ test("get (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .get("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(404)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.get("id", "connection_id");
+ }).rejects.toThrow(Management.NotFoundError);
+ });
+
+ test("get (5)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .get("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(429)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.get("id", "connection_id");
+ }).rejects.toThrow(Management.TooManyRequestsError);
+ });
+
+ test("delete (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ server
+ .mockEndpoint()
+ .delete("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(200)
+ .build();
+
+ const response = await client.organizations.connections.delete("id", "connection_id");
+ expect(response).toEqual(undefined);
+ });
+
+ test("delete (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .delete("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.delete("id", "connection_id");
+ }).rejects.toThrow(Management.UnauthorizedError);
+ });
+
+ test("delete (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .delete("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.delete("id", "connection_id");
+ }).rejects.toThrow(Management.ForbiddenError);
+ });
+
+ test("delete (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .delete("/organizations/id/connections/connection_id")
+ .respondWith()
+ .statusCode(429)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.delete("id", "connection_id");
+ }).rejects.toThrow(Management.TooManyRequestsError);
+ });
+
+ test("update (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = {};
+ const rawResponseBody = {
+ organization_connection_name: "organization_connection_name",
+ assign_membership_on_login: true,
+ show_as_button: true,
+ is_signup_enabled: true,
+ organization_access_level: "none",
+ is_enabled: true,
+ connection_id: "connection_id",
+ connection: { name: "name", strategy: "strategy" },
+ };
+ server
+ .mockEndpoint()
+ .patch("/organizations/id/connections/connection_id")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(200)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ const response = await client.organizations.connections.update("id", "connection_id");
+ expect(response).toEqual({
+ organization_connection_name: "organization_connection_name",
+ assign_membership_on_login: true,
+ show_as_button: true,
+ is_signup_enabled: true,
+ organization_access_level: "none",
+ is_enabled: true,
+ connection_id: "connection_id",
+ connection: {
+ name: "name",
+ strategy: "strategy",
+ },
+ });
+ });
+
+ test("update (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = {};
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .patch("/organizations/id/connections/connection_id")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(400)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.update("id", "connection_id");
+ }).rejects.toThrow(Management.BadRequestError);
+ });
+
+ test("update (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = {};
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .patch("/organizations/id/connections/connection_id")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.update("id", "connection_id");
+ }).rejects.toThrow(Management.UnauthorizedError);
+ });
+
+ test("update (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = {};
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .patch("/organizations/id/connections/connection_id")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.update("id", "connection_id");
+ }).rejects.toThrow(Management.ForbiddenError);
+ });
+
+ test("update (5)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new ManagementClient({ maxRetries: 0, token: "test", environment: server.baseUrl });
+ const rawRequestBody = {};
+ const rawResponseBody = { key: "value" };
+ server
+ .mockEndpoint()
+ .patch("/organizations/id/connections/connection_id")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(429)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.organizations.connections.update("id", "connection_id");
+ }).rejects.toThrow(Management.TooManyRequestsError);
+ });
+});
diff --git a/yarn.lock b/yarn.lock
index 420f0fcfa8..57d4a82437 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1703,9 +1703,9 @@ dunder-proto@^1.0.1:
gopd "^1.2.0"
electron-to-chromium@^1.5.328:
- version "1.5.333"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.333.tgz#1a9f02e181c16af470639cf0da41c6db93f65123"
- integrity sha512-skNh4FsE+IpCJV7xAQGbQ4eyOGvcEctVBAk7a5KPzxC3alES9rLrT+2IsPRPgeQr8LVxdJr8BHQ9481+TOr0xg==
+ version "1.5.334"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.334.tgz#1e3fdd8d014852104eb8e632e760fb364db7dd0e"
+ integrity sha512-mgjZAz7Jyx1SRCwEpy9wefDS7GvNPazLthHg8eQMJ76wBdGQQDW33TCrUTvQ4wzpmOrv2zrFoD3oNufMdyMpog==
emittery@^0.13.1:
version "0.13.1"
@@ -4009,9 +4009,9 @@ webpack-sources@^3.3.4:
integrity sha512-7tP1PdV4vF+lYPnkMR0jMY5/la2ub5Fc/8VQrrU+lXkiM6C4TjVfGw7iKfyhnTQOsD+6Q/iKw0eFciziRgD58Q==
webpack@^5.97.1:
- version "5.105.4"
- resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.105.4.tgz#1b77fcd55a985ac7ca9de80a746caffa38220169"
- integrity sha512-jTywjboN9aHxFlToqb0K0Zs9SbBoW4zRUlGzI2tYNxVYcEi/IPpn+Xi4ye5jTLvX2YeLuic/IvxNot+Q1jMoOw==
+ version "5.106.0"
+ resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.106.0.tgz#ee374da5573eef1e47b2650d6be8e40fb928d697"
+ integrity sha512-Pkx5joZ9RrdgO5LBkyX1L2ZAJeK/Taz3vqZ9CbcP0wS5LEMx5QkKsEwLl29QJfihZ+DKRBFldzy1O30pJ1MDpA==
dependencies:
"@types/eslint-scope" "^3.7.7"
"@types/estree" "^1.0.8"