From 795935a95f8f10556aee3861a329f8ee81ed6697 Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Thu, 20 Mar 2025 01:19:29 +0530 Subject: [PATCH] Generated Stubs From Script --- auth0/management/actions.pyi | 17 +++ auth0/management/async_auth0.pyi | 5 + auth0/management/attack_protection.pyi | 10 ++ auth0/management/auth0.pyi | 5 + auth0/management/blacklists.pyi | 6 + auth0/management/branding.pyi | 14 +++ auth0/management/client_credentials.pyi | 8 ++ auth0/management/client_grants.pyi | 9 ++ auth0/management/clients.pyi | 10 ++ auth0/management/connections.pyi | 10 ++ auth0/management/custom_domains.pyi | 9 ++ auth0/management/device_credentials.pyi | 7 ++ auth0/management/email_templates.pyi | 7 ++ auth0/management/emails.pyi | 8 ++ auth0/management/grants.pyi | 6 + auth0/management/guardian.pyi | 13 +++ auth0/management/hooks.pyi | 13 +++ auth0/management/jobs.pyi | 9 ++ auth0/management/log_streams.pyi | 9 ++ auth0/management/logs.pyi | 6 + auth0/management/organizations.pyi | 28 +++++ auth0/management/prompts.pyi | 8 ++ auth0/management/resource_servers.pyi | 9 ++ auth0/management/roles.pyi | 14 +++ auth0/management/rules.pyi | 9 ++ auth0/management/rules_configs.pyi | 7 ++ auth0/management/stats.pyi | 6 + auth0/management/tenants.pyi | 6 + auth0/management/tickets.pyi | 6 + auth0/management/user_blocks.pyi | 8 ++ auth0/management/users.pyi | 31 ++++++ auth0/management/users_by_email.pyi | 5 + scripts/generate_stubs.py | 141 ++++++++++++++++++++++++ 33 files changed, 459 insertions(+) create mode 100644 auth0/management/actions.pyi create mode 100644 auth0/management/async_auth0.pyi create mode 100644 auth0/management/attack_protection.pyi create mode 100644 auth0/management/auth0.pyi create mode 100644 auth0/management/blacklists.pyi create mode 100644 auth0/management/branding.pyi create mode 100644 auth0/management/client_credentials.pyi create mode 100644 auth0/management/client_grants.pyi create mode 100644 auth0/management/clients.pyi create mode 100644 auth0/management/connections.pyi create mode 100644 auth0/management/custom_domains.pyi create mode 100644 auth0/management/device_credentials.pyi create mode 100644 auth0/management/email_templates.pyi create mode 100644 auth0/management/emails.pyi create mode 100644 auth0/management/grants.pyi create mode 100644 auth0/management/guardian.pyi create mode 100644 auth0/management/hooks.pyi create mode 100644 auth0/management/jobs.pyi create mode 100644 auth0/management/log_streams.pyi create mode 100644 auth0/management/logs.pyi create mode 100644 auth0/management/organizations.pyi create mode 100644 auth0/management/prompts.pyi create mode 100644 auth0/management/resource_servers.pyi create mode 100644 auth0/management/roles.pyi create mode 100644 auth0/management/rules.pyi create mode 100644 auth0/management/rules_configs.pyi create mode 100644 auth0/management/stats.pyi create mode 100644 auth0/management/tenants.pyi create mode 100644 auth0/management/tickets.pyi create mode 100644 auth0/management/user_blocks.pyi create mode 100644 auth0/management/users.pyi create mode 100644 auth0/management/users_by_email.pyi create mode 100644 scripts/generate_stubs.py diff --git a/auth0/management/actions.pyi b/auth0/management/actions.pyi new file mode 100644 index 00000000..0046efc3 --- /dev/null +++ b/auth0/management/actions.pyi @@ -0,0 +1,17 @@ +from typing import Any + + +class Actions: + def get_actions_async(self: Any, trigger_id: str | None = None, action_name: str | None = None, deployed: bool | None = None, installed: bool = False, page: int | None = None, per_page: int | None = None) -> Any: ... + def create_action_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def update_action_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def get_action_async(self: Any, id: str) -> dict[str, Any]: ... + def delete_action_async(self: Any, id: str, force: bool = False) -> Any: ... + def get_triggers_async(self: Any) -> dict[str, Any]: ... + def get_execution_async(self: Any, id: str) -> dict[str, Any]: ... + def get_action_versions_async(self: Any, id: str, page: int | None = None, per_page: int | None = None) -> dict[str, Any]: ... + def get_trigger_bindings_async(self: Any, id: str, page: int | None = None, per_page: int | None = None) -> dict[str, Any]: ... + def get_action_version_async(self: Any, action_id: str, version_id: str) -> dict[str, Any]: ... + def deploy_action_async(self: Any, id: str) -> dict[str, Any]: ... + def rollback_action_version_async(self: Any, action_id: str, version_id: str) -> dict[str, Any]: ... + def update_trigger_bindings_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/async_auth0.pyi b/auth0/management/async_auth0.pyi new file mode 100644 index 00000000..cd13b44f --- /dev/null +++ b/auth0/management/async_auth0.pyi @@ -0,0 +1,5 @@ +from typing import Any + + +class AsyncAuth0: + def set_session_async(self: Any, session: aiohttp.ClientSession) -> None: ... diff --git a/auth0/management/attack_protection.pyi b/auth0/management/attack_protection.pyi new file mode 100644 index 00000000..6a4c7d6c --- /dev/null +++ b/auth0/management/attack_protection.pyi @@ -0,0 +1,10 @@ +from typing import Any + + +class AttackProtection: + def get_breached_password_detection_async(self: Any) -> dict[str, Any]: ... + def update_breached_password_detection_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_brute_force_protection_async(self: Any) -> dict[str, Any]: ... + def update_brute_force_protection_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_suspicious_ip_throttling_async(self: Any) -> dict[str, Any]: ... + def update_suspicious_ip_throttling_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/auth0.pyi b/auth0/management/auth0.pyi new file mode 100644 index 00000000..49642a3a --- /dev/null +++ b/auth0/management/auth0.pyi @@ -0,0 +1,5 @@ +from typing import Any + + +class Auth0: + pass diff --git a/auth0/management/blacklists.pyi b/auth0/management/blacklists.pyi new file mode 100644 index 00000000..f6f77405 --- /dev/null +++ b/auth0/management/blacklists.pyi @@ -0,0 +1,6 @@ +from typing import Any + + +class Blacklists: + def get_async(self: Any, aud: str | None = None) -> list[dict[str, str]]: ... + def create_async(self: Any, jti: str, aud: str | None = None) -> dict[str, str]: ... diff --git a/auth0/management/branding.pyi b/auth0/management/branding.pyi new file mode 100644 index 00000000..e5158154 --- /dev/null +++ b/auth0/management/branding.pyi @@ -0,0 +1,14 @@ +from typing import Any + + +class Branding: + def get_async(self: Any) -> dict[str, Any]: ... + def update_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_template_universal_login_async(self: Any) -> dict[str, Any]: ... + def delete_template_universal_login_async(self: Any) -> Any: ... + def update_template_universal_login_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_default_branding_theme_async(self: Any) -> dict[str, Any]: ... + def get_branding_theme_async(self: Any, theme_id: str) -> dict[str, Any]: ... + def delete_branding_theme_async(self: Any, theme_id: str) -> Any: ... + def update_branding_theme_async(self: Any, theme_id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def create_branding_theme_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/client_credentials.pyi b/auth0/management/client_credentials.pyi new file mode 100644 index 00000000..6bd742d8 --- /dev/null +++ b/auth0/management/client_credentials.pyi @@ -0,0 +1,8 @@ +from typing import Any + + +class ClientCredentials: + def all_async(self: Any, client_id: str) -> list[dict[str, Any]]: ... + def get_async(self: Any, client_id: str, id: str) -> dict[str, Any]: ... + def create_async(self: Any, client_id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_async(self: Any, client_id: str, id: str) -> dict[str, Any]: ... diff --git a/auth0/management/client_grants.pyi b/auth0/management/client_grants.pyi new file mode 100644 index 00000000..bb2f59f1 --- /dev/null +++ b/auth0/management/client_grants.pyi @@ -0,0 +1,9 @@ +from typing import Any + + +class ClientGrants: + def all_async(self: Any, audience: str | None = None, page: int | None = None, per_page: int | None = None, include_totals: bool = False, client_id: str | None = None, allow_any_organization: bool | None = None) -> Any: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def get_organizations_async(self: Any, id: str, page: int | None = None, per_page: int | None = None, include_totals: bool = False, from_param: str | None = None, take: int | None = None) -> Any: ... diff --git a/auth0/management/clients.pyi b/auth0/management/clients.pyi new file mode 100644 index 00000000..f78197bd --- /dev/null +++ b/auth0/management/clients.pyi @@ -0,0 +1,10 @@ +from typing import Any + + +class Clients: + def all_async(self: Any, fields: list[str] | None = None, include_fields: bool = True, page: int | None = None, per_page: int | None = None, extra_params: dict[str, Any] | None = None) -> list[dict[str, Any]]: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_async(self: Any, id: str, fields: list[str] | None = None, include_fields: bool = True) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def rotate_secret_async(self: Any, id: str) -> dict[str, Any]: ... diff --git a/auth0/management/connections.pyi b/auth0/management/connections.pyi new file mode 100644 index 00000000..3be752c2 --- /dev/null +++ b/auth0/management/connections.pyi @@ -0,0 +1,10 @@ +from typing import Any + + +class Connections: + def all_async(self: Any, strategy: str | None = None, fields: list[str] | None = None, include_fields: bool = True, page: int | None = None, per_page: int | None = None, extra_params: dict[str, Any] | None = None, name: str | None = None) -> list[dict[str, Any]]: ... + def get_async(self: Any, id: str, fields: list[str] | None = None, include_fields: bool = True) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_user_by_email_async(self: Any, id: str, email: str) -> Any: ... diff --git a/auth0/management/custom_domains.pyi b/auth0/management/custom_domains.pyi new file mode 100644 index 00000000..77b56c4a --- /dev/null +++ b/auth0/management/custom_domains.pyi @@ -0,0 +1,9 @@ +from typing import Any + + +class CustomDomains: + def all_async(self: Any) -> list[dict[str, Any]]: ... + def get_async(self: Any, id: str) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def create_new_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def verify_async(self: Any, id: str) -> dict[str, Any]: ... diff --git a/auth0/management/device_credentials.pyi b/auth0/management/device_credentials.pyi new file mode 100644 index 00000000..217167c7 --- /dev/null +++ b/auth0/management/device_credentials.pyi @@ -0,0 +1,7 @@ +from typing import Any + + +class DeviceCredentials: + def get_async(self: Any, user_id: str, client_id: str, type: str, fields: list[str] | None = None, include_fields: bool = True, page: int | None = None, per_page: int | None = None, include_totals: bool = False) -> Any: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... diff --git a/auth0/management/email_templates.pyi b/auth0/management/email_templates.pyi new file mode 100644 index 00000000..a842cd63 --- /dev/null +++ b/auth0/management/email_templates.pyi @@ -0,0 +1,7 @@ +from typing import Any + + +class EmailTemplates: + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_async(self: Any, template_name: str) -> dict[str, Any]: ... + def update_async(self: Any, template_name: str, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/emails.pyi b/auth0/management/emails.pyi new file mode 100644 index 00000000..ca5120e5 --- /dev/null +++ b/auth0/management/emails.pyi @@ -0,0 +1,8 @@ +from typing import Any + + +class Emails: + def get_async(self: Any, fields: list[str] | None = None, include_fields: bool = True) -> dict[str, Any]: ... + def config_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_async(self: Any) -> Any: ... + def update_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/grants.pyi b/auth0/management/grants.pyi new file mode 100644 index 00000000..764de2fc --- /dev/null +++ b/auth0/management/grants.pyi @@ -0,0 +1,6 @@ +from typing import Any + + +class Grants: + def all_async(self: Any, page: int | None = None, per_page: int | None = None, include_totals: bool = False, extra_params: dict[str, Any] | None = None) -> Any: ... + def delete_async(self: Any, id: str) -> Any: ... diff --git a/auth0/management/guardian.pyi b/auth0/management/guardian.pyi new file mode 100644 index 00000000..c85df09f --- /dev/null +++ b/auth0/management/guardian.pyi @@ -0,0 +1,13 @@ +from typing import Any + + +class Guardian: + def all_factors_async(self: Any) -> list[dict[str, Any]]: ... + def update_factor_async(self: Any, name: str, body: dict[str, Any]) -> dict[str, Any]: ... + def update_templates_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_templates_async(self: Any) -> dict[str, Any]: ... + def get_enrollment_async(self: Any, id: str) -> dict[str, Any]: ... + def delete_enrollment_async(self: Any, id: str) -> Any: ... + def create_enrollment_ticket_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_factor_providers_async(self: Any, factor_name: str, name: str) -> dict[str, Any]: ... + def update_factor_providers_async(self: Any, factor_name: str, name: str, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/hooks.pyi b/auth0/management/hooks.pyi new file mode 100644 index 00000000..ddc305bc --- /dev/null +++ b/auth0/management/hooks.pyi @@ -0,0 +1,13 @@ +from typing import Any + + +class Hooks: + def all_async(self: Any, enabled: bool = True, fields: list[str] | None = None, include_fields: bool = True, page: int | None = None, per_page: int | None = None, include_totals: bool = False) -> Any: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_async(self: Any, id: str, fields: list[str] | None = None) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def get_secrets_async(self: Any, id: str) -> dict[str, Any]: ... + def add_secrets_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_secrets_async(self: Any, id: str, body: list[str]) -> Any: ... + def update_secrets_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/jobs.pyi b/auth0/management/jobs.pyi new file mode 100644 index 00000000..ed69f2cc --- /dev/null +++ b/auth0/management/jobs.pyi @@ -0,0 +1,9 @@ +from typing import Any + + +class Jobs: + def get_async(self: Any, id: str) -> dict[str, Any]: ... + def get_failed_job_async(self: Any, id: str) -> dict[str, Any]: ... + def export_users_async(self: Any, body: dict[str, Any]) -> Any: ... + def import_users_async(self: Any, connection_id: str, file_obj: Any, upsert: bool = False, send_completion_email: bool = True, external_id: str | None = None) -> dict[str, Any]: ... + def send_verification_email_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/log_streams.pyi b/auth0/management/log_streams.pyi new file mode 100644 index 00000000..c907758e --- /dev/null +++ b/auth0/management/log_streams.pyi @@ -0,0 +1,9 @@ +from typing import Any + + +class LogStreams: + def list_async(self: Any) -> list[dict[str, Any]]: ... + def get_async(self: Any, id: str) -> dict[str, Any]: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> dict[str, Any]: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/logs.pyi b/auth0/management/logs.pyi new file mode 100644 index 00000000..de2428de --- /dev/null +++ b/auth0/management/logs.pyi @@ -0,0 +1,6 @@ +from typing import Any + + +class Logs: + def search_async(self: Any, page: int = 0, per_page: int = 50, sort: str | None = None, q: str | None = None, include_totals: bool = True, fields: list[str] | None = None, from_param: str | None = None, take: int | None = None, include_fields: bool = True) -> Any: ... + def get_async(self: Any, id: str) -> dict[str, Any]: ... diff --git a/auth0/management/organizations.pyi b/auth0/management/organizations.pyi new file mode 100644 index 00000000..6319b55d --- /dev/null +++ b/auth0/management/organizations.pyi @@ -0,0 +1,28 @@ +from typing import Any + + +class Organizations: + def all_organizations_async(self: Any, page: int | None = None, per_page: int | None = None, include_totals: bool = True, from_param: str | None = None, take: int | None = None) -> Any: ... + def get_organization_by_name_async(self: Any, name: str | None = None) -> dict[str, Any]: ... + def get_organization_async(self: Any, id: str) -> dict[str, Any]: ... + def create_organization_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def update_organization_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_organization_async(self: Any, id: str) -> Any: ... + def all_organization_connections_async(self: Any, id: str, page: int | None = None, per_page: int | None = None) -> list[dict[str, Any]]: ... + def get_organization_connection_async(self: Any, id: str, connection_id: str) -> dict[str, Any]: ... + def create_organization_connection_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def update_organization_connection_async(self: Any, id: str, connection_id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_organization_connection_async(self: Any, id: str, connection_id: str) -> Any: ... + def all_organization_members_async(self: Any, id: str, page: int | None = None, per_page: int | None = None, include_totals: bool = True, from_param: str | None = None, take: int | None = None, fields: list[str] | None = None, include_fields: bool = True) -> Any: ... + def create_organization_members_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_organization_members_async(self: Any, id: str, body: dict[str, Any]) -> Any: ... + def all_organization_member_roles_async(self: Any, id: str, user_id: str, page: int | None = None, per_page: int | None = None, include_totals: bool = False) -> list[dict[str, Any]]: ... + def create_organization_member_roles_async(self: Any, id: str, user_id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_organization_member_roles_async(self: Any, id: str, user_id: str, body: dict[str, Any]) -> Any: ... + def all_organization_invitations_async(self: Any, id: str, page: int | None = None, per_page: int | None = None, include_totals: bool = False) -> Any: ... + def get_organization_invitation_async(self: Any, id: str, invitaton_id: str) -> dict[str, Any]: ... + def create_organization_invitation_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_organization_invitation_async(self: Any, id: str, invitation_id: str) -> Any: ... + def get_client_grants_async(self: Any, id: str, audience: str | None = None, client_id: str | None = None, page: int | None = None, per_page: int | None = None, include_totals: bool = False) -> Any: ... + def add_client_grant_async(self: Any, id: str, grant_id: str) -> dict[str, Any]: ... + def delete_client_grant_async(self: Any, id: str, grant_id: str) -> dict[str, Any]: ... diff --git a/auth0/management/prompts.pyi b/auth0/management/prompts.pyi new file mode 100644 index 00000000..7f5968ce --- /dev/null +++ b/auth0/management/prompts.pyi @@ -0,0 +1,8 @@ +from typing import Any + + +class Prompts: + def get_async(self: Any) -> dict[str, Any]: ... + def update_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_custom_text_async(self: Any, prompt: str, language: str) -> Any: ... + def update_custom_text_async(self: Any, prompt: str, language: str, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/resource_servers.pyi b/auth0/management/resource_servers.pyi new file mode 100644 index 00000000..516b3553 --- /dev/null +++ b/auth0/management/resource_servers.pyi @@ -0,0 +1,9 @@ +from typing import Any + + +class ResourceServers: + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_all_async(self: Any, page: int | None = None, per_page: int | None = None, include_totals: bool = False) -> Any: ... + def get_async(self: Any, id: str) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/roles.pyi b/auth0/management/roles.pyi new file mode 100644 index 00000000..f9b0486d --- /dev/null +++ b/auth0/management/roles.pyi @@ -0,0 +1,14 @@ +from typing import Any + + +class Roles: + def list_async(self: Any, page: int = 0, per_page: int = 25, include_totals: bool = True, name_filter: str | None = None) -> Any: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_async(self: Any, id: str) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def list_users_async(self: Any, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True, from_param: str | None = None, take: int | None = None) -> Any: ... + def add_users_async(self: Any, id: str, users: List[str]) -> dict[str, Any]: ... + def list_permissions_async(self: Any, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True) -> Any: ... + def remove_permissions_async(self: Any, id: str, permissions: List[dict[str, str]]) -> Any: ... + def add_permissions_async(self: Any, id: str, permissions: List[dict[str, str]]) -> dict[str, Any]: ... diff --git a/auth0/management/rules.pyi b/auth0/management/rules.pyi new file mode 100644 index 00000000..124c316e --- /dev/null +++ b/auth0/management/rules.pyi @@ -0,0 +1,9 @@ +from typing import Any + + +class Rules: + def all_async(self: Any, stage: str = 'login_success', enabled: bool = True, fields: list[str] | None = None, include_fields: bool = True, page: int | None = None, per_page: int | None = None, include_totals: bool = False) -> Any: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_async(self: Any, id: str, fields: list[str] | None = None, include_fields: bool = True) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/rules_configs.pyi b/auth0/management/rules_configs.pyi new file mode 100644 index 00000000..bf156e98 --- /dev/null +++ b/auth0/management/rules_configs.pyi @@ -0,0 +1,7 @@ +from typing import Any + + +class RulesConfigs: + def all_async(self: Any) -> list[dict[str, Any]]: ... + def unset_async(self: Any, key: str) -> Any: ... + def set_async(self: Any, key: str, value: str) -> dict[str, Any]: ... diff --git a/auth0/management/stats.pyi b/auth0/management/stats.pyi new file mode 100644 index 00000000..67b4651c --- /dev/null +++ b/auth0/management/stats.pyi @@ -0,0 +1,6 @@ +from typing import Any + + +class Stats: + def active_users_async(self: Any) -> int: ... + def daily_stats_async(self: Any, from_date: str | None = None, to_date: str | None = None) -> list[dict[str, Any]]: ... diff --git a/auth0/management/tenants.pyi b/auth0/management/tenants.pyi new file mode 100644 index 00000000..ff2df94c --- /dev/null +++ b/auth0/management/tenants.pyi @@ -0,0 +1,6 @@ +from typing import Any + + +class Tenants: + def get_async(self: Any, fields: list[str] | None = None, include_fields: bool = True) -> dict[str, Any]: ... + def update_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/tickets.pyi b/auth0/management/tickets.pyi new file mode 100644 index 00000000..b1b26327 --- /dev/null +++ b/auth0/management/tickets.pyi @@ -0,0 +1,6 @@ +from typing import Any + + +class Tickets: + def create_email_verification_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def create_pswd_change_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... diff --git a/auth0/management/user_blocks.pyi b/auth0/management/user_blocks.pyi new file mode 100644 index 00000000..9b2e70a9 --- /dev/null +++ b/auth0/management/user_blocks.pyi @@ -0,0 +1,8 @@ +from typing import Any + + +class UserBlocks: + def get_by_identifier_async(self: Any, identifier: str) -> dict[str, Any]: ... + def unblock_by_identifier_async(self: Any, identifier: dict[str, Any]) -> Any: ... + def get_async(self: Any, id: str) -> dict[str, Any]: ... + def unblock_async(self: Any, id: str) -> Any: ... diff --git a/auth0/management/users.pyi b/auth0/management/users.pyi new file mode 100644 index 00000000..1e358fca --- /dev/null +++ b/auth0/management/users.pyi @@ -0,0 +1,31 @@ +from typing import Any + + +class Users: + def list_async(self: Any, page: int = 0, per_page: int = 25, sort: str | None = None, connection: str | None = None, q: str | None = None, search_engine: str | None = None, include_totals: bool = True, fields: List[str] | None = None, include_fields: bool = True) -> Any: ... + def create_async(self: Any, body: dict[str, Any]) -> dict[str, Any]: ... + def get_async(self: Any, id: str, fields: List[str] | None = None, include_fields: bool = True) -> dict[str, Any]: ... + def delete_async(self: Any, id: str) -> Any: ... + def update_async(self: Any, id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def list_organizations_async(self: Any, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True) -> Any: ... + def list_roles_async(self: Any, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True) -> Any: ... + def remove_roles_async(self: Any, id: str, roles: List[str]) -> Any: ... + def add_roles_async(self: Any, id: str, roles: List[str]) -> dict[str, Any]: ... + def list_permissions_async(self: Any, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True) -> Any: ... + def remove_permissions_async(self: Any, id: str, permissions: List[str]) -> Any: ... + def add_permissions_async(self: Any, id: str, permissions: List[str]) -> dict[str, Any]: ... + def delete_multifactor_async(self: Any, id: str, provider: str) -> Any: ... + def delete_authenticators_async(self: Any, id: str) -> Any: ... + def unlink_user_account_async(self: Any, id: str, provider: str, user_id: str) -> Any: ... + def link_user_account_async(self: Any, user_id: str, body: dict[str, Any]) -> list[dict[str, Any]]: ... + def regenerate_recovery_code_async(self: Any, user_id: str) -> dict[str, Any]: ... + def get_guardian_enrollments_async(self: Any, user_id: str) -> dict[str, Any]: ... + def get_log_events_async(self: Any, user_id: str, page: int = 0, per_page: int = 50, sort: str | None = None, include_totals: bool = False) -> Any: ... + def invalidate_remembered_browsers_async(self: Any, user_id: str) -> dict[str, Any]: ... + def get_authentication_methods_async(self: Any, user_id: str) -> dict[str, Any]: ... + def get_authentication_method_by_id_async(self: Any, user_id: str, authentication_method_id: str) -> dict[str, Any]: ... + def create_authentication_method_async(self: Any, user_id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def update_authentication_methods_async(self: Any, user_id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def update_authentication_method_by_id_async(self: Any, user_id: str, authentication_method_id: str, body: dict[str, Any]) -> dict[str, Any]: ... + def delete_authentication_methods_async(self: Any, user_id: str) -> Any: ... + def delete_authentication_method_by_id_async(self: Any, user_id: str, authentication_method_id: str) -> Any: ... diff --git a/auth0/management/users_by_email.pyi b/auth0/management/users_by_email.pyi new file mode 100644 index 00000000..0353d9ec --- /dev/null +++ b/auth0/management/users_by_email.pyi @@ -0,0 +1,5 @@ +from typing import Any + + +class UsersByEmail: + def search_users_by_email_async(self: Any, email: str, fields: list[str] | None = None, include_fields: bool = True) -> list[dict[str, Any]]: ... diff --git a/scripts/generate_stubs.py b/scripts/generate_stubs.py new file mode 100644 index 00000000..4c45c518 --- /dev/null +++ b/scripts/generate_stubs.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python3 + +import ast +import os + +# Directory containing the real .py files +SOURCE_DIR = "auth0/management" +PY_SUFFIX = ".py" +STUB_SUFFIX = ".pyi" + + +def parse_function_signature(funcdef: ast.FunctionDef) -> tuple[list[str], str]: + """ + From a FunctionDef node, extract a list of parameter strings (including + annotation and default) and the return type string (without the leading '->'). + If the function has no return annotation, default to 'Any'. + """ + params = [] + # Number of positional arguments + all_args = funcdef.args.args # e.g. [self, fields, include_fields] + # Default values for the trailing arguments + # e.g. if we have "fields: list[str] | None = None, include_fields: bool = True" + # then funcdef.args.defaults will correspond to [None, True]. + defaults = funcdef.args.defaults + + # Where defaults start (the last N arguments in 'all_args' have defaults) + defaults_start_index = len(all_args) - len(defaults) + + for i, arg in enumerate(all_args): + arg_name = arg.arg # e.g. "fields" + if arg.annotation: + # Convert the AST for the annotation to source code + annotation_str = ast.unparse(arg.annotation) + else: + annotation_str = "Any" + + if i >= defaults_start_index: # argument has a default + default_idx = i - defaults_start_index + default_ast = defaults[default_idx] # e.g. "None", "True", etc. + default_str = ast.unparse(default_ast) + param_str = f"{arg_name}: {annotation_str} = {default_str}" + else: + param_str = f"{arg_name}: {annotation_str}" + + params.append(param_str) + + # Also handle keyword-only arguments (funcdef.args.kwonlyargs) if you wish + # ... but for brevity we skip that here. + + # Return annotation + if funcdef.returns: + return_str = ast.unparse(funcdef.returns) # e.g. "dict[str, Any]" + else: + return_str = "Any" + + return (params, return_str) + + +def generate_stub_for_file(py_file_path: str) -> str | None: + """ + Parse a .py file, find classes and their sync methods, and generate + a .pyi stub with *async versions* that replicate param/return annotations. + """ + with open(py_file_path, "r", encoding="utf-8") as f: + source_code = f.read() + + tree = ast.parse(source_code, filename=py_file_path) + + stub_lines = [] + # We can insert a minimal import so that "Any" etc. can be used + stub_lines.append("from typing import Any\n\n") + + found_any_class = False + + for node in tree.body: + if isinstance(node, ast.ClassDef): + found_any_class = True + class_name = node.name + stub_lines.append(f"class {class_name}:") + + # Collect lines for method stubs inside this class + method_lines = [] + for class_child in node.body: + if isinstance(class_child, ast.FunctionDef): + orig_name = class_child.name + + # Skip private/special methods or existing *_async + if orig_name.startswith("_") or orig_name.endswith("_async"): + continue + + async_name = orig_name + "_async" + params, return_str = parse_function_signature(class_child) + # Join the parameters with commas + params_str = ", ".join(params) + + # If there's no "self" param at all, you might want to insert it. + # But if the code always has "self" as the first param, it's fine. + + method_sig = f"def {async_name}({params_str}) -> {return_str}: ..." + + # Indent inside the class + method_lines.append(" " + method_sig) + + if not method_lines: + # If this class has no generated stubs, put a pass + method_lines.append(" pass") + + stub_lines.extend(method_lines) + stub_lines.append("") # blank line after each class + + if not found_any_class: + # If there's not even a class definition in this file, skip writing + return None + + # If the final content only has the "from typing import Any\n" line, skip too + if len(stub_lines) <= 2: + return None + + return "\n".join(stub_lines) + + +def main(): + for root, dirs, files in os.walk(SOURCE_DIR): + for filename in files: + if filename.endswith(PY_SUFFIX): + full_path = os.path.join(root, filename) + # Optionally skip special files, e.g. "__init__.py" if you want + # if filename == "__init__.py": + # continue + + stub_content = generate_stub_for_file(full_path) + if stub_content: + stub_filename = filename.replace(PY_SUFFIX, STUB_SUFFIX) + stub_path = os.path.join(root, stub_filename) + with open(stub_path, "w", encoding="utf-8") as stub_file: + stub_file.write(stub_content) + print(f"Generated stub: {stub_path}") + + +if __name__ == "__main__": + main()