Skip to content

Commit

Permalink
Release candidate 4 for 1.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Feb 21, 2024
1 parent 987cc34 commit 889402a
Show file tree
Hide file tree
Showing 262 changed files with 2,111 additions and 1,782 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.4.13-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.5.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
4 changes: 2 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent' : 'AppwritePythonSDK/5.0.0-rc.3 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
'user-agent' : 'AppwritePythonSDK/5.0.0-rc.4 (${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.0-rc.3',
'x-sdk-version': '5.0.0-rc.4',
'X-Appwrite-Response-Format' : '1.5.0',
}

Expand Down
4 changes: 2 additions & 2 deletions appwrite/encoders/value_class_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ..enums.execution_method import ExecutionMethod
from ..enums.name import Name
from ..enums.message_status import MessageStatus
from ..enums.smtp_encryption import SMTPEncryption
from ..enums.encryption import Encryption
from ..enums.compression import Compression
from ..enums.image_gravity import ImageGravity
from ..enums.image_format import ImageFormat
Expand Down Expand Up @@ -60,7 +60,7 @@ def default(self, o):
if isinstance(o, MessageStatus):
return o.value

if isinstance(o, SMTPEncryption):
if isinstance(o, Encryption):
return o.value

if isinstance(o, Compression):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum

class SMTPEncryption(Enum):
class Encryption(Enum):
NONE = "none"
SSL = "ssl"
TLS = "tls"
32 changes: 32 additions & 0 deletions appwrite/enums/runtime.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
from enum import Enum

class Runtime(Enum):
NODE145 = "node-14.5"
NODE160 = "node-16.0"
NODE180 = "node-18.0"
NODE190 = "node-19.0"
NODE200 = "node-20.0"
PHP80 = "php-8.0"
PHP81 = "php-8.1"
PHP82 = "php-8.2"
RUBY30 = "ruby-3.0"
RUBY31 = "ruby-3.1"
RUBY32 = "ruby-3.2"
PYTHON38 = "python-3.8"
PYTHON39 = "python-3.9"
PYTHON310 = "python-3.10"
PYTHON311 = "python-3.11"
PYTHON312 = "python-3.12"
DART215 = "dart-2.15"
DART216 = "dart-2.16"
DART217 = "dart-2.17"
DART218 = "dart-2.18"
DART30 = "dart-3.0"
DART31 = "dart-3.1"
DOTNET31 = "dotnet-3.1"
DOTNET60 = "dotnet-6.0"
DOTNET70 = "dotnet-7.0"
JAVA80 = "java-8.0"
JAVA110 = "java-11.0"
JAVA170 = "java-17.0"
JAVA180 = "java-18.0"
SWIFT55 = "swift-5.5"
SWIFT58 = "swift-5.8"
KOTLIN16 = "kotlin-1.6"
KOTLIN18 = "kotlin-1.8"
CPP17 = "cpp-17"
CPP20 = "cpp-20"
BUN10 = "bun-1.0"
39 changes: 21 additions & 18 deletions appwrite/services/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def list_messages(self, queries = None, search = None):
'content-type': 'application/json',
}, api_params)

def create_email(self, message_id, subject, content, topics = None, users = None, targets = None, cc = None, bcc = None, status = None, html = None, scheduled_at = None):
"""Create an email."""
def create_email(self, message_id, subject, content, topics = None, users = None, targets = None, cc = None, bcc = None, attachments = None, status = None, html = None, scheduled_at = None):
"""Create an email"""


api_path = '/messaging/messages/email'
Expand All @@ -44,6 +44,7 @@ def create_email(self, message_id, subject, content, topics = None, users = None
api_params['targets'] = targets
api_params['cc'] = cc
api_params['bcc'] = bcc
api_params['attachments'] = attachments
api_params['status'] = status
api_params['html'] = html
api_params['scheduledAt'] = scheduled_at
Expand All @@ -53,7 +54,7 @@ def create_email(self, message_id, subject, content, topics = None, users = None
}, api_params)

def update_email(self, message_id, topics = None, users = None, targets = None, subject = None, content = None, status = None, html = None, cc = None, bcc = None, scheduled_at = None):
"""Update an email."""
"""Update an email"""


api_path = '/messaging/messages/email/{messageId}'
Expand All @@ -78,8 +79,8 @@ def update_email(self, message_id, topics = None, users = None, targets = None,
'content-type': 'application/json',
}, api_params)

def create_push(self, message_id, title, body, topics = None, users = None, targets = None, data = None, action = None, icon = None, sound = None, color = None, tag = None, badge = None, status = None, scheduled_at = None):
"""Create a push notification."""
def create_push(self, message_id, title, body, topics = None, users = None, targets = None, data = None, action = None, image = None, icon = None, sound = None, color = None, tag = None, badge = None, status = None, scheduled_at = None):
"""Create a push notification"""


api_path = '/messaging/messages/push'
Expand All @@ -102,6 +103,7 @@ def create_push(self, message_id, title, body, topics = None, users = None, targ
api_params['targets'] = targets
api_params['data'] = data
api_params['action'] = action
api_params['image'] = image
api_params['icon'] = icon
api_params['sound'] = sound
api_params['color'] = color
Expand All @@ -114,8 +116,8 @@ def create_push(self, message_id, title, body, topics = None, users = None, targ
'content-type': 'application/json',
}, api_params)

def update_push(self, message_id, topics = None, users = None, targets = None, title = None, body = None, data = None, action = None, icon = None, sound = None, color = None, tag = None, badge = None, status = None, scheduled_at = None):
"""Update a push notification."""
def update_push(self, message_id, topics = None, users = None, targets = None, title = None, body = None, data = None, action = None, image = None, icon = None, sound = None, color = None, tag = None, badge = None, status = None, scheduled_at = None):
"""Update a push notification"""


api_path = '/messaging/messages/push/{messageId}'
Expand All @@ -132,6 +134,7 @@ def update_push(self, message_id, topics = None, users = None, targets = None, t
api_params['body'] = body
api_params['data'] = data
api_params['action'] = action
api_params['image'] = image
api_params['icon'] = icon
api_params['sound'] = sound
api_params['color'] = color
Expand All @@ -145,7 +148,7 @@ def update_push(self, message_id, topics = None, users = None, targets = None, t
}, api_params)

def create_sms(self, message_id, content, topics = None, users = None, targets = None, status = None, scheduled_at = None):
"""Create an SMS."""
"""Create an SMS"""


api_path = '/messaging/messages/sms'
Expand All @@ -170,7 +173,7 @@ def create_sms(self, message_id, content, topics = None, users = None, targets =
}, api_params)

def update_sms(self, message_id, topics = None, users = None, targets = None, content = None, status = None, scheduled_at = None):
"""Update an SMS."""
"""Update an SMS"""


api_path = '/messaging/messages/sms/{messageId}'
Expand Down Expand Up @@ -817,7 +820,7 @@ def list_subscriber_logs(self, subscriber_id, queries = None):
}, api_params)

def list_topics(self, queries = None, search = None):
"""List topics."""
"""List topics"""


api_path = '/messaging/topics'
Expand All @@ -831,7 +834,7 @@ def list_topics(self, queries = None, search = None):
}, api_params)

def create_topic(self, topic_id, name, subscribe = None):
"""Create a topic."""
"""Create a topic"""


api_path = '/messaging/topics'
Expand All @@ -852,7 +855,7 @@ def create_topic(self, topic_id, name, subscribe = None):
}, api_params)

def get_topic(self, topic_id):
"""Get a topic."""
"""Get a topic"""


api_path = '/messaging/topics/{topicId}'
Expand All @@ -868,7 +871,7 @@ def get_topic(self, topic_id):
}, api_params)

def update_topic(self, topic_id, name = None):
"""Update a topic."""
"""Update a topic"""


api_path = '/messaging/topics/{topicId}'
Expand All @@ -885,7 +888,7 @@ def update_topic(self, topic_id, name = None):
}, api_params)

def delete_topic(self, topic_id):
"""Delete a topic."""
"""Delete a topic"""


api_path = '/messaging/topics/{topicId}'
Expand Down Expand Up @@ -918,7 +921,7 @@ def list_topic_logs(self, topic_id, queries = None):
}, api_params)

def list_subscribers(self, topic_id, queries = None, search = None):
"""List subscribers."""
"""List subscribers"""


api_path = '/messaging/topics/{topicId}/subscribers'
Expand All @@ -936,7 +939,7 @@ def list_subscribers(self, topic_id, queries = None, search = None):
}, api_params)

def create_subscriber(self, topic_id, subscriber_id, target_id):
"""Create a subscriber."""
"""Create a subscriber"""


api_path = '/messaging/topics/{topicId}/subscribers'
Expand All @@ -960,7 +963,7 @@ def create_subscriber(self, topic_id, subscriber_id, target_id):
}, api_params)

def get_subscriber(self, topic_id, subscriber_id):
"""Get a subscriber."""
"""Get a subscriber"""


api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}'
Expand All @@ -980,7 +983,7 @@ def get_subscriber(self, topic_id, subscriber_id):
}, api_params)

def delete_subscriber(self, topic_id, subscriber_id):
"""Delete a subscriber."""
"""Delete a subscriber"""


api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}'
Expand Down
15 changes: 7 additions & 8 deletions docs/examples/account/add-authenticator.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from appwrite.client import Client
from Appwrite.enums import AuthenticatorType
from appwrite.enums import AuthenticatorType

client = Client()

(client
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_session('') # The user session to authenticate with
)
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('5df5acd0d48c2') # Your project ID
client.set_session('') # The user session to authenticate with

account = Account(client)

result = account.add_authenticator(AuthenticatorType.TOTP)
result = account.add_authenticator(
type = AuthenticatorType.TOTP
)
7 changes: 2 additions & 5 deletions docs/examples/account/create-anonymous-session.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from appwrite.client import Client

client = Client()

(client
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
)
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('5df5acd0d48c2') # Your project ID

account = Account(client)

Expand Down
12 changes: 6 additions & 6 deletions docs/examples/account/create-email-password-session.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from appwrite.client import Client

client = Client()

(client
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
)
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('5df5acd0d48c2') # Your project ID

account = Account(client)

result = account.create_email_password_session('email@example.com', 'password')
result = account.create_email_password_session(
email = 'email@example.com',
password = 'password'
)
13 changes: 7 additions & 6 deletions docs/examples/account/create-email-token.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from appwrite.client import Client

client = Client()

(client
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
)
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('5df5acd0d48c2') # Your project ID

account = Account(client)

result = account.create_email_token('[USER_ID]', 'email@example.com')
result = account.create_email_token(
user_id = '[USER_ID]',
email = 'email@example.com',
phrase = False # optional
)
7 changes: 2 additions & 5 deletions docs/examples/account/create-j-w-t.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from appwrite.client import Client

client = Client()

(client
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
)
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('5df5acd0d48c2') # Your project ID

account = Account(client)

Expand Down
14 changes: 8 additions & 6 deletions docs/examples/account/create-magic-u-r-l-token.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from appwrite.client import Client

client = Client()

(client
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
)
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('5df5acd0d48c2') # Your project ID

account = Account(client)

result = account.create_magic_url_token('[USER_ID]', 'email@example.com')
result = account.create_magic_url_token(
user_id = '[USER_ID]',
email = 'email@example.com',
url = 'https://example.com', # optional
phrase = False # optional
)
17 changes: 10 additions & 7 deletions docs/examples/account/create-o-auth2session.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from appwrite.client import Client
from Appwrite.enums import OAuthProvider
from appwrite.enums import OAuthProvider

client = Client()

(client
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
)
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('5df5acd0d48c2') # Your project ID

account = Account(client)

result = account.create_o_auth2_session(OAuthProvider.AMAZON)
result = account.create_o_auth2_session(
provider = OAuthProvider.AMAZON,
success = 'https://example.com', # optional
failure = 'https://example.com', # optional
token = False, # optional
scopes = [] # optional
)
Loading

0 comments on commit 889402a

Please sign in to comment.