From f03f80925c6df49b1ff3836274c14e6a19b46e9e Mon Sep 17 00:00:00 2001 From: Lyle Schemmerling Date: Thu, 26 Jun 2025 16:41:36 -0600 Subject: [PATCH 1/2] add the application-tenant api and move it out of the application object --- src/FusionAuthClient.ts | 82 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/src/FusionAuthClient.ts b/src/FusionAuthClient.ts index 49c8510..a32e3b7 100644 --- a/src/FusionAuthClient.ts +++ b/src/FusionAuthClient.ts @@ -710,6 +710,23 @@ export class FusionAuthClient { .go(); } + /** + * Adds the application tenants for universal applications. + * + * @param {UUID} applicationId The Id of the application that the role belongs to. + * @param {UniversalApplicationTenantsRequest} request The request object that contains all the information used to create the Entity. + * @returns {Promise>} + */ + createUniversalApplicationTenants(applicationId: UUID, request: UniversalApplicationTenantsRequest): Promise> { + return this.start() + .withUri('/api/application') + .withUriSegment(applicationId) + .withUriSegment("application-tenant") + .withJSONBody(request) + .withMethod("POST") + .go(); + } + /** * Creates a user. You can optionally specify an Id for the user, if not provided one will be generated. * @@ -1305,6 +1322,40 @@ export class FusionAuthClient { .go(); } + /** + * Removes the specified tenant from the universal application tenants list. + * + * @param {UUID} applicationId The Id of the application that the role belongs to. + * @param {UUID} tenantId The Id of the tenant to delete from the universal application tenants list. + * @returns {Promise>} + */ + deleteUniversalApplicationTenant(applicationId: UUID, tenantId: UUID): Promise> { + return this.start() + .withUri('/api/application') + .withUriSegment(applicationId) + .withUriSegment("application-tenant") + .withUriSegment(tenantId) + .withMethod("DELETE") + .go(); + } + + /** + * Removes the specified tenants from the universal application tenants list. + * + * @param {UUID} applicationId The Id of the universal application that the tenants are linked to. + * @param {Array} tenantIds The Ids of the tenants to delete from the universal application tenants list. + * @returns {Promise>} + */ + deleteUniversalApplicationTenants(applicationId: UUID, tenantIds: Array): Promise> { + return this.start() + .withUri('/api/application') + .withUriSegment(applicationId) + .withUriSegment("application-tenant") + .withParameter('tenantIds', tenantIds) + .withMethod("DELETE") + .go(); + } + /** * Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated * with the user. @@ -3784,6 +3835,21 @@ export class FusionAuthClient { .go(); } + /** + * Retrieves the application tenants for universal applications. + * + * @param {UUID} applicationId The Id of the application that the role belongs to. + * @returns {Promise>} + */ + retrieveUniversalApplicationTenants(applicationId: UUID): Promise> { + return this.start() + .withUri('/api/application') + .withUriSegment(applicationId) + .withUriSegment("application-tenant") + .withMethod("GET") + .go(); + } + /** * Retrieves the user for the given Id. * @@ -5913,7 +5979,6 @@ export enum XMLSignatureLocation { } export interface UniversalConfiguration { - applicationTenants?: Array; global?: boolean; universal?: boolean; } @@ -11163,9 +11228,24 @@ export interface TwoFactorTrust { * @author Lyle Schemmerling */ export interface UniversalApplicationTenant { + applicationId?: UUID; tenantId?: UUID; } +/** + * @author Lyle Schemmerling + */ +export interface UniversalApplicationTenantsRequest { + applicationTenants?: Array; +} + +/** + * @author Lyle Schemmerling + */ +export interface UniversalApplicationTenantsResponse { + applicationTenants?: Array; +} + /** * Policy for handling unknown OAuth scopes in the request * From e202d2d5853fa239600405d602c442e65dd4ec59 Mon Sep 17 00:00:00 2001 From: Lyle Schemmerling Date: Mon, 7 Jul 2025 15:14:16 -0600 Subject: [PATCH 2/2] separate out the universal config and update clients --- src/FusionAuthClient.ts | 134 ++++++++++++++++++++++++++++++++-------- 1 file changed, 107 insertions(+), 27 deletions(-) diff --git a/src/FusionAuthClient.ts b/src/FusionAuthClient.ts index a32e3b7..9bc42c3 100644 --- a/src/FusionAuthClient.ts +++ b/src/FusionAuthClient.ts @@ -713,15 +713,17 @@ export class FusionAuthClient { /** * Adds the application tenants for universal applications. * - * @param {UUID} applicationId The Id of the application that the role belongs to. - * @param {UniversalApplicationTenantsRequest} request The request object that contains all the information used to create the Entity. - * @returns {Promise>} + * @param {UUID} applicationId The Id of the application that the universal application tenant belongs to. + * @param {UUID} universalApplicationTenantId (Optional) The Id of the universal application tenant. + * @param {UniversalApplicationTenantRequest} request The request object that contains all the information used to create the UniversalApplicationTenants. + * @returns {Promise>} */ - createUniversalApplicationTenants(applicationId: UUID, request: UniversalApplicationTenantsRequest): Promise> { - return this.start() + createUniversalApplicationTenant(applicationId: UUID, universalApplicationTenantId: UUID, request: UniversalApplicationTenantRequest): Promise> { + return this.start() .withUri('/api/application') .withUriSegment(applicationId) - .withUriSegment("application-tenant") + .withUriSegment("universal-application-tenant") + .withUriSegment(universalApplicationTenantId) .withJSONBody(request) .withMethod("POST") .go(); @@ -1323,18 +1325,18 @@ export class FusionAuthClient { } /** - * Removes the specified tenant from the universal application tenants list. + * Deletes the universal application tenant. * - * @param {UUID} applicationId The Id of the application that the role belongs to. - * @param {UUID} tenantId The Id of the tenant to delete from the universal application tenants list. + * @param {UUID} applicationId The Id of the application that the UniversalApplicationTenant belongs to. + * @param {UUID} universalApplicationTenantId The Id of the UniversalApplicationTenant to delete. * @returns {Promise>} */ - deleteUniversalApplicationTenant(applicationId: UUID, tenantId: UUID): Promise> { + deleteUniversalApplicationTenant(applicationId: UUID, universalApplicationTenantId: UUID): Promise> { return this.start() .withUri('/api/application') .withUriSegment(applicationId) - .withUriSegment("application-tenant") - .withUriSegment(tenantId) + .withUriSegment("universal-application-tenant") + .withUriSegment(universalApplicationTenantId) .withMethod("DELETE") .go(); } @@ -3836,16 +3838,18 @@ export class FusionAuthClient { } /** - * Retrieves the application tenants for universal applications. + * Retrieves the universal application tenant. * - * @param {UUID} applicationId The Id of the application that the role belongs to. - * @returns {Promise>} + * @param {UUID} applicationId The Id of the universal application that tenant is mapped to + * @param {UUID} universalApplicationTenantId The Id of the universal application tenant. + * @returns {Promise>} */ - retrieveUniversalApplicationTenants(applicationId: UUID): Promise> { - return this.start() + retrieveUniversalApplicationTenant(applicationId: UUID, universalApplicationTenantId: UUID): Promise> { + return this.start() .withUri('/api/application') .withUriSegment(applicationId) .withUriSegment("application-tenant") + .withUriSegment(universalApplicationTenantId) .withMethod("GET") .go(); } @@ -4686,6 +4690,22 @@ export class FusionAuthClient { .go(); } + /** + * Searches universal application tenants for the specified applicationId and with the specified criteria and pagination. + * + * @param {UniversalApplicationTenantSearchRequest} request The search criteria and pagination information. + * @returns {Promise>} + */ + searchUniversalApplicationTenants(request: UniversalApplicationTenantSearchRequest): Promise> { + return this.start() + .withUri('/api/application') + .withUriSegment("universal-application-tenant") + .withUriSegment("search") + .withJSONBody(request) + .withMethod("POST") + .go(); + } + /** * Searches user comments with the specified criteria and pagination. * @@ -5408,6 +5428,25 @@ export class FusionAuthClient { .go(); } + /** + * Adds the application tenants for universal applications. + * + * @param {UUID} applicationId The Id of the application that the UniversalApplicationTenant belongs to. + * @param {UUID} universalApplicationTenantId The Id of the universal application tenant. + * @param {UniversalApplicationTenantRequest} request The request object that contains all the information used to create the UniversalApplicationTenant. + * @returns {Promise>} + */ + updateUniversalApplicationTenant(applicationId: UUID, universalApplicationTenantId: UUID, request: UniversalApplicationTenantRequest): Promise> { + return this.start() + .withUri('/api/application') + .withUriSegment(applicationId) + .withUriSegment("universal-application-tenant") + .withUriSegment(universalApplicationTenantId) + .withJSONBody(request) + .withMethod("PUT") + .go(); + } + /** * Updates the user with the given Id. * @@ -5857,7 +5896,7 @@ export interface Application { state?: ObjectState; tenantId?: UUID; themeId?: UUID; - universalConfiguration?: UniversalConfiguration; + universalConfiguration?: UniversalApplicationConfiguration; unverified?: RegistrationUnverifiedOptions; verificationEmailTemplateId?: UUID; verificationStrategy?: VerificationStrategy; @@ -5978,11 +6017,6 @@ export enum XMLSignatureLocation { Response = "Response" } -export interface UniversalConfiguration { - global?: boolean; - universal?: boolean; -} - /** * @author Daniel DeGroff */ @@ -11227,23 +11261,69 @@ export interface TwoFactorTrust { /** * @author Lyle Schemmerling */ +export interface UniversalApplicationConfiguration { + global?: boolean; + universal?: boolean; +} + +/** + * An object that represents the mapping between a Universal Application and a Tenant. + * + * @author Lyle Schemmerling + */ export interface UniversalApplicationTenant { + applicationId?: UUID; + data?: Record; + id?: UUID; + insertInstant?: number; + lastUpdateInstant?: number; + tenantId?: UUID; +} + +/** + * The request object for creating or updating a Universal Application Tenant. + * + * @author Lyle Schemmerling + */ +export interface UniversalApplicationTenantRequest { + universalApplicationTenant?: UniversalApplicationTenant; +} + +/** + * The response object for a single Universal Application Tenant. + * + * @author Lyle Schemmerling + */ +export interface UniversalApplicationTenantResponse { + universalApplicationTenant?: UniversalApplicationTenant; +} + +/** + * @author Lyle Schemmerling + */ +export interface UniversalApplicationTenantSearchCriteria extends BaseSearchCriteria { applicationId?: UUID; tenantId?: UUID; + tenantName?: string; } /** + * The request object with the search criteria for Universal Application Tenants. + * * @author Lyle Schemmerling */ -export interface UniversalApplicationTenantsRequest { - applicationTenants?: Array; +export interface UniversalApplicationTenantSearchRequest { + search?: UniversalApplicationTenantSearchCriteria; } /** + * The response object for Universal Application Tenants search results. + * * @author Lyle Schemmerling */ -export interface UniversalApplicationTenantsResponse { - applicationTenants?: Array; +export interface UniversalApplicationTenantSearchResponse { + total?: number; + universalApplicationTenants?: Array; } /**