Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

- API version: 5.7.0
- Package version: 5.7.0
- API version: 5.8.0
- Package version: 5.8.0

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion docs/CreateNotificationSuccessResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **str** | Notification identifier when the request created a notification. An empty string means no notification was created; read `errors` for details (HTTP may still be 200). | [optional]
**id** | **str** | Notification identifier when the request created a notification. An empty string means no notification was created; read `errors` for details (HTTP may still be 200). All OneSignal server SDKs expose message-sent / message-not-sent narrowing helpers (named idiomatically per language — e.g. `isMessageSent`, `is_message_sent`, `message_sent?`); prefer them over comparing `id` directly. | [optional]
**external_id** | **str, none_type** | Optional correlation / idempotency-related value from the API response. This is not the end-user External ID used for targeting recipients (that lives under `include_aliases.external_id`). | [optional]
**errors** | **bool, date, datetime, dict, float, int, list, str, none_type** | Polymorphic field: may be an array of human-readable strings and/or an object (for example with `invalid_aliases`, `invalid_external_user_ids`, or `invalid_player_ids`) depending on the API response; HTTP may still be 200 with partial success. Typed SDKs model this loosely so both shapes deserialize. | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
Expand Down
48 changes: 47 additions & 1 deletion docs/DefaultApi.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/NotificationSlice.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Name | Type | Description | Notes
**total_count** | **int** | | [optional]
**offset** | **int** | | [optional]
**limit** | **int** | | [optional]
**time_offset** | **str** | The time_offset cursor specified in the request, if any. | [optional]
**next_time_offset** | **str** | An opaque Base64 cursor token representing the next page of messages to fetch. Present when time_offset was provided in the request. Pass this value as time_offset on the next request to continue paginating. | [optional]
**notifications** | [**[NotificationWithMeta]**](NotificationWithMeta.md) | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]

Expand Down
4 changes: 2 additions & 2 deletions onesignal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""


__version__ = "5.7.0"
__version__ = "5.8.0"

# import ApiClient
from onesignal.api_client import ApiClient
Expand Down
8 changes: 7 additions & 1 deletion onesignal/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down Expand Up @@ -1608,6 +1608,7 @@ def __init__(self, api_client=None):
'limit',
'offset',
'kind',
'time_offset',
],
'required': [
'app_id',
Expand Down Expand Up @@ -1640,18 +1641,22 @@ def __init__(self, api_client=None):
(int,),
'kind':
(int,),
'time_offset':
(str,),
},
'attribute_map': {
'app_id': 'app_id',
'limit': 'limit',
'offset': 'offset',
'kind': 'kind',
'time_offset': 'time_offset',
},
'location_map': {
'app_id': 'query',
'limit': 'query',
'offset': 'query',
'kind': 'query',
'time_offset': 'query',
},
'collection_format_map': {
}
Expand Down Expand Up @@ -5041,6 +5046,7 @@ def get_notifications(
limit (int): How many notifications to return. Max is 50. Default is 50.. [optional]
offset (int): Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at.. [optional]
kind (int): Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only . [optional]
time_offset (str): Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned.. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
Expand Down
6 changes: 3 additions & 3 deletions onesignal/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down Expand Up @@ -77,7 +77,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/5.7.0/python'
self.user_agent = 'OpenAPI-Generator/5.8.0/python'

def __enter__(self):
return self
Expand Down Expand Up @@ -142,7 +142,7 @@ def __call_api(
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
header_params['OS-Usage-Data'] = "kind=sdk, sdk-name=onesignal-python, version=5.7.0"
header_params['OS-Usage-Data'] = "kind=sdk, sdk-name=onesignal-python, version=5.8.0"
if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
Expand Down
6 changes: 3 additions & 3 deletions onesignal/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down Expand Up @@ -399,8 +399,8 @@ def to_debug_report(self):
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 5.7.0\n"\
"SDK Package Version: 5.7.0".\
"Version of the API: 5.8.0\n"\
"SDK Package Version: 5.8.0".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion onesignal/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
27 changes: 27 additions & 0 deletions onesignal/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,30 @@ def create_notification_with_retry(api, notification, max_retries=3, base_delay=
if delay > 0:
time.sleep(delay)
attempt += 1


def is_message_sent(response):
"""Return True when a POST /notifications 200 response is the "message
sent" branch -- a notification was created and ``id`` is a non-empty string.

POST /notifications returns 200 in two cases that share the
``CreateNotificationSuccessResponse`` shape: a notification was created
(non-empty ``id``), or none was (empty ``id``, with ``errors`` carrying the
reason). Prefer this guard over inspecting ``id`` directly.

:param response: a ``CreateNotificationSuccessResponse``
:return: True if a notification was created
"""
notification_id = getattr(response, 'id', None)
return isinstance(notification_id, str) and len(notification_id) > 0


def is_message_not_sent(response):
"""Return True when a POST /notifications 200 response is the "message not
sent" branch -- no notification was created (``id`` is absent or empty);
inspect ``errors`` for why.

:param response: a ``CreateNotificationSuccessResponse``
:return: True if no notification was created
"""
return not is_message_sent(response)
2 changes: 1 addition & 1 deletion onesignal/model/api_key_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/api_key_tokens_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/basic_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/basic_notification_all_of.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/copy_template_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/create_api_key_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/create_api_key_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
6 changes: 3 additions & 3 deletions onesignal/model/create_notification_success_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down Expand Up @@ -139,7 +139,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
id (str): Notification identifier when the request created a notification. An empty string means no notification was created; read `errors` for details (HTTP may still be 200).. [optional] # noqa: E501
id (str): Notification identifier when the request created a notification. An empty string means no notification was created; read `errors` for details (HTTP may still be 200). All OneSignal server SDKs expose message-sent / message-not-sent narrowing helpers (named idiomatically per language — e.g. `isMessageSent`, `is_message_sent`, `message_sent?`); prefer them over comparing `id` directly.. [optional] # noqa: E501
external_id (str, none_type): Optional correlation / idempotency-related value from the API response. This is not the end-user External ID used for targeting recipients (that lives under `include_aliases.external_id`).. [optional] # noqa: E501
errors (bool, date, datetime, dict, float, int, list, str, none_type): Polymorphic field: may be an array of human-readable strings and/or an object (for example with `invalid_aliases`, `invalid_external_user_ids`, or `invalid_player_ids`) depending on the API response; HTTP may still be 200 with partial success. Typed SDKs model this loosely so both shapes deserialize.. [optional] # noqa: E501
"""
Expand Down Expand Up @@ -227,7 +227,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
id (str): Notification identifier when the request created a notification. An empty string means no notification was created; read `errors` for details (HTTP may still be 200).. [optional] # noqa: E501
id (str): Notification identifier when the request created a notification. An empty string means no notification was created; read `errors` for details (HTTP may still be 200). All OneSignal server SDKs expose message-sent / message-not-sent narrowing helpers (named idiomatically per language — e.g. `isMessageSent`, `is_message_sent`, `message_sent?`); prefer them over comparing `id` directly.. [optional] # noqa: E501
external_id (str, none_type): Optional correlation / idempotency-related value from the API response. This is not the end-user External ID used for targeting recipients (that lives under `include_aliases.external_id`).. [optional] # noqa: E501
errors (bool, date, datetime, dict, float, int, list, str, none_type): Polymorphic field: may be an array of human-readable strings and/or an object (for example with `invalid_aliases`, `invalid_external_user_ids`, or `invalid_player_ids`) depending on the API response; HTTP may still be 200 with partial success. Typed SDKs model this loosely so both shapes deserialize.. [optional] # noqa: E501
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/create_segment_conflict_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/create_segment_success_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/create_template_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/create_user_conflict_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/custom_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/custom_events_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
2 changes: 1 addition & 1 deletion onesignal/model/delivery_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com # noqa: E501

The version of the OpenAPI document: 5.7.0
The version of the OpenAPI document: 5.8.0
Contact: devrel@onesignal.com
Generated by: https://openapi-generator.tech
"""
Expand Down
Loading
Loading