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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log

## 22.1.0

* Updated: removed `new_specification` parameter from `backups.create_restoration`
* Updated: `Database.policies` and `Database.archives` are now optional
* Added: account OAuth2 consent methods `list_consents`, `get_consent`, `delete_consent` and consent token methods
* Added: `Oauth2Consent` and `Oauth2ConsentToken` models
* Added: `oauth2.authorize_post` method and `oauth2.introspect` key scope
* Added: `apps.list_o_auth2_scopes` method and `AppScope` model
* Added: geolocation, connection, and SDK attribution fields on `ActivityEvent`
* Added: `token` parameter to `sites.get_deployment_download`
* Updated: `AppSecret.secret` is always empty; the secret is returned only on creation

## 22.0.0

* Breaking: removed `Health` service and all health models and enums
Expand Down
4 changes: 2 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent' : f'AppwritePythonSDK/22.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'user-agent' : f'AppwritePythonSDK/22.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '22.0.0',
'x-sdk-version': '22.1.0',
'X-Appwrite-Response-Format' : '1.9.5',
}
self._config = {}
Expand Down
11 changes: 11 additions & 0 deletions appwrite/enums/database_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,15 @@
class DatabaseStatus(Enum):
PROVISIONING = "provisioning"
READY = "ready"
INACTIVE = "inactive"
PAUSED = "paused"
FAILED = "failed"
DELETING = "deleting"
DELETED = "deleted"
RESTORING = "restoring"
SCALING = "scaling"
UPGRADING = "upgrading"
MIGRATING = "migrating"
PAUSING = "pausing"
RESUMING = "resuming"
FAILING_OVER = "failing-over"
3 changes: 3 additions & 0 deletions appwrite/enums/database_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ class DatabaseType(Enum):
TABLESDB = "tablesdb"
DOCUMENTSDB = "documentsdb"
VECTORSDB = "vectorsdb"
MYSQL = "mysql"
POSTGRESQL = "postgresql"
MONGODB = "mongodb"
3 changes: 3 additions & 0 deletions appwrite/enums/project_key_scopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,12 @@ class ProjectKeyScopes(Enum):
DEDICATEDDATABASES_EXECUTE = "dedicatedDatabases.execute"
DOMAINS_READ = "domains.read"
DOMAINS_WRITE = "domains.write"
WAFRULES_READ = "wafRules.read"
WAFRULES_WRITE = "wafRules.write"
EVENTS_READ = "events.read"
APPS_READ = "apps.read"
APPS_WRITE = "apps.write"
OAUTH2_READ = "oauth2.read"
OAUTH2_WRITE = "oauth2.write"
OAUTH2_INTROSPECT = "oauth2.introspect"
USAGE_READ = "usage.read"
32 changes: 32 additions & 0 deletions appwrite/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@
from .billing_plan_dedicated_database_limits import BillingPlanDedicatedDatabaseLimits
from .billing_plan_supported_addons import BillingPlanSupportedAddons
from .block import Block
from .dedicated_database import DedicatedDatabase
from .database_status import DatabaseStatus
from .dedicated_database_member import DedicatedDatabaseMember
from .dedicated_database_replicas import DedicatedDatabaseReplicas
from .organization import Organization
from .backup_policy import BackupPolicy
from .policy_deny_aliased_email import PolicyDenyAliasedEmail
Expand All @@ -228,27 +232,39 @@
from .policy_deny_corporate_email import PolicyDenyCorporateEmail
from .program import Program
from .backup_restoration import BackupRestoration
from .dedicated_database_specification import DedicatedDatabaseSpecification
from .dedicated_database_specification_list import DedicatedDatabaseSpecificationList
from .dedicated_database_specification_pricing import DedicatedDatabaseSpecificationPricing
from .database_status_connections import DatabaseStatusConnections
from .database_status_replica import DatabaseStatusReplica
from .database_status_volume import DatabaseStatusVolume
from .usage_billing_plan import UsageBillingPlan
from .app import App
from .app_secret import AppSecret
from .app_secret_plaintext import AppSecretPlaintext
from .app_scope import AppScope
from .oauth2_authorize import Oauth2Authorize
from .oauth2_approve import Oauth2Approve
from .oauth2_reject import Oauth2Reject
from .oauth2_grant import Oauth2Grant
from .oauth2_device_authorization import Oauth2DeviceAuthorization
from .oauth2_par import Oauth2PAR
from .oauth2_token import Oauth2Token
from .oauth2_consent import Oauth2Consent
from .oauth2_consent_token import Oauth2ConsentToken
from .oauth2_project import Oauth2Project
from .oauth2_organization import Oauth2Organization
from .oauth2_project_list import Oauth2ProjectList
from .oauth2_organization_list import Oauth2OrganizationList
from .oauth2_consent_list import Oauth2ConsentList
from .oauth2_consent_token_list import Oauth2ConsentTokenList
from .activity_event_list import ActivityEventList
from .backup_archive_list import BackupArchiveList
from .backup_policy_list import BackupPolicyList
from .backup_restoration_list import BackupRestorationList
from .apps_list import AppsList
from .app_secret_list import AppSecretList
from .app_scope_list import AppScopeList

__all__ = [
'AppwriteModel',
Expand Down Expand Up @@ -473,6 +489,10 @@
'BillingPlanDedicatedDatabaseLimits',
'BillingPlanSupportedAddons',
'Block',
'DedicatedDatabase',
'DatabaseStatus',
'DedicatedDatabaseMember',
'DedicatedDatabaseReplicas',
'Organization',
'BackupPolicy',
'PolicyDenyAliasedEmail',
Expand All @@ -481,25 +501,37 @@
'PolicyDenyCorporateEmail',
'Program',
'BackupRestoration',
'DedicatedDatabaseSpecification',
'DedicatedDatabaseSpecificationList',
'DedicatedDatabaseSpecificationPricing',
'DatabaseStatusConnections',
'DatabaseStatusReplica',
'DatabaseStatusVolume',
'UsageBillingPlan',
'App',
'AppSecret',
'AppSecretPlaintext',
'AppScope',
'Oauth2Authorize',
'Oauth2Approve',
'Oauth2Reject',
'Oauth2Grant',
'Oauth2DeviceAuthorization',
'Oauth2PAR',
'Oauth2Token',
'Oauth2Consent',
'Oauth2ConsentToken',
'Oauth2Project',
'Oauth2Organization',
'Oauth2ProjectList',
'Oauth2OrganizationList',
'Oauth2ConsentList',
'Oauth2ConsentTokenList',
'ActivityEventList',
'BackupArchiveList',
'BackupPolicyList',
'BackupRestorationList',
'AppsList',
'AppSecretList',
'AppScopeList',
]
33 changes: 33 additions & 0 deletions appwrite/models/activity_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ class ActivityEvent(AppwriteModel):
API mode when event triggered.
country : str
Location.
continentcode : str
Continent code.
city : str
City name.
subdivisions : str
Region/state chain.
isp : str
Internet service provider.
autonomoussystemnumber : str
Autonomous System Number (ASN).
autonomoussystemorganization : str
Organization that owns the ASN.
connectiontype : str
Connection type (e.g. cable, cellular, corporate).
connectionusagetype : str
User type (e.g. residential, business, hosting).
connectionorganization : str
Registered organization of the IP.
time : str
Log creation date in ISO 8601 format.
projectid : str
Expand All @@ -45,6 +63,10 @@ class ActivityEvent(AppwriteModel):
Team ID.
hostname : str
Hostname.
sdk : str
Name of the SDK that triggered the event.
sdkversion : str
Version of the SDK that triggered the event.
"""
id: str = Field(..., alias='$id')
actortype: str = Field(..., alias='actorType')
Expand All @@ -60,7 +82,18 @@ class ActivityEvent(AppwriteModel):
ip: str = Field(..., alias='ip')
mode: str = Field(..., alias='mode')
country: str = Field(..., alias='country')
continentcode: str = Field(..., alias='continentCode')
city: str = Field(..., alias='city')
subdivisions: str = Field(..., alias='subdivisions')
isp: str = Field(..., alias='isp')
autonomoussystemnumber: str = Field(..., alias='autonomousSystemNumber')
autonomoussystemorganization: str = Field(..., alias='autonomousSystemOrganization')
connectiontype: str = Field(..., alias='connectionType')
connectionusagetype: str = Field(..., alias='connectionUsageType')
connectionorganization: str = Field(..., alias='connectionOrganization')
time: str = Field(..., alias='time')
projectid: str = Field(..., alias='projectId')
teamid: str = Field(..., alias='teamId')
hostname: str = Field(..., alias='hostname')
sdk: str = Field(..., alias='sdk')
sdkversion: str = Field(..., alias='sdkVersion')
27 changes: 27 additions & 0 deletions appwrite/models/app_scope.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from typing import Any, Dict, List, Optional, Union, cast
from pydantic import Field, PrivateAttr

from .base_model import AppwriteModel

class AppScope(AppwriteModel):
"""
AppScope

Attributes
----------
value : str
Scope value as requested by apps.
description : str
Human-readable description of what the scope grants.
type : str
What the scope grants access to. One of `account`, `project`, or `organization`. Only `project` and `organization` scopes are installable.
category : str
Scope category, used to group scopes on consent and installation screens.
deprecated : bool
Whether the scope is deprecated. Deprecated scopes can still be requested but should not be offered for new grants.
"""
value: str = Field(..., alias='value')
description: str = Field(..., alias='description')
type: str = Field(..., alias='type')
category: str = Field(..., alias='category')
deprecated: bool = Field(..., alias='deprecated')
19 changes: 19 additions & 0 deletions appwrite/models/app_scope_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from typing import Any, Dict, List, Optional, Union, cast
from pydantic import Field, PrivateAttr

from .base_model import AppwriteModel
from .app_scope import AppScope

class AppScopeList(AppwriteModel):
"""
App scopes list

Attributes
----------
total : float
Total number of scopes that matched your query.
scopes : List[AppScope]
List of scopes.
"""
total: float = Field(..., alias='total')
scopes: List[AppScope] = Field(..., alias='scopes')
2 changes: 1 addition & 1 deletion appwrite/models/app_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AppSecret(AppwriteModel):
appid : str
Application ID this secret belongs to.
secret : str
Hashed application client secret.
Always empty. The application client secret is returned only once, in the response of the createSecret method.
hint : str
Last few characters of the client secret, used to help identify it.
createdbyid : str
Expand Down
2 changes: 1 addition & 1 deletion appwrite/models/app_secret_plaintext.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AppSecretPlaintext(AppwriteModel):
appid : str
Application ID this secret belongs to.
secret : str
Application client secret. Returned in full only when the secret is created; subsequent reads return a masked value.
Application client secret. Returned only when the secret is created; subsequent reads always return an empty value.
hint : str
Last few characters of the client secret, used to help identify it.
createdbyid : str
Expand Down
3 changes: 3 additions & 0 deletions appwrite/models/billing_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class BillingPlan(AppwriteModel):
Members
webhooks : float
Webhooks
wafrules : float
Maximum WAF rules per project
projects : float
Projects
platforms : float
Expand Down Expand Up @@ -165,6 +167,7 @@ class BillingPlan(AppwriteModel):
screenshotsgenerated: float = Field(..., alias='screenshotsGenerated')
members: float = Field(..., alias='members')
webhooks: float = Field(..., alias='webhooks')
wafrules: float = Field(..., alias='wafRules')
projects: float = Field(..., alias='projects')
platforms: float = Field(..., alias='platforms')
users: float = Field(..., alias='users')
Expand Down
13 changes: 8 additions & 5 deletions appwrite/models/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class Database(AppwriteModel):
type : DatabaseType
Database type.
status : Optional[DatabaseStatus]
Database status. Possible values: `provisioning`, `ready` or `failed`
policies : List[BackupPolicy]
Dedicated database lifecycle status. Null when the database has no valid dedicated backing.
replicas : Optional[float]
Number of secondary high availability replicas, excluding the primary. Null when backing configuration is unavailable.
policies : Optional[List[BackupPolicy]]
Database backup policies.
archives : List[BackupArchive]
archives : Optional[List[BackupArchive]]
Database backup archives.
"""
id: str = Field(..., alias='$id')
Expand All @@ -39,5 +41,6 @@ class Database(AppwriteModel):
enabled: bool = Field(..., alias='enabled')
type: DatabaseType = Field(..., alias='type')
status: Optional[DatabaseStatus] = Field(default=None, alias='status')
policies: List[BackupPolicy] = Field(..., alias='policies')
archives: List[BackupArchive] = Field(..., alias='archives')
replicas: Optional[float] = Field(default=None, alias='replicas')
policies: Optional[List[BackupPolicy]] = Field(default=None, alias='policies')
archives: Optional[List[BackupArchive]] = Field(default=None, alias='archives')
39 changes: 39 additions & 0 deletions appwrite/models/database_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from typing import Any, Dict, List, Optional, Union, cast
from pydantic import Field, PrivateAttr

from .base_model import AppwriteModel
from .database_status_connections import DatabaseStatusConnections
from .database_status_replica import DatabaseStatusReplica
from .database_status_volume import DatabaseStatusVolume

class DatabaseStatus(AppwriteModel):
"""
Status

Attributes
----------
health : str
Overall health status: healthy, degraded, or unhealthy.
ready : bool
Whether the database is ready to accept connections.
engine : str
Database engine: postgresql, mysql, mariadb, or mongodb.
version : str
Database engine version.
uptime : float
Database uptime in seconds.
connections : DatabaseStatusConnections
Connection statistics.
replicas : List[DatabaseStatusReplica]
List of database replicas and their status.
volumes : List[DatabaseStatusVolume]
Storage volume information.
"""
health: str = Field(..., alias='health')
ready: bool = Field(..., alias='ready')
engine: str = Field(..., alias='engine')
version: str = Field(..., alias='version')
uptime: float = Field(..., alias='uptime')
connections: DatabaseStatusConnections = Field(..., alias='connections')
replicas: List[DatabaseStatusReplica] = Field(..., alias='replicas')
volumes: List[DatabaseStatusVolume] = Field(..., alias='volumes')
18 changes: 18 additions & 0 deletions appwrite/models/database_status_connections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import Any, Dict, List, Optional, Union, cast
from pydantic import Field, PrivateAttr

from .base_model import AppwriteModel

class DatabaseStatusConnections(AppwriteModel):
"""
Connections

Attributes
----------
current : float
Current number of active connections.
max : float
Maximum allowed connections.
"""
current: float = Field(..., alias='current')
max: float = Field(..., alias='max')
Loading