Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove return types for paginated endpoints #510

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auth0/management/client_grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def all(
per_page: int | None = None,
include_totals: bool = False,
client_id: str | None = None,
) -> list[dict[str, Any]]:
):
"""Retrieves all client grants.

Args:
Expand Down
2 changes: 1 addition & 1 deletion auth0/management/device_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get(
page: int | None = None,
per_page: int | None = None,
include_totals: bool = False,
) -> list[dict[str, Any]]:
):
"""List device credentials.

Args:
Expand Down
2 changes: 1 addition & 1 deletion auth0/management/grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def all(
per_page: int | None = None,
include_totals: bool = False,
extra_params: dict[str, Any] | None = None,
) -> list[dict[str, Any]]:
):
"""Retrieves all grants.

Args:
Expand Down
2 changes: 1 addition & 1 deletion auth0/management/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def all(
page: int | None = None,
per_page: int | None = None,
include_totals: bool = False,
) -> list[dict[str, Any]]:
):
"""Retrieves a list of all hooks.

Args:
Expand Down
2 changes: 1 addition & 1 deletion auth0/management/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def search(
from_param: str | None = None,
take: int | None = None,
include_fields: bool = True,
) -> list[dict[str, Any]]:
):
"""Search log events.

Args:
Expand Down
6 changes: 3 additions & 3 deletions auth0/management/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def all_organizations(
include_totals: bool = True,
from_param: str | None = None,
take: int | None = None,
) -> list[dict[str, Any]]:
):
"""Retrieves a list of all the organizations.

Args:
Expand Down Expand Up @@ -246,7 +246,7 @@ def all_organization_members(
include_totals: bool = True,
from_param: str | None = None,
take: int | None = None,
) -> list[dict[str, Any]]:
):
"""Retrieves a list of all the organization members.

Args:
Expand Down Expand Up @@ -377,7 +377,7 @@ def all_organization_invitations(
page: int | None = None,
per_page: int | None = None,
include_totals: bool = False,
) -> list[dict[str, Any]]:
):
"""Retrieves a list of all the organization invitations.

Args:
Expand Down
2 changes: 1 addition & 1 deletion auth0/management/resource_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_all(
page: int | None = None,
per_page: int | None = None,
include_totals: bool = False,
) -> list[dict[str, Any]]:
):
"""Retrieves all resource servers

Args:
Expand Down
6 changes: 3 additions & 3 deletions auth0/management/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def list(
per_page: int = 25,
include_totals: bool = True,
name_filter: str | None = None,
) -> List[dict[str, Any]]:
):
Copy link

@kojiromike kojiromike Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use typing.Literal in combination with typing.overload to get dependent types. For example:

from typing import Literal, overload

@overload
def list(..., include_totals: Literal[True], ...) -> dict[str, Any]:
    ...

@overload
def list(..., include_totals: Literal[False], ...) -> list[dict[str, Any]]:
    ...

"""List or search roles.

Args:
Expand Down Expand Up @@ -135,7 +135,7 @@ def list_users(
include_totals: bool = True,
from_param: str | None = None,
take: int | None = None,
) -> List[dict[str, Any]]:
):
"""List the users that have been associated with a given role.

Args:
Expand Down Expand Up @@ -186,7 +186,7 @@ def add_users(self, id: str, users: List[str]) -> dict[str, Any]:

def list_permissions(
self, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True
) -> List[dict[str, Any]]:
):
"""List the permissions associated to a role.

Args:
Expand Down
2 changes: 1 addition & 1 deletion auth0/management/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def all(
page: int | None = None,
per_page: int | None = None,
include_totals: bool = False,
) -> list[dict[str, Any]]:
):
"""Retrieves a list of all rules.

Args:
Expand Down
10 changes: 5 additions & 5 deletions auth0/management/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def list(
include_totals: bool = True,
fields: List[str] | None = None,
include_fields: bool = True,
) -> List[dict[str, Any]]:
):
"""List or search users.

Args:
Expand Down Expand Up @@ -170,7 +170,7 @@ def update(self, id: str, body: dict[str, Any]) -> dict[str, Any]:

def list_organizations(
self, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True
) -> List[dict[str, Any]]:
):
"""List the organizations that the user is member of.

Args:
Expand Down Expand Up @@ -198,7 +198,7 @@ def list_organizations(

def list_roles(
self, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True
) -> List[dict[str, Any]]:
):
"""List the roles associated with a user.

Args:
Expand Down Expand Up @@ -254,7 +254,7 @@ def add_roles(self, id: str, roles: List[str]) -> dict[str, Any]:

def list_permissions(
self, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True
) -> List[dict[str, Any]]:
):
"""List the permissions associated to the user.

Args:
Expand Down Expand Up @@ -394,7 +394,7 @@ def get_log_events(
per_page: int = 50,
sort: str | None = None,
include_totals: bool = False,
) -> List[dict[str, Any]]:
):
"""Retrieve every log event for a specific user id.

Args:
Expand Down