From 545dcf9dc4ec2227cdd48133cd8e7b8ebb02c01a Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 12 Nov 2024 21:51:54 +0200 Subject: [PATCH] :art: Deprecated count/start and implements limit/offset instead --- aries_cloudcontroller/api/credentials_api.py | 32 ++++++++++++++++--- .../api/present_proof_v10_api.py | 32 ++++++++++++++++--- .../api/present_proof_v20_api.py | 32 ++++++++++++++++--- 3 files changed, 84 insertions(+), 12 deletions(-) diff --git a/aries_cloudcontroller/api/credentials_api.py b/aries_cloudcontroller/api/credentials_api.py index afb69c4b..4cf96bb0 100644 --- a/aries_cloudcontroller/api/credentials_api.py +++ b/aries_cloudcontroller/api/credentials_api.py @@ -439,11 +439,19 @@ async def get_records( self, count: Annotated[ Optional[Annotated[str, Field(strict=True)]], - Field(description="Maximum number to retrieve"), + Field( + description="Maximum number to retrieve (DEPRECATED - use limit instead)" + ), + ] = None, + limit: Annotated[ + Optional[StrictInt], Field(description="Number of results to return") + ] = None, + offset: Annotated[ + Optional[StrictInt], Field(description="Offset for pagination") ] = None, start: Annotated[ Optional[Annotated[str, Field(strict=True)]], - Field(description="Start index"), + Field(description="Start index (DEPRECATED - use offset instead)"), ] = None, wql: Annotated[ Optional[Annotated[str, Field(strict=True)]], @@ -464,9 +472,13 @@ async def get_records( """Fetch credentials from wallet - :param count: Maximum number to retrieve + :param count: Maximum number to retrieve (DEPRECATED - use limit instead) :type count: str - :param start: Start index + :param limit: Number of results to return + :type limit: int + :param offset: Offset for pagination + :type offset: int + :param start: Start index (DEPRECATED - use offset instead) :type start: str :param wql: (JSON) WQL query :type wql: str @@ -475,6 +487,8 @@ async def get_records( _param = self._get_records_serialize( count=count, + limit=limit, + offset=offset, start=start, wql=wql, _request_auth=_request_auth, @@ -498,6 +512,8 @@ async def get_records( def _get_records_serialize( self, count, + limit, + offset, start, wql, _request_auth, @@ -525,6 +541,14 @@ def _get_records_serialize( _query_params.append(("count", count)) + if limit is not None: + + _query_params.append(("limit", limit)) + + if offset is not None: + + _query_params.append(("offset", offset)) + if start is not None: _query_params.append(("start", start)) diff --git a/aries_cloudcontroller/api/present_proof_v10_api.py b/aries_cloudcontroller/api/present_proof_v10_api.py index fb6fd282..e52caf5c 100644 --- a/aries_cloudcontroller/api/present_proof_v10_api.py +++ b/aries_cloudcontroller/api/present_proof_v10_api.py @@ -280,19 +280,27 @@ async def get_matching_credentials( ], count: Annotated[ Optional[Annotated[str, Field(strict=True)]], - Field(description="Maximum number to retrieve"), + Field( + description="Maximum number to retrieve (DEPRECATED - use limit instead)" + ), ] = None, extra_query: Annotated[ Optional[Annotated[str, Field(strict=True)]], Field(description="(JSON) object mapping referents to extra WQL queries"), ] = None, + limit: Annotated[ + Optional[StrictInt], Field(description="Number of results to return") + ] = None, + offset: Annotated[ + Optional[StrictInt], Field(description="Offset for pagination") + ] = None, referent: Annotated[ Optional[StrictStr], Field(description="Proof request referents of interest, comma-separated"), ] = None, start: Annotated[ Optional[Annotated[str, Field(strict=True)]], - Field(description="Start index"), + Field(description="Start index (DEPRECATED - use offset instead)"), ] = None, _request_timeout: Union[ None, @@ -311,13 +319,17 @@ async def get_matching_credentials( :param pres_ex_id: Presentation exchange identifier (required) :type pres_ex_id: str - :param count: Maximum number to retrieve + :param count: Maximum number to retrieve (DEPRECATED - use limit instead) :type count: str :param extra_query: (JSON) object mapping referents to extra WQL queries :type extra_query: str + :param limit: Number of results to return + :type limit: int + :param offset: Offset for pagination + :type offset: int :param referent: Proof request referents of interest, comma-separated :type referent: str - :param start: Start index + :param start: Start index (DEPRECATED - use offset instead) :type start: str ... """ # noqa: E501 @@ -330,6 +342,8 @@ async def get_matching_credentials( pres_ex_id=pres_ex_id, count=count, extra_query=extra_query, + limit=limit, + offset=offset, referent=referent, start=start, _request_auth=_request_auth, @@ -355,6 +369,8 @@ def _get_matching_credentials_serialize( pres_ex_id, count, extra_query, + limit, + offset, referent, start, _request_auth, @@ -388,6 +404,14 @@ def _get_matching_credentials_serialize( _query_params.append(("extra_query", extra_query)) + if limit is not None: + + _query_params.append(("limit", limit)) + + if offset is not None: + + _query_params.append(("offset", offset)) + if referent is not None: _query_params.append(("referent", referent)) diff --git a/aries_cloudcontroller/api/present_proof_v20_api.py b/aries_cloudcontroller/api/present_proof_v20_api.py index 1cc09abf..9afa1b21 100644 --- a/aries_cloudcontroller/api/present_proof_v20_api.py +++ b/aries_cloudcontroller/api/present_proof_v20_api.py @@ -268,19 +268,27 @@ async def get_matching_credentials( ], count: Annotated[ Optional[Annotated[str, Field(strict=True)]], - Field(description="Maximum number to retrieve"), + Field( + description="Maximum number to retrieve (DEPRECATED - use limit instead)" + ), ] = None, extra_query: Annotated[ Optional[Annotated[str, Field(strict=True)]], Field(description="(JSON) object mapping referents to extra WQL queries"), ] = None, + limit: Annotated[ + Optional[StrictInt], Field(description="Number of results to return") + ] = None, + offset: Annotated[ + Optional[StrictInt], Field(description="Offset for pagination") + ] = None, referent: Annotated[ Optional[StrictStr], Field(description="Proof request referents of interest, comma-separated"), ] = None, start: Annotated[ Optional[Annotated[str, Field(strict=True)]], - Field(description="Start index"), + Field(description="Start index (DEPRECATED - use offset instead)"), ] = None, _request_timeout: Union[ None, @@ -299,13 +307,17 @@ async def get_matching_credentials( :param pres_ex_id: Presentation exchange identifier (required) :type pres_ex_id: str - :param count: Maximum number to retrieve + :param count: Maximum number to retrieve (DEPRECATED - use limit instead) :type count: str :param extra_query: (JSON) object mapping referents to extra WQL queries :type extra_query: str + :param limit: Number of results to return + :type limit: int + :param offset: Offset for pagination + :type offset: int :param referent: Proof request referents of interest, comma-separated :type referent: str - :param start: Start index + :param start: Start index (DEPRECATED - use offset instead) :type start: str ... """ # noqa: E501 @@ -314,6 +326,8 @@ async def get_matching_credentials( pres_ex_id=pres_ex_id, count=count, extra_query=extra_query, + limit=limit, + offset=offset, referent=referent, start=start, _request_auth=_request_auth, @@ -339,6 +353,8 @@ def _get_matching_credentials_serialize( pres_ex_id, count, extra_query, + limit, + offset, referent, start, _request_auth, @@ -372,6 +388,14 @@ def _get_matching_credentials_serialize( _query_params.append(("extra_query", extra_query)) + if limit is not None: + + _query_params.append(("limit", limit)) + + if offset is not None: + + _query_params.append(("offset", offset)) + if referent is not None: _query_params.append(("referent", referent))