Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.6.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.1-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/7.0.1 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
'user-agent' : 'AppwritePythonSDK/6.2.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '7.0.1',
'x-sdk-version': '6.2.0',
'X-Appwrite-Response-Format' : '1.6.0',
}

Expand Down
4 changes: 4 additions & 0 deletions appwrite/encoders/value_class_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ..enums.runtime import Runtime
from ..enums.execution_method import ExecutionMethod
from ..enums.name import Name
from ..enums.message_priority import MessagePriority
from ..enums.smtp_encryption import SmtpEncryption
from ..enums.compression import Compression
from ..enums.image_gravity import ImageGravity
Expand Down Expand Up @@ -56,6 +57,9 @@ def default(self, o):
if isinstance(o, Name):
return o.value

if isinstance(o, MessagePriority):
return o.value

if isinstance(o, SmtpEncryption):
return o.value

Expand Down
5 changes: 5 additions & 0 deletions appwrite/enums/message_priority.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from enum import Enum

class MessagePriority(Enum):
NORMAL = "normal"
HIGH = "high"
1 change: 1 addition & 0 deletions appwrite/enums/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ class Runtime(Enum):
BUN_1_1 = "bun-1.1"
GO_1_23 = "go-1.23"
STATIC_1 = "static-1"
FLUTTER_3_24 = "flutter-3.24"
16 changes: 8 additions & 8 deletions appwrite/services/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ 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, image = None, icon = None, sound = None, color = None, tag = None, badge = None, draft = None, scheduled_at = None):
def create_push(self, message_id, title = None, body = None, topics = None, users = None, targets = None, data = None, action = None, image = None, icon = None, sound = None, color = None, tag = None, badge = None, draft = None, scheduled_at = None, content_available = None, critical = None, priority = None):
"""Create push notification"""


Expand All @@ -89,12 +89,6 @@ def create_push(self, message_id, title, body, topics = None, users = None, targ
if message_id is None:
raise AppwriteException('Missing required parameter: "message_id"')

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

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


api_params['messageId'] = message_id
api_params['title'] = title
Expand All @@ -112,12 +106,15 @@ def create_push(self, message_id, title, body, topics = None, users = None, targ
api_params['badge'] = badge
api_params['draft'] = draft
api_params['scheduledAt'] = scheduled_at
api_params['contentAvailable'] = content_available
api_params['critical'] = critical
api_params['priority'] = priority

return self.client.call('post', api_path, {
'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, image = None, icon = None, sound = None, color = None, tag = None, badge = None, draft = None, scheduled_at = None):
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, draft = None, scheduled_at = None, content_available = None, critical = None, priority = None):
"""Update push notification"""


Expand All @@ -143,6 +140,9 @@ def update_push(self, message_id, topics = None, users = None, targets = None, t
api_params['badge'] = badge
api_params['draft'] = draft
api_params['scheduledAt'] = scheduled_at
api_params['contentAvailable'] = content_available
api_params['critical'] = critical
api_params['priority'] = priority

return self.client.call('patch', api_path, {
'content-type': 'application/json',
Expand Down
11 changes: 7 additions & 4 deletions docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ messaging = Messaging(client)

result = messaging.create_push(
message_id = '<MESSAGE_ID>',
title = '<TITLE>',
body = '<BODY>',
title = '<TITLE>', # optional
body = '<BODY>', # optional
topics = [], # optional
users = [], # optional
targets = [], # optional
Expand All @@ -21,7 +21,10 @@ result = messaging.create_push(
sound = '<SOUND>', # optional
color = '<COLOR>', # optional
tag = '<TAG>', # optional
badge = '<BADGE>', # optional
badge = None, # optional
draft = False, # optional
scheduled_at = '' # optional
scheduled_at = '', # optional
content_available = False, # optional
critical = False, # optional
priority = MessagePriority.NORMAL # optional
)
5 changes: 4 additions & 1 deletion docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ result = messaging.update_push(
tag = '<TAG>', # optional
badge = None, # optional
draft = False, # optional
scheduled_at = '' # optional
scheduled_at = '', # optional
content_available = False, # optional
critical = False, # optional
priority = MessagePriority.NORMAL # optional
)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'appwrite/encoders',
'appwrite/enums',
],
version = '7.0.1',
version = '6.2.0',
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,
Expand All @@ -23,7 +23,7 @@
maintainer = 'Appwrite Team',
maintainer_email = 'team@appwrite.io',
url = 'https://appwrite.io/support',
download_url='https://github.com/appwrite/sdk-for-python/archive/7.0.1.tar.gz',
download_url='https://github.com/appwrite/sdk-for-python/archive/6.2.0.tar.gz',
install_requires=[
'requests',
],
Expand Down
Loading