Skip to content

Commit 362ea5a

Browse files
committed
Add new push message parameters
1 parent 0543fe9 commit 362ea5a

File tree

9 files changed

+34
-18
lines changed

9 files changed

+34
-18
lines changed

README.md

+1-1
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.6.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.6.1-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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def __init__(self):
1313
self._endpoint = 'https://cloud.appwrite.io/v1'
1414
self._global_headers = {
1515
'content-type': '',
16-
'user-agent' : 'AppwritePythonSDK/7.0.1 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
16+
'user-agent' : 'AppwritePythonSDK/6.2.0 (${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': '7.0.1',
20+
'x-sdk-version': '6.2.0',
2121
'X-Appwrite-Response-Format' : '1.6.0',
2222
}
2323

appwrite/encoders/value_class_encoder.py

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ..enums.runtime import Runtime
1212
from ..enums.execution_method import ExecutionMethod
1313
from ..enums.name import Name
14+
from ..enums.message_priority import MessagePriority
1415
from ..enums.smtp_encryption import SmtpEncryption
1516
from ..enums.compression import Compression
1617
from ..enums.image_gravity import ImageGravity
@@ -56,6 +57,9 @@ def default(self, o):
5657
if isinstance(o, Name):
5758
return o.value
5859

60+
if isinstance(o, MessagePriority):
61+
return o.value
62+
5963
if isinstance(o, SmtpEncryption):
6064
return o.value
6165

appwrite/enums/message_priority.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from enum import Enum
2+
3+
class MessagePriority(Enum):
4+
NORMAL = "normal"
5+
HIGH = "high"

appwrite/enums/runtime.py

+1
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ class Runtime(Enum):
5959
BUN_1_1 = "bun-1.1"
6060
GO_1_23 = "go-1.23"
6161
STATIC_1 = "static-1"
62+
FLUTTER_3_24 = "flutter-3.24"

appwrite/services/messaging.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def update_email(self, message_id, topics = None, users = None, targets = None,
8080
'content-type': 'application/json',
8181
}, api_params)
8282

83-
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):
83+
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):
8484
"""Create push notification"""
8585

8686

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

92-
if title is None:
93-
raise AppwriteException('Missing required parameter: "title"')
94-
95-
if body is None:
96-
raise AppwriteException('Missing required parameter: "body"')
97-
9892

9993
api_params['messageId'] = message_id
10094
api_params['title'] = title
@@ -112,12 +106,15 @@ def create_push(self, message_id, title, body, topics = None, users = None, targ
112106
api_params['badge'] = badge
113107
api_params['draft'] = draft
114108
api_params['scheduledAt'] = scheduled_at
109+
api_params['contentAvailable'] = content_available
110+
api_params['critical'] = critical
111+
api_params['priority'] = priority
115112

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

120-
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):
117+
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):
121118
"""Update push notification"""
122119

123120

@@ -143,6 +140,9 @@ def update_push(self, message_id, topics = None, users = None, targets = None, t
143140
api_params['badge'] = badge
144141
api_params['draft'] = draft
145142
api_params['scheduledAt'] = scheduled_at
143+
api_params['contentAvailable'] = content_available
144+
api_params['critical'] = critical
145+
api_params['priority'] = priority
146146

147147
return self.client.call('patch', api_path, {
148148
'content-type': 'application/json',

docs/examples/messaging/create-push.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ messaging = Messaging(client)
99

1010
result = messaging.create_push(
1111
message_id = '<MESSAGE_ID>',
12-
title = '<TITLE>',
13-
body = '<BODY>',
12+
title = '<TITLE>', # optional
13+
body = '<BODY>', # optional
1414
topics = [], # optional
1515
users = [], # optional
1616
targets = [], # optional
@@ -21,7 +21,10 @@ result = messaging.create_push(
2121
sound = '<SOUND>', # optional
2222
color = '<COLOR>', # optional
2323
tag = '<TAG>', # optional
24-
badge = '<BADGE>', # optional
24+
badge = None, # optional
2525
draft = False, # optional
26-
scheduled_at = '' # optional
26+
scheduled_at = '', # optional
27+
content_available = False, # optional
28+
critical = False, # optional
29+
priority = MessagePriority.NORMAL # optional
2730
)

docs/examples/messaging/update-push.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ result = messaging.update_push(
2323
tag = '<TAG>', # optional
2424
badge = None, # optional
2525
draft = False, # optional
26-
scheduled_at = '' # optional
26+
scheduled_at = '', # optional
27+
content_available = False, # optional
28+
critical = False, # optional
29+
priority = MessagePriority.NORMAL # optional
2730
)

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'appwrite/encoders',
1414
'appwrite/enums',
1515
],
16-
version = '7.0.1',
16+
version = '6.2.0',
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,
@@ -23,7 +23,7 @@
2323
maintainer = 'Appwrite Team',
2424
maintainer_email = '[email protected]',
2525
url = 'https://appwrite.io/support',
26-
download_url='https://github.com/appwrite/sdk-for-python/archive/7.0.1.tar.gz',
26+
download_url='https://github.com/appwrite/sdk-for-python/archive/6.2.0.tar.gz',
2727
install_requires=[
2828
'requests',
2929
],

0 commit comments

Comments
 (0)