From e24a35639e55936ec5113e4fd4f1b3baddf03fe7 Mon Sep 17 00:00:00 2001 From: Lyle Schemmerling Date: Thu, 26 Jun 2025 16:41:36 -0600 Subject: [PATCH] add the application-tenant api and move it out of the application object --- .../python/fusionauth/fusionauth_client.py | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/main/python/fusionauth/fusionauth_client.py b/src/main/python/fusionauth/fusionauth_client.py index e635856..931d97f 100644 --- a/src/main/python/fusionauth/fusionauth_client.py +++ b/src/main/python/fusionauth/fusionauth_client.py @@ -615,6 +615,21 @@ def create_theme(self, request, theme_id=None): .post() \ .go() + def create_universal_application_tenants(self, application_id, request): + """ + Adds the application tenants for universal applications. + + Attributes: + application_id: The Id of the application that the role belongs to. + request: The request object that contains all the information used to create the Entity. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("application-tenant") \ + .body_handler(JSONBodyHandler(request)) \ + .post() \ + .go() + def create_user(self, request, user_id=None): """ Creates a user. You can optionally specify an Id for the user, if not provided one will be generated. @@ -1131,6 +1146,36 @@ def delete_theme(self, theme_id): .delete() \ .go() + def delete_universal_application_tenant(self, application_id, tenant_id): + """ + Removes the specified tenant from the universal application tenants list. + + Attributes: + application_id: The Id of the application that the role belongs to. + tenant_id: The Id of the tenant to delete from the universal application tenants list. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("application-tenant") \ + .url_segment(tenant_id) \ + .delete() \ + .go() + + def delete_universal_application_tenants(self, application_id, tenant_ids): + """ + Removes the specified tenants from the universal application tenants list. + + Attributes: + application_id: The Id of the universal application that the tenants are linked to. + tenant_ids: The Ids of the tenants to delete from the universal application tenants list. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("application-tenant") \ + .url_parameter('tenantIds', self.convert_true_false(tenant_ids)) \ + .delete() \ + .go() + def delete_user(self, user_id): """ Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated @@ -3287,6 +3332,19 @@ def retrieve_two_factor_status(self, user_id, application_id, two_factor_trust_i .get() \ .go() + def retrieve_universal_application_tenants(self, application_id): + """ + Retrieves the application tenants for universal applications. + + Attributes: + application_id: The Id of the application that the role belongs to. + """ + return self.start().uri('/api/application') \ + .url_segment(application_id) \ + .url_segment("application-tenant") \ + .get() \ + .go() + def retrieve_user(self, user_id): """ Retrieves the user for the given Id.