-
Notifications
You must be signed in to change notification settings - Fork 1k
Add validating message objects APIs #409
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,10 @@ | |
| Group, UserIds, RichMenuAliasResponse, RichMenuAliasListResponse, ChannelAccessTokens, | ||
| IssueChannelTokenResponseV2, VerifyChannelTokenResponseV2, ValidAccessTokenKeyIDsResponse, | ||
| InsightMessageEventOfCustomAggregationUnitResponse, AggregationInfoResponse, | ||
| AggregationNameListResponse | ||
| AggregationNameListResponse, | ||
| ValidateBroadcastMessageObjectsResponse, | ||
| ValidateMulticastMessageObjectsResponse, ValidateNarrowcastMessageObjectsResponse, | ||
| ValidatePushMessageObjectsResponse, ValidateReplyMessageObjectsResponse, | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -174,7 +177,7 @@ def multicast(self, to, messages, retry_key=None, notification_disabled=False, | |
| Messages cannot be sent to groups or rooms. | ||
|
|
||
| :param to: IDs of the receivers | ||
| Max: 150 users | ||
| Max: 500 users | ||
| :type to: list[str] | ||
| :param messages: Messages. | ||
| Max: 5 | ||
|
|
@@ -327,6 +330,176 @@ def get_progress_status_narrowcast(self, request_id, timeout=None): | |
|
|
||
| return MessageProgressNarrowcastResponse.new_from_json_dict(response.json) | ||
|
|
||
| def validate_reply_message_objects(self, messages, timeout=None): | ||
| """Call validate reply message objects API. | ||
|
|
||
| https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-reply-message | ||
|
|
||
| You can validate that an array of message objects is valid as a value | ||
| for the messages property of the request body for the send reply message endpoint. | ||
|
|
||
| :param messages: Messages. | ||
| Max: 5 | ||
| :type messages: T <= :py:class:`linebot.models.send_messages.SendMessage` | | ||
| list[T <= :py:class:`linebot.models.send_messages.SendMessage`] | ||
| :param timeout: (optional) How long to wait for the server | ||
| to send data before giving up, as a float, | ||
| or a (connect timeout, read timeout) float tuple. | ||
| Default is self.http_client.timeout | ||
| :type timeout: float | tuple(float, float) | ||
| :rtype: :py:class:`linebot.models.responses.ValidateReplyMessageObjectsResponse` | ||
| """ | ||
| if not isinstance(messages, (list, tuple)): | ||
| messages = [messages] | ||
|
|
||
| data = { | ||
| 'messages': [message.as_json_dict() for message in messages], | ||
| } | ||
|
|
||
| response = self._post( | ||
| '/v2/bot/message/validate/reply', data=json.dumps(data), | ||
| timeout=timeout | ||
| ) | ||
|
|
||
| return ValidateReplyMessageObjectsResponse( | ||
| request_id=response.headers.get('X-Line-Request-Id')) | ||
louis70109 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def validate_push_message_objects(self, messages, timeout=None): | ||
| """Call validate push message objects API. | ||
|
|
||
| https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-push-message | ||
|
|
||
| You can validate that an array of message objects is valid as a value | ||
| for the messages property of the request body for the send push message endpoint. | ||
|
|
||
| :param messages: Messages. | ||
| Max: 5 | ||
| :type messages: T <= :py:class:`linebot.models.send_messages.SendMessage` | | ||
| list[T <= :py:class:`linebot.models.send_messages.SendMessage`] | ||
| :param timeout: (optional) How long to wait for the server | ||
| to send data before giving up, as a float, | ||
| or a (connect timeout, read timeout) float tuple. | ||
| Default is self.http_client.timeout | ||
| :type timeout: float | tuple(float, float) | ||
| :rtype: :py:class:`linebot.models.responses.ValidatePushMessageObjectsResponse` | ||
| """ | ||
| if not isinstance(messages, (list, tuple)): | ||
| messages = [messages] | ||
|
|
||
| data = { | ||
| 'messages': [message.as_json_dict() for message in messages], | ||
| } | ||
|
|
||
| response = self._post( | ||
| '/v2/bot/message/validate/push', data=json.dumps(data), | ||
| timeout=timeout | ||
| ) | ||
|
|
||
| return ValidatePushMessageObjectsResponse( | ||
| request_id=response.headers.get('X-Line-Request-Id')) | ||
|
Comment on lines
+398
to
+399
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. 🆙 |
||
|
|
||
| def validate_multicast_message_objects(self, messages, timeout=None): | ||
| """Call validate multicast message objects API. | ||
|
|
||
| https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-multicast-message | ||
|
|
||
| You can validate that an array of message objects is valid as a value | ||
| for the messages property of the request body for the send multicast message endpoint. | ||
|
|
||
| :param messages: Messages. | ||
| Max: 5 | ||
| :type messages: T <= :py:class:`linebot.models.send_messages.SendMessage` | | ||
| list[T <= :py:class:`linebot.models.send_messages.SendMessage`] | ||
| :param timeout: (optional) How long to wait for the server | ||
| to send data before giving up, as a float, | ||
| or a (connect timeout, read timeout) float tuple. | ||
| Default is self.http_client.timeout | ||
| :type timeout: float | tuple(float, float) | ||
| :rtype: :py:class:`linebot.models.responses.ValidateMulticastMessageObjectsResponse` | ||
| """ | ||
| if not isinstance(messages, (list, tuple)): | ||
| messages = [messages] | ||
|
|
||
| data = { | ||
| 'messages': [message.as_json_dict() for message in messages], | ||
| } | ||
|
|
||
| response = self._post( | ||
| '/v2/bot/message/validate/multicast', data=json.dumps(data), | ||
| timeout=timeout | ||
| ) | ||
|
|
||
| return ValidateMulticastMessageObjectsResponse( | ||
| request_id=response.headers.get('X-Line-Request-Id')) | ||
louis70109 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def validate_broadcast_message_objects(self, messages, timeout=None): | ||
| """Call validate broadcast message objects API. | ||
|
|
||
| https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-broadcast-message | ||
|
|
||
| You can validate that an array of message objects is valid as a value | ||
| for the messages property of the request body for the send broadcast message endpoint. | ||
|
|
||
| :param messages: Messages. | ||
| Max: 5 | ||
| :type messages: T <= :py:class:`linebot.models.send_messages.SendMessage` | | ||
| list[T <= :py:class:`linebot.models.send_messages.SendMessage`] | ||
| :param timeout: (optional) How long to wait for the server | ||
| to send data before giving up, as a float, | ||
| or a (connect timeout, read timeout) float tuple. | ||
| Default is self.http_client.timeout | ||
| :type timeout: float | tuple(float, float) | ||
| :rtype: :py:class:`linebot.models.responses.ValidateBroadcastMessageObjectsResponse` | ||
| """ | ||
| if not isinstance(messages, (list, tuple)): | ||
| messages = [messages] | ||
|
|
||
| data = { | ||
| 'messages': [message.as_json_dict() for message in messages], | ||
| } | ||
|
|
||
| response = self._post( | ||
| '/v2/bot/message/validate/broadcast', data=json.dumps(data), | ||
| timeout=timeout | ||
| ) | ||
|
|
||
| return ValidateBroadcastMessageObjectsResponse( | ||
| request_id=response.headers.get('X-Line-Request-Id')) | ||
|
|
||
louis70109 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| def validate_narrowcast_message_objects(self, messages, timeout=None): | ||
| """Call validate narrowcast message objects API. | ||
|
|
||
| https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-narrowcast-message | ||
|
|
||
| You can validate that an array of message objects is valid as a value | ||
| for the messages property of the request body for the send narrowcast message endpoint. | ||
|
|
||
| :param messages: Messages. | ||
| Max: 5 | ||
| :type messages: T <= :py:class:`linebot.models.send_messages.SendMessage` | | ||
| list[T <= :py:class:`linebot.models.send_messages.SendMessage`] | ||
| :param timeout: (optional) How long to wait for the server | ||
| to send data before giving up, as a float, | ||
| or a (connect timeout, read timeout) float tuple. | ||
| Default is self.http_client.timeout | ||
| :type timeout: float | tuple(float, float) | ||
| :rtype: :py:class:`linebot.models.responses.ValidateNarrowcastMessageObjectsResponse` | ||
| """ | ||
| if not isinstance(messages, (list, tuple)): | ||
| messages = [messages] | ||
|
|
||
| data = { | ||
| 'messages': [message.as_json_dict() for message in messages], | ||
| } | ||
|
|
||
| response = self._post( | ||
| '/v2/bot/message/validate/narrowcast', data=json.dumps(data), | ||
| timeout=timeout | ||
| ) | ||
|
|
||
| return ValidateNarrowcastMessageObjectsResponse( | ||
| request_id=response.headers.get('X-Line-Request-Id')) | ||
louis70109 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def get_message_delivery_broadcast(self, date, timeout=None): | ||
| """Get number of sent broadcast messages. | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.