Skip to content

Add new push message parameters #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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 LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
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/7.1.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': '7.1.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
1 change: 1 addition & 0 deletions docs/examples/account/create-anonymous-session.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-email-password-session.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-email-token.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-j-w-t.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-magic-u-r-l-token.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-mfa-authenticator.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account
from appwrite.enums import AuthenticatorType

client = Client()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-mfa-challenge.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account
from appwrite.enums import AuthenticationFactor

client = Client()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-o-auth2token.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account
from appwrite.enums import OAuthProvider

client = Client()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-phone-token.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-phone-verification.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-recovery.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-session.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-verification.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/delete-identity.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/delete-mfa-authenticator.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account
from appwrite.enums import AuthenticatorType

client = Client()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/delete-session.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/delete-sessions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/get-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/get-prefs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/get-session.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/get.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/list-identities.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/list-logs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/list-mfa-factors.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/list-sessions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-email.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-m-f-a.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-magic-u-r-l-session.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-mfa-authenticator.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account
from appwrite.enums import AuthenticatorType

client = Client()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-mfa-challenge.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-name.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-password.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-phone-session.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-phone-verification.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-phone.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-prefs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-recovery.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-session.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-status.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/update-verification.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.account import Account

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/avatars/get-browser.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
from appwrite.enums import Browser

client = Client()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/avatars/get-credit-card.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
from appwrite.enums import CreditCard

client = Client()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/avatars/get-favicon.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
1 change: 1 addition & 0 deletions docs/examples/avatars/get-flag.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars
from appwrite.enums import Flag

client = Client()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/avatars/get-image.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.services.avatars import Avatars

client = Client()
client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
Expand Down
Loading