Skip to content

Commit

Permalink
🎨 Deprecated count/start and implements limit/offset instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ff137 committed Nov 12, 2024
1 parent b373ea4 commit 545dcf9
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 12 deletions.
32 changes: 28 additions & 4 deletions aries_cloudcontroller/api/credentials_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]],
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -498,6 +512,8 @@ async def get_records(
def _get_records_serialize(
self,
count,
limit,
offset,
start,
wql,
_request_auth,
Expand Down Expand Up @@ -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))
Expand Down
32 changes: 28 additions & 4 deletions aries_cloudcontroller/api/present_proof_v10_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -355,6 +369,8 @@ def _get_matching_credentials_serialize(
pres_ex_id,
count,
extra_query,
limit,
offset,
referent,
start,
_request_auth,
Expand Down Expand Up @@ -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))
Expand Down
32 changes: 28 additions & 4 deletions aries_cloudcontroller/api/present_proof_v20_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -339,6 +353,8 @@ def _get_matching_credentials_serialize(
pres_ex_id,
count,
extra_query,
limit,
offset,
referent,
start,
_request_auth,
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 545dcf9

Please sign in to comment.