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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

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

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

## 22.2.0

* Added: `apps` installation and key management methods (`list_installations`, `get_installation`, `create_installation_token`, `list_installation_scopes`, `list_keys`, `create_key`, `get_key`, `delete_key`)
* Added: `installation_scopes` and `installation_redirect_url` parameters to `apps.update`
* Added: app installation management methods to `organization` and `teams` services
* Added: `installation_access_token_duration` parameter to `project.update_o_auth2_server`
* Added: `installationScopes` and `installationRedirectUrl` fields to `App` model
* Added: `organization.installations.read`/`organization.installations.write` key scopes

## 22.1.0

* Updated: removed `new_specification` parameter from `backups.create_restoration`
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.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'user-agent' : f'AppwritePythonSDK/22.2.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.1.0',
'x-sdk-version': '22.2.0',
'X-Appwrite-Response-Format' : '1.9.5',
}
self._config = {}
Expand Down
2 changes: 2 additions & 0 deletions appwrite/enums/organization_key_scopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class OrganizationKeyScopes(Enum):
DEVKEYS_WRITE = "devKeys.write"
ORGANIZATION_KEYS_READ = "organization.keys.read"
ORGANIZATION_KEYS_WRITE = "organization.keys.write"
ORGANIZATION_INSTALLATIONS_READ = "organization.installations.read"
ORGANIZATION_INSTALLATIONS_WRITE = "organization.installations.write"
ORGANIZATION_MEMBERSHIPS_READ = "organization.memberships.read"
ORGANIZATION_MEMBERSHIPS_WRITE = "organization.memberships.write"
ORGANIZATION_READ = "organization.read"
Expand Down
8 changes: 8 additions & 0 deletions appwrite/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@
from .app_secret import AppSecret
from .app_secret_plaintext import AppSecretPlaintext
from .app_scope import AppScope
from .app_installation import AppInstallation
from .app_key import AppKey
from .oauth2_authorize import Oauth2Authorize
from .oauth2_approve import Oauth2Approve
from .oauth2_reject import Oauth2Reject
Expand All @@ -265,6 +267,8 @@
from .apps_list import AppsList
from .app_secret_list import AppSecretList
from .app_scope_list import AppScopeList
from .app_installation_list import AppInstallationList
from .app_key_list import AppKeyList

__all__ = [
'AppwriteModel',
Expand Down Expand Up @@ -512,6 +516,8 @@
'AppSecret',
'AppSecretPlaintext',
'AppScope',
'AppInstallation',
'AppKey',
'Oauth2Authorize',
'Oauth2Approve',
'Oauth2Reject',
Expand All @@ -534,4 +540,6 @@
'AppsList',
'AppSecretList',
'AppScopeList',
'AppInstallationList',
'AppKeyList',
]
6 changes: 6 additions & 0 deletions appwrite/models/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class App(AppwriteModel):
ID of team that owns the application, if owned by team. Otherwise, user ID will be used.
userid : str
ID of user who owns the application, if owned by user. Otherwise, team ID will be used.
installationscopes : List[Any]
Scopes the application requests when installed on a team. Organization-level and project-level scopes only.
installationredirecturl : str
URL users are redirected to after creating or updating an installation of this application. Empty for no redirect.
secrets : List[AppSecret]
List of application secrets.
"""
Expand All @@ -82,4 +86,6 @@ class App(AppwriteModel):
deviceflow: bool = Field(..., alias='deviceFlow')
teamid: str = Field(..., alias='teamId')
userid: str = Field(..., alias='userId')
installationscopes: List[Any] = Field(..., alias='installationScopes')
installationredirecturl: str = Field(..., alias='installationRedirectUrl')
secrets: List[AppSecret] = Field(..., alias='secrets')
42 changes: 42 additions & 0 deletions appwrite/models/app_installation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from typing import Any, Dict, List, Optional, Union, cast
from pydantic import Field, PrivateAttr

from .base_model import AppwriteModel

class AppInstallation(AppwriteModel):
"""
AppInstallation

Attributes
----------
id : str
Installation ID.
createdat : str
Installation creation time in ISO 8601 format.
updatedat : str
Installation update time in ISO 8601 format.
appid : str
ID of the installed application.
teamid : str
ID of the team the application is installed on.
scopes : List[Any]
Scopes granted to the application. Snapshot of the application's installation scopes taken when the installation was created or last updated.
authorizationdetails : Dict[str, Any]
Authorization details granted to the application. Rich authorization request (RFC 9396) style entries; the Appwrite Console stores authorized project IDs here.
createdbyid : str
ID of the user who created the installation.
createdbyname : str
Name of the user who created the installation.
lastaccessedat : Optional[str]
Time an access token was last issued for the installation in ISO 8601 format. Null if never used.
"""
id: str = Field(..., alias='$id')
createdat: str = Field(..., alias='$createdAt')
updatedat: str = Field(..., alias='$updatedAt')
appid: str = Field(..., alias='appId')
teamid: str = Field(..., alias='teamId')
scopes: List[Any] = Field(..., alias='scopes')
authorizationdetails: Dict[str, Any] = Field(..., alias='authorizationDetails')
createdbyid: str = Field(..., alias='createdById')
createdbyname: str = Field(..., alias='createdByName')
lastaccessedat: Optional[str] = Field(default=None, alias='lastAccessedAt')
19 changes: 19 additions & 0 deletions appwrite/models/app_installation_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_installation import AppInstallation

class AppInstallationList(AppwriteModel):
"""
App installations list

Attributes
----------
total : float
Total number of installations that matched your query.
installations : List[AppInstallation]
List of installations.
"""
total: float = Field(..., alias='total')
installations: List[AppInstallation] = Field(..., alias='installations')
39 changes: 39 additions & 0 deletions appwrite/models/app_key.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

class AppKey(AppwriteModel):
"""
AppKey

Attributes
----------
id : str
App key ID.
createdat : str
App key creation time in ISO 8601 format.
updatedat : str
App key update time in ISO 8601 format.
appid : str
Application ID this app key belongs to.
secret : str
App key secret.
hint : str
Last few characters of the app key secret, used to help identify it.
createdbyid : str
ID of the user who created the app key.
createdbyname : str
Name of the user who created the app key.
lastaccessedat : Optional[str]
Time the app key was last used for authentication in ISO 8601 format. Null if never used.
"""
id: str = Field(..., alias='$id')
createdat: str = Field(..., alias='$createdAt')
updatedat: str = Field(..., alias='$updatedAt')
appid: str = Field(..., alias='appId')
secret: str = Field(..., alias='secret')
hint: str = Field(..., alias='hint')
createdbyid: str = Field(..., alias='createdById')
createdbyname: str = Field(..., alias='createdByName')
lastaccessedat: Optional[str] = Field(default=None, alias='lastAccessedAt')
19 changes: 19 additions & 0 deletions appwrite/models/app_key_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_key import AppKey

class AppKeyList(AppwriteModel):
"""
App keys list

Attributes
----------
total : float
Total number of keys that matched your query.
keys : List[AppKey]
List of keys.
"""
total: float = Field(..., alias='total')
keys: List[AppKey] = Field(..., alias='keys')
6 changes: 6 additions & 0 deletions appwrite/models/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class Database(AppwriteModel):
Database type.
status : Optional[DatabaseStatus]
Dedicated database lifecycle status. Null when the database has no valid dedicated backing.
engine : Optional[str]
Underlying engine of the dedicated backing: postgresql, mysql, mariadb, or mongodb. A managed product (tablesdb, documentsdb, vectorsdb) reports the engine it runs on, so its type and engine can differ. Null when the database has no dedicated backing.
specification : Optional[str]
Compute specification identifier of the dedicated backing, e.g. s-2vcpu-2gb. Null when the database has no dedicated backing.
replicas : Optional[float]
Number of secondary high availability replicas, excluding the primary. Null when backing configuration is unavailable.
policies : Optional[List[BackupPolicy]]
Expand All @@ -41,6 +45,8 @@ class Database(AppwriteModel):
enabled: bool = Field(..., alias='enabled')
type: DatabaseType = Field(..., alias='type')
status: Optional[DatabaseStatus] = Field(default=None, alias='status')
engine: Optional[str] = Field(default=None, alias='engine')
specification: Optional[str] = Field(default=None, alias='specification')
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')
3 changes: 3 additions & 0 deletions appwrite/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class Project(AppwriteModel):
OAuth2 server access token duration in seconds for public clients (SPAs, mobile, native)
oauth2serverpublicrefreshtokenduration : Optional[float]
OAuth2 server refresh token duration in seconds for public clients (SPAs, mobile, native)
oauth2serverinstallationaccesstokenduration : Optional[float]
OAuth2 server access token duration in seconds for app installation access tokens
oauth2serverconfidentialpkce : Optional[bool]
When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting.
oauth2serververificationurl : Optional[str]
Expand Down Expand Up @@ -142,6 +144,7 @@ class Project(AppwriteModel):
oauth2serverrefreshtokenduration: Optional[float] = Field(default=None, alias='oAuth2ServerRefreshTokenDuration')
oauth2serverpublicaccesstokenduration: Optional[float] = Field(default=None, alias='oAuth2ServerPublicAccessTokenDuration')
oauth2serverpublicrefreshtokenduration: Optional[float] = Field(default=None, alias='oAuth2ServerPublicRefreshTokenDuration')
oauth2serverinstallationaccesstokenduration: Optional[float] = Field(default=None, alias='oAuth2ServerInstallationAccessTokenDuration')
oauth2serverconfidentialpkce: Optional[bool] = Field(default=None, alias='oAuth2ServerConfidentialPkce')
oauth2serververificationurl: Optional[str] = Field(default=None, alias='oAuth2ServerVerificationUrl')
oauth2serverusercodelength: Optional[float] = Field(default=None, alias='oAuth2ServerUserCodeLength')
Expand Down
Loading