Skip to content

Commit ea24358

Browse files
authored
Merge pull request #13 from ActivitySmithHQ/regen/openapi-13a315d7312968827894bc81e8925cabf13db62a
Regenerate from OpenAPI 13a315d7312968827894bc81e8925cabf13db62a
2 parents cb20554 + dd7ecab commit ea24358

17 files changed

+417
-7
lines changed

activitysmith_openapi/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
from activitysmith_openapi.models.live_activity_update_request import LiveActivityUpdateRequest
4848
from activitysmith_openapi.models.live_activity_update_response import LiveActivityUpdateResponse
4949
from activitysmith_openapi.models.no_recipients_error import NoRecipientsError
50+
from activitysmith_openapi.models.push_notification_action import PushNotificationAction
51+
from activitysmith_openapi.models.push_notification_action_type import PushNotificationActionType
5052
from activitysmith_openapi.models.push_notification_request import PushNotificationRequest
5153
from activitysmith_openapi.models.push_notification_response import PushNotificationResponse
54+
from activitysmith_openapi.models.push_notification_webhook_method import PushNotificationWebhookMethod
5255
from activitysmith_openapi.models.rate_limit_error import RateLimitError
5356
from activitysmith_openapi.models.send_push_notification429_response import SendPushNotification429Response

activitysmith_openapi/api/push_notifications_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def send_push_notification(
5656
) -> PushNotificationResponse:
5757
"""Send a push notification
5858
59-
Sends a push notification to devices matched by API key scope and optional target channels.
59+
Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
6060
6161
:param push_notification_request: (required)
6262
:type push_notification_request: PushNotificationRequest
@@ -127,7 +127,7 @@ def send_push_notification_with_http_info(
127127
) -> ApiResponse[PushNotificationResponse]:
128128
"""Send a push notification
129129
130-
Sends a push notification to devices matched by API key scope and optional target channels.
130+
Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
131131
132132
:param push_notification_request: (required)
133133
:type push_notification_request: PushNotificationRequest
@@ -198,7 +198,7 @@ def send_push_notification_without_preload_content(
198198
) -> RESTResponseType:
199199
"""Send a push notification
200200
201-
Sends a push notification to devices matched by API key scope and optional target channels.
201+
Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
202202
203203
:param push_notification_request: (required)
204204
:type push_notification_request: PushNotificationRequest
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# PushNotificationAction
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**title** | **str** | Button title displayed in iOS expanded notification UI. |
9+
**type** | [**PushNotificationActionType**](PushNotificationActionType.md) | |
10+
**url** | **str** | HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend. |
11+
**method** | [**PushNotificationWebhookMethod**](PushNotificationWebhookMethod.md) | Webhook HTTP method. Used only when type=webhook. | [optional] [default to PushNotificationWebhookMethod.POST]
12+
**body** | **Dict[str, object]** | Optional webhook payload body. Used only when type=webhook. | [optional]
13+
14+
## Example
15+
16+
```python
17+
from activitysmith_openapi.models.push_notification_action import PushNotificationAction
18+
19+
# TODO update the JSON string below
20+
json = "{}"
21+
# create an instance of PushNotificationAction from a JSON string
22+
push_notification_action_instance = PushNotificationAction.from_json(json)
23+
# print the JSON string representation of the object
24+
print(PushNotificationAction.to_json())
25+
26+
# convert the object into a dict
27+
push_notification_action_dict = push_notification_action_instance.to_dict()
28+
# create an instance of PushNotificationAction from a dict
29+
push_notification_action_from_dict = PushNotificationAction.from_dict(push_notification_action_dict)
30+
```
31+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
32+
33+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# PushNotificationActionType
2+
3+
4+
## Enum
5+
6+
* `OPEN_URL` (value: `'open_url'`)
7+
8+
* `WEBHOOK` (value: `'webhook'`)
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+

activitysmith_openapi/docs/PushNotificationRequest.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Name | Type | Description | Notes
88
**title** | **str** | |
99
**message** | **str** | | [optional]
1010
**subtitle** | **str** | | [optional]
11+
**redirection** | **str** | Optional HTTPS URL opened when user taps the notification body. | [optional]
12+
**actions** | [**List[PushNotificationAction]**](PushNotificationAction.md) | Optional interactive actions shown on iOS long-press. | [optional]
1113
**payload** | **Dict[str, object]** | | [optional]
1214
**badge** | **int** | | [optional]
1315
**sound** | **str** | | [optional]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# PushNotificationWebhookMethod
2+
3+
4+
## Enum
5+
6+
* `GET` (value: `'GET'`)
7+
8+
* `POST` (value: `'POST'`)
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+

activitysmith_openapi/docs/PushNotificationsApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Method | HTTP request | Description
1212
1313
Send a push notification
1414

15-
Sends a push notification to devices matched by API key scope and optional target channels.
15+
Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL (tap) and up to 4 interactive actions (long-press on iOS).
1616

1717
### Example
1818

activitysmith_openapi/models/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
from activitysmith_openapi.models.live_activity_update_request import LiveActivityUpdateRequest
3030
from activitysmith_openapi.models.live_activity_update_response import LiveActivityUpdateResponse
3131
from activitysmith_openapi.models.no_recipients_error import NoRecipientsError
32+
from activitysmith_openapi.models.push_notification_action import PushNotificationAction
33+
from activitysmith_openapi.models.push_notification_action_type import PushNotificationActionType
3234
from activitysmith_openapi.models.push_notification_request import PushNotificationRequest
3335
from activitysmith_openapi.models.push_notification_response import PushNotificationResponse
36+
from activitysmith_openapi.models.push_notification_webhook_method import PushNotificationWebhookMethod
3437
from activitysmith_openapi.models.rate_limit_error import RateLimitError
3538
from activitysmith_openapi.models.send_push_notification429_response import SendPushNotification429Response
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# coding: utf-8
2+
3+
"""
4+
ActivitySmith API
5+
6+
Send push notifications and Live Activities to your own devices via a single API key.
7+
8+
The version of the OpenAPI document: 1.0.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21+
from typing import Any, ClassVar, Dict, List, Optional
22+
from typing_extensions import Annotated
23+
from activitysmith_openapi.models.push_notification_action_type import PushNotificationActionType
24+
from activitysmith_openapi.models.push_notification_webhook_method import PushNotificationWebhookMethod
25+
from typing import Optional, Set
26+
from typing_extensions import Self
27+
28+
class PushNotificationAction(BaseModel):
29+
"""
30+
PushNotificationAction
31+
""" # noqa: E501
32+
title: StrictStr = Field(description="Button title displayed in iOS expanded notification UI.")
33+
type: PushNotificationActionType
34+
url: Annotated[str, Field(strict=True)] = Field(description="HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.")
35+
method: Optional[PushNotificationWebhookMethod] = Field(default=PushNotificationWebhookMethod.POST, description="Webhook HTTP method. Used only when type=webhook.")
36+
body: Optional[Dict[str, Any]] = Field(default=None, description="Optional webhook payload body. Used only when type=webhook.")
37+
additional_properties: Dict[str, Any] = {}
38+
__properties: ClassVar[List[str]] = ["title", "type", "url", "method", "body"]
39+
40+
@field_validator('url')
41+
def url_validate_regular_expression(cls, value):
42+
"""Validates the regular expression"""
43+
if not re.match(r"^https:\/\/", value):
44+
raise ValueError(r"must validate the regular expression /^https:\/\//")
45+
return value
46+
47+
model_config = ConfigDict(
48+
populate_by_name=True,
49+
validate_assignment=True,
50+
protected_namespaces=(),
51+
)
52+
53+
54+
def to_str(self) -> str:
55+
"""Returns the string representation of the model using alias"""
56+
return pprint.pformat(self.model_dump(by_alias=True))
57+
58+
def to_json(self) -> str:
59+
"""Returns the JSON representation of the model using alias"""
60+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61+
return json.dumps(self.to_dict())
62+
63+
@classmethod
64+
def from_json(cls, json_str: str) -> Optional[Self]:
65+
"""Create an instance of PushNotificationAction from a JSON string"""
66+
return cls.from_dict(json.loads(json_str))
67+
68+
def to_dict(self) -> Dict[str, Any]:
69+
"""Return the dictionary representation of the model using alias.
70+
71+
This has the following differences from calling pydantic's
72+
`self.model_dump(by_alias=True)`:
73+
74+
* `None` is only added to the output dict for nullable fields that
75+
were set at model initialization. Other fields with value `None`
76+
are ignored.
77+
* Fields in `self.additional_properties` are added to the output dict.
78+
"""
79+
excluded_fields: Set[str] = set([
80+
"additional_properties",
81+
])
82+
83+
_dict = self.model_dump(
84+
by_alias=True,
85+
exclude=excluded_fields,
86+
exclude_none=True,
87+
)
88+
# puts key-value pairs in additional_properties in the top level
89+
if self.additional_properties is not None:
90+
for _key, _value in self.additional_properties.items():
91+
_dict[_key] = _value
92+
93+
return _dict
94+
95+
@classmethod
96+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97+
"""Create an instance of PushNotificationAction from a dict"""
98+
if obj is None:
99+
return None
100+
101+
if not isinstance(obj, dict):
102+
return cls.model_validate(obj)
103+
104+
_obj = cls.model_validate({
105+
"title": obj.get("title"),
106+
"type": obj.get("type"),
107+
"url": obj.get("url"),
108+
"method": obj.get("method") if obj.get("method") is not None else PushNotificationWebhookMethod.POST,
109+
"body": obj.get("body")
110+
})
111+
# store additional fields in additional_properties
112+
for _key in obj.keys():
113+
if _key not in cls.__properties:
114+
_obj.additional_properties[_key] = obj.get(_key)
115+
116+
return _obj
117+
118+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# coding: utf-8
2+
3+
"""
4+
ActivitySmith API
5+
6+
Send push notifications and Live Activities to your own devices via a single API key.
7+
8+
The version of the OpenAPI document: 1.0.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
import json
17+
from enum import Enum
18+
from typing_extensions import Self
19+
20+
21+
class PushNotificationActionType(str, Enum):
22+
"""
23+
PushNotificationActionType
24+
"""
25+
26+
"""
27+
allowed enum values
28+
"""
29+
OPEN_URL = 'open_url'
30+
WEBHOOK = 'webhook'
31+
32+
@classmethod
33+
def from_json(cls, json_str: str) -> Self:
34+
"""Create an instance of PushNotificationActionType from a JSON string"""
35+
return cls(json.loads(json_str))
36+
37+

0 commit comments

Comments
 (0)