Skip to content

Commit 4c0cdeb

Browse files
authored
feat: SDK update for version 22.2.0 (#152)
* chore: update Python SDK to 22.0.0 * chore: update Python SDK to 22.0.0 * chore: update Python SDK to 22.1.0 * chore: update Python SDK to 22.2.0 * chore: update Python SDK to 22.2.0
1 parent 8b7af1f commit 4c0cdeb

41 files changed

Lines changed: 1671 additions & 9 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check out code
12-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
12+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1313

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

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change Log
22

3+
## 22.2.0
4+
5+
* 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`)
6+
* Added: `installation_scopes` and `installation_redirect_url` parameters to `apps.update`
7+
* Added: app installation management methods to `organization` and `teams` services
8+
* Added: `installation_access_token_duration` parameter to `project.update_o_auth2_server`
9+
* Added: `installationScopes` and `installationRedirectUrl` fields to `App` model
10+
* Added: `organization.installations.read`/`organization.installations.write` key scopes
11+
312
## 22.1.0
413

514
* Updated: removed `new_specification` parameter from `backups.create_restoration`

appwrite/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def __init__(self):
1717
self._endpoint = 'https://cloud.appwrite.io/v1'
1818
self._global_headers = {
1919
'content-type': '',
20-
'user-agent' : f'AppwritePythonSDK/22.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
20+
'user-agent' : f'AppwritePythonSDK/22.2.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
2121
'x-sdk-name': 'Python',
2222
'x-sdk-platform': 'server',
2323
'x-sdk-language': 'python',
24-
'x-sdk-version': '22.1.0',
24+
'x-sdk-version': '22.2.0',
2525
'X-Appwrite-Response-Format' : '1.9.5',
2626
}
2727
self._config = {}

appwrite/enums/organization_key_scopes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class OrganizationKeyScopes(Enum):
77
DEVKEYS_WRITE = "devKeys.write"
88
ORGANIZATION_KEYS_READ = "organization.keys.read"
99
ORGANIZATION_KEYS_WRITE = "organization.keys.write"
10+
ORGANIZATION_INSTALLATIONS_READ = "organization.installations.read"
11+
ORGANIZATION_INSTALLATIONS_WRITE = "organization.installations.write"
1012
ORGANIZATION_MEMBERSHIPS_READ = "organization.memberships.read"
1113
ORGANIZATION_MEMBERSHIPS_WRITE = "organization.memberships.write"
1214
ORGANIZATION_READ = "organization.read"

appwrite/models/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@
243243
from .app_secret import AppSecret
244244
from .app_secret_plaintext import AppSecretPlaintext
245245
from .app_scope import AppScope
246+
from .app_installation import AppInstallation
247+
from .app_key import AppKey
246248
from .oauth2_authorize import Oauth2Authorize
247249
from .oauth2_approve import Oauth2Approve
248250
from .oauth2_reject import Oauth2Reject
@@ -265,6 +267,8 @@
265267
from .apps_list import AppsList
266268
from .app_secret_list import AppSecretList
267269
from .app_scope_list import AppScopeList
270+
from .app_installation_list import AppInstallationList
271+
from .app_key_list import AppKeyList
268272

269273
__all__ = [
270274
'AppwriteModel',
@@ -512,6 +516,8 @@
512516
'AppSecret',
513517
'AppSecretPlaintext',
514518
'AppScope',
519+
'AppInstallation',
520+
'AppKey',
515521
'Oauth2Authorize',
516522
'Oauth2Approve',
517523
'Oauth2Reject',
@@ -534,4 +540,6 @@
534540
'AppsList',
535541
'AppSecretList',
536542
'AppScopeList',
543+
'AppInstallationList',
544+
'AppKeyList',
537545
]

appwrite/models/app.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ class App(AppwriteModel):
5656
ID of team that owns the application, if owned by team. Otherwise, user ID will be used.
5757
userid : str
5858
ID of user who owns the application, if owned by user. Otherwise, team ID will be used.
59+
installationscopes : List[Any]
60+
Scopes the application requests when installed on a team. Organization-level and project-level scopes only.
61+
installationredirecturl : str
62+
URL users are redirected to after creating or updating an installation of this application. Empty for no redirect.
5963
secrets : List[AppSecret]
6064
List of application secrets.
6165
"""
@@ -82,4 +86,6 @@ class App(AppwriteModel):
8286
deviceflow: bool = Field(..., alias='deviceFlow')
8387
teamid: str = Field(..., alias='teamId')
8488
userid: str = Field(..., alias='userId')
89+
installationscopes: List[Any] = Field(..., alias='installationScopes')
90+
installationredirecturl: str = Field(..., alias='installationRedirectUrl')
8591
secrets: List[AppSecret] = Field(..., alias='secrets')
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from typing import Any, Dict, List, Optional, Union, cast
2+
from pydantic import Field, PrivateAttr
3+
4+
from .base_model import AppwriteModel
5+
6+
class AppInstallation(AppwriteModel):
7+
"""
8+
AppInstallation
9+
10+
Attributes
11+
----------
12+
id : str
13+
Installation ID.
14+
createdat : str
15+
Installation creation time in ISO 8601 format.
16+
updatedat : str
17+
Installation update time in ISO 8601 format.
18+
appid : str
19+
ID of the installed application.
20+
teamid : str
21+
ID of the team the application is installed on.
22+
scopes : List[Any]
23+
Scopes granted to the application. Snapshot of the application's installation scopes taken when the installation was created or last updated.
24+
authorizationdetails : Dict[str, Any]
25+
Authorization details granted to the application. Rich authorization request (RFC 9396) style entries; the Appwrite Console stores authorized project IDs here.
26+
createdbyid : str
27+
ID of the user who created the installation.
28+
createdbyname : str
29+
Name of the user who created the installation.
30+
lastaccessedat : Optional[str]
31+
Time an access token was last issued for the installation in ISO 8601 format. Null if never used.
32+
"""
33+
id: str = Field(..., alias='$id')
34+
createdat: str = Field(..., alias='$createdAt')
35+
updatedat: str = Field(..., alias='$updatedAt')
36+
appid: str = Field(..., alias='appId')
37+
teamid: str = Field(..., alias='teamId')
38+
scopes: List[Any] = Field(..., alias='scopes')
39+
authorizationdetails: Dict[str, Any] = Field(..., alias='authorizationDetails')
40+
createdbyid: str = Field(..., alias='createdById')
41+
createdbyname: str = Field(..., alias='createdByName')
42+
lastaccessedat: Optional[str] = Field(default=None, alias='lastAccessedAt')
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Any, Dict, List, Optional, Union, cast
2+
from pydantic import Field, PrivateAttr
3+
4+
from .base_model import AppwriteModel
5+
from .app_installation import AppInstallation
6+
7+
class AppInstallationList(AppwriteModel):
8+
"""
9+
App installations list
10+
11+
Attributes
12+
----------
13+
total : float
14+
Total number of installations that matched your query.
15+
installations : List[AppInstallation]
16+
List of installations.
17+
"""
18+
total: float = Field(..., alias='total')
19+
installations: List[AppInstallation] = Field(..., alias='installations')

appwrite/models/app_key.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from typing import Any, Dict, List, Optional, Union, cast
2+
from pydantic import Field, PrivateAttr
3+
4+
from .base_model import AppwriteModel
5+
6+
class AppKey(AppwriteModel):
7+
"""
8+
AppKey
9+
10+
Attributes
11+
----------
12+
id : str
13+
App key ID.
14+
createdat : str
15+
App key creation time in ISO 8601 format.
16+
updatedat : str
17+
App key update time in ISO 8601 format.
18+
appid : str
19+
Application ID this app key belongs to.
20+
secret : str
21+
App key secret.
22+
hint : str
23+
Last few characters of the app key secret, used to help identify it.
24+
createdbyid : str
25+
ID of the user who created the app key.
26+
createdbyname : str
27+
Name of the user who created the app key.
28+
lastaccessedat : Optional[str]
29+
Time the app key was last used for authentication in ISO 8601 format. Null if never used.
30+
"""
31+
id: str = Field(..., alias='$id')
32+
createdat: str = Field(..., alias='$createdAt')
33+
updatedat: str = Field(..., alias='$updatedAt')
34+
appid: str = Field(..., alias='appId')
35+
secret: str = Field(..., alias='secret')
36+
hint: str = Field(..., alias='hint')
37+
createdbyid: str = Field(..., alias='createdById')
38+
createdbyname: str = Field(..., alias='createdByName')
39+
lastaccessedat: Optional[str] = Field(default=None, alias='lastAccessedAt')

appwrite/models/app_key_list.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Any, Dict, List, Optional, Union, cast
2+
from pydantic import Field, PrivateAttr
3+
4+
from .base_model import AppwriteModel
5+
from .app_key import AppKey
6+
7+
class AppKeyList(AppwriteModel):
8+
"""
9+
App keys list
10+
11+
Attributes
12+
----------
13+
total : float
14+
Total number of keys that matched your query.
15+
keys : List[AppKey]
16+
List of keys.
17+
"""
18+
total: float = Field(..., alias='total')
19+
keys: List[AppKey] = Field(..., alias='keys')

0 commit comments

Comments
 (0)