Skip to content

Commit 0379959

Browse files
feat: 1.6.x
1 parent ad531fe commit 0379959

File tree

269 files changed

+554
-447
lines changed

Some content is hidden

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

269 files changed

+554
-447
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Appwrite Python SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.5.7-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
88

9-
**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
9+
**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).**
1010

1111
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
1212

appwrite/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def call(self, method, path='', headers=None, params=None, response_type='json')
113113

114114
response.raise_for_status()
115115

116+
warnings = response.headers.get('x-appwrite-warning')
117+
if warnings:
118+
for warning in warnings.split(';'):
119+
print(f'Warning: {warning}')
120+
116121
content_type = response.headers['Content-Type']
117122

118123
if response_type == 'location':

appwrite/enums/name.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Name(Enum):
88
V1_FUNCTIONS = "v1-functions"
99
V1_USAGE = "v1-usage"
1010
V1_USAGE_DUMP = "v1-usage-dump"
11-
WEBHOOKSV1 = "webhooksv1"
11+
V1_WEBHOOKS = "v1-webhooks"
1212
V1_CERTIFICATES = "v1-certificates"
1313
V1_BUILDS = "v1-builds"
1414
V1_MESSAGING = "v1-messaging"

appwrite/enums/runtime.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ class Runtime(Enum):
4646
CPP_17 = "cpp-17"
4747
CPP_20 = "cpp-20"
4848
BUN_1_0 = "bun-1.0"
49+
GO_1_22 = "go-1.22"

appwrite/services/account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def create_jwt(self):
9595
"""Create JWT"""
9696

9797

98-
api_path = '/account/jwt'
98+
api_path = '/account/jwts'
9999
api_params = {}
100100

101101
return self.client.call('post', api_path, {

appwrite/services/functions.py

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def list(self, queries = None, search = None):
2020
'content-type': 'application/json',
2121
}, api_params)
2222

23-
def create(self, function_id, name, runtime, execute = None, events = None, schedule = None, timeout = None, enabled = None, logging = None, entrypoint = None, commands = None, installation_id = None, provider_repository_id = None, provider_branch = None, provider_silent_mode = None, provider_root_directory = None, template_repository = None, template_owner = None, template_root_directory = None, template_branch = None):
23+
def create(self, function_id, name, runtime, execute = None, events = None, schedule = None, timeout = None, enabled = None, logging = None, entrypoint = None, commands = None, scopes = None, installation_id = None, provider_repository_id = None, provider_branch = None, provider_silent_mode = None, provider_root_directory = None, template_repository = None, template_owner = None, template_root_directory = None, template_branch = None):
2424
"""Create function"""
2525

2626

@@ -47,6 +47,7 @@ def create(self, function_id, name, runtime, execute = None, events = None, sche
4747
api_params['logging'] = logging
4848
api_params['entrypoint'] = entrypoint
4949
api_params['commands'] = commands
50+
api_params['scopes'] = scopes
5051
api_params['installationId'] = installation_id
5152
api_params['providerRepositoryId'] = provider_repository_id
5253
api_params['providerBranch'] = provider_branch
@@ -88,7 +89,7 @@ def get(self, function_id):
8889
'content-type': 'application/json',
8990
}, api_params)
9091

91-
def update(self, function_id, name, runtime = None, execute = None, events = None, schedule = None, timeout = None, enabled = None, logging = None, entrypoint = None, commands = None, installation_id = None, provider_repository_id = None, provider_branch = None, provider_silent_mode = None, provider_root_directory = None):
92+
def update(self, function_id, name, runtime = None, execute = None, events = None, schedule = None, timeout = None, enabled = None, logging = None, entrypoint = None, commands = None, scopes = None, installation_id = None, provider_repository_id = None, provider_branch = None, provider_silent_mode = None, provider_root_directory = None):
9293
"""Update function"""
9394

9495

@@ -112,6 +113,7 @@ def update(self, function_id, name, runtime = None, execute = None, events = Non
112113
api_params['logging'] = logging
113114
api_params['entrypoint'] = entrypoint
114115
api_params['commands'] = commands
116+
api_params['scopes'] = scopes
115117
api_params['installationId'] = installation_id
116118
api_params['providerRepositoryId'] = provider_repository_id
117119
api_params['providerBranch'] = provider_branch
@@ -247,30 +249,47 @@ def delete_deployment(self, function_id, deployment_id):
247249
'content-type': 'application/json',
248250
}, api_params)
249251

250-
def create_build(self, function_id, deployment_id, build_id):
251-
"""Create build"""
252+
def create_build(self, function_id, deployment_id, build_id = None):
253+
"""Rebuild deployment"""
252254

253255

254-
api_path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'
256+
api_path = '/functions/{functionId}/deployments/{deploymentId}/build'
255257
api_params = {}
256258
if function_id is None:
257259
raise AppwriteException('Missing required parameter: "function_id"')
258260

259261
if deployment_id is None:
260262
raise AppwriteException('Missing required parameter: "deployment_id"')
261263

262-
if build_id is None:
263-
raise AppwriteException('Missing required parameter: "build_id"')
264-
265264
api_path = api_path.replace('{functionId}', function_id)
266265
api_path = api_path.replace('{deploymentId}', deployment_id)
267-
api_path = api_path.replace('{buildId}', build_id)
268266

267+
api_params['buildId'] = build_id
269268

270269
return self.client.call('post', api_path, {
271270
'content-type': 'application/json',
272271
}, api_params)
273272

273+
def update_deployment_build(self, function_id, deployment_id):
274+
"""Cancel deployment"""
275+
276+
277+
api_path = '/functions/{functionId}/deployments/{deploymentId}/build'
278+
api_params = {}
279+
if function_id is None:
280+
raise AppwriteException('Missing required parameter: "function_id"')
281+
282+
if deployment_id is None:
283+
raise AppwriteException('Missing required parameter: "deployment_id"')
284+
285+
api_path = api_path.replace('{functionId}', function_id)
286+
api_path = api_path.replace('{deploymentId}', deployment_id)
287+
288+
289+
return self.client.call('patch', api_path, {
290+
'content-type': 'application/json',
291+
}, api_params)
292+
274293
def download_deployment(self, function_id, deployment_id):
275294
"""Download Deployment"""
276295

@@ -309,7 +328,7 @@ def list_executions(self, function_id, queries = None, search = None):
309328
'content-type': 'application/json',
310329
}, api_params)
311330

312-
def create_execution(self, function_id, body = None, xasync = None, path = None, method = None, headers = None):
331+
def create_execution(self, function_id, body = None, xasync = None, path = None, method = None, headers = None, scheduled_at = None):
313332
"""Create execution"""
314333

315334

@@ -325,6 +344,7 @@ def create_execution(self, function_id, body = None, xasync = None, path = None,
325344
api_params['path'] = path
326345
api_params['method'] = method
327346
api_params['headers'] = headers
347+
api_params['scheduledAt'] = scheduled_at
328348

329349
return self.client.call('post', api_path, {
330350
'content-type': 'application/json',
@@ -350,6 +370,26 @@ def get_execution(self, function_id, execution_id):
350370
'content-type': 'application/json',
351371
}, api_params)
352372

373+
def delete_execution(self, function_id, execution_id):
374+
"""Delete execution"""
375+
376+
377+
api_path = '/functions/{functionId}/executions/{executionId}'
378+
api_params = {}
379+
if function_id is None:
380+
raise AppwriteException('Missing required parameter: "function_id"')
381+
382+
if execution_id is None:
383+
raise AppwriteException('Missing required parameter: "execution_id"')
384+
385+
api_path = api_path.replace('{functionId}', function_id)
386+
api_path = api_path.replace('{executionId}', execution_id)
387+
388+
389+
return self.client.call('delete', api_path, {
390+
'content-type': 'application/json',
391+
}, api_params)
392+
353393
def list_variables(self, function_id):
354394
"""List variables"""
355395

appwrite/services/users.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,24 @@ def update_email(self, user_id, email):
330330
'content-type': 'application/json',
331331
}, api_params)
332332

333+
def create_jwt(self, user_id, session_id = None, duration = None):
334+
"""Create user JWT"""
335+
336+
337+
api_path = '/users/{userId}/jwts'
338+
api_params = {}
339+
if user_id is None:
340+
raise AppwriteException('Missing required parameter: "user_id"')
341+
342+
api_path = api_path.replace('{userId}', user_id)
343+
344+
api_params['sessionId'] = session_id
345+
api_params['duration'] = duration
346+
347+
return self.client.call('post', api_path, {
348+
'content-type': 'application/json',
349+
}, api_params)
350+
333351
def update_labels(self, user_id, labels):
334352
"""Update user labels"""
335353

docs/examples/account/create-anonymous-session.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from appwrite.client import Client
22

33
client = Client()
44
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
5-
client.set_project('5df5acd0d48c2') # Your project ID
5+
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
66

77
account = Account(client)
88

docs/examples/account/create-email-password-session.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from appwrite.client import Client
22

33
client = Client()
44
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
5-
client.set_project('5df5acd0d48c2') # Your project ID
5+
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
66

77
account = Account(client)
88

docs/examples/account/create-email-token.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from appwrite.client import Client
22

33
client = Client()
44
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
5-
client.set_project('5df5acd0d48c2') # Your project ID
5+
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
66

77
account = Account(client)
88

0 commit comments

Comments
 (0)