Skip to content

Commit

Permalink
chore: release rc
Browse files Browse the repository at this point in the history
  • Loading branch information
christyjacob4 committed Aug 17, 2024
1 parent 0379959 commit d312ab7
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite Python SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.5.7-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand Down
6 changes: 3 additions & 3 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent' : 'AppwritePythonSDK/5.0.3 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
'user-agent' : 'AppwritePythonSDK/6.0.0-rc.1 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '5.0.3',
'X-Appwrite-Response-Format' : '1.5.0',
'x-sdk-version': '6.0.0-rc.1',
'X-Appwrite-Response-Format' : '1.6.0',
}

def set_self_signed(self, status=True):
Expand Down
12 changes: 4 additions & 8 deletions appwrite/services/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def update_mfa(self, mfa):
}, api_params)

def create_mfa_authenticator(self, type):
"""Add Authenticator"""
"""Create Authenticator"""


api_path = '/account/mfa/authenticators/{type}'
Expand Down Expand Up @@ -167,7 +167,7 @@ def update_mfa_authenticator(self, type, otp):
'content-type': 'application/json',
}, api_params)

def delete_mfa_authenticator(self, type, otp):
def delete_mfa_authenticator(self, type):
"""Delete Authenticator"""


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

if otp is None:
raise AppwriteException('Missing required parameter: "otp"')

api_path = api_path.replace('{type}', type)

api_params['otp'] = otp

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

def create_mfa_challenge(self, factor):
"""Create 2FA Challenge"""
"""Create MFA Challenge"""


api_path = '/account/mfa/challenge'
Expand Down Expand Up @@ -693,7 +689,7 @@ def create_phone_verification(self):
}, api_params)

def update_phone_verification(self, user_id, secret):
"""Create phone verification (confirmation)"""
"""Update phone verification (confirmation)"""


api_path = '/account/verification/phone'
Expand Down
57 changes: 46 additions & 11 deletions appwrite/services/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def list(self, queries = None, search = None):
'content-type': 'application/json',
}, api_params)

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):
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):
"""Create function"""


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

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

return self.client.call('get', api_path, {
'content-type': 'application/json',
}, api_params)

def list_templates(self, runtimes = None, use_cases = None, limit = None, offset = None):
"""List function templates"""


api_path = '/functions/templates'
api_params = {}

api_params['runtimes'] = runtimes
api_params['useCases'] = use_cases
api_params['limit'] = limit
api_params['offset'] = offset

return self.client.call('get', api_path, {
'content-type': 'application/json',
}, api_params)

def get_template(self, template_id):
"""Get function template"""


api_path = '/functions/templates/{templateId}'
api_params = {}
if template_id is None:
raise AppwriteException('Missing required parameter: "template_id"')

api_path = api_path.replace('{templateId}', template_id)


return self.client.call('get', api_path, {
'content-type': 'application/json',
}, api_params)
Expand Down Expand Up @@ -210,7 +242,7 @@ def get_deployment(self, function_id, deployment_id):
}, api_params)

def update_deployment(self, function_id, deployment_id):
"""Update function deployment"""
"""Update deployment"""


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

def download_deployment(self, function_id, deployment_id):
"""Download Deployment"""
def get_deployment_download(self, function_id, deployment_id):
"""Download deployment"""


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

def create_execution(self, function_id, body = None, xasync = None, path = None, method = None, headers = None, scheduled_at = None):
def create_execution(self, function_id, body = None, xasync = None, path = None, method = None, headers = None, scheduled_at = None, on_progress = None):
"""Create execution"""


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

api_params['body'] = body
api_params['async'] = xasync
api_params['async'] = str(xasync).lower() if type(xasync) is bool else xasync
api_params['path'] = path
api_params['method'] = method
api_params['headers'] = headers
api_params['headers'] = str(headers).lower() if type(headers) is bool else headers
api_params['scheduledAt'] = scheduled_at

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

upload_id = ''

return self.client.chunked_upload(api_path, {
'content-type': 'multipart/form-data',
}, api_params, param_name, on_progress, upload_id)

def get_execution(self, function_id, execution_id):
"""Get execution"""
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/account/delete-mfa-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ client.set_session('') # The user session to authenticate with
account = Account(client)

result = account.delete_mfa_authenticator(
type = AuthenticatorType.TOTP,
otp = '<OTP>'
type = AuthenticatorType.TOTP
)
2 changes: 1 addition & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ result = functions.create(
template_repository = '<TEMPLATE_REPOSITORY>', # optional
template_owner = '<TEMPLATE_OWNER>', # optional
template_root_directory = '<TEMPLATE_ROOT_DIRECTORY>', # optional
template_branch = '<TEMPLATE_BRANCH>' # optional
template_version = '<TEMPLATE_VERSION>' # optional
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ from appwrite.client import Client
client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('&lt;YOUR_PROJECT_ID&gt;') # Your project ID
client.set_key('&lt;YOUR_API_KEY&gt;') # Your secret API key
client.set_session('') # The user session to authenticate with

functions = Functions(client)

result = functions.download_deployment(
result = functions.get_deployment_download(
function_id = '<FUNCTION_ID>',
deployment_id = '<DEPLOYMENT_ID>'
)
11 changes: 11 additions & 0 deletions docs/examples/functions/get-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from appwrite.client import Client

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('&lt;YOUR_PROJECT_ID&gt;') # Your project ID

functions = Functions(client)

result = functions.get_template(
template_id = '<TEMPLATE_ID>'
)
14 changes: 14 additions & 0 deletions docs/examples/functions/list-templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from appwrite.client import Client

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('&lt;YOUR_PROJECT_ID&gt;') # Your project ID

functions = Functions(client)

result = functions.list_templates(
runtimes = [], # optional
use_cases = [], # optional
limit = 1, # optional
offset = 0 # optional
)
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
'appwrite/encoders',
'appwrite/enums',
],
version = '5.0.3',
version = '6.0.0-rc.1',
license='BSD-3-Clause',
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',
long_description = long_description,
long_description_content_type = 'text/markdown',
author = 'Appwrite Team',
author_email = 'team@appwrite.io',
author_email = 'team@localhost.test',
maintainer = 'Appwrite Team',
maintainer_email = 'team@appwrite.io',
maintainer_email = 'team@localhost.test',
url = 'https://appwrite.io/support',
download_url='https://github.com/appwrite/sdk-for-python/archive/5.0.3.tar.gz',
download_url='https://github.com/appwrite/sdk-for-python/archive/6.0.0-rc.1.tar.gz',
install_requires=[
'requests',
],
Expand Down

0 comments on commit d312ab7

Please sign in to comment.