Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.9'

Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## 19.0.0

* Breaking: Renamed `AuthMethod` enum to `ProjectAuthMethodId`
* Breaking: Renamed `EmailTemplateType` to `ProjectEmailTemplateId` and `EmailTemplateLocale` to `ProjectEmailTemplateLocale`
* Breaking: Renamed `ServiceId` to `ProjectServiceId`, `ProtocolId` to `ProjectProtocolId`, `Secure` to `ProjectSMTPSecure`, `ProjectPolicy` to `ProjectPolicyId`
* Breaking: Replaced `Scopes` enum with `ProjectKeyScopes` for project key endpoints
* Breaking: Removed `update_deny_canonical_email_policy`; replaced with `update_deny_aliased_email_policy`, `update_deny_disposable_email_policy`, and `update_deny_free_email_policy`
* Breaking: Removed `AuthProvider` model; use new `ProjectOAuthProviderId` enum instead
* Added: `Project.get` method to fetch current project details
* Added: `Advisor`, `Presences`, and `Usage` services
* Added: `Insight`, `Presence`, `Report`, `UsageEvent`, and `UsageGauge` models with list variants
* Added: `ProjectAuthMethod`, `ProjectProtocol`, and `ProjectService` models
* Added: `ProjectOAuthProviderId` and `ProjectOAuth2GooglePrompt` enums
* Updated: `Project`, `Database`, and `OAuth2Google` model schemas
* Updated: `X-Appwrite-Response-Format` header to `1.9.5`

## 18.1.0

* Added: Introduced `bigint` create/update APIs for legacy Databases attributes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite Python SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.4-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.5-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand Down
6 changes: 3 additions & 3 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent' : f'AppwritePythonSDK/18.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'user-agent' : f'AppwritePythonSDK/19.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': '18.1.0',
'X-Appwrite-Response-Format' : '1.9.4',
'x-sdk-version': '19.0.0',
'X-Appwrite-Response-Format' : '1.9.5',
}

def set_self_signed(self, status=True):
Expand Down
44 changes: 30 additions & 14 deletions appwrite/encoders/value_class_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
from ..enums.name import Name
from ..enums.message_priority import MessagePriority
from ..enums.smtp_encryption import SmtpEncryption
from ..enums.auth_method import AuthMethod
from ..enums.project_policy import ProjectPolicy
from ..enums.protocol_id import ProtocolId
from ..enums.service_id import ServiceId
from ..enums.secure import Secure
from ..enums.email_template_type import EmailTemplateType
from ..enums.email_template_locale import EmailTemplateLocale
from ..enums.project_auth_method_id import ProjectAuthMethodId
from ..enums.project_key_scopes import ProjectKeyScopes
from ..enums.project_o_auth2_google_prompt import ProjectOAuth2GooglePrompt
from ..enums.project_o_auth_provider_id import ProjectOAuthProviderId
from ..enums.project_policy_id import ProjectPolicyId
from ..enums.project_protocol_id import ProjectProtocolId
from ..enums.project_service_id import ProjectServiceId
from ..enums.project_smtp_secure import ProjectSMTPSecure
from ..enums.project_email_template_id import ProjectEmailTemplateId
from ..enums.project_email_template_locale import ProjectEmailTemplateLocale
from ..enums.status_code import StatusCode
from ..enums.proxy_resource_type import ProxyResourceType
from ..enums.framework import Framework
Expand All @@ -48,6 +51,7 @@
from ..enums.deployment_status import DeploymentStatus
from ..enums.execution_trigger import ExecutionTrigger
from ..enums.execution_status import ExecutionStatus
from ..enums.o_auth2_google_prompt import OAuth2GooglePrompt
from ..enums.platform_type import PlatformType
from ..enums.health_antivirus_status import HealthAntivirusStatus
from ..enums.health_check_status import HealthCheckStatus
Expand Down Expand Up @@ -132,25 +136,34 @@ def default(self, o):
if isinstance(o, SmtpEncryption):
return o.value

if isinstance(o, AuthMethod):
if isinstance(o, ProjectAuthMethodId):
return o.value

if isinstance(o, ProjectPolicy):
if isinstance(o, ProjectKeyScopes):
return o.value

if isinstance(o, ProtocolId):
if isinstance(o, ProjectOAuth2GooglePrompt):
return o.value

if isinstance(o, ServiceId):
if isinstance(o, ProjectOAuthProviderId):
return o.value

if isinstance(o, Secure):
if isinstance(o, ProjectPolicyId):
return o.value

if isinstance(o, EmailTemplateType):
if isinstance(o, ProjectProtocolId):
return o.value

if isinstance(o, EmailTemplateLocale):
if isinstance(o, ProjectServiceId):
return o.value

if isinstance(o, ProjectSMTPSecure):
return o.value

if isinstance(o, ProjectEmailTemplateId):
return o.value

if isinstance(o, ProjectEmailTemplateLocale):
return o.value

if isinstance(o, StatusCode):
Expand Down Expand Up @@ -204,6 +217,9 @@ def default(self, o):
if isinstance(o, ExecutionStatus):
return o.value

if isinstance(o, OAuth2GooglePrompt):
return o.value

if isinstance(o, PlatformType):
return o.value

Expand Down
6 changes: 6 additions & 0 deletions appwrite/enums/o_auth2_google_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum

class OAuth2GooglePrompt(Enum):
NONE = "none"
CONSENT = "consent"
SELECT_ACCOUNT = "select_account"
Comment on lines +1 to +6
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Duplicate enum with ProjectOAuth2GooglePrompt

OAuth2GooglePrompt (this file) and ProjectOAuth2GooglePrompt (appwrite/enums/project_o_auth2_google_prompt.py) define the exact same three values (none, consent, select_account). Both are imported and registered in value_class_encoder.py. The encoder handles OAuth2GooglePrompt but no service or model appears to accept it as a parameter — only ProjectOAuth2GooglePrompt is used in project.py. If OAuth2GooglePrompt is a legacy shim it should be marked deprecated; if it is truly redundant it should be removed.

2 changes: 0 additions & 2 deletions appwrite/enums/o_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,3 @@ class OAuthProvider(Enum):
YANDEX = "yandex"
ZOHO = "zoho"
ZOOM = "zoom"
GITHUBIMAGINE = "githubImagine"
GOOGLEIMAGINE = "googleImagine"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

class AuthMethod(Enum):
class ProjectAuthMethodId(Enum):
EMAIL_PASSWORD = "email-password"
MAGIC_URL = "magic-url"
EMAIL_OTP = "email-otp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

class EmailTemplateType(Enum):
class ProjectEmailTemplateId(Enum):
VERIFICATION = "verification"
MAGICSESSION = "magicSession"
RECOVERY = "recovery"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

class EmailTemplateLocale(Enum):
class ProjectEmailTemplateLocale(Enum):
AF = "af"
AR_AE = "ar-ae"
AR_BH = "ar-bh"
Expand Down
97 changes: 97 additions & 0 deletions appwrite/enums/project_key_scopes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
from enum import Enum

class ProjectKeyScopes(Enum):
PROJECT_READ = "project.read"
PROJECT_WRITE = "project.write"
KEYS_READ = "keys.read"
KEYS_WRITE = "keys.write"
PLATFORMS_READ = "platforms.read"
PLATFORMS_WRITE = "platforms.write"
MOCKS_READ = "mocks.read"
MOCKS_WRITE = "mocks.write"
POLICIES_READ = "policies.read"
POLICIES_WRITE = "policies.write"
PROJECT_POLICIES_READ = "project.policies.read"
PROJECT_POLICIES_WRITE = "project.policies.write"
TEMPLATES_READ = "templates.read"
TEMPLATES_WRITE = "templates.write"
OAUTH2_READ = "oauth2.read"
OAUTH2_WRITE = "oauth2.write"
USERS_READ = "users.read"
USERS_WRITE = "users.write"
SESSIONS_READ = "sessions.read"
SESSIONS_WRITE = "sessions.write"
TEAMS_READ = "teams.read"
TEAMS_WRITE = "teams.write"
DATABASES_READ = "databases.read"
DATABASES_WRITE = "databases.write"
TABLES_READ = "tables.read"
TABLES_WRITE = "tables.write"
COLUMNS_READ = "columns.read"
COLUMNS_WRITE = "columns.write"
INDEXES_READ = "indexes.read"
INDEXES_WRITE = "indexes.write"
ROWS_READ = "rows.read"
ROWS_WRITE = "rows.write"
COLLECTIONS_READ = "collections.read"
COLLECTIONS_WRITE = "collections.write"
ATTRIBUTES_READ = "attributes.read"
ATTRIBUTES_WRITE = "attributes.write"
DOCUMENTS_READ = "documents.read"
DOCUMENTS_WRITE = "documents.write"
BUCKETS_READ = "buckets.read"
BUCKETS_WRITE = "buckets.write"
FILES_READ = "files.read"
FILES_WRITE = "files.write"
TOKENS_READ = "tokens.read"
TOKENS_WRITE = "tokens.write"
FUNCTIONS_READ = "functions.read"
FUNCTIONS_WRITE = "functions.write"
EXECUTIONS_READ = "executions.read"
EXECUTIONS_WRITE = "executions.write"
EXECUTION_READ = "execution.read"
EXECUTION_WRITE = "execution.write"
SITES_READ = "sites.read"
SITES_WRITE = "sites.write"
LOG_READ = "log.read"
LOG_WRITE = "log.write"
PROVIDERS_READ = "providers.read"
PROVIDERS_WRITE = "providers.write"
TOPICS_READ = "topics.read"
TOPICS_WRITE = "topics.write"
SUBSCRIBERS_READ = "subscribers.read"
SUBSCRIBERS_WRITE = "subscribers.write"
TARGETS_READ = "targets.read"
TARGETS_WRITE = "targets.write"
MESSAGES_READ = "messages.read"
MESSAGES_WRITE = "messages.write"
RULES_READ = "rules.read"
RULES_WRITE = "rules.write"
WEBHOOKS_READ = "webhooks.read"
WEBHOOKS_WRITE = "webhooks.write"
LOCALE_READ = "locale.read"
AVATARS_READ = "avatars.read"
HEALTH_READ = "health.read"
ASSISTANT_READ = "assistant.read"
MIGRATIONS_READ = "migrations.read"
MIGRATIONS_WRITE = "migrations.write"
SCHEDULES_READ = "schedules.read"
SCHEDULES_WRITE = "schedules.write"
VCS_READ = "vcs.read"
VCS_WRITE = "vcs.write"
INSIGHTS_READ = "insights.read"
INSIGHTS_WRITE = "insights.write"
REPORTS_READ = "reports.read"
REPORTS_WRITE = "reports.write"
PRESENCES_READ = "presences.read"
PRESENCES_WRITE = "presences.write"
BACKUPS_POLICIES_READ = "backups.policies.read"
BACKUPS_POLICIES_WRITE = "backups.policies.write"
ARCHIVES_READ = "archives.read"
ARCHIVES_WRITE = "archives.write"
RESTORATIONS_READ = "restorations.read"
RESTORATIONS_WRITE = "restorations.write"
DOMAINS_READ = "domains.read"
DOMAINS_WRITE = "domains.write"
EVENTS_READ = "events.read"
USAGE_READ = "usage.read"
6 changes: 6 additions & 0 deletions appwrite/enums/project_o_auth2_google_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum

class ProjectOAuth2GooglePrompt(Enum):
NONE = "none"
CONSENT = "consent"
SELECT_ACCOUNT = "select_account"
48 changes: 48 additions & 0 deletions appwrite/enums/project_o_auth_provider_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from enum import Enum

class ProjectOAuthProviderId(Enum):
AMAZON = "amazon"
APPLE = "apple"
AUTH0 = "auth0"
AUTHENTIK = "authentik"
AUTODESK = "autodesk"
BITBUCKET = "bitbucket"
BITLY = "bitly"
BOX = "box"
DAILYMOTION = "dailymotion"
DISCORD = "discord"
DISQUS = "disqus"
DROPBOX = "dropbox"
ETSY = "etsy"
FACEBOOK = "facebook"
FIGMA = "figma"
FUSIONAUTH = "fusionauth"
GITHUB = "github"
GITLAB = "gitlab"
GOOGLE = "google"
KEYCLOAK = "keycloak"
KICK = "kick"
LINKEDIN = "linkedin"
MICROSOFT = "microsoft"
NOTION = "notion"
OIDC = "oidc"
OKTA = "okta"
PAYPAL = "paypal"
PAYPALSANDBOX = "paypalSandbox"
PODIO = "podio"
SALESFORCE = "salesforce"
SLACK = "slack"
SPOTIFY = "spotify"
STRIPE = "stripe"
TRADESHIFT = "tradeshift"
TRADESHIFTBOX = "tradeshiftBox"
TWITCH = "twitch"
WORDPRESS = "wordpress"
X = "x"
YAHOO = "yahoo"
YAMMER = "yammer"
YANDEX = "yandex"
ZOHO = "zoho"
ZOOM = "zoom"
GITHUBIMAGINE = "githubImagine"
GOOGLEIMAGINE = "googleImagine"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

class ProjectPolicy(Enum):
class ProjectPolicyId(Enum):
PASSWORD_DICTIONARY = "password-dictionary"
PASSWORD_HISTORY = "password-history"
PASSWORD_PERSONAL_DATA = "password-personal-data"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

class ProtocolId(Enum):
class ProjectProtocolId(Enum):
REST = "rest"
GRAPHQL = "graphql"
WEBSOCKET = "websocket"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

class ServiceId(Enum):
class ProjectServiceId(Enum):
ACCOUNT = "account"
AVATARS = "avatars"
DATABASES = "databases"
Expand All @@ -18,3 +18,4 @@ class ServiceId(Enum):
GRAPHQL = "graphql"
MIGRATIONS = "migrations"
MESSAGING = "messaging"
ADVISOR = "advisor"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum

class Secure(Enum):
class ProjectSMTPSecure(Enum):
TLS = "tls"
SSL = "ssl"
7 changes: 7 additions & 0 deletions appwrite/enums/scopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ class Scopes(Enum):
SCHEDULES_WRITE = "schedules.write"
VCS_READ = "vcs.read"
VCS_WRITE = "vcs.write"
INSIGHTS_READ = "insights.read"
INSIGHTS_WRITE = "insights.write"
REPORTS_READ = "reports.read"
REPORTS_WRITE = "reports.write"
PRESENCES_READ = "presences.read"
PRESENCES_WRITE = "presences.write"
BACKUPS_POLICIES_READ = "backups.policies.read"
BACKUPS_POLICIES_WRITE = "backups.policies.write"
ARCHIVES_READ = "archives.read"
Expand All @@ -88,3 +94,4 @@ class Scopes(Enum):
DOMAINS_READ = "domains.read"
DOMAINS_WRITE = "domains.write"
EVENTS_READ = "events.read"
USAGE_READ = "usage.read"
Loading