From c803c77d704cac46ee0d0b26f9a67f33f622fbfb Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Wed, 18 Nov 2026 17:42:28 +0530 Subject: [PATCH] chore: update SDK to 28.0.0 --- CHANGELOG.md | 7 + appwrite/client.py | 4 +- appwrite/enums/o_auth_provider.py | 13 + appwrite/enums/project_o_auth_provider_id.py | 13 + appwrite/models/__init__.py | 26 + appwrite/models/function.py | 15 + appwrite/models/o_auth2_atlassian.py | 43 ++ appwrite/models/o_auth2_instagram.py | 43 ++ appwrite/models/o_auth2_line.py | 43 ++ appwrite/models/o_auth2_linear.py | 43 ++ appwrite/models/o_auth2_netlify.py | 43 ++ appwrite/models/o_auth2_patreon.py | 43 ++ appwrite/models/o_auth2_provider_list.py | 28 +- appwrite/models/o_auth2_railway.py | 43 ++ appwrite/models/o_auth2_reddit.py | 43 ++ appwrite/models/o_auth2_roblox.py | 43 ++ appwrite/models/o_auth2_strava.py | 43 ++ appwrite/models/o_auth2_vercel.py | 43 ++ appwrite/models/o_auth2_vk.py | 43 ++ appwrite/models/o_auth2_work_os.py | 43 ++ appwrite/models/site.py | 15 + appwrite/services/account.py | 2 +- appwrite/services/functions.py | 34 +- appwrite/services/project.py | 725 +++++++++++++++++- appwrite/services/proxy.py | 2 + appwrite/services/sites.py | 34 +- appwrite/services/tables_db.py | 4 +- appwrite/services/teams.py | 164 ++++ docs/examples/functions/create.md | 5 +- docs/examples/functions/update.md | 3 + .../examples/project/get-o-auth-2-provider.md | 15 +- .../project/update-o-auth-2-atlassian.md | 20 + .../project/update-o-auth-2-instagram.md | 20 + docs/examples/project/update-o-auth-2-line.md | 20 + .../project/update-o-auth-2-linear.md | 20 + .../project/update-o-auth-2-netlify.md | 20 + .../project/update-o-auth-2-patreon.md | 20 + .../project/update-o-auth-2-railway.md | 20 + .../project/update-o-auth-2-reddit.md | 20 + .../project/update-o-auth-2-roblox.md | 20 + .../project/update-o-auth-2-strava.md | 20 + .../project/update-o-auth-2-vercel.md | 20 + .../project/update-o-auth-2-work-os.md | 20 + docs/examples/project/update-o-auth-2vk.md | 20 + docs/examples/sites/create.md | 5 +- docs/examples/sites/update.md | 5 +- docs/examples/teams/delete-photo.md | 15 + docs/examples/teams/get-photo.md | 19 + docs/examples/teams/update-photo.md | 20 + pyproject.toml | 2 +- setup.py | 4 +- test/services/test_functions.py | 24 + test/services/test_project.py | 481 ++++++++++++ test/services/test_sites.py | 27 + test/services/test_teams.py | 100 +++ 55 files changed, 2608 insertions(+), 22 deletions(-) create mode 100644 appwrite/models/o_auth2_atlassian.py create mode 100644 appwrite/models/o_auth2_instagram.py create mode 100644 appwrite/models/o_auth2_line.py create mode 100644 appwrite/models/o_auth2_linear.py create mode 100644 appwrite/models/o_auth2_netlify.py create mode 100644 appwrite/models/o_auth2_patreon.py create mode 100644 appwrite/models/o_auth2_railway.py create mode 100644 appwrite/models/o_auth2_reddit.py create mode 100644 appwrite/models/o_auth2_roblox.py create mode 100644 appwrite/models/o_auth2_strava.py create mode 100644 appwrite/models/o_auth2_vercel.py create mode 100644 appwrite/models/o_auth2_vk.py create mode 100644 appwrite/models/o_auth2_work_os.py create mode 100644 docs/examples/project/update-o-auth-2-atlassian.md create mode 100644 docs/examples/project/update-o-auth-2-instagram.md create mode 100644 docs/examples/project/update-o-auth-2-line.md create mode 100644 docs/examples/project/update-o-auth-2-linear.md create mode 100644 docs/examples/project/update-o-auth-2-netlify.md create mode 100644 docs/examples/project/update-o-auth-2-patreon.md create mode 100644 docs/examples/project/update-o-auth-2-railway.md create mode 100644 docs/examples/project/update-o-auth-2-reddit.md create mode 100644 docs/examples/project/update-o-auth-2-roblox.md create mode 100644 docs/examples/project/update-o-auth-2-strava.md create mode 100644 docs/examples/project/update-o-auth-2-vercel.md create mode 100644 docs/examples/project/update-o-auth-2-work-os.md create mode 100644 docs/examples/project/update-o-auth-2vk.md create mode 100644 docs/examples/teams/delete-photo.md create mode 100644 docs/examples/teams/get-photo.md create mode 100644 docs/examples/teams/update-photo.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 43fac9a5..7d88f2ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 28.0.0 + +* Breaking: `email_enabled` moved after the new provider params in positional `functions.update` calls +* Added: `provider_comments`, `provider_deployments` and `provider_statuses` on function and site create and update, and on `Function` and `Site` +* Added: `teams.get_photo`, `teams.update_photo` and `teams.delete_photo` +* Added: `project` OAuth2 settings for Atlassian, Instagram, LINE, Linear, Netlify, Patreon, Railway, Reddit, Roblox, Strava, Vercel, VK and WorkOS + ## 27.3.0 * Added: `account.create_ldap_session` for LDAP sign-in diff --git a/appwrite/client.py b/appwrite/client.py index 13e7ae2c..c1eab5b0 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -20,11 +20,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent': f'AppwritePythonSDK/27.3.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent': f'AppwritePythonSDK/28.0.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': '27.3.0', + 'x-sdk-version': '28.0.0', 'X-Appwrite-Response-Format': '2.7.2', } self._config = {} diff --git a/appwrite/enums/o_auth_provider.py b/appwrite/enums/o_auth_provider.py index 072f2419..19345dca 100644 --- a/appwrite/enums/o_auth_provider.py +++ b/appwrite/enums/o_auth_provider.py @@ -5,6 +5,7 @@ class OAuthProvider(Enum): AMAZON = "amazon" APPLE = "apple" APPWRITE = "appwrite" + ATLASSIAN = "atlassian" AUTH0 = "auth0" AUTHENTIK = "authentik" AUTODESK = "autodesk" @@ -24,31 +25,43 @@ class OAuthProvider(Enum): GITLAB = "gitlab" GOOGLE = "google" HUGGINGFACE = "huggingface" + INSTAGRAM = "instagram" KAKAO = "kakao" KEYCLOAK = "keycloak" KICK = "kick" + LINE = "line" + LINEAR = "linear" LINKEDIN = "linkedin" MICROSOFT = "microsoft" NAVER = "naver" + NETLIFY = "netlify" NOTION = "notion" OIDC = "oidc" OKTA = "okta" + PATREON = "patreon" PAYPAL = "paypal" PAYPALSANDBOX = "paypalSandbox" PODIO = "podio" + RAILWAY = "railway" + REDDIT = "reddit" RESEND = "resend" + ROBLOX = "roblox" SALESFORCE = "salesforce" SLACK = "slack" SPOTIFY = "spotify" + STRAVA = "strava" STRIPE = "stripe" TIKTOK = "tiktok" TRADESHIFT = "tradeshift" TRADESHIFTBOX = "tradeshiftBox" TWITCH = "twitch" + VERCEL = "vercel" VIPPS = "vipps" VIPPSSANDBOX = "vippsSandbox" + VK = "vk" WEBFLOW = "webflow" WORDPRESS = "wordpress" + WORKOS = "workos" X = "x" YAHOO = "yahoo" YAMMER = "yammer" diff --git a/appwrite/enums/project_o_auth_provider_id.py b/appwrite/enums/project_o_auth_provider_id.py index a792ba93..5c3fc321 100644 --- a/appwrite/enums/project_o_auth_provider_id.py +++ b/appwrite/enums/project_o_auth_provider_id.py @@ -5,6 +5,7 @@ class ProjectOAuthProviderId(Enum): AMAZON = "amazon" APPLE = "apple" APPWRITE = "appwrite" + ATLASSIAN = "atlassian" AUTH0 = "auth0" AUTHENTIK = "authentik" AUTODESK = "autodesk" @@ -24,31 +25,43 @@ class ProjectOAuthProviderId(Enum): GITLAB = "gitlab" GOOGLE = "google" HUGGINGFACE = "huggingface" + INSTAGRAM = "instagram" KAKAO = "kakao" KEYCLOAK = "keycloak" KICK = "kick" + LINE = "line" + LINEAR = "linear" LINKEDIN = "linkedin" MICROSOFT = "microsoft" NAVER = "naver" + NETLIFY = "netlify" NOTION = "notion" OIDC = "oidc" OKTA = "okta" + PATREON = "patreon" PAYPAL = "paypal" PAYPALSANDBOX = "paypalSandbox" PODIO = "podio" + RAILWAY = "railway" + REDDIT = "reddit" RESEND = "resend" + ROBLOX = "roblox" SALESFORCE = "salesforce" SLACK = "slack" SPOTIFY = "spotify" + STRAVA = "strava" STRIPE = "stripe" TIKTOK = "tiktok" TRADESHIFT = "tradeshift" TRADESHIFTBOX = "tradeshiftBox" TWITCH = "twitch" + VERCEL = "vercel" VIPPS = "vipps" VIPPSSANDBOX = "vippsSandbox" + VK = "vk" WEBFLOW = "webflow" WORDPRESS = "wordpress" + WORKOS = "workos" X = "x" YAHOO = "yahoo" YAMMER = "yammer" diff --git a/appwrite/models/__init__.py b/appwrite/models/__init__.py index 24b79d7e..f3113b63 100644 --- a/appwrite/models/__init__.py +++ b/appwrite/models/__init__.py @@ -160,6 +160,19 @@ from .o_auth2_yahoo import OAuth2Yahoo from .o_auth2_cloudflare import OAuth2Cloudflare from .o_auth2_hugging_face import OAuth2HuggingFace +from .o_auth2_instagram import OAuth2Instagram +from .o_auth2_patreon import OAuth2Patreon +from .o_auth2_strava import OAuth2Strava +from .o_auth2_vk import OAuth2VK +from .o_auth2_netlify import OAuth2Netlify +from .o_auth2_railway import OAuth2Railway +from .o_auth2_reddit import OAuth2Reddit +from .o_auth2_vercel import OAuth2Vercel +from .o_auth2_atlassian import OAuth2Atlassian +from .o_auth2_line import OAuth2Line +from .o_auth2_linear import OAuth2Linear +from .o_auth2_roblox import OAuth2Roblox +from .o_auth2_work_os import OAuth2WorkOS from .o_auth2_linkedin import OAuth2Linkedin from .o_auth2_disqus import OAuth2Disqus from .o_auth2_amazon import OAuth2Amazon @@ -493,6 +506,19 @@ 'OAuth2Yahoo', 'OAuth2Cloudflare', 'OAuth2HuggingFace', + 'OAuth2Instagram', + 'OAuth2Patreon', + 'OAuth2Strava', + 'OAuth2VK', + 'OAuth2Netlify', + 'OAuth2Railway', + 'OAuth2Reddit', + 'OAuth2Vercel', + 'OAuth2Atlassian', + 'OAuth2Line', + 'OAuth2Linear', + 'OAuth2Roblox', + 'OAuth2WorkOS', 'OAuth2Linkedin', 'OAuth2Disqus', 'OAuth2Amazon', diff --git a/appwrite/models/function.py b/appwrite/models/function.py index c25b1017..bc2f789f 100644 --- a/appwrite/models/function.py +++ b/appwrite/models/function.py @@ -71,6 +71,12 @@ class Function(AppwriteModel): Path to function in VCS (Version Control System) repository providersilentmode : bool Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + providercomments : bool + Whether a build summary is posted on pull requests. Commit statuses are still reported when disabled. + providerdeployments : bool + Whether pushes that match the branch and path rules are deployed automatically. + providerstatuses : bool + Whether the build status is reported on each commit. providerbranches : List[Any] List of branch name patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all branches. providerpaths : List[Any] @@ -113,6 +119,9 @@ class Function(AppwriteModel): providerbranch: str = Field(..., alias='providerBranch') providerrootdirectory: str = Field(..., alias='providerRootDirectory') providersilentmode: bool = Field(..., alias='providerSilentMode') + providercomments: bool = Field(..., alias='providerComments') + providerdeployments: bool = Field(..., alias='providerDeployments') + providerstatuses: bool = Field(..., alias='providerStatuses') providerbranches: List[Any] = Field(..., alias='providerBranches') providerpaths: List[Any] = Field(..., alias='providerPaths') buildspecification: str = Field(..., alias='buildSpecification') @@ -184,6 +193,12 @@ def _apply_defaults(cls, data: Any) -> Any: data['providerRootDirectory'] = '' if 'providerSilentMode' not in data and 'providersilentmode' not in data: data['providerSilentMode'] = False + if 'providerComments' not in data and 'providercomments' not in data: + data['providerComments'] = True + if 'providerDeployments' not in data and 'providerdeployments' not in data: + data['providerDeployments'] = True + if 'providerStatuses' not in data and 'providerstatuses' not in data: + data['providerStatuses'] = True if 'providerBranches' not in data and 'providerbranches' not in data: data['providerBranches'] = [] if 'providerPaths' not in data and 'providerpaths' not in data: diff --git a/appwrite/models/o_auth2_atlassian.py b/appwrite/models/o_auth2_atlassian.py new file mode 100644 index 00000000..63b6e499 --- /dev/null +++ b/appwrite/models/o_auth2_atlassian.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Atlassian(AppwriteModel): + """ + OAuth2Atlassian + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Atlassian OAuth2 client ID. + clientsecret : str + Atlassian OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_instagram.py b/appwrite/models/o_auth2_instagram.py new file mode 100644 index 00000000..061b51b0 --- /dev/null +++ b/appwrite/models/o_auth2_instagram.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Instagram(AppwriteModel): + """ + OAuth2Instagram + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Instagram OAuth2 client ID. + clientsecret : str + Instagram OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_line.py b/appwrite/models/o_auth2_line.py new file mode 100644 index 00000000..306ab064 --- /dev/null +++ b/appwrite/models/o_auth2_line.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Line(AppwriteModel): + """ + OAuth2Line + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + LINE OAuth2 client ID. + clientsecret : str + LINE OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_linear.py b/appwrite/models/o_auth2_linear.py new file mode 100644 index 00000000..b482a3b7 --- /dev/null +++ b/appwrite/models/o_auth2_linear.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Linear(AppwriteModel): + """ + OAuth2Linear + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Linear OAuth2 client ID. + clientsecret : str + Linear OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_netlify.py b/appwrite/models/o_auth2_netlify.py new file mode 100644 index 00000000..7044a6eb --- /dev/null +++ b/appwrite/models/o_auth2_netlify.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Netlify(AppwriteModel): + """ + OAuth2Netlify + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Netlify OAuth2 client ID. + clientsecret : str + Netlify OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_patreon.py b/appwrite/models/o_auth2_patreon.py new file mode 100644 index 00000000..e81b1438 --- /dev/null +++ b/appwrite/models/o_auth2_patreon.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Patreon(AppwriteModel): + """ + OAuth2Patreon + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Patreon OAuth2 client ID. + clientsecret : str + Patreon OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_provider_list.py b/appwrite/models/o_auth2_provider_list.py index 4717f7ce..5f7a7d36 100644 --- a/appwrite/models/o_auth2_provider_list.py +++ b/appwrite/models/o_auth2_provider_list.py @@ -45,6 +45,19 @@ from .o_auth2_kick import OAuth2Kick from .o_auth2_microsoft import OAuth2Microsoft from .o_auth2_hugging_face import OAuth2HuggingFace +from .o_auth2_instagram import OAuth2Instagram +from .o_auth2_patreon import OAuth2Patreon +from .o_auth2_strava import OAuth2Strava +from .o_auth2_vk import OAuth2VK +from .o_auth2_netlify import OAuth2Netlify +from .o_auth2_railway import OAuth2Railway +from .o_auth2_reddit import OAuth2Reddit +from .o_auth2_vercel import OAuth2Vercel +from .o_auth2_atlassian import OAuth2Atlassian +from .o_auth2_line import OAuth2Line +from .o_auth2_linear import OAuth2Linear +from .o_auth2_roblox import OAuth2Roblox +from .o_auth2_work_os import OAuth2WorkOS from .o_auth2_resend import OAuth2Resend from .o_auth2_cloudflare import OAuth2Cloudflare from .o_auth2_tik_tok import OAuth2TikTok @@ -61,7 +74,7 @@ class OAuth2ProviderList(AppwriteModel): ---------- total : float Total number of OAuth2 providers in the given project. - providers : List[Union[OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Webflow, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Appwrite, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft, OAuth2HuggingFace, OAuth2Resend, OAuth2Cloudflare, OAuth2TikTok, OAuth2Kakao, OAuth2Naver, OAuth2Vipps]] + providers : List[Union[OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Webflow, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Appwrite, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft, OAuth2HuggingFace, OAuth2Instagram, OAuth2Patreon, OAuth2Strava, OAuth2VK, OAuth2Netlify, OAuth2Railway, OAuth2Reddit, OAuth2Vercel, OAuth2Atlassian, OAuth2Line, OAuth2Linear, OAuth2Roblox, OAuth2WorkOS, OAuth2Resend, OAuth2Cloudflare, OAuth2TikTok, OAuth2Kakao, OAuth2Naver, OAuth2Vipps]] List of OAuth2 providers. """ @@ -111,6 +124,19 @@ class OAuth2ProviderList(AppwriteModel): OAuth2Kick, OAuth2Microsoft, OAuth2HuggingFace, + OAuth2Instagram, + OAuth2Patreon, + OAuth2Strava, + OAuth2VK, + OAuth2Netlify, + OAuth2Railway, + OAuth2Reddit, + OAuth2Vercel, + OAuth2Atlassian, + OAuth2Line, + OAuth2Linear, + OAuth2Roblox, + OAuth2WorkOS, OAuth2Resend, OAuth2Cloudflare, OAuth2TikTok, diff --git a/appwrite/models/o_auth2_railway.py b/appwrite/models/o_auth2_railway.py new file mode 100644 index 00000000..89dd2cd0 --- /dev/null +++ b/appwrite/models/o_auth2_railway.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Railway(AppwriteModel): + """ + OAuth2Railway + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Railway OAuth2 client ID. + clientsecret : str + Railway OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_reddit.py b/appwrite/models/o_auth2_reddit.py new file mode 100644 index 00000000..0081e6e4 --- /dev/null +++ b/appwrite/models/o_auth2_reddit.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Reddit(AppwriteModel): + """ + OAuth2Reddit + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Reddit OAuth2 client ID. + clientsecret : str + Reddit OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_roblox.py b/appwrite/models/o_auth2_roblox.py new file mode 100644 index 00000000..a0821d5d --- /dev/null +++ b/appwrite/models/o_auth2_roblox.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Roblox(AppwriteModel): + """ + OAuth2Roblox + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Roblox OAuth2 client ID. + clientsecret : str + Roblox OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_strava.py b/appwrite/models/o_auth2_strava.py new file mode 100644 index 00000000..77e8a8a0 --- /dev/null +++ b/appwrite/models/o_auth2_strava.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Strava(AppwriteModel): + """ + OAuth2Strava + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Strava OAuth2 client ID. + clientsecret : str + Strava OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_vercel.py b/appwrite/models/o_auth2_vercel.py new file mode 100644 index 00000000..e2ed3e44 --- /dev/null +++ b/appwrite/models/o_auth2_vercel.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2Vercel(AppwriteModel): + """ + OAuth2Vercel + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + Vercel OAuth2 client ID. + clientsecret : str + Vercel OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_vk.py b/appwrite/models/o_auth2_vk.py new file mode 100644 index 00000000..54345ccd --- /dev/null +++ b/appwrite/models/o_auth2_vk.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2VK(AppwriteModel): + """ + OAuth2VK + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + VK OAuth2 client ID. + clientsecret : str + VK OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/o_auth2_work_os.py b/appwrite/models/o_auth2_work_os.py new file mode 100644 index 00000000..0183cbff --- /dev/null +++ b/appwrite/models/o_auth2_work_os.py @@ -0,0 +1,43 @@ +from typing import Any, Dict, List, Optional, Union, cast +from pydantic import Field, PrivateAttr, model_validator + +from .base_model import AppwriteModel + + +class OAuth2WorkOS(AppwriteModel): + """ + OAuth2WorkOS + + Attributes + ---------- + id : str + OAuth2 provider ID. + enabled : bool + OAuth2 provider is active and can be used to create sessions. + clientid : str + WorkOS OAuth2 client ID. + clientsecret : str + WorkOS OAuth2 client secret. + """ + + id: str = Field(..., alias='$id') + enabled: bool = Field(..., alias='enabled') + clientid: str = Field(..., alias='clientId') + clientsecret: str = Field(..., alias='clientSecret', json_schema_extra={'format': 'password'}) + + @model_validator(mode='before') + @classmethod + def _apply_defaults(cls, data: Any) -> Any: + if not isinstance(data, dict): + return data + + data = dict(data) + if '$id' not in data and 'id' not in data: + data['$id'] = '' + if 'enabled' not in data: + data['enabled'] = False + if 'clientId' not in data and 'clientid' not in data: + data['clientId'] = '' + if 'clientSecret' not in data and 'clientsecret' not in data: + data['clientSecret'] = '' + return data diff --git a/appwrite/models/site.py b/appwrite/models/site.py index b2ef0b16..ff624b7d 100644 --- a/appwrite/models/site.py +++ b/appwrite/models/site.py @@ -69,6 +69,12 @@ class Site(AppwriteModel): Path to site in VCS (Version Control System) repository providersilentmode : bool Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + providercomments : bool + Whether a build summary is posted on pull requests. Commit statuses are still reported when disabled. + providerdeployments : bool + Whether pushes that match the branch and path rules are deployed automatically. + providerstatuses : bool + Whether the build status is reported on each commit. providerbranches : List[Any] List of branch name patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all branches. providerpaths : List[Any] @@ -118,6 +124,9 @@ class Site(AppwriteModel): providerbranch: str = Field(..., alias='providerBranch') providerrootdirectory: str = Field(..., alias='providerRootDirectory') providersilentmode: bool = Field(..., alias='providerSilentMode') + providercomments: bool = Field(..., alias='providerComments') + providerdeployments: bool = Field(..., alias='providerDeployments') + providerstatuses: bool = Field(..., alias='providerStatuses') providerbranches: List[Any] = Field(..., alias='providerBranches') providerpaths: List[Any] = Field(..., alias='providerPaths') buildspecification: str = Field(..., alias='buildSpecification') @@ -193,6 +202,12 @@ def _apply_defaults(cls, data: Any) -> Any: data['providerRootDirectory'] = '' if 'providerSilentMode' not in data and 'providersilentmode' not in data: data['providerSilentMode'] = False + if 'providerComments' not in data and 'providercomments' not in data: + data['providerComments'] = True + if 'providerDeployments' not in data and 'providerdeployments' not in data: + data['providerDeployments'] = True + if 'providerStatuses' not in data and 'providerstatuses' not in data: + data['providerStatuses'] = True if 'providerBranches' not in data and 'providerbranches' not in data: data['providerBranches'] = [] if 'providerPaths' not in data and 'providerpaths' not in data: diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 85f4d498..edbd9552 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -2578,7 +2578,7 @@ def create_o_auth2_token( Parameters ---------- provider : OAuthProvider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, naver, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, vipps, vippsSandbox, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, atlassian, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, instagram, kakao, keycloak, kick, line, linear, linkedin, microsoft, naver, netlify, notion, oidc, okta, patreon, paypal, paypalSandbox, podio, railway, reddit, resend, roblox, salesforce, slack, spotify, strava, stripe, tiktok, tradeshift, tradeshiftBox, twitch, vercel, vipps, vippsSandbox, vk, webflow, wordpress, workos, x, yahoo, yammer, yandex, zoho, zoom. success : Optional[str] URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. failure : Optional[str] diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index b20d8fa5..8ebd049a 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -102,6 +102,9 @@ def create( deployment_retention: Optional[float] = None, interval: Optional[float] = None, description: Optional[str] = None, + provider_comments: Optional[bool] = None, + provider_deployments: Optional[bool] = None, + provider_statuses: Optional[bool] = None, ) -> Function: """ Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. @@ -139,7 +142,7 @@ def create( provider_branch : Optional[str] Production branch for the repo linked to the function. provider_silent_mode : Optional[bool] - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, no comments or checks are posted to commits and pull requests. provider_root_directory : Optional[str] Path to function code in the linked repo. provider_branches : Optional[List[str]] @@ -156,6 +159,12 @@ def create( Minutes between scheduled executions. Appwrite picks when within each interval the function runs. Use 0 to disable. Cannot be combined with schedule. description : Optional[str] Optional description for the function. + provider_comments : Optional[bool] + Post a build summary on pull requests for the repo linked to the function. Commit statuses are still reported when disabled. Ignored in silent mode. + provider_deployments : Optional[bool] + Deploy every push that matches the branch and path rules for the repo linked to the function. When disabled, deploy manually. + provider_statuses : Optional[bool] + Report the build status on each commit for the repo linked to the function. Ignored in silent mode. Returns ------- Function @@ -220,6 +229,12 @@ def create( api_params['interval'] = self._normalize_value(interval) if description is not None: api_params['description'] = self._normalize_value(description) + if provider_comments is not None: + api_params['providerComments'] = self._normalize_value(provider_comments) + if provider_deployments is not None: + api_params['providerDeployments'] = self._normalize_value(provider_deployments) + if provider_statuses is not None: + api_params['providerStatuses'] = self._normalize_value(provider_statuses) response = self.client.call( 'post', @@ -383,6 +398,9 @@ def update( deployment_retention: Optional[float] = None, interval: Optional[float] = None, description: Optional[str] = None, + provider_comments: Optional[bool] = None, + provider_deployments: Optional[bool] = None, + provider_statuses: Optional[bool] = None, email_enabled: Optional[bool] = None, ) -> Function: """ @@ -421,7 +439,7 @@ def update( provider_branch : Optional[str] Production branch for the repo linked to the function provider_silent_mode : Optional[bool] - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, no comments or checks are posted to commits and pull requests. provider_root_directory : Optional[str] Path to function code in the linked repo. provider_branches : Optional[List[str]] @@ -438,6 +456,12 @@ def update( Minutes between scheduled executions. Appwrite picks when within each interval the function runs. Use 0 to disable. Cannot be combined with schedule. When omitted, the current interval is kept unless schedule is set. description : Optional[str] Optional description for the function. + provider_comments : Optional[bool] + Post a build summary on pull requests for the repo linked to the function. Commit statuses are still reported when disabled. Ignored in silent mode. + provider_deployments : Optional[bool] + Deploy every push that matches the branch and path rules for the repo linked to the function. When disabled, deploy manually. + provider_statuses : Optional[bool] + Report the build status on each commit for the repo linked to the function. Ignored in silent mode. email_enabled : Optional[bool] Enable inbound email triggering for this function. When false or omitted on create, SMTP recipients are rejected. Opt-in; default is off. Returns @@ -503,6 +527,12 @@ def update( api_params['interval'] = self._normalize_value(interval) if description is not None: api_params['description'] = self._normalize_value(description) + if provider_comments is not None: + api_params['providerComments'] = self._normalize_value(provider_comments) + if provider_deployments is not None: + api_params['providerDeployments'] = self._normalize_value(provider_deployments) + if provider_statuses is not None: + api_params['providerStatuses'] = self._normalize_value(provider_statuses) if email_enabled is not None: api_params['emailEnabled'] = self._normalize_value(email_enabled) diff --git a/appwrite/services/project.py b/appwrite/services/project.py index 09880bcd..9d39f3b5 100644 --- a/appwrite/services/project.py +++ b/appwrite/services/project.py @@ -19,6 +19,7 @@ from ..models.o_auth2_amazon import OAuth2Amazon from ..models.o_auth2_apple import OAuth2Apple from ..models.o_auth2_appwrite import OAuth2Appwrite +from ..models.o_auth2_atlassian import OAuth2Atlassian from ..enums.project_o_auth2_auth0_prompt import ProjectOAuth2Auth0Prompt from ..models.o_auth2_auth0 import OAuth2Auth0 from ..models.o_auth2_authentik import OAuth2Authentik @@ -42,33 +43,45 @@ from ..enums.project_o_auth2_google_prompt import ProjectOAuth2GooglePrompt from ..models.o_auth2_google import OAuth2Google from ..models.o_auth2_hugging_face import OAuth2HuggingFace +from ..models.o_auth2_instagram import OAuth2Instagram from ..enums.project_o_auth2_kakao_prompt import ProjectOAuth2KakaoPrompt from ..models.o_auth2_kakao import OAuth2Kakao from ..models.o_auth2_keycloak import OAuth2Keycloak from ..models.o_auth2_kick import OAuth2Kick +from ..models.o_auth2_line import OAuth2Line +from ..models.o_auth2_linear import OAuth2Linear from ..models.o_auth2_linkedin import OAuth2Linkedin from ..enums.project_o_auth2_microsoft_prompt import ProjectOAuth2MicrosoftPrompt from ..models.o_auth2_microsoft import OAuth2Microsoft from ..models.o_auth2_naver import OAuth2Naver +from ..models.o_auth2_netlify import OAuth2Netlify from ..models.o_auth2_notion import OAuth2Notion from ..enums.project_o_auth2_oidc_prompt import ProjectOAuth2OidcPrompt from ..models.o_auth2_oidc import OAuth2Oidc from ..enums.project_o_auth2_okta_prompt import ProjectOAuth2OktaPrompt from ..models.o_auth2_okta import OAuth2Okta +from ..models.o_auth2_patreon import OAuth2Patreon from ..models.o_auth2_paypal import OAuth2Paypal from ..models.o_auth2_podio import OAuth2Podio +from ..models.o_auth2_railway import OAuth2Railway +from ..models.o_auth2_reddit import OAuth2Reddit from ..models.o_auth2_resend import OAuth2Resend +from ..models.o_auth2_roblox import OAuth2Roblox from ..enums.project_o_auth2_salesforce_prompt import ProjectOAuth2SalesforcePrompt from ..models.o_auth2_salesforce import OAuth2Salesforce from ..models.o_auth2_slack import OAuth2Slack from ..models.o_auth2_spotify import OAuth2Spotify +from ..models.o_auth2_strava import OAuth2Strava from ..models.o_auth2_stripe import OAuth2Stripe from ..models.o_auth2_tik_tok import OAuth2TikTok from ..models.o_auth2_tradeshift import OAuth2Tradeshift from ..models.o_auth2_twitch import OAuth2Twitch +from ..models.o_auth2_vercel import OAuth2Vercel from ..models.o_auth2_vipps import OAuth2Vipps +from ..models.o_auth2_vk import OAuth2VK from ..models.o_auth2_webflow import OAuth2Webflow from ..models.o_auth2_word_press import OAuth2WordPress +from ..models.o_auth2_work_os import OAuth2WorkOS from ..models.o_auth2_x import OAuth2X from ..models.o_auth2_yahoo import OAuth2Yahoo from ..models.o_auth2_yandex import OAuth2Yandex @@ -1470,6 +1483,56 @@ def update_o_auth2_appwrite( return self._parse_response(response, model=OAuth2Appwrite) + def update_o_auth2_atlassian( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Atlassian: + """ + Update the project OAuth2 Atlassian configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Atlassian OAuth2 app. For example: uQ7mZ3s0000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of Atlassian OAuth2 app. For example: ATOA0000000000000000000000000000000000000000000000000000000000000000000000 + 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. + Returns + ------- + OAuth2Atlassian + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/atlassian' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Atlassian) + def update_o_auth2_auth0( self, client_id: Optional[str] = None, @@ -2470,6 +2533,56 @@ def update_o_auth2_hugging_face( return self._parse_response(response, model=OAuth2HuggingFace) + def update_o_auth2_instagram( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Instagram: + """ + Update the project OAuth2 Instagram configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Instagram OAuth2 app. For example: 00000000000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of Instagram OAuth2 app. For example: 00000000000000000000000000000000 + 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. + Returns + ------- + OAuth2Instagram + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/instagram' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Instagram) + def update_o_auth2_kakao( self, client_id: Optional[str] = None, @@ -2635,6 +2748,106 @@ def update_o_auth2_kick( return self._parse_response(response, model=OAuth2Kick) + def update_o_auth2_line( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Line: + """ + Update the project OAuth2 LINE configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of LINE OAuth2 app. For example: 1650000000 + client_secret : Optional[str] + 'Client Secret' of LINE OAuth2 app. For example: a1b2c3d4e5f600000000000000000000 + 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. + Returns + ------- + OAuth2Line + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/line' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Line) + + def update_o_auth2_linear( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Linear: + """ + Update the project OAuth2 Linear configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Linear OAuth2 app. For example: 5e1c0000000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of Linear OAuth2 app. For example: 9f8e7d6c5b4a00000000000000000000 + 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. + Returns + ------- + OAuth2Linear + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/linear' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Linear) + def update_o_auth2_linkedin( self, client_id: Optional[str] = None, @@ -2795,6 +3008,56 @@ def update_o_auth2_naver( return self._parse_response(response, model=OAuth2Naver) + def update_o_auth2_netlify( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Netlify: + """ + Update the project OAuth2 Netlify configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Netlify OAuth2 app. For example: 00000000000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of Netlify OAuth2 app. For example: 00000000000000000000000000000000 + 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. + Returns + ------- + OAuth2Netlify + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/netlify' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Netlify) + def update_o_auth2_notion( self, oauth_client_id: Optional[str] = None, @@ -2990,6 +3253,56 @@ def update_o_auth2_okta( return self._parse_response(response, model=OAuth2Okta) + def update_o_auth2_patreon( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Patreon: + """ + Update the project OAuth2 Patreon configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Patreon OAuth2 app. For example: 00000000000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of Patreon OAuth2 app. For example: 00000000000000000000000000000000 + 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. + Returns + ------- + OAuth2Patreon + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/patreon' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Patreon) + def update_o_auth2_paypal( self, client_id: Optional[str] = None, @@ -3140,19 +3453,119 @@ def update_o_auth2_podio( return self._parse_response(response, model=OAuth2Podio) - def update_o_auth2_resend( + def update_o_auth2_railway( self, client_id: Optional[str] = None, client_secret: Optional[str] = None, enabled: Optional[bool] = None, - ) -> OAuth2Resend: + ) -> OAuth2Railway: """ - Update the project OAuth2 Resend configuration. + Update the project OAuth2 Railway configuration. Parameters ---------- client_id : Optional[str] - 'Client ID' of Resend OAuth2 app. For example: f47ac10b-58cc-4372-a567-0e02b2c3d479 + 'Client ID' of Railway OAuth2 app. For example: 00000000000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of Railway OAuth2 app. For example: 00000000000000000000000000000000 + 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. + Returns + ------- + OAuth2Railway + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/railway' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Railway) + + def update_o_auth2_reddit( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Reddit: + """ + Update the project OAuth2 Reddit configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Reddit OAuth2 app. For example: aBcD0000000000000000aB + client_secret : Optional[str] + 'Client Secret' of Reddit OAuth2 app. For example: xYz00000000000000000000000000a + 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. + Returns + ------- + OAuth2Reddit + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/reddit' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Reddit) + + def update_o_auth2_resend( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Resend: + """ + Update the project OAuth2 Resend configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Resend OAuth2 app. For example: f47ac10b-58cc-4372-a567-0e02b2c3d479 client_secret : Optional[str] 'Client Secret' of Resend OAuth2 app. For example: 9c1e4b00000000000000000000000000000000000000000000000000a72d5f4 enabled : Optional[bool] @@ -3190,6 +3603,56 @@ def update_o_auth2_resend( return self._parse_response(response, model=OAuth2Resend) + def update_o_auth2_roblox( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Roblox: + """ + Update the project OAuth2 Roblox configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Roblox OAuth2 app. For example: 1234567890123456789 + client_secret : Optional[str] + 'Client Secret' of Roblox OAuth2 app. For example: RBX-0000000000000000000000000000000000000000000000000000000000000000000000 + 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. + Returns + ------- + OAuth2Roblox + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/roblox' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Roblox) + def update_o_auth2_salesforce( self, customer_key: Optional[str] = None, @@ -3345,6 +3808,56 @@ def update_o_auth2_spotify( return self._parse_response(response, model=OAuth2Spotify) + def update_o_auth2_strava( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Strava: + """ + Update the project OAuth2 Strava configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Strava OAuth2 app. For example: 00000000000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of Strava OAuth2 app. For example: 00000000000000000000000000000000 + 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. + Returns + ------- + OAuth2Strava + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/strava' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Strava) + def update_o_auth2_stripe( self, client_id: Optional[str] = None, @@ -3595,6 +4108,56 @@ def update_o_auth2_twitch( return self._parse_response(response, model=OAuth2Twitch) + def update_o_auth2_vercel( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2Vercel: + """ + Update the project OAuth2 Vercel configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of Vercel OAuth2 app. For example: cl_0000000000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of Vercel OAuth2 app. For example: vc_0000000000000000000000000000000000000000000000 + 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. + Returns + ------- + OAuth2Vercel + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/vercel' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2Vercel) + def update_o_auth2_vipps( self, client_id: Optional[str] = None, @@ -3695,6 +4258,56 @@ def update_o_auth2_vipps_sandbox( return self._parse_response(response, model=OAuth2Vipps) + def update_o_auth2_vk( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2VK: + """ + Update the project OAuth2 VK configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of VK OAuth2 app. For example: 00000000000000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of VK OAuth2 app. For example: 00000000000000000000000000000000 + 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. + Returns + ------- + OAuth2VK + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/vk' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2VK) + def update_o_auth2_webflow( self, client_id: Optional[str] = None, @@ -3795,6 +4408,56 @@ def update_o_auth2_word_press( return self._parse_response(response, model=OAuth2WordPress) + def update_o_auth2_work_os( + self, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + enabled: Optional[bool] = None, + ) -> OAuth2WorkOS: + """ + Update the project OAuth2 WorkOS configuration. + + Parameters + ---------- + client_id : Optional[str] + 'Client ID' of WorkOS OAuth2 app. For example: client_01H0000000000000000000000 + client_secret : Optional[str] + 'Client Secret' of WorkOS OAuth2 app. For example: wos0000000000000000000000000000000000000000000000000000000000000 + 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. + Returns + ------- + OAuth2WorkOS + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/project/oauth2/workos' + api_params = {} + if client_id is not None: + api_params['clientId'] = self._normalize_value(client_id) + if client_secret is not None: + api_params['clientSecret'] = self._normalize_value(client_secret) + if enabled is not None: + 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', + 'accept': 'application/json', + }, + api_params, + ) + + return self._parse_response(response, model=OAuth2WorkOS) + def update_o_auth2_x( self, customer_key: Optional[str] = None, @@ -4079,6 +4742,19 @@ def get_o_auth2_provider( OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, + OAuth2Instagram, + OAuth2Patreon, + OAuth2Strava, + OAuth2VK, + OAuth2Netlify, + OAuth2Railway, + OAuth2Reddit, + OAuth2Vercel, + OAuth2Atlassian, + OAuth2Line, + OAuth2Linear, + OAuth2Roblox, + OAuth2WorkOS, OAuth2Resend, OAuth2Cloudflare, OAuth2Linkedin, @@ -4112,7 +4788,7 @@ def get_o_auth2_provider( OAuth2 provider key. For example: github, google, apple. Returns ------- - Union[OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Webflow, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Resend, OAuth2Cloudflare, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft, OAuth2TikTok, OAuth2Kakao, OAuth2Naver, OAuth2Vipps] + Union[OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Webflow, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Instagram, OAuth2Patreon, OAuth2Strava, OAuth2VK, OAuth2Netlify, OAuth2Railway, OAuth2Reddit, OAuth2Vercel, OAuth2Atlassian, OAuth2Line, OAuth2Linear, OAuth2Roblox, OAuth2WorkOS, OAuth2Resend, OAuth2Cloudflare, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft, OAuth2TikTok, OAuth2Kakao, OAuth2Naver, OAuth2Vipps] API response as one of the typed response models Raises @@ -4214,6 +4890,45 @@ def get_o_auth2_provider( if response.get('$id') == 'huggingface': return self._parse_response(response, model=OAuth2HuggingFace) + if response.get('$id') == 'instagram': + return self._parse_response(response, model=OAuth2Instagram) + + if response.get('$id') == 'patreon': + return self._parse_response(response, model=OAuth2Patreon) + + if response.get('$id') == 'strava': + return self._parse_response(response, model=OAuth2Strava) + + if response.get('$id') == 'vk': + return self._parse_response(response, model=OAuth2VK) + + if response.get('$id') == 'netlify': + return self._parse_response(response, model=OAuth2Netlify) + + if response.get('$id') == 'railway': + return self._parse_response(response, model=OAuth2Railway) + + if response.get('$id') == 'reddit': + return self._parse_response(response, model=OAuth2Reddit) + + if response.get('$id') == 'vercel': + return self._parse_response(response, model=OAuth2Vercel) + + if response.get('$id') == 'atlassian': + return self._parse_response(response, model=OAuth2Atlassian) + + if response.get('$id') == 'line': + return self._parse_response(response, model=OAuth2Line) + + if response.get('$id') == 'linear': + return self._parse_response(response, model=OAuth2Linear) + + if response.get('$id') == 'roblox': + return self._parse_response(response, model=OAuth2Roblox) + + if response.get('$id') == 'workos': + return self._parse_response(response, model=OAuth2WorkOS) + if response.get('$id') == 'resend': return self._parse_response(response, model=OAuth2Resend) diff --git a/appwrite/services/proxy.py b/appwrite/services/proxy.py index 5aea63fa..de35a0b6 100644 --- a/appwrite/services/proxy.py +++ b/appwrite/services/proxy.py @@ -643,6 +643,8 @@ def update_rule_status( """ If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. A verified rule whose certificate renewal failed or is blocked, or whose certificate expired, is checked the same way, and its certificate renewed in the background. + A domain may also be assigned to a project with a TXT record at `_appwrite.` holding the project ID. The record is optional, but a domain assigned to another project never verifies here, and publishing it lets this project claim a domain another one holds. + Parameters ---------- rule_id : str diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py index a6c19446..d70930aa 100644 --- a/appwrite/services/sites.py +++ b/appwrite/services/sites.py @@ -104,6 +104,9 @@ def create( deployment_retention: Optional[float] = None, scopes: Optional[List[ProjectKeyScopes]] = None, description: Optional[str] = None, + provider_comments: Optional[bool] = None, + provider_deployments: Optional[bool] = None, + provider_statuses: Optional[bool] = None, ) -> Site: """ Create a new site. @@ -143,7 +146,7 @@ def create( provider_branch : Optional[str] Production branch for the repo linked to the site. provider_silent_mode : Optional[bool] - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, no comments or checks are posted to commits and pull requests. provider_root_directory : Optional[str] Path to site code in the linked repo. provider_branches : Optional[List[str]] @@ -160,6 +163,12 @@ def create( List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. description : Optional[str] Optional description for the site. + provider_comments : Optional[bool] + Post a build summary on pull requests for the repo linked to the site. Commit statuses are still reported when disabled. Ignored in silent mode. + provider_deployments : Optional[bool] + Deploy every push that matches the branch and path rules for the repo linked to the site. When disabled, deploy manually. + provider_statuses : Optional[bool] + Report the build status on each commit for the repo linked to the site. Ignored in silent mode. Returns ------- Site @@ -227,6 +236,12 @@ def create( api_params['scopes'] = self._normalize_value(scopes) if description is not None: api_params['description'] = self._normalize_value(description) + if provider_comments is not None: + api_params['providerComments'] = self._normalize_value(provider_comments) + if provider_deployments is not None: + api_params['providerDeployments'] = self._normalize_value(provider_deployments) + if provider_statuses is not None: + api_params['providerStatuses'] = self._normalize_value(provider_statuses) response = self.client.call( 'post', @@ -391,6 +406,9 @@ def update( deployment_retention: Optional[float] = None, scopes: Optional[List[ProjectKeyScopes]] = None, description: Optional[str] = None, + provider_comments: Optional[bool] = None, + provider_deployments: Optional[bool] = None, + provider_statuses: Optional[bool] = None, ) -> Site: """ Update site by its unique ID. @@ -430,7 +448,7 @@ def update( provider_branch : Optional[str] Production branch for the repo linked to the site. provider_silent_mode : Optional[bool] - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, no comments or checks are posted to commits and pull requests. provider_root_directory : Optional[str] Path to site code in the linked repo. provider_branches : Optional[List[str]] @@ -447,6 +465,12 @@ def update( List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. description : Optional[str] Optional description for the site. + provider_comments : Optional[bool] + Post a build summary on pull requests for the repo linked to the site. Commit statuses are still reported when disabled. Ignored in silent mode. + provider_deployments : Optional[bool] + Deploy every push that matches the branch and path rules for the repo linked to the site. When disabled, deploy manually. + provider_statuses : Optional[bool] + Report the build status on each commit for the repo linked to the site. Ignored in silent mode. Returns ------- Site @@ -513,6 +537,12 @@ def update( api_params['scopes'] = self._normalize_value(scopes) if description is not None: api_params['description'] = self._normalize_value(description) + if provider_comments is not None: + api_params['providerComments'] = self._normalize_value(provider_comments) + if provider_deployments is not None: + api_params['providerDeployments'] = self._normalize_value(provider_deployments) + if provider_statuses is not None: + api_params['providerStatuses'] = self._normalize_value(provider_statuses) response = self.client.call( 'put', diff --git a/appwrite/services/tables_db.py b/appwrite/services/tables_db.py index abeba563..66184883 100644 --- a/appwrite/services/tables_db.py +++ b/appwrite/services/tables_db.py @@ -711,7 +711,7 @@ def create_migration( auto_cutover: Optional[bool] = None, ) -> DatabaseMigration: """ - Start migrating a serverless TablesDB database onto a dedicated MySQL compute. Data is copied to the target while the source stays live. Reads continue throughout. Row writes are held for up to a few seconds while routing switches to the dedicated compute; a write the switch has not absorbed within that hold is refused with `database_migration_cutover` and can be retried. Schema changes (tables, columns, indexes) are refused from creation until the cutover completes, and resume once the migration is `soaking`. + Start migrating a serverless TablesDB database onto a dedicated MySQL compute. Data is copied to the target while the source stays live. Reads continue throughout. Row writes are held for up to a few seconds while routing switches to the dedicated compute and are never refused; a write the switch has not absorbed within that hold proceeds and is carried across to the dedicated compute. Schema changes (tables, columns, indexes) are refused from creation until the cutover completes, and resume once the migration is `soaking`. Parameters ---------- @@ -855,7 +855,7 @@ def create_cutover( migration_id: str, ) -> DatabaseMigration: """ - Cut a verified TablesDB migration over to its dedicated compute. Only applies to a migration created with `autoCutover` disabled, which waits at `ready_to_cutover` until this is called. The routing flip happens shortly after this returns. Reads are unaffected; row writes are held for up to a few seconds while it lands, and a write the flip has not absorbed within that hold is refused with `database_migration_cutover` and can be retried. One call buys one attempt: a cutover that fails a check returns the migration to `verifying` and parks it again, so call this once more to retry. + Cut a verified TablesDB migration over to its dedicated compute. Only applies to a migration created with `autoCutover` disabled, which waits at `ready_to_cutover` until this is called. The routing flip happens shortly after this returns. Reads are unaffected; row writes are held for up to a few seconds while it lands and are never refused; a write the flip has not absorbed within that hold proceeds and is carried across to the dedicated compute. One call buys one attempt: a cutover that fails a check returns the migration to `verifying` and parks it again, so call this once more to retry. Parameters ---------- diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 1df920f0..872b29c6 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -9,6 +9,7 @@ from ..models.app_installation import AppInstallation from ..models.membership_list import MembershipList from ..models.membership import Membership +from ..input_file import InputFile from ..models.preferences import Preferences T = TypeVar('T') @@ -856,6 +857,169 @@ def update_membership_status( return self._parse_response(response, model=Membership) + def get_photo( + self, + team_id: str, + width: Optional[float] = None, + height: Optional[float] = None, + quality: Optional[float] = None, + output: Optional[str] = None, + ) -> bytes: + """ + Returns the photo of a team: the uploaded photo (see teams.updatePhoto), else the initials of the team name, else a built-in static placeholder. + + Parameters + ---------- + team_id : str + Team ID. + width : Optional[float] + Output image width in pixels. Pass an integer between 0 and 2000. Defaults to 256. + height : Optional[float] + Output image height in pixels. Pass an integer between 0 and 2000. Defaults to 256. + quality : Optional[float] + Output image quality between 0 and 100. Defaults to 100. + output : Optional[str] + Output image format. Defaults to 'png'. + Returns + ------- + bytes + Response as bytes + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/teams/{teamId}/photo' + api_params = {} + if team_id is None or team_id == '': + raise AppwriteException('Missing required parameter: "team_id"') + api_path = api_path.replace('{teamId}', self._encode_path(team_id)) + if width is not None: + api_params['width'] = self._normalize_value(width) + if height is not None: + api_params['height'] = self._normalize_value(height) + if quality is not None: + api_params['quality'] = self._normalize_value(quality) + if output is not None: + api_params['output'] = self._normalize_value(output) + + response = self.client.call( + 'get', + api_path, + { + 'X-Appwrite-Project': self.client.get_config('project'), + 'accept': 'image/*', + }, + api_params, + ) + + return response + + def update_photo( + self, + team_id: str, + file: InputFile, + on_progress=None, + model_type: Type[T] = dict, + ) -> Team[T]: + """ + Update the photo of a team. Updating an already customized photo replaces it. The image must be at most 5MB and is sent in a single request. + + Parameters + ---------- + team_id : str + Team ID. + file : InputFile + Binary image file of at most 5MB. Allowed file types are png, jpg, jpeg, and webp. + on_progress : callable, optional + Optional callback for upload progress + + model_type : Type[T], optional + Pydantic model class for the user-defined data. Defaults to dict for backward compatibility. + + Returns + ------- + Team[T] + API response as a typed Pydantic model + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/teams/{teamId}/photo' + api_params = {} + if team_id is None or team_id == '': + raise AppwriteException('Missing required parameter: "team_id"') + if file is None: + raise AppwriteException('Missing required parameter: "file"') + api_path = api_path.replace('{teamId}', self._encode_path(team_id)) + api_params['file'] = self._normalize_value(file) + + param_name = 'file' + + upload_id = '' + + response = self.client.chunked_upload( + api_path, + { + 'X-Appwrite-Project': self.client.get_config('project'), + 'content-type': 'multipart/form-data', + 'accept': 'application/json', + }, + api_params, + param_name, + on_progress, + upload_id, + method='put', + ) + + return Team.with_data(response, model_type) + + def delete_photo( + self, + team_id: str, + ) -> Dict[str, Any]: + """ + Delete the photo of a team and store the built-in static placeholder in its place. The placeholder is the team's photo from then on, so it takes priority over the initials of the team name until a new photo is uploaded with teams.updatePhoto. + + Parameters + ---------- + team_id : str + Team ID. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/teams/{teamId}/photo' + api_params = {} + if team_id is None or team_id == '': + raise AppwriteException('Missing required parameter: "team_id"') + api_path = api_path.replace('{teamId}', self._encode_path(team_id)) + + response = self.client.call( + 'delete', + api_path, + { + 'X-Appwrite-Project': self.client.get_config('project'), + 'content-type': 'application/json', + 'accept': 'application/json', + }, + api_params, + ) + + return response + def get_prefs( self, team_id: str, diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 4cc28c82..b987b71f 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -36,7 +36,10 @@ result: Function = functions.create( runtime_specification = 's-1vcpu-512mb', # optional deployment_retention = 0, # optional interval = 0, # optional - description = '' # optional + description = '', # optional + provider_comments = False, # optional + provider_deployments = False, # optional + provider_statuses = False # optional ) print(result.model_dump()) diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 2efde2fb..f8ac3f78 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -37,6 +37,9 @@ result: Function = functions.update( deployment_retention = 0, # optional interval = 0, # optional description = '', # optional + provider_comments = False, # optional + provider_deployments = False, # optional + provider_statuses = False, # optional email_enabled = False # optional ) diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index 81c8d759..3ba8c5b1 100644 --- a/docs/examples/project/get-o-auth-2-provider.md +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -26,6 +26,19 @@ from appwrite.models import OAuth2Notion from appwrite.models import OAuth2Salesforce from appwrite.models import OAuth2Yahoo from appwrite.models import OAuth2HuggingFace +from appwrite.models import OAuth2Instagram +from appwrite.models import OAuth2Patreon +from appwrite.models import OAuth2Strava +from appwrite.models import OAuth2VK +from appwrite.models import OAuth2Netlify +from appwrite.models import OAuth2Railway +from appwrite.models import OAuth2Reddit +from appwrite.models import OAuth2Vercel +from appwrite.models import OAuth2Atlassian +from appwrite.models import OAuth2Line +from appwrite.models import OAuth2Linear +from appwrite.models import OAuth2Roblox +from appwrite.models import OAuth2WorkOS from appwrite.models import OAuth2Resend from appwrite.models import OAuth2Cloudflare from appwrite.models import OAuth2Linkedin @@ -59,7 +72,7 @@ client.set_key('') # Your secret API key project = Project(client) -result: Union[OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Webflow, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Resend, OAuth2Cloudflare, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft, OAuth2TikTok, OAuth2Kakao, OAuth2Naver, OAuth2Vipps] = project.get_o_auth2_provider( +result: Union[OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Webflow, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2HuggingFace, OAuth2Instagram, OAuth2Patreon, OAuth2Strava, OAuth2VK, OAuth2Netlify, OAuth2Railway, OAuth2Reddit, OAuth2Vercel, OAuth2Atlassian, OAuth2Line, OAuth2Linear, OAuth2Roblox, OAuth2WorkOS, OAuth2Resend, OAuth2Cloudflare, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft, OAuth2TikTok, OAuth2Kakao, OAuth2Naver, OAuth2Vipps] = project.get_o_auth2_provider( provider_id = ProjectOAuthProviderId.AMAZON ) diff --git a/docs/examples/project/update-o-auth-2-atlassian.md b/docs/examples/project/update-o-auth-2-atlassian.md new file mode 100644 index 00000000..0ef6309a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-atlassian.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Atlassian + +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: OAuth2Atlassian = project.update_o_auth2_atlassian( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-instagram.md b/docs/examples/project/update-o-auth-2-instagram.md new file mode 100644 index 00000000..273fb50e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-instagram.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Instagram + +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: OAuth2Instagram = project.update_o_auth2_instagram( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-line.md b/docs/examples/project/update-o-auth-2-line.md new file mode 100644 index 00000000..07b81e20 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-line.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Line + +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: OAuth2Line = project.update_o_auth2_line( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-linear.md b/docs/examples/project/update-o-auth-2-linear.md new file mode 100644 index 00000000..bcfa7d1f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-linear.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Linear + +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: OAuth2Linear = project.update_o_auth2_linear( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-netlify.md b/docs/examples/project/update-o-auth-2-netlify.md new file mode 100644 index 00000000..79df88c8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-netlify.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Netlify + +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: OAuth2Netlify = project.update_o_auth2_netlify( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-patreon.md b/docs/examples/project/update-o-auth-2-patreon.md new file mode 100644 index 00000000..c142e189 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-patreon.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Patreon + +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: OAuth2Patreon = project.update_o_auth2_patreon( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-railway.md b/docs/examples/project/update-o-auth-2-railway.md new file mode 100644 index 00000000..6cb5e2d7 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-railway.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Railway + +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: OAuth2Railway = project.update_o_auth2_railway( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-reddit.md b/docs/examples/project/update-o-auth-2-reddit.md new file mode 100644 index 00000000..7fe3b4f9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-reddit.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Reddit + +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: OAuth2Reddit = project.update_o_auth2_reddit( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-roblox.md b/docs/examples/project/update-o-auth-2-roblox.md new file mode 100644 index 00000000..f8dd7aef --- /dev/null +++ b/docs/examples/project/update-o-auth-2-roblox.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Roblox + +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: OAuth2Roblox = project.update_o_auth2_roblox( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-strava.md b/docs/examples/project/update-o-auth-2-strava.md new file mode 100644 index 00000000..793ca645 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-strava.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Strava + +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: OAuth2Strava = project.update_o_auth2_strava( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-vercel.md b/docs/examples/project/update-o-auth-2-vercel.md new file mode 100644 index 00000000..bdad321c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-vercel.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2Vercel + +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: OAuth2Vercel = project.update_o_auth2_vercel( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2-work-os.md b/docs/examples/project/update-o-auth-2-work-os.md new file mode 100644 index 00000000..e52f97f7 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-work-os.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2WorkOS + +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: OAuth2WorkOS = project.update_o_auth2_work_os( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/project/update-o-auth-2vk.md b/docs/examples/project/update-o-auth-2vk.md new file mode 100644 index 00000000..599c18dd --- /dev/null +++ b/docs/examples/project/update-o-auth-2vk.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.project import Project +from appwrite.models import OAuth2VK + +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: OAuth2VK = project.update_o_auth2_vk( + client_id = '', # optional + client_secret = '', # optional + enabled = False # optional +) + +print(result.model_dump()) +``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index c993e6fb..1f94c5b8 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -39,7 +39,10 @@ result: Site = sites.create( runtime_specification = 's-1vcpu-512mb', # optional deployment_retention = 0, # optional scopes = [ProjectKeyScopes.PROJECT_READ], # optional - description = '' # optional + description = '', # optional + provider_comments = False, # optional + provider_deployments = False, # optional + provider_statuses = False # optional ) print(result.model_dump()) diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index f6f5bbdd..0a629829 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -39,7 +39,10 @@ result: Site = sites.update( runtime_specification = 's-1vcpu-512mb', # optional deployment_retention = 0, # optional scopes = [ProjectKeyScopes.PROJECT_READ], # optional - description = '' # optional + description = '', # optional + provider_comments = False, # optional + provider_deployments = False, # optional + provider_statuses = False # optional ) print(result.model_dump()) diff --git a/docs/examples/teams/delete-photo.md b/docs/examples/teams/delete-photo.md new file mode 100644 index 00000000..fa8f5804 --- /dev/null +++ b/docs/examples/teams/delete-photo.md @@ -0,0 +1,15 @@ +```python +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.delete_photo( + team_id = '' +) +``` diff --git a/docs/examples/teams/get-photo.md b/docs/examples/teams/get-photo.md new file mode 100644 index 00000000..26e50644 --- /dev/null +++ b/docs/examples/teams/get-photo.md @@ -0,0 +1,19 @@ +```python +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result: bytes = teams.get_photo( + team_id = '', + width = 0, # optional + height = 0, # optional + quality = 0, # optional + output = 'png' # optional +) +``` diff --git a/docs/examples/teams/update-photo.md b/docs/examples/teams/update-photo.md new file mode 100644 index 00000000..ba751ad5 --- /dev/null +++ b/docs/examples/teams/update-photo.md @@ -0,0 +1,20 @@ +```python +from appwrite.client import Client +from appwrite.services.teams import Teams +from appwrite.input_file import InputFile +from appwrite.models import Team + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result: Team = teams.update_photo( + team_id = '', + file = InputFile.from_path('file.png') +) + +print(result.model_dump()) +``` diff --git a/pyproject.toml b/pyproject.toml index 62e46a2f..15b94de4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "appwrite" -version = "27.3.0" +version = "28.0.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.10" diff --git a/setup.py b/setup.py index 9c71ba88..5eee618a 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='appwrite', packages=setuptools.find_packages(), - version='27.3.0', + version='28.0.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/27.3.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/28.0.0.tar.gz', install_requires=[ 'requests>=2.34.2,<3', 'urllib3>=2.8.0,<3', diff --git a/test/services/test_functions.py b/test/services/test_functions.py index c8c0593e..8c64bd84 100644 --- a/test/services/test_functions.py +++ b/test/services/test_functions.py @@ -82,6 +82,9 @@ def test_create(self, m): "providerBranch": "main", "providerRootDirectory": "functions\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", @@ -120,6 +123,9 @@ def test_create(self, m): deployment_retention=1, interval=1, description='', + provider_comments=False, + provider_deployments=False, + provider_statuses=False, ) request = m.last_request url = urlsplit(request.url) @@ -155,6 +161,9 @@ def test_create(self, m): 'deploymentRetention': 1, 'interval': 1, 'description': '', + 'providerComments': False, + 'providerDeployments': False, + 'providerStatuses': False, }, ) self.assertEqual(response.to_dict(), data) @@ -255,6 +264,9 @@ def test_get(self, m): "providerBranch": "main", "providerRootDirectory": "functions\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", @@ -313,6 +325,9 @@ def test_update(self, m): "providerBranch": "main", "providerRootDirectory": "functions\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", @@ -351,6 +366,9 @@ def test_update(self, m): deployment_retention=1, interval=1, description='', + provider_comments=False, + provider_deployments=False, + provider_statuses=False, email_enabled=False, ) request = m.last_request @@ -386,6 +404,9 @@ def test_update(self, m): 'deploymentRetention': 1, 'interval': 1, 'description': '', + 'providerComments': False, + 'providerDeployments': False, + 'providerStatuses': False, 'emailEnabled': False, }, ) @@ -446,6 +467,9 @@ def test_update_function_deployment(self, m): "providerBranch": "main", "providerRootDirectory": "functions\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", diff --git a/test/services/test_project.py b/test/services/test_project.py index 2f72e472..7173a31d 100644 --- a/test/services/test_project.py +++ b/test/services/test_project.py @@ -1116,6 +1116,43 @@ def test_update_o_auth2_appwrite(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_atlassian(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "uQ7mZ3s0000000000000000000000000", + "clientSecret": "ATOA0000000000000000000000000000000000000000000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_atlassian( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/atlassian', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_auth0(self, m): data = { @@ -1849,6 +1886,43 @@ def test_update_o_auth2_hugging_face(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_instagram(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "00000000000000000000000000000000", + "clientSecret": "00000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_instagram( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/instagram', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_kakao(self, m): data = { @@ -1969,6 +2043,80 @@ def test_update_o_auth2_kick(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_line(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "1650000000", + "clientSecret": "a1b2c3d4e5f600000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_line( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/line', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + + @requests_mock.Mocker() + def test_update_o_auth2_linear(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "5e1c0000000000000000000000000000", + "clientSecret": "9f8e7d6c5b4a00000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_linear( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/linear', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_linkedin(self, m): data = { @@ -2086,6 +2234,43 @@ def test_update_o_auth2_naver(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_netlify(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "00000000000000000000000000000000", + "clientSecret": "00000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_netlify( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/netlify', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_notion(self, m): data = { @@ -2223,6 +2408,43 @@ def test_update_o_auth2_okta(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_patreon(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "00000000000000000000000000000000", + "clientSecret": "00000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_patreon( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/patreon', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_paypal(self, m): data = { @@ -2334,6 +2556,80 @@ def test_update_o_auth2_podio(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_railway(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "00000000000000000000000000000000", + "clientSecret": "00000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_railway( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/railway', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + + @requests_mock.Mocker() + def test_update_o_auth2_reddit(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "aBcD0000000000000000aB", + "clientSecret": "xYz00000000000000000000000000a", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_reddit( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/reddit', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_resend(self, m): data = { @@ -2371,6 +2667,43 @@ def test_update_o_auth2_resend(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_roblox(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "1234567890123456789", + "clientSecret": "RBX-0000000000000000000000000000000000000000000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_roblox( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/roblox', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_salesforce(self, m): data = { @@ -2485,6 +2818,43 @@ def test_update_o_auth2_spotify(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_strava(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "00000000000000000000000000000000", + "clientSecret": "00000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_strava( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/strava', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_stripe(self, m): data = { @@ -2670,6 +3040,43 @@ def test_update_o_auth2_twitch(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_vercel(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "cl_0000000000000000000000000000000", + "clientSecret": "vc_0000000000000000000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_vercel( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/vercel', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_vipps(self, m): data = { @@ -2744,6 +3151,43 @@ def test_update_o_auth2_vipps_sandbox(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_vk(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "00000000000000000000000000000000", + "clientSecret": "00000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_vk( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/vk', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_webflow(self, m): data = { @@ -2818,6 +3262,43 @@ def test_update_o_auth2_word_press(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_update_o_auth2_work_os(self, m): + data = { + "$id": "github", + "enabled": True, + "clientId": "client_01H0000000000000000000000", + "clientSecret": "wos0000000000000000000000000000000000000000000000000000000000000", + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PATCH', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.project.update_o_auth2_work_os( + client_id='', + client_secret='', + enabled=False, + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/project/oauth2/workos', + ) + sent = json.loads(request.body or '{}') + self.assertEqual( + sent, + { + 'clientId': '', + 'clientSecret': '', + 'enabled': False, + }, + ) + self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() def test_update_o_auth2_x(self, m): data = { diff --git a/test/services/test_sites.py b/test/services/test_sites.py index 72e61804..5bcb525e 100644 --- a/test/services/test_sites.py +++ b/test/services/test_sites.py @@ -82,6 +82,9 @@ def test_create(self, m): "providerBranch": "main", "providerRootDirectory": "sites\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", @@ -125,6 +128,9 @@ def test_create(self, m): deployment_retention=1, scopes=[], description='', + provider_comments=False, + provider_deployments=False, + provider_statuses=False, ) request = m.last_request url = urlsplit(request.url) @@ -161,6 +167,9 @@ def test_create(self, m): 'deploymentRetention': 1, 'scopes': [], 'description': '', + 'providerComments': False, + 'providerDeployments': False, + 'providerStatuses': False, }, ) self.assertEqual(response.to_dict(), data) @@ -261,6 +270,9 @@ def test_get(self, m): "providerBranch": "main", "providerRootDirectory": "sites\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", @@ -323,6 +335,9 @@ def test_update(self, m): "providerBranch": "main", "providerRootDirectory": "sites\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", @@ -366,6 +381,9 @@ def test_update(self, m): deployment_retention=1, scopes=[], description='', + provider_comments=False, + provider_deployments=False, + provider_statuses=False, ) request = m.last_request url = urlsplit(request.url) @@ -401,6 +419,9 @@ def test_update(self, m): 'deploymentRetention': 1, 'scopes': [], 'description': '', + 'providerComments': False, + 'providerDeployments': False, + 'providerStatuses': False, }, ) self.assertEqual(response.to_dict(), data) @@ -460,6 +481,9 @@ def test_update_analytics(self, m): "providerBranch": "main", "providerRootDirectory": "sites\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", @@ -528,6 +552,9 @@ def test_update_site_deployment(self, m): "providerBranch": "main", "providerRootDirectory": "sites\/helloWorld", "providerSilentMode": True, + "providerComments": True, + "providerDeployments": True, + "providerStatuses": True, "providerBranches": [], "providerPaths": [], "buildSpecification": "s-1vcpu-512mb", diff --git a/test/services/test_teams.py b/test/services/test_teams.py index 20116807..5dc873a8 100644 --- a/test/services/test_teams.py +++ b/test/services/test_teams.py @@ -600,6 +600,106 @@ def test_update_membership_status(self, m): ) self.assertEqual(response.to_dict(), data) + @requests_mock.Mocker() + def test_get_photo(self, m): + data = bytearray() + headers = {'Content-Type': 'application/octet-stream'} + m.request( + 'GET', + requests_mock.ANY, + body=data, + headers=headers, + ) + response = self.teams.get_photo( + '', + width=1, + height=1, + quality=1, + output='png', + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/teams//photo', + ) + sent = parse_qs(url.query, keep_blank_values=True) + self.assertEqual( + sent, + { + 'width': ['1'], + 'height': ['1'], + 'quality': ['1'], + 'output': ['png'], + }, + ) + self.assertEqual(response, data) + + @requests_mock.Mocker() + def test_update_photo(self, m): + data = { + "$id": "5e5ea5c16897e", + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "$updatedAt": "2020-10-15T06:38:00.000+00:00", + "name": "VIP", + "total": 7.0, + "prefs": {}, + } + headers = {'Content-Type': 'application/json'} + m.request( + 'PUT', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.teams.update_photo( + '', + InputFile.from_bytes(bytearray(), "example.file"), + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/teams//photo', + ) + sent = dict( + re.findall( + r'form-data; name="([^"\[]+)[^\r\n]*\r\n(?:[^\r\n]+\r\n)*\r\n(.*?)\r\n--', + request.body.decode('latin-1'), + re.S, + ) + ) + self.assertEqual( + sent, + { + 'file': '', + }, + ) + self.assertEqual(response.to_dict(), data) + + @requests_mock.Mocker() + def test_delete_photo(self, m): + data = '' + headers = {'Content-Type': 'application/json'} + m.request( + 'DELETE', + requests_mock.ANY, + text=json.dumps(data), + headers=headers, + ) + response = self.teams.delete_photo( + '', + ) + request = m.last_request + url = urlsplit(request.url) + self.assertEqual( + unquote(url.path), + '/v1/teams//photo', + ) + sent = json.loads(request.body or '{}') + self.assertEqual(sent, {}) + self.assertEqual(response, data) + @requests_mock.Mocker() def test_get_prefs(self, m): data = {}