@@ -43,22 +43,15 @@ class Realm(CreateRealm):
4343class CreateUser (BaseModel ):
4444 name : str
4545 display_name : str | None
46- email : t .Annotated [str | None , IsOptionalField ]
46+ email : t .Annotated [EmailStr , IsOptionalField ] = None
4747 active : bool
4848 name_locked : bool
4949 first_name : str | None
5050 last_name : str | None
5151
5252
53- class User (BaseModel ):
53+ class User (CreateUser ):
5454 id : uuid .UUID
55- name : str
56- active : bool
57- name_locked : bool
58- email : t .Annotated [EmailStr , IsOptionalField ] = None
59- display_name : str | None
60- first_name : str | None
61- last_name : str | None
6255 avatar : str | None
6356 cover : str | None
6457 realm_id : uuid .UUID
@@ -237,6 +230,43 @@ class RobotRole(CreateRobotRole):
237230 role_realm : t .Annotated [Realm | None , IsIncludable ] = None
238231
239232
233+ class CreateClient (BaseModel ):
234+ name : str
235+ secret : t .Annotated [str | None , IsOptionalField ] = None
236+ display_name : str | None
237+ description : str | None
238+ redirect_uri : str | None
239+ active : bool
240+ is_confidential : bool
241+ secret_hashed : bool
242+ grant_types : str | None
243+ realm_id : t .Annotated [uuid .UUID , Field (), WrapValidator (uuid_validator )]
244+
245+
246+ class Client (CreateClient ):
247+ id : uuid .UUID
248+ built_in : bool
249+ secret_encrypted : bool
250+ scope : str | None
251+ base_url : str | None
252+ root_url : str | None
253+ created_at : datetime
254+ updated_at : datetime
255+ realm : t .Annotated [Realm , IsIncludable ] = None
256+
257+
258+ class UpdateClient (BaseModel ):
259+ name : str | UNSET_T = UNSET
260+ secret : str | None | UNSET_T = UNSET
261+ display_name : str | None | UNSET_T = UNSET
262+ description : str | None | UNSET_T = UNSET
263+ redirect_uri : str | None | UNSET_T = UNSET
264+ active : bool | UNSET_T = UNSET
265+ is_confidential : bool | UNSET_T = UNSET
266+ secret_hashed : bool | UNSET_T = UNSET
267+ grant_types : str | None | UNSET_T = UNSET
268+
269+
240270class AuthClient (BaseClient ):
241271 """The client which implements all auth endpoints.
242272
@@ -642,3 +672,75 @@ def get_robot_roles(self, **params: te.Unpack[GetKwargs]) -> list[RobotRole]:
642672
643673 def find_robot_roles (self , ** params : te .Unpack [FindAllKwargs ]) -> list [RobotRole ]:
644674 return self ._find_all_resources (RobotRole , "robot-roles" , include = get_includable_names (RobotRole ), ** params )
675+
676+ def create_client (
677+ self ,
678+ name : str ,
679+ realm_id : Realm | str | uuid .UUID ,
680+ secret : str = None ,
681+ display_name : str = None ,
682+ description : str = None ,
683+ redirect_uri : str = None ,
684+ active : bool = True ,
685+ is_confidential : bool = True ,
686+ secret_hashed : bool = False ,
687+ grant_types : str = None ,
688+ ) -> Client :
689+ return self ._create_resource (
690+ Client ,
691+ CreateClient (
692+ name = name ,
693+ realm_id = realm_id ,
694+ secret = secret ,
695+ display_name = display_name ,
696+ description = description ,
697+ redirect_uri = redirect_uri ,
698+ active = active ,
699+ is_confidential = is_confidential ,
700+ secret_hashed = secret_hashed ,
701+ grant_types = grant_types ,
702+ ),
703+ "clients" ,
704+ )
705+
706+ def delete_client (self , client_id : Client | uuid .UUID | str ):
707+ self ._delete_resource ("clients" , client_id )
708+
709+ def get_client (self , client_id : Client | uuid .UUID | str , ** params : te .Unpack [GetKwargs ]) -> Client | None :
710+ return self ._get_single_resource (Client , "clients" , client_id , include = get_includable_names (Client ), ** params )
711+
712+ def get_clients (self , ** params : te .Unpack [GetKwargs ]) -> list [Client ]:
713+ return self ._get_all_resources (Client , "clients" , include = get_includable_names (Client ), ** params )
714+
715+ def find_clients (self , ** params : te .Unpack [FindAllKwargs ]) -> list [Client ]:
716+ return self ._find_all_resources (Client , "clients" , include = get_includable_names (Client ), ** params )
717+
718+ def update_client (
719+ self ,
720+ client_id : Client | uuid .UUID | str ,
721+ name : str | UNSET_T = UNSET ,
722+ secret : str | None | UNSET_T = UNSET ,
723+ display_name : str | None | UNSET_T = UNSET ,
724+ description : str | None | UNSET_T = UNSET ,
725+ redirect_uri : str | None | UNSET_T = UNSET ,
726+ active : bool | UNSET_T = UNSET ,
727+ is_confidential : bool | UNSET_T = UNSET ,
728+ secret_hashed : bool | UNSET_T = UNSET ,
729+ grant_types : str | None | UNSET_T = UNSET ,
730+ ) -> Client :
731+ return self ._update_resource (
732+ Client ,
733+ UpdateClient (
734+ name = name ,
735+ secret = secret ,
736+ display_name = display_name ,
737+ description = description ,
738+ redirect_uri = redirect_uri ,
739+ active = active ,
740+ is_confidential = is_confidential ,
741+ secret_hashed = secret_hashed ,
742+ grant_types = grant_types ,
743+ ),
744+ "clients" ,
745+ client_id ,
746+ )
0 commit comments