From 71dd562ac9ef0d2cf0d951612c4ca709a559b4eb Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 5 Jun 2026 14:03:58 +0530 Subject: [PATCH] chore: update Python SDK to 20.1.0 --- CHANGELOG.md | 12 +- appwrite/client.py | 20 +- appwrite/enums/project_key_scopes.py | 2 + appwrite/enums/project_policy_id.py | 1 + appwrite/models/__init__.py | 2 + appwrite/models/policy_list.py | 5 +- appwrite/models/policy_password_strength.py | 30 ++ appwrite/models/project.py | 41 +- appwrite/services/account.py | 48 ++- appwrite/services/activities.py | 3 + appwrite/services/advisor.py | 6 + appwrite/services/avatars.py | 9 + appwrite/services/backups.py | 13 + appwrite/services/databases.py | 72 ++++ appwrite/services/functions.py | 27 ++ appwrite/services/graphql.py | 3 + appwrite/services/health.py | 53 +++ appwrite/services/locale.py | 9 + appwrite/services/messaging.py | 217 ++++++++++ appwrite/services/organization.py | 11 + appwrite/services/presences.py | 6 + appwrite/services/project.py | 319 +++++++++++++-- appwrite/services/proxy.py | 9 + appwrite/services/sites.py | 26 ++ appwrite/services/storage.py | 14 + appwrite/services/tables_db.py | 72 ++++ appwrite/services/teams.py | 14 + appwrite/services/tokens.py | 6 + appwrite/services/usage.py | 3 + appwrite/services/users.py | 44 ++ appwrite/services/webhooks.py | 7 + docs/examples/account/update-password.md | 2 +- docs/examples/health/get-audits-db.md | 16 + .../examples/messaging/create-ses-provider.md | 27 ++ .../examples/messaging/update-ses-provider.md | 27 ++ docs/examples/project/get-policy.md | 3 +- .../project/update-o-auth-2-server.md | 25 ++ .../update-password-strength-policy.md | 22 + pyproject.toml | 2 +- setup.py | 4 +- test/services/test_health.py | 14 + test/services/test_messaging.py | 43 ++ test/services/test_organization.py | 39 +- test/services/test_project.py | 387 ++++++++++++++---- 44 files changed, 1567 insertions(+), 148 deletions(-) create mode 100644 appwrite/models/policy_password_strength.py create mode 100644 docs/examples/health/get-audits-db.md create mode 100644 docs/examples/messaging/create-ses-provider.md create mode 100644 docs/examples/messaging/update-ses-provider.md create mode 100644 docs/examples/project/update-o-auth-2-server.md create mode 100644 docs/examples/project/update-password-strength-policy.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d5ba813..2e20b2d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 20.1.0 + +* Added: `createSesProvider` and `updateSesProvider` to `messaging` +* Added: `updateOAuth2Server` to `project` for OAuth2 server settings +* Added: `updatePasswordStrengthPolicy` and `PolicyPasswordStrength` to `project` +* Added: `getAuditsDB` health check to `health` +* Added: `password-strength` to `ProjectPolicyId` +* Added: `apps.read` and `apps.write` to `ProjectKeyScopes` + + ## 20.0.0 * Breaking: Removed `githubImagine` and `googleImagine` from `ProjectOAuthProviderId` @@ -8,7 +18,7 @@ * Added: `Organization` service for managing projects and API keys * Added: `PolicyDenyAliasedEmail`, `PolicyDenyDisposableEmail`, and `PolicyDenyFreeEmail` policy models * Added: `deny-aliased-email`, `deny-disposable-email`, and `deny-free-email` to `ProjectPolicyId` -* Added: `BrowserTheme`, `HealthQueueName`, `OrganizationKeyScopes`, and `Region` enums +* Replaced: `BrowserTheme`, `HealthQueueName`, `OrganizationKeyScopes`, and `Region` enums * Added: `dart-3.12` and `flutter-3.44` runtimes * Added: `ProjectList` model and new attributes on `Function`, `Site`, and `UsageGauge` * Updated: `functions`, `sites`, `usage`, `health`, and `avatars` services diff --git a/appwrite/client.py b/appwrite/client.py index e0a6ab25..c81b6f65 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -17,13 +17,14 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/20.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/20.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '20.0.0', + 'x-sdk-version': '20.1.0', 'X-Appwrite-Response-Format' : '1.9.5', } + self._config = {} def set_self_signed(self, status=True): self._self_signed = status @@ -43,68 +44,81 @@ def add_header(self, key, value): def get_headers(self): return dict(self._global_headers) + def get_config(self, key): + return self._config.get(key, '') + def set_project(self, value): """Your project ID""" - self._global_headers['x-appwrite-project'] = value + self._config['project'] = value return self def set_key(self, value): """Your secret API key""" self._global_headers['x-appwrite-key'] = value + self._config['key'] = value return self def set_jwt(self, value): """Your secret JSON Web Token""" self._global_headers['x-appwrite-jwt'] = value + self._config['jwt'] = value return self def set_locale(self, value): self._global_headers['x-appwrite-locale'] = value + self._config['locale'] = value return self def set_session(self, value): """The user session to authenticate with""" self._global_headers['x-appwrite-session'] = value + self._config['session'] = value return self def set_forwarded_user_agent(self, value): """The user agent string of the client that made the request""" self._global_headers['x-forwarded-user-agent'] = value + self._config['forwardeduseragent'] = value return self def set_dev_key(self, value): """Your secret dev API key""" self._global_headers['x-appwrite-dev-key'] = value + self._config['devkey'] = value return self def set_cookie(self, value): """The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes.""" self._global_headers['cookie'] = value + self._config['cookie'] = value return self def set_impersonate_user_id(self, value): """Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.""" self._global_headers['x-appwrite-impersonate-user-id'] = value + self._config['impersonateuserid'] = value return self def set_impersonate_user_email(self, value): """Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.""" self._global_headers['x-appwrite-impersonate-user-email'] = value + self._config['impersonateuseremail'] = value return self def set_impersonate_user_phone(self, value): """Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.""" self._global_headers['x-appwrite-impersonate-user-phone'] = value + self._config['impersonateuserphone'] = value return self def call(self, method, path='', headers=None, params=None, response_type='json'): diff --git a/appwrite/enums/project_key_scopes.py b/appwrite/enums/project_key_scopes.py index 961d32f8..54e5ff58 100644 --- a/appwrite/enums/project_key_scopes.py +++ b/appwrite/enums/project_key_scopes.py @@ -94,4 +94,6 @@ class ProjectKeyScopes(Enum): DOMAINS_READ = "domains.read" DOMAINS_WRITE = "domains.write" EVENTS_READ = "events.read" + APPS_READ = "apps.read" + APPS_WRITE = "apps.write" USAGE_READ = "usage.read" diff --git a/appwrite/enums/project_policy_id.py b/appwrite/enums/project_policy_id.py index 1b347dab..fb1714c0 100644 --- a/appwrite/enums/project_policy_id.py +++ b/appwrite/enums/project_policy_id.py @@ -3,6 +3,7 @@ class ProjectPolicyId(Enum): PASSWORD_DICTIONARY = "password-dictionary" PASSWORD_HISTORY = "password-history" + PASSWORD_STRENGTH = "password-strength" PASSWORD_PERSONAL_DATA = "password-personal-data" SESSION_ALERT = "session-alert" SESSION_DURATION = "session-duration" diff --git a/appwrite/models/__init__.py b/appwrite/models/__init__.py index 550ec73d..e1b177b7 100644 --- a/appwrite/models/__init__.py +++ b/appwrite/models/__init__.py @@ -172,6 +172,7 @@ from .o_auth2_provider_list import OAuth2ProviderList from .policy_password_dictionary import PolicyPasswordDictionary from .policy_password_history import PolicyPasswordHistory +from .policy_password_strength import PolicyPasswordStrength from .policy_password_personal_data import PolicyPasswordPersonalData from .policy_session_alert import PolicySessionAlert from .policy_session_duration import PolicySessionDuration @@ -406,6 +407,7 @@ 'OAuth2ProviderList', 'PolicyPasswordDictionary', 'PolicyPasswordHistory', + 'PolicyPasswordStrength', 'PolicyPasswordPersonalData', 'PolicySessionAlert', 'PolicySessionDuration', diff --git a/appwrite/models/policy_list.py b/appwrite/models/policy_list.py index ab5149b3..97399089 100644 --- a/appwrite/models/policy_list.py +++ b/appwrite/models/policy_list.py @@ -4,6 +4,7 @@ from .base_model import AppwriteModel from .policy_password_dictionary import PolicyPasswordDictionary from .policy_password_history import PolicyPasswordHistory +from .policy_password_strength import PolicyPasswordStrength from .policy_password_personal_data import PolicyPasswordPersonalData from .policy_session_alert import PolicySessionAlert from .policy_session_duration import PolicySessionDuration @@ -23,8 +24,8 @@ class PolicyList(AppwriteModel): ---------- total : float Total number of policies in the given project. - policies : List[Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail]] + policies : List[Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail]] List of policies. """ total: float = Field(..., alias='total') - policies: List[Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail]] = Field(..., alias='policies') + policies: List[Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail]] = Field(..., alias='policies') diff --git a/appwrite/models/policy_password_strength.py b/appwrite/models/policy_password_strength.py new file mode 100644 index 00000000..7abb100a --- /dev/null +++ b/appwrite/models/policy_password_strength.py @@ -0,0 +1,30 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr + +from .base_model import AppwriteModel + +class PolicyPasswordStrength(AppwriteModel): + """ + Policy Password Strength + + Attributes + ---------- + id : str + Policy ID. + min : float + Minimum password length required for user passwords. + uppercase : bool + Whether passwords must include at least one uppercase letter. + lowercase : bool + Whether passwords must include at least one lowercase letter. + number : bool + Whether passwords must include at least one number. + symbols : bool + Whether passwords must include at least one symbol. + """ + id: str = Field(..., alias='$id') + min: float = Field(..., alias='min') + uppercase: bool = Field(..., alias='uppercase') + lowercase: bool = Field(..., alias='lowercase') + number: bool = Field(..., alias='number') + symbols: bool = Field(..., alias='symbols') diff --git a/appwrite/models/project.py b/appwrite/models/project.py index d717a07c..701823ff 100644 --- a/appwrite/models/project.py +++ b/appwrite/models/project.py @@ -6,8 +6,8 @@ from .project_auth_method import ProjectAuthMethod from .project_service import ProjectService from .project_protocol import ProjectProtocol -from .billing_limits import BillingLimits from .block import Block +from .billing_limits import BillingLimits class Project(AppwriteModel): """ @@ -25,6 +25,8 @@ class Project(AppwriteModel): Project name. teamid : str Project team ID. + region : str + Project region devkeys : List[DevKey] Deprecated since 1.9.5: List of dev keys. smtpenabled : bool @@ -61,20 +63,37 @@ class Project(AppwriteModel): List of services. protocols : List[ProjectProtocol] List of protocols. - region : str - Project region - billinglimits : Optional[BillingLimits] - Billing limits reached blocks : List[Block] Project blocks information consoleaccessedat : str Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. + billinglimits : Optional[BillingLimits] + Billing limits reached + oauth2serverenabled : bool + OAuth2 server status + oauth2serverauthorizationurl : str + OAuth2 server authorization URL + oauth2serverscopes : List[Any] + OAuth2 server allowed scopes + oauth2serveraccesstokenduration : float + OAuth2 server access token duration in seconds for confidential clients + oauth2serverrefreshtokenduration : float + OAuth2 server refresh token duration in seconds for confidential clients + oauth2serverpublicaccesstokenduration : float + OAuth2 server access token duration in seconds for public clients (SPAs, mobile, native) + oauth2serverpublicrefreshtokenduration : float + OAuth2 server refresh token duration in seconds for public clients (SPAs, mobile, native) + oauth2serverconfidentialpkce : bool + When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. + oauth2serverdiscoveryurl : str + OAuth2 server discovery URL """ id: str = Field(..., alias='$id') createdat: str = Field(..., alias='$createdAt') updatedat: str = Field(..., alias='$updatedAt') name: str = Field(..., alias='name') teamid: str = Field(..., alias='teamId') + region: str = Field(..., alias='region') devkeys: List[DevKey] = Field(..., alias='devKeys') smtpenabled: bool = Field(..., alias='smtpEnabled') smtpsendername: str = Field(..., alias='smtpSenderName') @@ -93,7 +112,15 @@ class Project(AppwriteModel): authmethods: List[ProjectAuthMethod] = Field(..., alias='authMethods') services: List[ProjectService] = Field(..., alias='services') protocols: List[ProjectProtocol] = Field(..., alias='protocols') - region: str = Field(..., alias='region') - billinglimits: Optional[BillingLimits] = Field(default=None, alias='billingLimits') blocks: List[Block] = Field(..., alias='blocks') consoleaccessedat: str = Field(..., alias='consoleAccessedAt') + billinglimits: Optional[BillingLimits] = Field(default=None, alias='billingLimits') + oauth2serverenabled: bool = Field(..., alias='oAuth2ServerEnabled') + oauth2serverauthorizationurl: str = Field(..., alias='oAuth2ServerAuthorizationUrl') + oauth2serverscopes: List[Any] = Field(..., alias='oAuth2ServerScopes') + oauth2serveraccesstokenduration: float = Field(..., alias='oAuth2ServerAccessTokenDuration') + oauth2serverrefreshtokenduration: float = Field(..., alias='oAuth2ServerRefreshTokenDuration') + oauth2serverpublicaccesstokenduration: float = Field(..., alias='oAuth2ServerPublicAccessTokenDuration') + oauth2serverpublicrefreshtokenduration: float = Field(..., alias='oAuth2ServerPublicRefreshTokenDuration') + oauth2serverconfidentialpkce: bool = Field(..., alias='oAuth2ServerConfidentialPkce') + oauth2serverdiscoveryurl: str = Field(..., alias='oAuth2ServerDiscoveryUrl') diff --git a/appwrite/services/account.py b/appwrite/services/account.py index f9d21d07..4f7d5f60 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union, Type, TypeVar from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -53,6 +54,7 @@ def get( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return User.with_data(response, model_type) @@ -113,6 +115,7 @@ def create( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -164,6 +167,7 @@ def update_email( api_params['password'] = self._normalize_value(password) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -205,6 +209,7 @@ def list_identities( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=IdentityList) @@ -242,6 +247,7 @@ def delete_identity( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -278,6 +284,7 @@ def create_jwt( api_params['duration'] = self._normalize_value(duration) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -319,6 +326,7 @@ def list_logs( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LogList) @@ -360,6 +368,7 @@ def update_mfa( api_params['mfa'] = self._normalize_value(mfa) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -398,6 +407,7 @@ def create_mfa_authenticator( response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -447,6 +457,7 @@ def update_mfa_authenticator( api_params['otp'] = self._normalize_value(otp) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -485,6 +496,7 @@ def delete_mfa_authenticator( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -523,6 +535,7 @@ def create_mfa_challenge( api_params['factor'] = self._normalize_value(factor) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -568,6 +581,7 @@ def update_mfa_challenge( api_params['otp'] = self._normalize_value(otp) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -595,6 +609,7 @@ def list_mfa_factors( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MfaFactors) @@ -621,6 +636,7 @@ def get_mfa_recovery_codes( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MfaRecoveryCodes) @@ -647,6 +663,7 @@ def create_mfa_recovery_codes( api_params = {} response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -674,6 +691,7 @@ def update_mfa_recovery_codes( api_params = {} response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -716,6 +734,7 @@ def update_name( api_params['name'] = self._normalize_value(name) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -736,7 +755,7 @@ def update_password( password : str New user password. Must be at least 8 chars. old_password : Optional[str] - Current user password. Must be at least 8 chars. + Current user password. Max length: 256 chars. model_type : Type[T], optional Pydantic model class for the user-defined data. Defaults to dict for backward compatibility. @@ -763,6 +782,7 @@ def update_password( api_params['oldPassword'] = self._normalize_value(old_password) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -812,6 +832,7 @@ def update_phone( api_params['password'] = self._normalize_value(password) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -846,6 +867,7 @@ def get_prefs( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return Preferences.with_data(response, model_type) @@ -887,6 +909,7 @@ def update_prefs( api_params['prefs'] = self._normalize_value(prefs) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -932,6 +955,7 @@ def create_recovery( api_params['url'] = self._normalize_value(url) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -986,6 +1010,7 @@ def update_recovery( api_params['password'] = self._normalize_value(password) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1013,6 +1038,7 @@ def list_sessions( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=SessionList) @@ -1039,6 +1065,7 @@ def delete_sessions( api_params = {} response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1066,6 +1093,7 @@ def create_anonymous_session( api_params = {} response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1113,6 +1141,7 @@ def create_email_password_session( api_params['password'] = self._normalize_value(password) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1161,6 +1190,7 @@ def update_magic_url_session( api_params['secret'] = self._normalize_value(secret) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1209,6 +1239,7 @@ def update_phone_session( api_params['secret'] = self._normalize_value(secret) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1254,6 +1285,7 @@ def create_session( api_params['secret'] = self._normalize_value(secret) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1292,6 +1324,7 @@ def get_session( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Session) @@ -1329,6 +1362,7 @@ def update_session( response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1367,6 +1401,7 @@ def delete_session( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1401,6 +1436,7 @@ def update_status( api_params = {} response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1454,6 +1490,7 @@ def create_email_token( api_params['phrase'] = self._normalize_value(phrase) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1512,6 +1549,7 @@ def create_magic_url_token( api_params['phrase'] = self._normalize_value(phrase) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1569,6 +1607,7 @@ def create_o_auth2_token( api_params['scopes'] = self._normalize_value(scopes) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params, response_type='location') return response @@ -1615,6 +1654,7 @@ def create_phone_token( api_params['phone'] = self._normalize_value(phone) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1656,6 +1696,7 @@ def create_email_verification( api_params['url'] = self._normalize_value(url) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1700,6 +1741,7 @@ def create_verification( api_params['url'] = self._normalize_value(url) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1745,6 +1787,7 @@ def update_email_verification( api_params['secret'] = self._normalize_value(secret) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1793,6 +1836,7 @@ def update_verification( api_params['secret'] = self._normalize_value(secret) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1820,6 +1864,7 @@ def create_phone_verification( api_params = {} response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1865,6 +1910,7 @@ def update_phone_verification( api_params['secret'] = self._normalize_value(secret) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/activities.py b/appwrite/services/activities.py index 687adb0d..63c8a3f5 100644 --- a/appwrite/services/activities.py +++ b/appwrite/services/activities.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -40,6 +41,7 @@ def list_events( api_params['queries'] = self._normalize_value(queries) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ActivityEventList) @@ -78,6 +80,7 @@ def get_event( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ActivityEvent) diff --git a/appwrite/services/advisor.py b/appwrite/services/advisor.py index f79345c7..3176193d 100644 --- a/appwrite/services/advisor.py +++ b/appwrite/services/advisor.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -48,6 +49,7 @@ def list_reports( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ReportList) @@ -86,6 +88,7 @@ def get_report( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Report) @@ -124,6 +127,7 @@ def delete_report( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -173,6 +177,7 @@ def list_insights( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=InsightList) @@ -218,6 +223,7 @@ def get_insight( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Insight) diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 393fd629..f04535bc 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -64,6 +65,7 @@ def get_browser( api_params['quality'] = self._normalize_value(quality) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -119,6 +121,7 @@ def get_credit_card( api_params['quality'] = self._normalize_value(quality) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -158,6 +161,7 @@ def get_favicon( api_params['url'] = self._normalize_value(url) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -213,6 +217,7 @@ def get_flag( api_params['quality'] = self._normalize_value(quality) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -264,6 +269,7 @@ def get_image( api_params['height'] = self._normalize_value(height) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -319,6 +325,7 @@ def get_initials( api_params['background'] = self._normalize_value(background) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -372,6 +379,7 @@ def get_qr( api_params['download'] = self._normalize_value(download) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -508,6 +516,7 @@ def get_screenshot( api_params['output'] = self._normalize_value(output) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response diff --git a/appwrite/services/backups.py b/appwrite/services/backups.py index b3a8b1b9..38dd52a4 100644 --- a/appwrite/services/backups.py +++ b/appwrite/services/backups.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -45,6 +46,7 @@ def list_archives( api_params['queries'] = self._normalize_value(queries) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=BackupArchiveList) @@ -86,6 +88,7 @@ def create_archive( api_params['resourceId'] = self._normalize_value(resource_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -124,6 +127,7 @@ def get_archive( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=BackupArchive) @@ -161,6 +165,7 @@ def delete_archive( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -197,6 +202,7 @@ def list_policies( api_params['queries'] = self._normalize_value(queries) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=BackupPolicyList) @@ -269,6 +275,7 @@ def create_policy( api_params['schedule'] = self._normalize_value(schedule) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -307,6 +314,7 @@ def get_policy( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=BackupPolicy) @@ -361,6 +369,7 @@ def update_policy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -399,6 +408,7 @@ def delete_policy( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -454,6 +464,7 @@ def create_restoration( api_params['newResourceName'] = self._normalize_value(new_resource_name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -490,6 +501,7 @@ def list_restorations( api_params['queries'] = self._normalize_value(queries) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=BackupRestorationList) @@ -527,6 +539,7 @@ def get_restoration( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=BackupRestoration) diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index a239de09..9ee228f7 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union, Type, TypeVar from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -86,6 +87,7 @@ def list( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=DatabaseList) @@ -139,6 +141,7 @@ def create( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -175,6 +178,7 @@ def list_transactions( api_params['queries'] = self._normalize_value(queries) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=TransactionList) @@ -210,6 +214,7 @@ def create_transaction( api_params['ttl'] = self._normalize_value(ttl) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -248,6 +253,7 @@ def get_transaction( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Transaction) @@ -295,6 +301,7 @@ def update_transaction( api_params['rollback'] = self._normalize_value(rollback) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -333,6 +340,7 @@ def delete_transaction( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -376,6 +384,7 @@ def create_operations( api_params['operations'] = self._normalize_value(operations) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -417,6 +426,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Database) @@ -467,6 +477,7 @@ def update( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -508,6 +519,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -564,6 +576,7 @@ def list_collections( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=CollectionList) @@ -642,6 +655,7 @@ def create_collection( api_params['indexes'] = self._normalize_value(indexes) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -690,6 +704,7 @@ def get_collection( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Collection) @@ -761,6 +776,7 @@ def update_collection( api_params['purge'] = self._normalize_value(purge) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -809,6 +825,7 @@ def delete_collection( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -867,6 +884,7 @@ def list_attributes( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=AttributeList) @@ -946,6 +964,7 @@ def create_big_int_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1025,6 +1044,7 @@ def update_big_int_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1097,6 +1117,7 @@ def create_boolean_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1167,6 +1188,7 @@ def update_boolean_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1238,6 +1260,7 @@ def create_datetime_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1308,6 +1331,7 @@ def update_datetime_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1380,6 +1404,7 @@ def create_email_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1451,6 +1476,7 @@ def update_email_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1530,6 +1556,7 @@ def create_enum_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1608,6 +1635,7 @@ def update_enum_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1688,6 +1716,7 @@ def create_float_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1767,6 +1796,7 @@ def update_float_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1847,6 +1877,7 @@ def create_integer_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1926,6 +1957,7 @@ def update_integer_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1998,6 +2030,7 @@ def create_ip_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2069,6 +2102,7 @@ def update_ip_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2135,6 +2169,7 @@ def create_line_attribute( api_params['default'] = self._normalize_value(default) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2205,6 +2240,7 @@ def update_line_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2279,6 +2315,7 @@ def create_longtext_attribute( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2347,6 +2384,7 @@ def update_longtext_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2421,6 +2459,7 @@ def create_mediumtext_attribute( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2489,6 +2528,7 @@ def update_mediumtext_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2555,6 +2595,7 @@ def create_point_attribute( api_params['default'] = self._normalize_value(default) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2625,6 +2666,7 @@ def update_point_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2691,6 +2733,7 @@ def create_polygon_attribute( api_params['default'] = self._normalize_value(default) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2761,6 +2804,7 @@ def update_polygon_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2842,6 +2886,7 @@ def create_relationship_attribute( api_params['onDelete'] = self._normalize_value(on_delete) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2907,6 +2952,7 @@ def update_relationship_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2991,6 +3037,7 @@ def create_string_attribute( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3066,6 +3113,7 @@ def update_string_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3140,6 +3188,7 @@ def create_text_attribute( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3208,6 +3257,7 @@ def update_text_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3280,6 +3330,7 @@ def create_url_attribute( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3351,6 +3402,7 @@ def update_url_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3432,6 +3484,7 @@ def create_varchar_attribute( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3504,6 +3557,7 @@ def update_varchar_attribute( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3559,6 +3613,7 @@ def get_attribute( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) if not isinstance(response, dict): raise AppwriteException('Expected object response when hydrating a response model') @@ -3645,6 +3700,7 @@ def delete_attribute( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3717,6 +3773,7 @@ def list_documents( api_params['ttl'] = self._normalize_value(ttl) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return DocumentList.with_data(response, model_type) @@ -3790,6 +3847,7 @@ def create_document( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3853,6 +3911,7 @@ def create_documents( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3917,6 +3976,7 @@ def upsert_documents( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3983,6 +4043,7 @@ def update_documents( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4044,6 +4105,7 @@ def delete_documents( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4113,6 +4175,7 @@ def get_document( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return Document.with_data(response, model_type) @@ -4184,6 +4247,7 @@ def upsert_document( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4256,6 +4320,7 @@ def update_document( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4315,6 +4380,7 @@ def delete_document( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4394,6 +4460,7 @@ def decrement_document_attribute( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4473,6 +4540,7 @@ def increment_document_attribute( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4531,6 +4599,7 @@ def list_indexes( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=IndexList) @@ -4610,6 +4679,7 @@ def create_index( api_params['lengths'] = self._normalize_value(lengths) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4665,6 +4735,7 @@ def get_index( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Index) @@ -4719,6 +4790,7 @@ def delete_index( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 3a400990..07b42865 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -65,6 +66,7 @@ def list( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=FunctionList) @@ -211,6 +213,7 @@ def create( api_params['deploymentRetention'] = self._normalize_value(deployment_retention) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -238,6 +241,7 @@ def list_runtimes( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=RuntimeList) @@ -264,6 +268,7 @@ def list_specifications( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=SpecificationList) @@ -301,6 +306,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Function) @@ -442,6 +448,7 @@ def update( api_params['deploymentRetention'] = self._normalize_value(deployment_retention) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -480,6 +487,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -525,6 +533,7 @@ def update_function_deployment( api_params['deploymentId'] = self._normalize_value(deployment_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -578,6 +587,7 @@ def list_deployments( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=DeploymentList) @@ -651,6 +661,7 @@ def create_deployment( upload_id = '' response = self.client.chunked_upload(api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'multipart/form-data', }, api_params, param_name, on_progress, upload_id) @@ -701,6 +712,7 @@ def create_duplicate_deployment( api_params['buildId'] = self._normalize_value(build_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -781,6 +793,7 @@ def create_template_deployment( api_params['activate'] = self._normalize_value(activate) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -840,6 +853,7 @@ def create_vcs_deployment( api_params['activate'] = self._normalize_value(activate) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -885,6 +899,7 @@ def get_deployment( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Deployment) @@ -929,6 +944,7 @@ def delete_deployment( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -979,6 +995,7 @@ def get_deployment_download( api_params['type'] = self._normalize_value(type) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -1023,6 +1040,7 @@ def update_deployment_status( response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1071,6 +1089,7 @@ def list_executions( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ExecutionList) @@ -1137,6 +1156,7 @@ def create_execution( api_params['scheduledAt'] = self._normalize_value(scheduled_at) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1182,6 +1202,7 @@ def get_execution( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Execution) @@ -1226,6 +1247,7 @@ def delete_execution( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1274,6 +1296,7 @@ def list_variables( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=VariableList) @@ -1337,6 +1360,7 @@ def create_variable( api_params['secret'] = self._normalize_value(secret) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1382,6 +1406,7 @@ def get_variable( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Variable) @@ -1438,6 +1463,7 @@ def update_variable( api_params['secret'] = self._normalize_value(secret) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1483,6 +1509,7 @@ def delete_variable( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 12b66685..f1756b48 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -40,6 +41,7 @@ def query( api_params['query'] = self._normalize_value(query) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'x-sdk-graphql': 'true', 'content-type': 'application/json', }, api_params) @@ -79,6 +81,7 @@ def mutation( api_params['query'] = self._normalize_value(query) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'x-sdk-graphql': 'true', 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/health.py b/appwrite/services/health.py index c8f2c8f4..a455158d 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -36,6 +37,7 @@ def get( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthStatus) @@ -62,11 +64,40 @@ def get_antivirus( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthAntivirus) + def get_audits_db( + self + ) -> HealthStatusList: + """ + Check the database that backs the audit and activity store. When the connection is reachable the endpoint returns a passing status with its response time. + + + Returns + ------- + HealthStatusList + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/health/audits-db' + api_params = {} + + response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), + }, api_params) + + return self._parse_response(response, model=HealthStatusList) + + def get_cache( self ) -> HealthStatusList: @@ -88,6 +119,7 @@ def get_cache( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthStatusList) @@ -123,6 +155,7 @@ def get_certificate( api_params['domain'] = self._normalize_value(domain) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthCertificate) @@ -164,6 +197,7 @@ def get_console_pausing( api_params['inactivityDays'] = self._normalize_value(inactivity_days) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthStatus) @@ -190,6 +224,7 @@ def get_db( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthStatusList) @@ -216,6 +251,7 @@ def get_pub_sub( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthStatusList) @@ -252,6 +288,7 @@ def get_queue_audits( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -287,6 +324,7 @@ def get_queue_builds( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -322,6 +360,7 @@ def get_queue_certificates( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -362,6 +401,7 @@ def get_queue_databases( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -397,6 +437,7 @@ def get_queue_deletes( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -440,6 +481,7 @@ def get_failed_jobs( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -475,6 +517,7 @@ def get_queue_functions( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -510,6 +553,7 @@ def get_queue_logs( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -545,6 +589,7 @@ def get_queue_mails( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -580,6 +625,7 @@ def get_queue_messaging( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -615,6 +661,7 @@ def get_queue_migrations( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -650,6 +697,7 @@ def get_queue_stats_resources( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -685,6 +733,7 @@ def get_queue_usage( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -720,6 +769,7 @@ def get_queue_webhooks( api_params['threshold'] = self._normalize_value(threshold) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthQueue) @@ -746,6 +796,7 @@ def get_storage( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthStatus) @@ -772,6 +823,7 @@ def get_storage_local( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthStatus) @@ -798,6 +850,7 @@ def get_time( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=HealthTime) diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index f097b7dc..5dbfe1ad 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -38,6 +39,7 @@ def get( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LocaleModel) @@ -64,6 +66,7 @@ def list_codes( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LocaleCodeList) @@ -90,6 +93,7 @@ def list_continents( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ContinentList) @@ -116,6 +120,7 @@ def list_countries( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=CountryList) @@ -142,6 +147,7 @@ def list_countries_eu( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=CountryList) @@ -168,6 +174,7 @@ def list_countries_phones( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=PhoneList) @@ -194,6 +201,7 @@ def list_currencies( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=CurrencyList) @@ -220,6 +228,7 @@ def list_languages( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LanguageList) diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 50de1eee..2614e43b 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -60,6 +61,7 @@ def list_messages( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MessageList) @@ -155,6 +157,7 @@ def create_email( api_params['scheduledAt'] = self._normalize_value(scheduled_at) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -238,6 +241,7 @@ def update_email( api_params['attachments'] = self._normalize_value(attachments) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -364,6 +368,7 @@ def create_push( api_params['priority'] = self._normalize_value(priority) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -475,6 +480,7 @@ def update_push( api_params['priority'] = self._normalize_value(priority) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -544,6 +550,7 @@ def create_sms( api_params['scheduledAt'] = self._normalize_value(scheduled_at) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -607,6 +614,7 @@ def update_sms( api_params['scheduledAt'] = self._normalize_value(scheduled_at) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -646,6 +654,7 @@ def get_message( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Message) @@ -683,6 +692,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -731,6 +741,7 @@ def list_message_logs( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LogList) @@ -778,6 +789,7 @@ def list_targets( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=TargetList) @@ -823,6 +835,7 @@ def list_providers( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ProviderList) @@ -896,6 +909,7 @@ def create_apns_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -967,6 +981,7 @@ def update_apns_provider( api_params['sandbox'] = self._normalize_value(sandbox) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1020,6 +1035,7 @@ def create_fcm_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1071,6 +1087,7 @@ def update_fcm_provider( api_params['serviceAccountJSON'] = self._normalize_value(service_account_json) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1154,6 +1171,7 @@ def create_mailgun_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1235,6 +1253,7 @@ def update_mailgun_provider( api_params['replyToEmail'] = self._normalize_value(reply_to_email) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1299,6 +1318,7 @@ def create_msg91_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1361,6 +1381,7 @@ def update_msg91_provider( api_params['authKey'] = self._normalize_value(auth_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1435,6 +1456,7 @@ def create_resend_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1507,6 +1529,7 @@ def update_resend_provider( api_params['replyToEmail'] = self._normalize_value(reply_to_email) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1581,6 +1604,7 @@ def create_sendgrid_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1653,6 +1677,175 @@ def update_sendgrid_provider( api_params['replyToEmail'] = self._normalize_value(reply_to_email) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), + 'content-type': 'application/json', + }, api_params) + + return self._parse_response(response, model=Provider) + + + def create_ses_provider( + self, + provider_id: str, + name: str, + access_key: Optional[str] = None, + secret_key: Optional[str] = None, + region: Optional[str] = None, + from_name: Optional[str] = None, + from_email: Optional[str] = None, + reply_to_name: Optional[str] = None, + reply_to_email: Optional[str] = None, + enabled: Optional[bool] = None + ) -> Provider: + """ + Create a new Amazon SES provider. + + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + access_key : Optional[str] + AWS access key ID. + secret_key : Optional[str] + AWS secret access key. + region : Optional[str] + AWS region, for example us-east-1. + from_name : Optional[str] + Sender Name. + from_email : Optional[str] + Sender email address. + reply_to_name : Optional[str] + Name set in the reply to field for the mail. Default value is sender name. + reply_to_email : Optional[str] + Email set in the reply to field for the mail. Default value is sender email. + enabled : Optional[bool] + Set as enabled. + + Returns + ------- + Provider + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/messaging/providers/ses' + api_params = {} + if provider_id is None: + raise AppwriteException('Missing required parameter: "provider_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + + api_params['providerId'] = self._normalize_value(provider_id) + api_params['name'] = self._normalize_value(name) + if access_key is not None: + api_params['accessKey'] = self._normalize_value(access_key) + if secret_key is not None: + api_params['secretKey'] = self._normalize_value(secret_key) + if region is not None: + api_params['region'] = self._normalize_value(region) + if from_name is not None: + api_params['fromName'] = self._normalize_value(from_name) + if from_email is not None: + api_params['fromEmail'] = self._normalize_value(from_email) + if reply_to_name is not None: + api_params['replyToName'] = self._normalize_value(reply_to_name) + if reply_to_email is not None: + api_params['replyToEmail'] = self._normalize_value(reply_to_email) + api_params['enabled'] = self._normalize_value(enabled) + + response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), + 'content-type': 'application/json', + }, api_params) + + return self._parse_response(response, model=Provider) + + + def update_ses_provider( + self, + provider_id: str, + name: Optional[str] = None, + enabled: Optional[bool] = None, + access_key: Optional[str] = None, + secret_key: Optional[str] = None, + region: Optional[str] = None, + from_name: Optional[str] = None, + from_email: Optional[str] = None, + reply_to_name: Optional[str] = None, + reply_to_email: Optional[str] = None + ) -> Provider: + """ + Update an Amazon SES provider by its unique ID. + + Parameters + ---------- + provider_id : str + Provider ID. + name : Optional[str] + Provider name. + enabled : Optional[bool] + Set as enabled. + access_key : Optional[str] + AWS access key ID. + secret_key : Optional[str] + AWS secret access key. + region : Optional[str] + AWS region, for example us-east-1. + from_name : Optional[str] + Sender Name. + from_email : Optional[str] + Sender email address. + reply_to_name : Optional[str] + Name set in the Reply To field for the mail. Default value is Sender Name. + reply_to_email : Optional[str] + Email set in the Reply To field for the mail. Default value is Sender Email. + + Returns + ------- + Provider + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/messaging/providers/ses/{providerId}' + api_params = {} + if provider_id is None: + raise AppwriteException('Missing required parameter: "provider_id"') + + api_path = api_path.replace('{providerId}', str(self._normalize_value(provider_id))) + + if name is not None: + api_params['name'] = self._normalize_value(name) + api_params['enabled'] = self._normalize_value(enabled) + if access_key is not None: + api_params['accessKey'] = self._normalize_value(access_key) + if secret_key is not None: + api_params['secretKey'] = self._normalize_value(secret_key) + if region is not None: + api_params['region'] = self._normalize_value(region) + if from_name is not None: + api_params['fromName'] = self._normalize_value(from_name) + if from_email is not None: + api_params['fromEmail'] = self._normalize_value(from_email) + if reply_to_name is not None: + api_params['replyToName'] = self._normalize_value(reply_to_name) + if reply_to_email is not None: + api_params['replyToEmail'] = self._normalize_value(reply_to_email) + + response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1759,6 +1952,7 @@ def create_smtp_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1859,6 +2053,7 @@ def update_smtp_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1923,6 +2118,7 @@ def create_telesign_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1985,6 +2181,7 @@ def update_telesign_provider( api_params['from'] = self._normalize_value(xfrom) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2049,6 +2246,7 @@ def create_textmagic_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2111,6 +2309,7 @@ def update_textmagic_provider( api_params['from'] = self._normalize_value(xfrom) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2175,6 +2374,7 @@ def create_twilio_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2237,6 +2437,7 @@ def update_twilio_provider( api_params['from'] = self._normalize_value(xfrom) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2301,6 +2502,7 @@ def create_vonage_provider( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2363,6 +2565,7 @@ def update_vonage_provider( api_params['from'] = self._normalize_value(xfrom) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2402,6 +2605,7 @@ def get_provider( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Provider) @@ -2439,6 +2643,7 @@ def delete_provider( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2487,6 +2692,7 @@ def list_provider_logs( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LogList) @@ -2534,6 +2740,7 @@ def list_subscriber_logs( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LogList) @@ -2579,6 +2786,7 @@ def list_topics( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=TopicList) @@ -2628,6 +2836,7 @@ def create_topic( api_params['subscribe'] = self._normalize_value(subscribe) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2667,6 +2876,7 @@ def get_topic( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Topic) @@ -2713,6 +2923,7 @@ def update_topic( api_params['subscribe'] = self._normalize_value(subscribe) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2751,6 +2962,7 @@ def delete_topic( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2799,6 +3011,7 @@ def list_topic_logs( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LogList) @@ -2851,6 +3064,7 @@ def list_subscribers( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=SubscriberList) @@ -2902,6 +3116,7 @@ def create_subscriber( api_params['targetId'] = self._normalize_value(target_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2948,6 +3163,7 @@ def get_subscriber( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Subscriber) @@ -2992,6 +3208,7 @@ def delete_subscriber( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/organization.py b/appwrite/services/organization.py index 7f5c3759..b9fffe2a 100644 --- a/appwrite/services/organization.py +++ b/appwrite/services/organization.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -49,6 +50,7 @@ def list_keys( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=KeyList) @@ -104,6 +106,7 @@ def create_key( api_params['expire'] = self._normalize_value(expire) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -142,6 +145,7 @@ def get_key( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Key) @@ -197,6 +201,7 @@ def update_key( api_params['expire'] = self._normalize_value(expire) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -235,6 +240,7 @@ def delete_key( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -281,6 +287,7 @@ def list_projects( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ProjectList) @@ -330,6 +337,7 @@ def create_project( api_params['region'] = self._normalize_value(region) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -368,6 +376,7 @@ def get_project( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Project) @@ -412,6 +421,7 @@ def update_project( api_params['name'] = self._normalize_value(name) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -450,6 +460,7 @@ def delete_project( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/presences.py b/appwrite/services/presences.py index 883d0be3..f286cf61 100644 --- a/appwrite/services/presences.py +++ b/appwrite/services/presences.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -51,6 +52,7 @@ def list( api_params['ttl'] = self._normalize_value(ttl) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=PresenceList) @@ -89,6 +91,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Presence) @@ -156,6 +159,7 @@ def upsert( api_params['metadata'] = self._normalize_value(metadata) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -227,6 +231,7 @@ def update( api_params['purge'] = self._normalize_value(purge) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -266,6 +271,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/project.py b/appwrite/services/project.py index 1201226f..f5a4a902 100644 --- a/appwrite/services/project.py +++ b/appwrite/services/project.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -60,6 +61,7 @@ from ..models.platform_web import PlatformWeb from ..models.platform_windows import PlatformWindows from ..models.policy_list import PolicyList +from ..models.policy_password_strength import PolicyPasswordStrength from ..enums.project_policy_id import ProjectPolicyId from ..models.policy_password_dictionary import PolicyPasswordDictionary from ..models.policy_password_history import PolicyPasswordHistory @@ -109,6 +111,7 @@ def get( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ProjectModel) @@ -135,6 +138,7 @@ def delete( api_params = {} response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -180,6 +184,7 @@ def update_auth_method( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -221,6 +226,7 @@ def list_keys( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=KeyList) @@ -278,6 +284,7 @@ def create_key( api_params['expire'] = self._normalize_value(expire) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -325,6 +332,7 @@ def create_ephemeral_key( api_params['duration'] = self._normalize_value(duration) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -363,6 +371,7 @@ def get_key( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Key) @@ -418,6 +427,7 @@ def update_key( api_params['expire'] = self._normalize_value(expire) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -456,6 +466,7 @@ def delete_key( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -494,6 +505,7 @@ def update_labels( api_params['labels'] = self._normalize_value(labels) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -535,6 +547,7 @@ def list_mock_phones( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MockNumberList) @@ -579,6 +592,7 @@ def create_mock_phone( api_params['otp'] = self._normalize_value(otp) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -617,6 +631,7 @@ def get_mock_phone( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MockNumber) @@ -661,6 +676,7 @@ def update_mock_phone( api_params['otp'] = self._normalize_value(otp) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -699,6 +715,7 @@ def delete_mock_phone( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -740,11 +757,83 @@ def list_o_auth2_providers( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=OAuth2ProviderList) + def update_o_auth2_server( + self, + enabled: bool, + authorization_url: str, + scopes: Optional[List[str]] = None, + access_token_duration: Optional[float] = None, + refresh_token_duration: Optional[float] = None, + public_access_token_duration: Optional[float] = None, + public_refresh_token_duration: Optional[float] = None, + confidential_pkce: Optional[bool] = None + ) -> ProjectModel: + """ + Update the OAuth2 server (OIDC provider) configuration. + + Parameters + ---------- + enabled : bool + Enable or disable the OAuth2 server. + authorization_url : str + URL to your application with consent screen. + scopes : Optional[List[str]] + List of allowed OAuth2 scopes. Maximum of 100 scopes are allowed, each up to 128 characters long. + access_token_duration : Optional[float] + Access token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 8 hours. + refresh_token_duration : Optional[float] + Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. + public_access_token_duration : Optional[float] + Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. + public_refresh_token_duration : Optional[float] + Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. + confidential_pkce : Optional[bool] + When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. + + Returns + ------- + ProjectModel + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2-server' + api_params = {} + if enabled is None: + raise AppwriteException('Missing required parameter: "enabled"') + + if authorization_url is None: + raise AppwriteException('Missing required parameter: "authorization_url"') + + + api_params['enabled'] = self._normalize_value(enabled) + api_params['authorizationUrl'] = self._normalize_value(authorization_url) + if scopes is not None: + api_params['scopes'] = self._normalize_value(scopes) + api_params['accessTokenDuration'] = self._normalize_value(access_token_duration) + api_params['refreshTokenDuration'] = self._normalize_value(refresh_token_duration) + api_params['publicAccessTokenDuration'] = self._normalize_value(public_access_token_duration) + api_params['publicRefreshTokenDuration'] = self._normalize_value(public_refresh_token_duration) + api_params['confidentialPkce'] = self._normalize_value(confidential_pkce) + + response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), + 'content-type': 'application/json', + }, api_params) + + return self._parse_response(response, model=ProjectModel) + + def update_o_auth2_amazon( self, client_id: Optional[str] = None, @@ -759,7 +848,7 @@ def update_o_auth2_amazon( client_id : Optional[str] 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 client_secret : Optional[str] - 'Client Secret' of Amazon OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -782,6 +871,7 @@ def update_o_auth2_amazon( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -833,6 +923,7 @@ def update_o_auth2_apple( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -854,7 +945,7 @@ def update_o_auth2_auth0( client_id : Optional[str] 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq client_secret : Optional[str] - 'Client Secret' of Auth0 OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF endpoint : Optional[str] Domain of Auth0 instance. For example: example.us.auth0.com enabled : Optional[bool] @@ -880,6 +971,7 @@ def update_o_auth2_auth0( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -901,7 +993,7 @@ def update_o_auth2_authentik( client_id : Optional[str] 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv client_secret : Optional[str] - 'Client Secret' of Authentik OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK endpoint : Optional[str] Domain of Authentik instance. For example: example.authentik.com enabled : Optional[bool] @@ -927,6 +1019,7 @@ def update_o_auth2_authentik( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -947,7 +1040,7 @@ def update_o_auth2_autodesk( client_id : Optional[str] 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 client_secret : Optional[str] - 'Client Secret' of Autodesk OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -970,6 +1063,7 @@ def update_o_auth2_autodesk( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -990,7 +1084,7 @@ def update_o_auth2_bitbucket( key : Optional[str] 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc secret : Optional[str] - 'Secret' of Bitbucket OAuth2 app. For example: your-oauth2-client-secret + 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1013,6 +1107,7 @@ def update_o_auth2_bitbucket( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1033,7 +1128,7 @@ def update_o_auth2_bitly( client_id : Optional[str] 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b client_secret : Optional[str] - 'Client Secret' of Bitly OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1056,6 +1151,7 @@ def update_o_auth2_bitly( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1076,7 +1172,7 @@ def update_o_auth2_box( client_id : Optional[str] 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y client_secret : Optional[str] - 'Client Secret' of Box OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1099,6 +1195,7 @@ def update_o_auth2_box( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1119,7 +1216,7 @@ def update_o_auth2_dailymotion( api_key : Optional[str] 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f api_secret : Optional[str] - 'API Secret' of Dailymotion OAuth2 app. For example: your-oauth2-client-secret + 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1142,6 +1239,7 @@ def update_o_auth2_dailymotion( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1162,7 +1260,7 @@ def update_o_auth2_discord( client_id : Optional[str] 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 client_secret : Optional[str] - 'Client Secret' of Discord OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1185,6 +1283,7 @@ def update_o_auth2_discord( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1205,7 +1304,7 @@ def update_o_auth2_disqus( public_key : Optional[str] 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX secret_key : Optional[str] - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: your-oauth2-client-secret + 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1228,6 +1327,7 @@ def update_o_auth2_disqus( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1248,7 +1348,7 @@ def update_o_auth2_dropbox( app_key : Optional[str] 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t app_secret : Optional[str] - 'App Secret' of Dropbox OAuth2 app. For example: your-oauth2-client-secret + 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1271,6 +1371,7 @@ def update_o_auth2_dropbox( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1291,7 +1392,7 @@ def update_o_auth2_etsy( key_string : Optional[str] 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 shared_secret : Optional[str] - 'Shared Secret' of Etsy OAuth2 app. For example: your-oauth2-client-secret + 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1314,6 +1415,7 @@ def update_o_auth2_etsy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1334,7 +1436,7 @@ def update_o_auth2_facebook( app_id : Optional[str] 'App ID' of Facebook OAuth2 app. For example: 260600000007694 app_secret : Optional[str] - 'App Secret' of Facebook OAuth2 app. For example: your-oauth2-client-secret + 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1357,6 +1459,7 @@ def update_o_auth2_facebook( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1377,7 +1480,7 @@ def update_o_auth2_figma( client_id : Optional[str] 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 client_secret : Optional[str] - 'Client Secret' of Figma OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1400,6 +1503,7 @@ def update_o_auth2_figma( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1421,7 +1525,7 @@ def update_o_auth2_fusion_auth( client_id : Optional[str] 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 client_secret : Optional[str] - 'Client Secret' of FusionAuth OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc endpoint : Optional[str] Domain of FusionAuth instance. For example: example.fusionauth.io enabled : Optional[bool] @@ -1447,6 +1551,7 @@ def update_o_auth2_fusion_auth( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1467,7 +1572,7 @@ def update_o_auth2_git_hub( client_id : Optional[str] 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 client_secret : Optional[str] - 'Client Secret' of GitHub OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1490,6 +1595,7 @@ def update_o_auth2_git_hub( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1511,7 +1617,7 @@ def update_o_auth2_gitlab( application_id : Optional[str] 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 secret : Optional[str] - 'Secret' of Gitlab OAuth2 app. For example: your-oauth2-client-secret + 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 endpoint : Optional[str] Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com enabled : Optional[bool] @@ -1537,6 +1643,7 @@ def update_o_auth2_gitlab( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1558,7 +1665,7 @@ def update_o_auth2_google( client_id : Optional[str] 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com client_secret : Optional[str] - 'Client Secret' of Google OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj prompt : Optional[List[ProjectOAuth2GooglePrompt]] Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. enabled : Optional[bool] @@ -1584,6 +1691,7 @@ def update_o_auth2_google( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1606,7 +1714,7 @@ def update_o_auth2_keycloak( client_id : Optional[str] 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app client_secret : Optional[str] - 'Client Secret' of Keycloak OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO endpoint : Optional[str] Domain of Keycloak instance. For example: keycloak.example.com realm_name : Optional[str] @@ -1635,6 +1743,7 @@ def update_o_auth2_keycloak( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1655,7 +1764,7 @@ def update_o_auth2_kick( client_id : Optional[str] 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 client_secret : Optional[str] - 'Client Secret' of Kick OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1678,6 +1787,7 @@ def update_o_auth2_kick( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1698,7 +1808,7 @@ def update_o_auth2_linkedin( client_id : Optional[str] 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv primary_client_secret : Optional[str] - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: your-oauth2-client-secret + 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1721,6 +1831,7 @@ def update_o_auth2_linkedin( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1742,7 +1853,7 @@ def update_o_auth2_microsoft( application_id : Optional[str] 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 application_secret : Optional[str] - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: your-oauth2-client-secret + 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u tenant : Optional[str] Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common enabled : Optional[bool] @@ -1768,6 +1879,7 @@ def update_o_auth2_microsoft( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1788,7 +1900,7 @@ def update_o_auth2_notion( oauth_client_id : Optional[str] 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 oauth_client_secret : Optional[str] - 'OAuth Client Secret' of Notion OAuth2 app. For example: your-oauth2-client-secret + 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1811,6 +1923,7 @@ def update_o_auth2_notion( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1835,7 +1948,7 @@ def update_o_auth2_oidc( client_id : Optional[str] 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG client_secret : Optional[str] - 'Client Secret' of Oidc OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV well_known_url : Optional[str] OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration authorization_url : Optional[str] @@ -1870,6 +1983,7 @@ def update_o_auth2_oidc( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1892,7 +2006,7 @@ def update_o_auth2_okta( client_id : Optional[str] 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 client_secret : Optional[str] - 'Client Secret' of Okta OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV domain : Optional[str] Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ authorization_server_id : Optional[str] @@ -1921,6 +2035,7 @@ def update_o_auth2_okta( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1941,7 +2056,7 @@ def update_o_auth2_paypal( client_id : Optional[str] 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB secret_key : Optional[str] - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: your-oauth2-client-secret + 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1964,6 +2079,7 @@ def update_o_auth2_paypal( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1984,7 +2100,7 @@ def update_o_auth2_paypal_sandbox( client_id : Optional[str] 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB secret_key : Optional[str] - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: your-oauth2-client-secret + 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2007,6 +2123,7 @@ def update_o_auth2_paypal_sandbox( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2027,7 +2144,7 @@ def update_o_auth2_podio( client_id : Optional[str] 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app client_secret : Optional[str] - 'Client Secret' of Podio OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2050,6 +2167,7 @@ def update_o_auth2_podio( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2070,7 +2188,7 @@ def update_o_auth2_salesforce( customer_key : Optional[str] 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq customer_secret : Optional[str] - 'Consumer Secret' of Salesforce OAuth2 app. For example: your-oauth2-client-secret + 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2093,6 +2211,7 @@ def update_o_auth2_salesforce( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2113,7 +2232,7 @@ def update_o_auth2_slack( client_id : Optional[str] 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 client_secret : Optional[str] - 'Client Secret' of Slack OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2136,6 +2255,7 @@ def update_o_auth2_slack( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2156,7 +2276,7 @@ def update_o_auth2_spotify( client_id : Optional[str] 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace client_secret : Optional[str] - 'Client Secret' of Spotify OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2179,6 +2299,7 @@ def update_o_auth2_spotify( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2199,7 +2320,7 @@ def update_o_auth2_stripe( client_id : Optional[str] 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR api_secret_key : Optional[str] - 'API Secret Key' of Stripe OAuth2 app. For example: your-oauth2-client-secret + 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2222,6 +2343,7 @@ def update_o_auth2_stripe( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2242,7 +2364,7 @@ def update_o_auth2_tradeshift( oauth2_client_id : Optional[str] 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app oauth2_client_secret : Optional[str] - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: your-oauth2-client-secret + 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2265,6 +2387,7 @@ def update_o_auth2_tradeshift( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2285,7 +2408,7 @@ def update_o_auth2_tradeshift_sandbox( oauth2_client_id : Optional[str] 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app oauth2_client_secret : Optional[str] - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: your-oauth2-client-secret + 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2308,6 +2431,7 @@ def update_o_auth2_tradeshift_sandbox( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2328,7 +2452,7 @@ def update_o_auth2_twitch( client_id : Optional[str] 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p client_secret : Optional[str] - 'Client Secret' of Twitch OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2351,6 +2475,7 @@ def update_o_auth2_twitch( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2371,7 +2496,7 @@ def update_o_auth2_word_press( client_id : Optional[str] 'Client ID' of WordPress OAuth2 app. For example: 130005 client_secret : Optional[str] - 'Client Secret' of WordPress OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2394,6 +2519,7 @@ def update_o_auth2_word_press( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2414,7 +2540,7 @@ def update_o_auth2_x( customer_key : Optional[str] 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT secret_key : Optional[str] - 'Secret Key' of X OAuth2 app. For example: your-oauth2-client-secret + 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2437,6 +2563,7 @@ def update_o_auth2_x( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2457,7 +2584,7 @@ def update_o_auth2_yahoo( client_id : Optional[str] 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm client_secret : Optional[str] - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2480,6 +2607,7 @@ def update_o_auth2_yahoo( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2500,7 +2628,7 @@ def update_o_auth2_yandex( client_id : Optional[str] 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c client_secret : Optional[str] - 'Client Secret' of Yandex OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2523,6 +2651,7 @@ def update_o_auth2_yandex( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2543,7 +2672,7 @@ def update_o_auth2_zoho( client_id : Optional[str] 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B client_secret : Optional[str] - 'Client Secret' of Zoho OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2566,6 +2695,7 @@ def update_o_auth2_zoho( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2586,7 +2716,7 @@ def update_o_auth2_zoom( client_id : Optional[str] 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ client_secret : Optional[str] - 'Client Secret' of Zoom OAuth2 app. For example: your-oauth2-client-secret + 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON enabled : Optional[bool] OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2609,6 +2739,7 @@ def update_o_auth2_zoom( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2647,6 +2778,7 @@ def get_o_auth2_provider( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) if not isinstance(response, dict): raise AppwriteException('Expected object response when hydrating a response model') @@ -2809,6 +2941,7 @@ def list_platforms( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=PlatformList) @@ -2860,6 +2993,7 @@ def create_android_platform( api_params['applicationId'] = self._normalize_value(application_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2912,6 +3046,7 @@ def update_android_platform( api_params['applicationId'] = self._normalize_value(application_id) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2964,6 +3099,7 @@ def create_apple_platform( api_params['bundleIdentifier'] = self._normalize_value(bundle_identifier) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3016,6 +3152,7 @@ def update_apple_platform( api_params['bundleIdentifier'] = self._normalize_value(bundle_identifier) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3068,6 +3205,7 @@ def create_linux_platform( api_params['packageName'] = self._normalize_value(package_name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3120,6 +3258,7 @@ def update_linux_platform( api_params['packageName'] = self._normalize_value(package_name) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3172,6 +3311,7 @@ def create_web_platform( api_params['hostname'] = self._normalize_value(hostname) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3224,6 +3364,7 @@ def update_web_platform( api_params['hostname'] = self._normalize_value(hostname) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3276,6 +3417,7 @@ def create_windows_platform( api_params['packageIdentifierName'] = self._normalize_value(package_identifier_name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3328,6 +3470,7 @@ def update_windows_platform( api_params['packageIdentifierName'] = self._normalize_value(package_identifier_name) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3366,6 +3509,7 @@ def get_platform( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) if not isinstance(response, dict): raise AppwriteException('Expected object response when hydrating a response model') @@ -3420,6 +3564,7 @@ def delete_platform( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3461,6 +3606,7 @@ def list_policies( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=PolicyList) @@ -3498,6 +3644,7 @@ def update_deny_aliased_email_policy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3536,6 +3683,7 @@ def update_deny_disposable_email_policy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3574,6 +3722,7 @@ def update_deny_free_email_policy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3630,6 +3779,7 @@ def update_membership_privacy_policy( api_params['userMFA'] = self._normalize_value(user_mfa) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3668,6 +3818,7 @@ def update_password_dictionary_policy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3705,6 +3856,7 @@ def update_password_history_policy( api_params['total'] = self._normalize_value(total) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3743,12 +3895,70 @@ def update_password_personal_data_policy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) return self._parse_response(response, model=ProjectModel) + def update_password_strength_policy( + self, + min: Optional[float] = None, + uppercase: Optional[bool] = None, + lowercase: Optional[bool] = None, + number: Optional[bool] = None, + symbols: Optional[bool] = None + ) -> PolicyPasswordStrength: + """ + Update the password strength requirements for users in the project. + + Parameters + ---------- + min : Optional[float] + Minimum password length. Value must be between 8 and 256. Default is 8. + uppercase : Optional[bool] + Whether passwords must include at least one uppercase letter. + lowercase : Optional[bool] + Whether passwords must include at least one lowercase letter. + number : Optional[bool] + Whether passwords must include at least one number. + symbols : Optional[bool] + Whether passwords must include at least one symbol. + + Returns + ------- + PolicyPasswordStrength + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/policies/password-strength' + api_params = {} + + if min is not None: + api_params['min'] = self._normalize_value(min) + if uppercase is not None: + api_params['uppercase'] = self._normalize_value(uppercase) + if lowercase is not None: + api_params['lowercase'] = self._normalize_value(lowercase) + if number is not None: + api_params['number'] = self._normalize_value(number) + if symbols is not None: + api_params['symbols'] = self._normalize_value(symbols) + + response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), + 'content-type': 'application/json', + }, api_params) + + return self._parse_response(response, model=PolicyPasswordStrength) + + def update_session_alert_policy( self, enabled: bool @@ -3781,6 +3991,7 @@ def update_session_alert_policy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3819,6 +4030,7 @@ def update_session_duration_policy( api_params['duration'] = self._normalize_value(duration) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3857,6 +4069,7 @@ def update_session_invalidation_policy( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3892,6 +4105,7 @@ def update_session_limit_policy( api_params['total'] = self._normalize_value(total) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3927,6 +4141,7 @@ def update_user_limit_policy( api_params['total'] = self._normalize_value(total) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3936,18 +4151,18 @@ def update_user_limit_policy( def get_policy( self, policy_id: ProjectPolicyId - ) -> Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail]: + ) -> Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail]: """ Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. Parameters ---------- policy_id : ProjectPolicyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. + Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. Returns ------- - Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail] + Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail] API response as one of the typed response models Raises @@ -3965,6 +4180,7 @@ def get_policy( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) if not isinstance(response, dict): raise AppwriteException('Expected object response when hydrating a response model') @@ -3975,6 +4191,9 @@ def get_policy( if response.get('$id') == 'password-history': return self._parse_response(response, model=PolicyPasswordHistory) + if response.get('$id') == 'password-strength': + return self._parse_response(response, model=PolicyPasswordStrength) + if response.get('$id') == 'password-personal-data': return self._parse_response(response, model=PolicyPasswordPersonalData) @@ -4047,6 +4266,7 @@ def update_protocol( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4092,6 +4312,7 @@ def update_service( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4163,6 +4384,7 @@ def update_smtp( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4201,6 +4423,7 @@ def create_smtp_test( api_params['emails'] = self._normalize_value(emails) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4242,6 +4465,7 @@ def list_email_templates( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=EmailTemplateList) @@ -4308,6 +4532,7 @@ def update_email_template( api_params['replyToName'] = self._normalize_value(reply_to_name) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4351,6 +4576,7 @@ def get_email_template( api_params['locale'] = self._normalize_value(locale) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=EmailTemplate) @@ -4391,6 +4617,7 @@ def list_variables( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=VariableList) @@ -4447,6 +4674,7 @@ def create_variable( api_params['secret'] = self._normalize_value(secret) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4485,6 +4713,7 @@ def get_variable( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Variable) @@ -4534,6 +4763,7 @@ def update_variable( api_params['secret'] = self._normalize_value(secret) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4572,6 +4802,7 @@ def delete_variable( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/proxy.py b/appwrite/services/proxy.py index 598c294c..09ca4fec 100644 --- a/appwrite/services/proxy.py +++ b/appwrite/services/proxy.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -47,6 +48,7 @@ def list_rules( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ProxyRuleList) @@ -86,6 +88,7 @@ def create_api_rule( api_params['domain'] = self._normalize_value(domain) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -138,6 +141,7 @@ def create_function_rule( api_params['branch'] = self._normalize_value(branch) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -206,6 +210,7 @@ def create_redirect_rule( api_params['resourceType'] = self._normalize_value(resource_type) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -258,6 +263,7 @@ def create_site_rule( api_params['branch'] = self._normalize_value(branch) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -296,6 +302,7 @@ def get_rule( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ProxyRule) @@ -333,6 +340,7 @@ def delete_rule( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -371,6 +379,7 @@ def update_rule_status( response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py index 17eacc79..279baff2 100644 --- a/appwrite/services/sites.py +++ b/appwrite/services/sites.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -65,6 +66,7 @@ def list( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=SiteList) @@ -218,6 +220,7 @@ def create( api_params['deploymentRetention'] = self._normalize_value(deployment_retention) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -245,6 +248,7 @@ def list_frameworks( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=FrameworkList) @@ -271,6 +275,7 @@ def list_specifications( api_params = {} response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=SpecificationList) @@ -308,6 +313,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Site) @@ -457,6 +463,7 @@ def update( api_params['deploymentRetention'] = self._normalize_value(deployment_retention) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -495,6 +502,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -540,6 +548,7 @@ def update_site_deployment( api_params['deploymentId'] = self._normalize_value(deployment_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -593,6 +602,7 @@ def list_deployments( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=DeploymentList) @@ -665,6 +675,7 @@ def create_deployment( upload_id = '' response = self.client.chunked_upload(api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'multipart/form-data', }, api_params, param_name, on_progress, upload_id) @@ -710,6 +721,7 @@ def create_duplicate_deployment( api_params['deploymentId'] = self._normalize_value(deployment_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -790,6 +802,7 @@ def create_template_deployment( api_params['activate'] = self._normalize_value(activate) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -849,6 +862,7 @@ def create_vcs_deployment( api_params['activate'] = self._normalize_value(activate) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -894,6 +908,7 @@ def get_deployment( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Deployment) @@ -938,6 +953,7 @@ def delete_deployment( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -988,6 +1004,7 @@ def get_deployment_download( api_params['type'] = self._normalize_value(type) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -1032,6 +1049,7 @@ def update_deployment_status( response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1080,6 +1098,7 @@ def list_logs( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ExecutionList) @@ -1124,6 +1143,7 @@ def get_log( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Execution) @@ -1168,6 +1188,7 @@ def delete_log( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1216,6 +1237,7 @@ def list_variables( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=VariableList) @@ -1279,6 +1301,7 @@ def create_variable( api_params['secret'] = self._normalize_value(secret) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1324,6 +1347,7 @@ def get_variable( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Variable) @@ -1380,6 +1404,7 @@ def update_variable( api_params['secret'] = self._normalize_value(secret) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1425,6 +1450,7 @@ def delete_variable( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 95efa375..6d80de9c 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -56,6 +57,7 @@ def list_buckets( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=BucketList) @@ -144,6 +146,7 @@ def create_bucket( api_params['transformations'] = self._normalize_value(transformations) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -182,6 +185,7 @@ def get_bucket( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Bucket) @@ -270,6 +274,7 @@ def update_bucket( api_params['transformations'] = self._normalize_value(transformations) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -308,6 +313,7 @@ def delete_bucket( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -361,6 +367,7 @@ def list_files( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=FileList) @@ -433,6 +440,7 @@ def create_file( upload_id = file_id response = self.client.chunked_upload(api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'multipart/form-data', }, api_params, param_name, on_progress, upload_id) @@ -478,6 +486,7 @@ def get_file( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=File) @@ -531,6 +540,7 @@ def update_file( api_params['permissions'] = self._normalize_value(permissions) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -576,6 +586,7 @@ def delete_file( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -626,6 +637,7 @@ def get_file_download( api_params['token'] = self._normalize_value(token) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -730,6 +742,7 @@ def get_file_preview( api_params['token'] = self._normalize_value(token) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response @@ -779,6 +792,7 @@ def get_file_view( api_params['token'] = self._normalize_value(token) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return response diff --git a/appwrite/services/tables_db.py b/appwrite/services/tables_db.py index 9916c5c2..97a1499f 100644 --- a/appwrite/services/tables_db.py +++ b/appwrite/services/tables_db.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union, Type, TypeVar from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -83,6 +84,7 @@ def list( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=DatabaseList) @@ -133,6 +135,7 @@ def create( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -169,6 +172,7 @@ def list_transactions( api_params['queries'] = self._normalize_value(queries) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=TransactionList) @@ -204,6 +208,7 @@ def create_transaction( api_params['ttl'] = self._normalize_value(ttl) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -242,6 +247,7 @@ def get_transaction( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Transaction) @@ -289,6 +295,7 @@ def update_transaction( api_params['rollback'] = self._normalize_value(rollback) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -327,6 +334,7 @@ def delete_transaction( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -370,6 +378,7 @@ def create_operations( api_params['operations'] = self._normalize_value(operations) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -408,6 +417,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Database) @@ -455,6 +465,7 @@ def update( api_params['enabled'] = self._normalize_value(enabled) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -493,6 +504,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -546,6 +558,7 @@ def list_tables( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=TableList) @@ -621,6 +634,7 @@ def create_table( api_params['indexes'] = self._normalize_value(indexes) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -666,6 +680,7 @@ def get_table( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Table) @@ -734,6 +749,7 @@ def update_table( api_params['purge'] = self._normalize_value(purge) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -779,6 +795,7 @@ def delete_table( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -834,6 +851,7 @@ def list_columns( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ColumnList) @@ -910,6 +928,7 @@ def create_big_int_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -986,6 +1005,7 @@ def update_big_int_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1055,6 +1075,7 @@ def create_boolean_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1122,6 +1143,7 @@ def update_boolean_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1190,6 +1212,7 @@ def create_datetime_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1257,6 +1280,7 @@ def update_datetime_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1326,6 +1350,7 @@ def create_email_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1394,6 +1419,7 @@ def update_email_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1469,6 +1495,7 @@ def create_enum_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1544,6 +1571,7 @@ def update_enum_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1621,6 +1649,7 @@ def create_float_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1697,6 +1726,7 @@ def update_float_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1774,6 +1804,7 @@ def create_integer_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1850,6 +1881,7 @@ def update_integer_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1919,6 +1951,7 @@ def create_ip_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1987,6 +2020,7 @@ def update_ip_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2050,6 +2084,7 @@ def create_line_column( api_params['default'] = self._normalize_value(default) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2117,6 +2152,7 @@ def update_line_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2191,6 +2227,7 @@ def create_longtext_column( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2259,6 +2296,7 @@ def update_longtext_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2333,6 +2371,7 @@ def create_mediumtext_column( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2401,6 +2440,7 @@ def update_mediumtext_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2464,6 +2504,7 @@ def create_point_column( api_params['default'] = self._normalize_value(default) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2531,6 +2572,7 @@ def update_point_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2594,6 +2636,7 @@ def create_polygon_column( api_params['default'] = self._normalize_value(default) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2661,6 +2704,7 @@ def update_polygon_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2739,6 +2783,7 @@ def create_relationship_column( api_params['onDelete'] = self._normalize_value(on_delete) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2823,6 +2868,7 @@ def create_string_column( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2898,6 +2944,7 @@ def update_string_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2972,6 +3019,7 @@ def create_text_column( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3040,6 +3088,7 @@ def update_text_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3109,6 +3158,7 @@ def create_url_column( api_params['array'] = self._normalize_value(array) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3177,6 +3227,7 @@ def update_url_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3258,6 +3309,7 @@ def create_varchar_column( api_params['encrypt'] = self._normalize_value(encrypt) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3330,6 +3382,7 @@ def update_varchar_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3382,6 +3435,7 @@ def get_column( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) if not isinstance(response, dict): raise AppwriteException('Expected object response when hydrating a response model') @@ -3465,6 +3519,7 @@ def delete_column( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3526,6 +3581,7 @@ def update_relationship_column( api_params['newKey'] = self._normalize_value(new_key) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3581,6 +3637,7 @@ def list_indexes( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ColumnIndexList) @@ -3657,6 +3714,7 @@ def create_index( api_params['lengths'] = self._normalize_value(lengths) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3709,6 +3767,7 @@ def get_index( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ColumnIndex) @@ -3760,6 +3819,7 @@ def delete_index( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3829,6 +3889,7 @@ def list_rows( api_params['ttl'] = self._normalize_value(ttl) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return RowList.with_data(response, model_type) @@ -3899,6 +3960,7 @@ def create_row( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -3959,6 +4021,7 @@ def create_rows( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4020,6 +4083,7 @@ def upsert_rows( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4083,6 +4147,7 @@ def update_rows( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4141,6 +4206,7 @@ def delete_rows( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4207,6 +4273,7 @@ def get_row( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return Row.with_data(response, model_type) @@ -4275,6 +4342,7 @@ def upsert_row( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4344,6 +4412,7 @@ def update_row( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4400,6 +4469,7 @@ def delete_row( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4476,6 +4546,7 @@ def decrement_row_column( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -4552,6 +4623,7 @@ def increment_row_column( api_params['transactionId'] = self._normalize_value(transaction_id) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 1c90ac65..ee9333a7 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union, Type, TypeVar from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -59,6 +60,7 @@ def list( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return TeamList.with_data(response, model_type) @@ -112,6 +114,7 @@ def create( api_params['roles'] = self._normalize_value(roles) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -154,6 +157,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return Team.with_data(response, model_type) @@ -202,6 +206,7 @@ def update_name( api_params['name'] = self._normalize_value(name) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -240,6 +245,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -293,6 +299,7 @@ def list_memberships( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MembershipList) @@ -369,6 +376,7 @@ def create_membership( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -414,6 +422,7 @@ def get_membership( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Membership) @@ -466,6 +475,7 @@ def update_membership( api_params['roles'] = self._normalize_value(roles) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -511,6 +521,7 @@ def delete_membership( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -573,6 +584,7 @@ def update_membership_status( api_params['secret'] = self._normalize_value(secret) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -615,6 +627,7 @@ def get_prefs( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return Preferences.with_data(response, model_type) @@ -663,6 +676,7 @@ def update_prefs( api_params['prefs'] = self._normalize_value(prefs) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/tokens.py b/appwrite/services/tokens.py index 198c395d..046129ae 100644 --- a/appwrite/services/tokens.py +++ b/appwrite/services/tokens.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -59,6 +60,7 @@ def list( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ResourceTokenList) @@ -107,6 +109,7 @@ def create_file_token( api_params['expire'] = self._normalize_value(expire) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -145,6 +148,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=ResourceToken) @@ -186,6 +190,7 @@ def update( api_params['expire'] = self._normalize_value(expire) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -224,6 +229,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/usage.py b/appwrite/services/usage.py index 3f3eb308..2a6e5f5e 100644 --- a/appwrite/services/usage.py +++ b/appwrite/services/usage.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -45,6 +46,7 @@ def list_events( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=UsageEventList) @@ -85,6 +87,7 @@ def list_gauges( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=UsageGaugeList) diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 83224f28..705c111c 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union, Type, TypeVar from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -71,6 +72,7 @@ def list( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return UserList.with_data(response, model_type) @@ -130,6 +132,7 @@ def create( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -191,6 +194,7 @@ def create_argon2_user( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -252,6 +256,7 @@ def create_bcrypt_user( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -298,6 +303,7 @@ def list_identities( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=IdentityList) @@ -335,6 +341,7 @@ def delete_identity( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -396,6 +403,7 @@ def create_md5_user( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -457,6 +465,7 @@ def create_ph_pass_user( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -553,6 +562,7 @@ def create_scrypt_user( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -635,6 +645,7 @@ def create_scrypt_modified_user( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -701,6 +712,7 @@ def create_sha_user( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -743,6 +755,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return User.with_data(response, model_type) @@ -780,6 +793,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -829,6 +843,7 @@ def update_email( api_params['email'] = self._normalize_value(email) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -879,6 +894,7 @@ def update_impersonator( api_params['impersonator'] = self._normalize_value(impersonator) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -927,6 +943,7 @@ def create_jwt( api_params['duration'] = self._normalize_value(duration) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -978,6 +995,7 @@ def update_labels( api_params['labels'] = self._normalize_value(labels) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1026,6 +1044,7 @@ def list_logs( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=LogList) @@ -1078,6 +1097,7 @@ def list_memberships( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MembershipList) @@ -1126,6 +1146,7 @@ def update_mfa( api_params['mfa'] = self._normalize_value(mfa) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1171,6 +1192,7 @@ def delete_mfa_authenticator( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1209,6 +1231,7 @@ def list_mfa_factors( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MfaFactors) @@ -1246,6 +1269,7 @@ def get_mfa_recovery_codes( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=MfaRecoveryCodes) @@ -1283,6 +1307,7 @@ def update_mfa_recovery_codes( response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1321,6 +1346,7 @@ def create_mfa_recovery_codes( response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1370,6 +1396,7 @@ def update_name( api_params['name'] = self._normalize_value(name) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1419,6 +1446,7 @@ def update_password( api_params['password'] = self._normalize_value(password) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1468,6 +1496,7 @@ def update_phone( api_params['number'] = self._normalize_value(number) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1510,6 +1539,7 @@ def get_prefs( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return Preferences.with_data(response, model_type) @@ -1558,6 +1588,7 @@ def update_prefs( api_params['prefs'] = self._normalize_value(prefs) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1601,6 +1632,7 @@ def list_sessions( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=SessionList) @@ -1640,6 +1672,7 @@ def create_session( response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1678,6 +1711,7 @@ def delete_sessions( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1723,6 +1757,7 @@ def delete_session( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1772,6 +1807,7 @@ def update_status( api_params['status'] = self._normalize_value(status) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1820,6 +1856,7 @@ def list_targets( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=TargetList) @@ -1888,6 +1925,7 @@ def create_target( api_params['name'] = self._normalize_value(name) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -1933,6 +1971,7 @@ def get_target( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Target) @@ -1992,6 +2031,7 @@ def update_target( api_params['name'] = self._normalize_value(name) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2037,6 +2077,7 @@ def delete_target( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2086,6 +2127,7 @@ def create_token( api_params['expire'] = self._normalize_value(expire) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2135,6 +2177,7 @@ def update_email_verification( api_params['emailVerification'] = self._normalize_value(email_verification) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -2184,6 +2227,7 @@ def update_phone_verification( api_params['phoneVerification'] = self._normalize_value(phone_verification) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/webhooks.py b/appwrite/services/webhooks.py index 8c0e9407..d4abdcd3 100644 --- a/appwrite/services/webhooks.py +++ b/appwrite/services/webhooks.py @@ -1,4 +1,5 @@ from ..service import Service +from urllib.parse import quote from typing import Any, Dict, List, Optional, Union from ..exception import AppwriteException from appwrite.utils.deprecated import deprecated @@ -45,6 +46,7 @@ def list( api_params['total'] = self._normalize_value(total) response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=WebhookList) @@ -127,6 +129,7 @@ def create( api_params['secret'] = self._normalize_value(secret) response = self.client.call('post', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -165,6 +168,7 @@ def get( response = self.client.call('get', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), }, api_params) return self._parse_response(response, model=Webhook) @@ -243,6 +247,7 @@ def update( api_params['authPassword'] = self._normalize_value(auth_password) response = self.client.call('put', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -281,6 +286,7 @@ def delete( response = self.client.call('delete', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) @@ -323,6 +329,7 @@ def update_secret( api_params['secret'] = self._normalize_value(secret) response = self.client.call('patch', api_path, { + 'X-Appwrite-Project': self.client.get_config('project'), 'content-type': 'application/json', }, api_params) diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index dc504e2c..e93a5aa4 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -12,7 +12,7 @@ account = Account(client) result: User = account.update_password( password = '', - old_password = 'password' # optional + old_password = '' # optional ) print(result.model_dump()) diff --git a/docs/examples/health/get-audits-db.md b/docs/examples/health/get-audits-db.md new file mode 100644 index 00000000..774edec1 --- /dev/null +++ b/docs/examples/health/get-audits-db.md @@ -0,0 +1,16 @@ +```python +from appwrite.client import Client +from appwrite.services.health import Health +from appwrite.models import HealthStatusList + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +health = Health(client) + +result: HealthStatusList = health.get_audits_db() + +print(result.model_dump()) +``` diff --git a/docs/examples/messaging/create-ses-provider.md b/docs/examples/messaging/create-ses-provider.md new file mode 100644 index 00000000..369ffc71 --- /dev/null +++ b/docs/examples/messaging/create-ses-provider.md @@ -0,0 +1,27 @@ +```python +from appwrite.client import Client +from appwrite.services.messaging import Messaging +from appwrite.models import Provider + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result: Provider = messaging.create_ses_provider( + provider_id = '', + name = '', + access_key = '', # optional + secret_key = '', # optional + region = '', # optional + from_name = '', # optional + from_email = 'email@example.com', # optional + reply_to_name = '', # optional + reply_to_email = 'email@example.com', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/messaging/update-ses-provider.md b/docs/examples/messaging/update-ses-provider.md new file mode 100644 index 00000000..ab77e2eb --- /dev/null +++ b/docs/examples/messaging/update-ses-provider.md @@ -0,0 +1,27 @@ +```python +from appwrite.client import Client +from appwrite.services.messaging import Messaging +from appwrite.models import Provider + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result: Provider = messaging.update_ses_provider( + provider_id = '', + name = '', # optional + enabled = False, # optional + access_key = '', # optional + secret_key = '', # optional + region = '', # optional + from_name = '', # optional + from_email = 'email@example.com', # optional + reply_to_name = '', # optional + reply_to_email = '' # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index 4ab04c3c..a26145e1 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -3,6 +3,7 @@ from appwrite.client import Client from appwrite.services.project import Project from appwrite.models import PolicyPasswordDictionary from appwrite.models import PolicyPasswordHistory +from appwrite.models import PolicyPasswordStrength from appwrite.models import PolicyPasswordPersonalData from appwrite.models import PolicySessionAlert from appwrite.models import PolicySessionDuration @@ -23,7 +24,7 @@ client.set_key('') # Your secret API key project = Project(client) -result: Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail] = project.get_policy( +result: Union[PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail] = project.get_policy( policy_id = ProjectPolicyId.PASSWORD_DICTIONARY ) diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md new file mode 100644 index 00000000..91334190 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-server.md @@ -0,0 +1,25 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import Project as ProjectModel + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +project = Project(client) + +result: ProjectModel = project.update_o_auth2_server( + enabled = False, + authorization_url = 'https://example.com', + scopes = [], # optional + access_token_duration = 60, # optional + refresh_token_duration = 60, # optional + public_access_token_duration = 60, # optional + public_refresh_token_duration = 60, # optional + confidential_pkce = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-password-strength-policy.md b/docs/examples/project/update-password-strength-policy.md new file mode 100644 index 00000000..c87aeaf3 --- /dev/null +++ b/docs/examples/project/update-password-strength-policy.md @@ -0,0 +1,22 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import PolicyPasswordStrength + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +project = Project(client) + +result: PolicyPasswordStrength = project.update_password_strength_policy( + min = 8, # optional + uppercase = False, # optional + lowercase = False, # optional + number = False, # optional + symbols = False # optional +) + +print(result.model_dump()) +``` diff --git a/pyproject.toml b/pyproject.toml index 7e61f375..80db5e40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "appwrite" -version = "20.0.0" +version = "20.1.0" description = "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API" readme = "README.md" requires-python = ">=3.9" diff --git a/setup.py b/setup.py index 71980fb1..9fdc9256 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name = 'appwrite', packages = setuptools.find_packages(), - version = '20.0.0', + version = '20.1.0', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -18,7 +18,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/20.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/20.1.0.tar.gz', install_requires=[ 'requests', 'pydantic>=2,<3', diff --git a/test/services/test_health.py b/test/services/test_health.py index 1670be8f..930aeb62 100644 --- a/test/services/test_health.py +++ b/test/services/test_health.py @@ -42,6 +42,20 @@ def test_get_antivirus(self, m): self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_get_audits_db(self, m): + data = { + "total": 5.0, + "statuses": [] +} + headers = {'Content-Type': 'application/json'} + m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) + + response = self.health.get_audits_db( + ) + + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_get_cache(self, m): data = { diff --git a/test/services/test_messaging.py b/test/services/test_messaging.py index 329991a3..1424b6a1 100644 --- a/test/services/test_messaging.py +++ b/test/services/test_messaging.py @@ -638,6 +638,49 @@ def test_update_sendgrid_provider(self, m): self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_create_ses_provider(self, m): + data = { + "$id": "5e5ea5c16897e", + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "$updatedAt": "2020-10-15T06:38:00.000+00:00", + "name": "Mailgun", + "provider": "mailgun", + "enabled": True, + "type": "sms", + "credentials": {} +} + headers = {'Content-Type': 'application/json'} + m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) + + response = self.messaging.create_ses_provider( + '', + '', + ) + + self.assertEqual(response.to_dict(), data) + + @requests_mock.Mocker() + def test_update_ses_provider(self, m): + data = { + "$id": "5e5ea5c16897e", + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "$updatedAt": "2020-10-15T06:38:00.000+00:00", + "name": "Mailgun", + "provider": "mailgun", + "enabled": True, + "type": "sms", + "credentials": {} +} + headers = {'Content-Type': 'application/json'} + m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) + + response = self.messaging.update_ses_provider( + '', + ) + + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_create_smtp_provider(self, m): data = { diff --git a/test/services/test_organization.py b/test/services/test_organization.py index 71bdc4b0..ac221c35 100644 --- a/test/services/test_organization.py +++ b/test/services/test_organization.py @@ -131,6 +131,7 @@ def test_create_project(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -149,9 +150,17 @@ def test_create_project(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -171,6 +180,7 @@ def test_get_project(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -189,9 +199,17 @@ def test_get_project(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -210,6 +228,7 @@ def test_update_project(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -228,9 +247,17 @@ def test_update_project(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) diff --git a/test/services/test_project.py b/test/services/test_project.py index 1dadabfa..556761df 100644 --- a/test/services/test_project.py +++ b/test/services/test_project.py @@ -21,6 +21,7 @@ def test_get(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -39,9 +40,17 @@ def test_get(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -70,6 +79,7 @@ def test_update_auth_method(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -88,9 +98,17 @@ def test_update_auth_method(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -229,6 +247,7 @@ def test_update_labels(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -247,9 +266,17 @@ def test_update_labels(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -353,13 +380,62 @@ def test_list_o_auth2_providers(self, m): self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_server(self, m): + data = { + "$id": "5e5ea5c16897e", + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "$updatedAt": "2020-10-15T06:38:00.000+00:00", + "name": "New Project", + "teamId": "1592981250", + "region": "fra", + "devKeys": [], + "smtpEnabled": True, + "smtpSenderName": "John Appwrite", + "smtpSenderEmail": "john@appwrite.io", + "smtpReplyToName": "Support Team", + "smtpReplyToEmail": "support@appwrite.io", + "smtpHost": "mail.appwrite.io", + "smtpPort": 25.0, + "smtpUsername": "emailuser", + "smtpPassword": "", + "smtpSecure": "tls", + "pingCount": 1.0, + "pingedAt": "2020-10-15T06:38:00.000+00:00", + "labels": [], + "status": "active", + "authMethods": [], + "services": [], + "protocols": [], + "blocks": [], + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" +} + headers = {'Content-Type': 'application/json'} + m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) + + response = self.project.update_o_auth2_server( + True, + 'https://example.com', + ) + + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_amazon(self, m): data = { "$id": "github", "enabled": True, "clientId": "amzn1.application-oa2-client.87400c00000000000000000000063d5b2", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "79ffe4000000000000000000000000000000000000000000000000000002de55" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -393,7 +469,7 @@ def test_update_o_auth2_auth0(self, m): "$id": "github", "enabled": True, "clientId": "OaOkIA000000000000000000005KLSYq", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "zXz0000-00000000000000000000000000000-00000000000000000000PJafnF", "endpoint": "example.us.auth0.com" } headers = {'Content-Type': 'application/json'} @@ -410,7 +486,7 @@ def test_update_o_auth2_authentik(self, m): "$id": "github", "enabled": True, "clientId": "dTKOPa0000000000000000000000000000e7G8hv", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK", "endpoint": "example.authentik.com" } headers = {'Content-Type': 'application/json'} @@ -427,7 +503,7 @@ def test_update_o_auth2_autodesk(self, m): "$id": "github", "enabled": True, "clientId": "5zw90v00000000000000000000kVYXN7", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "7I000000000000MW" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -443,7 +519,7 @@ def test_update_o_auth2_bitbucket(self, m): "$id": "github", "enabled": True, "key": "Knt70000000000ByRc", - "secret": "your-oauth2-client-secret" + "secret": "NMfLZJ00000000000000000000TLQdDx" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -459,7 +535,7 @@ def test_update_o_auth2_bitly(self, m): "$id": "github", "enabled": True, "clientId": "d95151000000000000000000000000000067af9b", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "a13e250000000000000000000000000000d73095" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -475,7 +551,7 @@ def test_update_o_auth2_box(self, m): "$id": "github", "enabled": True, "clientId": "deglcs00000000000000000000x2og6y", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "OKM1f100000000000000000000eshEif" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -491,7 +567,7 @@ def test_update_o_auth2_dailymotion(self, m): "$id": "github", "enabled": True, "apiKey": "07a9000000000000067f", - "apiSecret": "your-oauth2-client-secret" + "apiSecret": "a399a90000000000000000000000000000d90639" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -507,7 +583,7 @@ def test_update_o_auth2_discord(self, m): "$id": "github", "enabled": True, "clientId": "950722000000343754", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "YmPXnM000000000000000000002zFg5D" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -523,7 +599,7 @@ def test_update_o_auth2_disqus(self, m): "$id": "github", "enabled": True, "publicKey": "cgegH70000000000000000000000000000000000000000000000000000Hr1nYX", - "secretKey": "your-oauth2-client-secret" + "secretKey": "W7Bykj00000000000000000000000000000000000000000000000000003o43w9" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -539,7 +615,7 @@ def test_update_o_auth2_dropbox(self, m): "$id": "github", "enabled": True, "appKey": "jl000000000009t", - "appSecret": "your-oauth2-client-secret" + "appSecret": "g200000000000vw" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -555,7 +631,7 @@ def test_update_o_auth2_etsy(self, m): "$id": "github", "enabled": True, "keyString": "nsgzxh0000000000008j85a2", - "sharedSecret": "your-oauth2-client-secret" + "sharedSecret": "tp000000ru" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -571,7 +647,7 @@ def test_update_o_auth2_facebook(self, m): "$id": "github", "enabled": True, "appId": "260600000007694", - "appSecret": "your-oauth2-client-secret" + "appSecret": "2d0b2800000000000000000000d38af4" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -587,7 +663,7 @@ def test_update_o_auth2_figma(self, m): "$id": "github", "enabled": True, "clientId": "byay5H0000000000VtiI40", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "yEpOYn0000000000000000004iIsU5" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -603,7 +679,7 @@ def test_update_o_auth2_fusion_auth(self, m): "$id": "github", "enabled": True, "clientId": "b2222c00-0000-0000-0000-000000862097", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "Jx4s0C0000000000000000000000000000000wGqLsc", "endpoint": "example.fusionauth.io" } headers = {'Content-Type': 'application/json'} @@ -620,7 +696,7 @@ def test_update_o_auth2_git_hub(self, m): "$id": "github", "enabled": True, "clientId": "e4d87900000000540733", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "5e07c00000000000000000000000000000198bcc" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -636,7 +712,7 @@ def test_update_o_auth2_gitlab(self, m): "$id": "github", "enabled": True, "applicationId": "d41ffe0000000000000000000000000000000000000000000000000000d5e252", - "secret": "your-oauth2-client-secret", + "secret": "gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38", "endpoint": "https:\/\/gitlab.com" } headers = {'Content-Type': 'application/json'} @@ -653,7 +729,7 @@ def test_update_o_auth2_google(self, m): "$id": "github", "enabled": True, "clientId": "120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "GOCSPX-2k8gsR0000000000000000VNahJj", "prompt": [] } headers = {'Content-Type': 'application/json'} @@ -670,7 +746,7 @@ def test_update_o_auth2_keycloak(self, m): "$id": "github", "enabled": True, "clientId": "appwrite-o0000000st-app", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "jdjrJd00000000000000000000HUsaZO", "endpoint": "keycloak.example.com", "realmName": "appwrite-realm" } @@ -688,7 +764,7 @@ def test_update_o_auth2_kick(self, m): "$id": "github", "enabled": True, "clientId": "01KQ7C00000000000001MFHS32", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "34ac5600000000000000000000000000000000000000000000000000e830c8b" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -704,7 +780,7 @@ def test_update_o_auth2_linkedin(self, m): "$id": "github", "enabled": True, "clientId": "770000000000dv", - "primaryClientSecret": "your-oauth2-client-secret" + "primaryClientSecret": "WPL_AP1.2Bf0000000000000.\/HtlYw==" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -720,7 +796,7 @@ def test_update_o_auth2_microsoft(self, m): "$id": "github", "enabled": True, "applicationId": "00001111-aaaa-2222-bbbb-3333cccc4444", - "applicationSecret": "your-oauth2-client-secret", + "applicationSecret": "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", "tenant": "common" } headers = {'Content-Type': 'application/json'} @@ -737,7 +813,7 @@ def test_update_o_auth2_notion(self, m): "$id": "github", "enabled": True, "oauthClientId": "341d8700-0000-0000-0000-000000446ee3", - "oauthClientSecret": "your-oauth2-client-secret" + "oauthClientSecret": "secret_dLUr4b000000000000000000000000000000lFHAa9" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -753,7 +829,7 @@ def test_update_o_auth2_oidc(self, m): "$id": "github", "enabled": True, "clientId": "qibI2x0000000000000000000000000006L2YFoG", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV", "wellKnownURL": "https:\/\/myoauth.com\/.well-known\/openid-configuration", "authorizationURL": "https:\/\/myoauth.com\/oauth2\/authorize", "tokenURL": "https:\/\/myoauth.com\/oauth2\/token", @@ -773,7 +849,7 @@ def test_update_o_auth2_okta(self, m): "$id": "github", "enabled": True, "clientId": "0oa00000000000000698", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV", "domain": "trial-6400025.okta.com", "authorizationServerId": "aus000000000000000h7z" } @@ -791,7 +867,7 @@ def test_update_o_auth2_paypal(self, m): "$id": "github", "enabled": True, "clientId": "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", - "secretKey": "your-oauth2-client-secret" + "secretKey": "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -807,7 +883,7 @@ def test_update_o_auth2_paypal_sandbox(self, m): "$id": "github", "enabled": True, "clientId": "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", - "secretKey": "your-oauth2-client-secret" + "secretKey": "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -823,7 +899,7 @@ def test_update_o_auth2_podio(self, m): "$id": "github", "enabled": True, "clientId": "appwrite-oauth-test-app", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "Rn247T0000000000000000000000000000000000000000000000000000W2zWTN" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -839,7 +915,7 @@ def test_update_o_auth2_salesforce(self, m): "$id": "github", "enabled": True, "customerKey": "3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq", - "customerSecret": "your-oauth2-client-secret" + "customerSecret": "3w000000000000e2" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -855,7 +931,7 @@ def test_update_o_auth2_slack(self, m): "$id": "github", "enabled": True, "clientId": "23000000089.15000000000023", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "81656000000000000000000000f3d2fd" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -871,7 +947,7 @@ def test_update_o_auth2_spotify(self, m): "$id": "github", "enabled": True, "clientId": "6ec271000000000000000000009beace", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "db068a000000000000000000008b5b9f" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -887,7 +963,7 @@ def test_update_o_auth2_stripe(self, m): "$id": "github", "enabled": True, "clientId": "ca_UKibXX0000000000000000000006byvR", - "apiSecretKey": "your-oauth2-client-secret" + "apiSecretKey": "sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -903,7 +979,7 @@ def test_update_o_auth2_tradeshift(self, m): "$id": "github", "enabled": True, "oauth2ClientId": "appwrite-test-org.appwrite-test-app", - "oauth2ClientSecret": "your-oauth2-client-secret" + "oauth2ClientSecret": "7cb52700-0000-0000-0000-000000ca5b83" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -919,7 +995,7 @@ def test_update_o_auth2_tradeshift_sandbox(self, m): "$id": "github", "enabled": True, "oauth2ClientId": "appwrite-test-org.appwrite-test-app", - "oauth2ClientSecret": "your-oauth2-client-secret" + "oauth2ClientSecret": "7cb52700-0000-0000-0000-000000ca5b83" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -935,7 +1011,7 @@ def test_update_o_auth2_twitch(self, m): "$id": "github", "enabled": True, "clientId": "vvi0in000000000000000000ikmt9p", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "pmapue000000000000000000zylw3v" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -951,7 +1027,7 @@ def test_update_o_auth2_word_press(self, m): "$id": "github", "enabled": True, "clientId": "130005", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -967,7 +1043,7 @@ def test_update_o_auth2_x(self, m): "$id": "github", "enabled": True, "customerKey": "slzZV0000000000000NFLaWT", - "secretKey": "your-oauth2-client-secret" + "secretKey": "tkEPkp00000000000000000000000000000000000000FTxbI9" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -983,7 +1059,7 @@ def test_update_o_auth2_yahoo(self, m): "$id": "github", "enabled": True, "clientId": "dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "cf978f0000000000000000000000000000c5e2e9" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -999,7 +1075,7 @@ def test_update_o_auth2_yandex(self, m): "$id": "github", "enabled": True, "clientId": "6a8a6a0000000000000000000091483c", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "bbf98500000000000000000000c75a63" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1015,7 +1091,7 @@ def test_update_o_auth2_zoho(self, m): "$id": "github", "enabled": True, "clientId": "1000.83C178000000000000000000RPNX0B", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "fb5cac000000000000000000000000000000a68f6e" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1031,7 +1107,7 @@ def test_update_o_auth2_zoom(self, m): "$id": "github", "enabled": True, "clientId": "QMAC00000000000000w0AQ", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "GAWsG4000000000000000000007U01ON" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1047,7 +1123,7 @@ def test_get_o_auth2_provider(self, m): "$id": "github", "enabled": True, "clientId": "e4d87900000000540733", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "5e07c00000000000000000000000000000198bcc" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1316,7 +1392,7 @@ def test_delete_platform(self, m): @requests_mock.Mocker() def test_list_policies(self, m): data = { - "total": 9.0, + "total": 10.0, "policies": [] } headers = {'Content-Type': 'application/json'} @@ -1335,6 +1411,7 @@ def test_update_deny_aliased_email_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1353,9 +1430,17 @@ def test_update_deny_aliased_email_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1374,6 +1459,7 @@ def test_update_deny_disposable_email_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1392,9 +1478,17 @@ def test_update_deny_disposable_email_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1413,6 +1507,7 @@ def test_update_deny_free_email_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1431,9 +1526,17 @@ def test_update_deny_free_email_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1452,6 +1555,7 @@ def test_update_membership_privacy_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1470,9 +1574,17 @@ def test_update_membership_privacy_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1490,6 +1602,7 @@ def test_update_password_dictionary_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1508,9 +1621,17 @@ def test_update_password_dictionary_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1529,6 +1650,7 @@ def test_update_password_history_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1547,9 +1669,17 @@ def test_update_password_history_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1568,6 +1698,7 @@ def test_update_password_personal_data_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1586,9 +1717,17 @@ def test_update_password_personal_data_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1599,6 +1738,24 @@ def test_update_password_personal_data_policy(self, m): self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_password_strength_policy(self, m): + data = { + "$id": "password-dictionary", + "min": 12.0, + "uppercase": True, + "lowercase": True, + "number": True, + "symbols": True +} + headers = {'Content-Type': 'application/json'} + m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) + + response = self.project.update_password_strength_policy( + ) + + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_session_alert_policy(self, m): data = { @@ -1607,6 +1764,7 @@ def test_update_session_alert_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1625,9 +1783,17 @@ def test_update_session_alert_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1646,6 +1812,7 @@ def test_update_session_duration_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1664,9 +1831,17 @@ def test_update_session_duration_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1685,6 +1860,7 @@ def test_update_session_invalidation_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1703,9 +1879,17 @@ def test_update_session_invalidation_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1724,6 +1908,7 @@ def test_update_session_limit_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1742,9 +1927,17 @@ def test_update_session_limit_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1763,6 +1956,7 @@ def test_update_user_limit_policy(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1781,9 +1975,17 @@ def test_update_user_limit_policy(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1817,6 +2019,7 @@ def test_update_protocol(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1835,9 +2038,17 @@ def test_update_protocol(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1857,6 +2068,7 @@ def test_update_service(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1875,9 +2087,17 @@ def test_update_service(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers) @@ -1897,6 +2117,7 @@ def test_update_smtp(self, m): "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [], "smtpEnabled": True, "smtpSenderName": "John Appwrite", @@ -1915,9 +2136,17 @@ def test_update_smtp(self, m): "authMethods": [], "services": [], "protocols": [], - "region": "fra", "blocks": [], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": True, + "oAuth2ServerAuthorizationUrl": "https:\/\/cloud.appwrite.io\/oauth2\/.well-known\/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600.0, + "oAuth2ServerRefreshTokenDuration": 86400.0, + "oAuth2ServerPublicAccessTokenDuration": 3600.0, + "oAuth2ServerPublicRefreshTokenDuration": 2592000.0, + "oAuth2ServerConfidentialPkce": True, + "oAuth2ServerDiscoveryUrl": "https:\/\/auth.example.com\/.well-known\/openid-configuration" } headers = {'Content-Type': 'application/json'} m.request(requests_mock.ANY, requests_mock.ANY, text=json.dumps(data), headers=headers)