Skip to content

Commit d312ab7

Browse files
committed
chore: release rc
1 parent 0379959 commit d312ab7

File tree

10 files changed

+87
-32
lines changed

10 files changed

+87
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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.7-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.6.0-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)

appwrite/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ def __init__(self):
1313
self._endpoint = 'https://cloud.appwrite.io/v1'
1414
self._global_headers = {
1515
'content-type': '',
16-
'user-agent' : 'AppwritePythonSDK/5.0.3 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
16+
'user-agent' : 'AppwritePythonSDK/6.0.0-rc.1 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
1717
'x-sdk-name': 'Python',
1818
'x-sdk-platform': 'server',
1919
'x-sdk-language': 'python',
20-
'x-sdk-version': '5.0.3',
21-
'X-Appwrite-Response-Format' : '1.5.0',
20+
'x-sdk-version': '6.0.0-rc.1',
21+
'X-Appwrite-Response-Format' : '1.6.0',
2222
}
2323

2424
def set_self_signed(self, status=True):

appwrite/services/account.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def update_mfa(self, mfa):
132132
}, api_params)
133133

134134
def create_mfa_authenticator(self, type):
135-
"""Add Authenticator"""
135+
"""Create Authenticator"""
136136

137137

138138
api_path = '/account/mfa/authenticators/{type}'
@@ -167,7 +167,7 @@ def update_mfa_authenticator(self, type, otp):
167167
'content-type': 'application/json',
168168
}, api_params)
169169

170-
def delete_mfa_authenticator(self, type, otp):
170+
def delete_mfa_authenticator(self, type):
171171
"""Delete Authenticator"""
172172

173173

@@ -176,19 +176,15 @@ def delete_mfa_authenticator(self, type, otp):
176176
if type is None:
177177
raise AppwriteException('Missing required parameter: "type"')
178178

179-
if otp is None:
180-
raise AppwriteException('Missing required parameter: "otp"')
181-
182179
api_path = api_path.replace('{type}', type)
183180

184-
api_params['otp'] = otp
185181

186182
return self.client.call('delete', api_path, {
187183
'content-type': 'application/json',
188184
}, api_params)
189185

190186
def create_mfa_challenge(self, factor):
191-
"""Create 2FA Challenge"""
187+
"""Create MFA Challenge"""
192188

193189

194190
api_path = '/account/mfa/challenge'
@@ -693,7 +689,7 @@ def create_phone_verification(self):
693689
}, api_params)
694690

695691
def update_phone_verification(self, user_id, secret):
696-
"""Create phone verification (confirmation)"""
692+
"""Update phone verification (confirmation)"""
697693

698694

699695
api_path = '/account/verification/phone'

appwrite/services/functions.py

Lines changed: 46 additions & 11 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, 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):
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_version = None):
2424
"""Create function"""
2525

2626

@@ -56,7 +56,7 @@ def create(self, function_id, name, runtime, execute = None, events = None, sche
5656
api_params['templateRepository'] = template_repository
5757
api_params['templateOwner'] = template_owner
5858
api_params['templateRootDirectory'] = template_root_directory
59-
api_params['templateBranch'] = template_branch
59+
api_params['templateVersion'] = template_version
6060

6161
return self.client.call('post', api_path, {
6262
'content-type': 'application/json',
@@ -69,6 +69,38 @@ def list_runtimes(self):
6969
api_path = '/functions/runtimes'
7070
api_params = {}
7171

72+
return self.client.call('get', api_path, {
73+
'content-type': 'application/json',
74+
}, api_params)
75+
76+
def list_templates(self, runtimes = None, use_cases = None, limit = None, offset = None):
77+
"""List function templates"""
78+
79+
80+
api_path = '/functions/templates'
81+
api_params = {}
82+
83+
api_params['runtimes'] = runtimes
84+
api_params['useCases'] = use_cases
85+
api_params['limit'] = limit
86+
api_params['offset'] = offset
87+
88+
return self.client.call('get', api_path, {
89+
'content-type': 'application/json',
90+
}, api_params)
91+
92+
def get_template(self, template_id):
93+
"""Get function template"""
94+
95+
96+
api_path = '/functions/templates/{templateId}'
97+
api_params = {}
98+
if template_id is None:
99+
raise AppwriteException('Missing required parameter: "template_id"')
100+
101+
api_path = api_path.replace('{templateId}', template_id)
102+
103+
72104
return self.client.call('get', api_path, {
73105
'content-type': 'application/json',
74106
}, api_params)
@@ -210,7 +242,7 @@ def get_deployment(self, function_id, deployment_id):
210242
}, api_params)
211243

212244
def update_deployment(self, function_id, deployment_id):
213-
"""Update function deployment"""
245+
"""Update deployment"""
214246

215247

216248
api_path = '/functions/{functionId}/deployments/{deploymentId}'
@@ -290,8 +322,8 @@ def update_deployment_build(self, function_id, deployment_id):
290322
'content-type': 'application/json',
291323
}, api_params)
292324

293-
def download_deployment(self, function_id, deployment_id):
294-
"""Download Deployment"""
325+
def get_deployment_download(self, function_id, deployment_id):
326+
"""Download deployment"""
295327

296328

297329
api_path = '/functions/{functionId}/deployments/{deploymentId}/download'
@@ -328,7 +360,7 @@ def list_executions(self, function_id, queries = None, search = None):
328360
'content-type': 'application/json',
329361
}, api_params)
330362

331-
def create_execution(self, function_id, body = None, xasync = None, path = None, method = None, headers = None, scheduled_at = None):
363+
def create_execution(self, function_id, body = None, xasync = None, path = None, method = None, headers = None, scheduled_at = None, on_progress = None):
332364
"""Create execution"""
333365

334366

@@ -340,15 +372,18 @@ def create_execution(self, function_id, body = None, xasync = None, path = None,
340372
api_path = api_path.replace('{functionId}', function_id)
341373

342374
api_params['body'] = body
343-
api_params['async'] = xasync
375+
api_params['async'] = str(xasync).lower() if type(xasync) is bool else xasync
344376
api_params['path'] = path
345377
api_params['method'] = method
346-
api_params['headers'] = headers
378+
api_params['headers'] = str(headers).lower() if type(headers) is bool else headers
347379
api_params['scheduledAt'] = scheduled_at
348380

349-
return self.client.call('post', api_path, {
350-
'content-type': 'application/json',
351-
}, api_params)
381+
382+
upload_id = ''
383+
384+
return self.client.chunked_upload(api_path, {
385+
'content-type': 'multipart/form-data',
386+
}, api_params, param_name, on_progress, upload_id)
352387

353388
def get_execution(self, function_id, execution_id):
354389
"""Get execution"""

docs/examples/account/delete-mfa-authenticator.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ client.set_session('') # The user session to authenticate with
99
account = Account(client)
1010

1111
result = account.delete_mfa_authenticator(
12-
type = AuthenticatorType.TOTP,
13-
otp = '<OTP>'
12+
type = AuthenticatorType.TOTP
1413
)

docs/examples/functions/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ result = functions.create(
2929
template_repository = '<TEMPLATE_REPOSITORY>', # optional
3030
template_owner = '<TEMPLATE_OWNER>', # optional
3131
template_root_directory = '<TEMPLATE_ROOT_DIRECTORY>', # optional
32-
template_branch = '<TEMPLATE_BRANCH>' # optional
32+
template_version = '<TEMPLATE_VERSION>' # optional
3333
)

docs/examples/functions/download-deployment.md renamed to docs/examples/functions/get-deployment-download.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ from appwrite.client import Client
33
client = Client()
44
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
55
client.set_project('&lt;YOUR_PROJECT_ID&gt;') # Your project ID
6-
client.set_key('&lt;YOUR_API_KEY&gt;') # Your secret API key
6+
client.set_session('') # The user session to authenticate with
77

88
functions = Functions(client)
99

10-
result = functions.download_deployment(
10+
result = functions.get_deployment_download(
1111
function_id = '<FUNCTION_ID>',
1212
deployment_id = '<DEPLOYMENT_ID>'
1313
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from appwrite.client import Client
2+
3+
client = Client()
4+
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
5+
client.set_project('&lt;YOUR_PROJECT_ID&gt;') # Your project ID
6+
7+
functions = Functions(client)
8+
9+
result = functions.get_template(
10+
template_id = '<TEMPLATE_ID>'
11+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from appwrite.client import Client
2+
3+
client = Client()
4+
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
5+
client.set_project('&lt;YOUR_PROJECT_ID&gt;') # Your project ID
6+
7+
functions = Functions(client)
8+
9+
result = functions.list_templates(
10+
runtimes = [], # optional
11+
use_cases = [], # optional
12+
limit = 1, # optional
13+
offset = 0 # optional
14+
)

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
'appwrite/encoders',
1414
'appwrite/enums',
1515
],
16-
version = '5.0.3',
16+
version = '6.0.0-rc.1',
1717
license='BSD-3-Clause',
1818
description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API',
1919
long_description = long_description,
2020
long_description_content_type = 'text/markdown',
2121
author = 'Appwrite Team',
22-
author_email = 'team@appwrite.io',
22+
author_email = 'team@localhost.test',
2323
maintainer = 'Appwrite Team',
24-
maintainer_email = 'team@appwrite.io',
24+
maintainer_email = 'team@localhost.test',
2525
url = 'https://appwrite.io/support',
26-
download_url='https://github.com/appwrite/sdk-for-python/archive/5.0.3.tar.gz',
26+
download_url='https://github.com/appwrite/sdk-for-python/archive/6.0.0-rc.1.tar.gz',
2727
install_requires=[
2828
'requests',
2929
],

0 commit comments

Comments
 (0)