[go: nahoru, domu]

Skip to content

Commit

Permalink
Update Business Messages Python client library to support sending Rea…
Browse files Browse the repository at this point in the history
…d Receipts
  • Loading branch information
adamjchan committed Feb 10, 2022
1 parent 0cb7ea0 commit d5c76fa
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 7 deletions.
30 changes: 30 additions & 0 deletions businessmessages/businessmessages_v1_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Generated client library for businessmessages version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.

from __future__ import absolute_import

from apitools.base.py import base_api
from . import businessmessages_v1_messages as messages

Expand Down Expand Up @@ -115,6 +118,33 @@ def Create(self, request, global_params=None):
supports_download=False,
)

def UpdateReceipt(self, request, global_params=None):
r"""Sends a receipt for a message from an agent to a user.
Args:
request: (BusinessMessagesReceipt) input message
global_params: (StandardQueryParameters, default: None) global arguments
Returns:
(BusinessMessagesReceipt) The response message.
"""
config = self.GetMethodConfig('UpdateReceipt')
return self._RunMethod(
config, request, global_params=global_params)

UpdateReceipt.method_config = lambda: base_api.ApiMethodInfo(
flat_path='v1/conversations/{conversationsId}/messages/{messagesId}/receipt',
http_method='PATCH',
method_id='businessmessages.conversations.messages.updateReceipt',
ordered_params=['name'],
path_params=['name'],
query_params=[],
relative_path='v1/{+name}',
request_field='<request>',
request_type_name='BusinessMessagesReceipt',
response_type_name='BusinessMessagesReceipt',
supports_download=False,
)

class ConversationsSurveysService(base_api.BaseApiService):
"""Service class for the conversations_surveys resource."""

Expand Down
47 changes: 41 additions & 6 deletions businessmessages/businessmessages_v1_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""
# NOTE: This file is autogenerated and should not be edited by hand.

from __future__ import absolute_import

from apitools.base.protorpclite import messages as _messages
from apitools.base.py import encoding

Expand Down Expand Up @@ -30,20 +32,25 @@ class BusinessMessagesAuthenticationRequestOauth(_messages.Message):
codeChallenge: Required. The [code
challenge](https://tools.ietf.org/html/rfc7636#section-4.2) used to
exchange access tokens.
codeChallengeMethod: Optional. The [code challenge
method](https://www.oauth.com/oauth2-servers/pkce/authorization-
request/) used to generate the code challenge. If this parameter is
omitted, the server assumes `plain`.
scopes: Required. An array that specifies the
[scopes](https://oauth.net/2/scope/) of the request.
"""

clientId = _messages.StringField(1)
codeChallenge = _messages.StringField(2)
scopes = _messages.StringField(3, repeated=True)
codeChallengeMethod = _messages.StringField(3)
scopes = _messages.StringField(4, repeated=True)


class BusinessMessagesCardContent(_messages.Message):
r"""Card content.
Fields:
description: Optional. Description of the card. Maximum 2000 characters.
description: Optional. Description of the card. Maximum 2,000 characters.
media: Optional. Media to include in the card.
suggestions: Optional. List of suggestions to include in the card. Maximum
4 suggestions.
Expand Down Expand Up @@ -216,7 +223,7 @@ class BusinessMessagesMessage(_messages.Message):
rich text. If the message contains invalid formatting, Business Messages
returns an error.
fallback: Optional. Fallback text that displays if the user's device
doesn't support the message type or content.
doesn't support the message type or content. Maximum 3,072 characters.
image: Image message.
messageId: Required. The unique identifier of the message, assigned by the
agent. If a message attempts to use the same `messageId` as a previous
Expand All @@ -234,7 +241,7 @@ class BusinessMessagesMessage(_messages.Message):
most recent message within the conversation (including both agent and
user messages). The user can tap a suggested reply to send the text
reply to the agent.
text: Text message.
text: Text message. Maximum 3,072 characters.
"""

containsRichText = _messages.BooleanField(1)
Expand All @@ -258,6 +265,34 @@ class BusinessMessagesOpenUrlAction(_messages.Message):
url = _messages.StringField(1)


class BusinessMessagesReceipt(_messages.Message):
r"""A receipt of the message.
Enums:
ReceiptTypeValueValuesEnum: A receipt type.
Fields:
name: The name of the receipt, as set by Business Messages. Resolves to
"conversations/{conversationId}/messages/{messageId}/receipt", where
{conversationId} is the unique ID for the conversation and {messageId}
is the unique ID for the message.
receiptType: A receipt type.
"""

class ReceiptTypeValueValuesEnum(_messages.Enum):
r"""A receipt type.
Values:
RECEIPT_TYPE_UNSPECIFIED: Unspecified receipt type.
READ: Message read.
"""
RECEIPT_TYPE_UNSPECIFIED = 0
READ = 1

name = _messages.StringField(1)
receiptType = _messages.EnumField('ReceiptTypeValueValuesEnum', 2)


class BusinessMessagesRepresentative(_messages.Message):
r"""Details about the representative (human or chatbot) that sent the
message.
Expand Down Expand Up @@ -325,7 +360,7 @@ class BusinessMessagesSuggestedAction(_messages.Message):
dialAction: Opens the user's default dialer app.
openUrlAction: Opens the specified URL.
postbackData: The string that the agent receives when a user taps the
suggested action.
suggested action. Maximum 2,048 characters.
text: Text that is shown in the suggested action. Maximum 25 characters.
"""

Expand All @@ -340,7 +375,7 @@ class BusinessMessagesSuggestedReply(_messages.Message):
Fields:
postbackData: The string that the agent receives when a user taps the
suggested reply.
suggested reply. Maximum 2,048 characters.
text: Text that is shown in the suggested reply and sent to the agent when
the user taps it. Maximum 25 characters.
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setuptools.setup(
name="google-businessmessages",
version="1.0.4",
version="1.0.5",
author="Google LLC",
author_email="googleapis-packages@google.com",
description="Google's Business Messages API client library",
Expand Down

0 comments on commit d5c76fa

Please sign in to comment.