@@ -3966,22 +3966,26 @@ def set_events(self, payload):
39663966 )
39673967 return raise_error_from_response (data_raw , KeycloakPutError , expected_codes = [204 ])
39683968
3969- def get_client_all_sessions (self , client_id ):
3969+ def get_client_all_sessions (self , client_id , query = None ):
39703970 """Get sessions associated with the client.
39713971
39723972 UserSessionRepresentation
39733973 https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_usersessionrepresentation
39743974
39753975 :param client_id: id of client
39763976 :type client_id: str
3977+ :param query: Additional query parameters
3978+ :type query: dict
39773979 :return: UserSessionRepresentation
39783980 :rtype: list
39793981 """
3982+ query = query or {}
39803983 params_path = {"realm-name" : self .connection .realm_name , "id" : client_id }
3981- data_raw = self .connection .raw_get (
3982- urls_patterns .URL_ADMIN_CLIENT_ALL_SESSIONS .format (** params_path )
3983- )
3984- return raise_error_from_response (data_raw , KeycloakGetError )
3984+ url = urls_patterns .URL_ADMIN_CLIENT_ALL_SESSIONS .format (** params_path )
3985+ if "first" in query or "max" in query :
3986+ return self .__fetch_paginated (url , query )
3987+
3988+ return self .__fetch_all (url , query )
39853989
39863990 def get_client_sessions_stats (self ):
39873991 """Get current session count for all clients with active sessions.
@@ -8300,22 +8304,26 @@ async def a_set_events(self, payload):
83008304 )
83018305 return raise_error_from_response (data_raw , KeycloakPutError , expected_codes = [204 ])
83028306
8303- async def a_get_client_all_sessions (self , client_id ):
8307+ async def a_get_client_all_sessions (self , client_id , query = None ):
83048308 """Get sessions associated with the client asynchronously.
83058309
83068310 UserSessionRepresentation
83078311 https://www.keycloak.org/docs-api/24.0.2/rest-api/index.html#_usersessionrepresentation
83088312
83098313 :param client_id: id of client
83108314 :type client_id: str
8315+ :param query: Additional query parameters
8316+ :type query: dict
83118317 :return: UserSessionRepresentation
83128318 :rtype: list
83138319 """
8320+ query = query or {}
83148321 params_path = {"realm-name" : self .connection .realm_name , "id" : client_id }
8315- data_raw = await self .connection .a_raw_get (
8316- urls_patterns .URL_ADMIN_CLIENT_ALL_SESSIONS .format (** params_path )
8317- )
8318- return raise_error_from_response (data_raw , KeycloakGetError )
8322+ url = urls_patterns .URL_ADMIN_CLIENT_ALL_SESSIONS .format (** params_path )
8323+ if "first" in query or "max" in query :
8324+ return await self .a___fetch_paginated (url , query )
8325+
8326+ return await self .a___fetch_all (url , query )
83198327
83208328 async def a_get_client_sessions_stats (self ):
83218329 """Get current session count for all clients with active sessions asynchronously.
0 commit comments