Skip to content

Commit a33e4b0

Browse files
feat: [google-apps-chat] add rich link annotation type (#12459)
BEGIN_COMMIT_OVERRIDE feat: add rich link annotation type END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. PiperOrigin-RevId: 615897483 Source-Link: googleapis/googleapis@f5ed6db Source-Link: googleapis/googleapis-gen@ce37bd9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFwcHMtY2hhdC8uT3dsQm90LnlhbWwiLCJoIjoiY2UzN2JkOTk2NDIwY2JhMDQwNzUwMmMwNjFjMDJmYjRjNDlhZmE0YSJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent af6ce5d commit a33e4b0

File tree

8 files changed

+118
-5
lines changed

8 files changed

+118
-5
lines changed

packages/google-apps-chat/google/apps/chat/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
from google.apps.chat_v1.types.annotation import (
2727
Annotation,
2828
AnnotationType,
29+
DriveLinkData,
30+
RichLinkMetadata,
2931
SlashCommandMetadata,
3032
UserMentionMetadata,
3133
)
@@ -98,6 +100,8 @@
98100
"ChatServiceAsyncClient",
99101
"ActionStatus",
100102
"Annotation",
103+
"DriveLinkData",
104+
"RichLinkMetadata",
101105
"SlashCommandMetadata",
102106
"UserMentionMetadata",
103107
"AnnotationType",

packages/google-apps-chat/google/apps/chat_v1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from .types.annotation import (
2424
Annotation,
2525
AnnotationType,
26+
DriveLinkData,
27+
RichLinkMetadata,
2628
SlashCommandMetadata,
2729
UserMentionMetadata,
2830
)
@@ -117,6 +119,7 @@
117119
"Dialog",
118120
"DialogAction",
119121
"DriveDataRef",
122+
"DriveLinkData",
120123
"Emoji",
121124
"EmojiReactionSummary",
122125
"FindDirectMessageRequest",
@@ -139,6 +142,7 @@
139142
"Message",
140143
"QuotedMessageMetadata",
141144
"Reaction",
145+
"RichLinkMetadata",
142146
"SetUpSpaceRequest",
143147
"SlashCommand",
144148
"SlashCommandMetadata",

packages/google-apps-chat/google/apps/chat_v1/services/chat_service/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ async def sample_get_space():
16261626
The request object. A request to return a single space.
16271627
name (:class:`str`):
16281628
Required. Resource name of the space, in the form
1629-
"spaces/*".
1629+
``"spaces/*"``.
16301630
16311631
Format: ``spaces/{space}``
16321632

packages/google-apps-chat/google/apps/chat_v1/services/chat_service/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ def sample_get_space():
20442044
The request object. A request to return a single space.
20452045
name (str):
20462046
Required. Resource name of the space, in the form
2047-
"spaces/*".
2047+
``"spaces/*"``.
20482048
20492049
Format: ``spaces/{space}``
20502050

packages/google-apps-chat/google/apps/chat_v1/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
from .annotation import (
1818
Annotation,
1919
AnnotationType,
20+
DriveLinkData,
21+
RichLinkMetadata,
2022
SlashCommandMetadata,
2123
UserMentionMetadata,
2224
)
@@ -87,6 +89,8 @@
8789
__all__ = (
8890
"ActionStatus",
8991
"Annotation",
92+
"DriveLinkData",
93+
"RichLinkMetadata",
9094
"SlashCommandMetadata",
9195
"UserMentionMetadata",
9296
"AnnotationType",

packages/google-apps-chat/google/apps/chat_v1/types/annotation.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import proto # type: ignore
2121

22+
from google.apps.chat_v1.types import attachment
2223
from google.apps.chat_v1.types import user as gc_user
2324

2425
__protobuf__ = proto.module(
@@ -28,6 +29,8 @@
2829
"Annotation",
2930
"UserMentionMetadata",
3031
"SlashCommandMetadata",
32+
"RichLinkMetadata",
33+
"DriveLinkData",
3134
},
3235
)
3336

@@ -42,10 +45,13 @@ class AnnotationType(proto.Enum):
4245
A user is mentioned.
4346
SLASH_COMMAND (2):
4447
A slash command is invoked.
48+
RICH_LINK (3):
49+
A rich link annotation.
4550
"""
4651
ANNOTATION_TYPE_UNSPECIFIED = 0
4752
USER_MENTION = 1
4853
SLASH_COMMAND = 2
54+
RICH_LINK = 3
4955

5056

5157
class Annotation(proto.Message):
@@ -104,6 +110,10 @@ class Annotation(proto.Message):
104110
slash_command (google.apps.chat_v1.types.SlashCommandMetadata):
105111
The metadata for a slash command.
106112
113+
This field is a member of `oneof`_ ``metadata``.
114+
rich_link_metadata (google.apps.chat_v1.types.RichLinkMetadata):
115+
The metadata for a rich link.
116+
107117
This field is a member of `oneof`_ ``metadata``.
108118
"""
109119

@@ -133,6 +143,12 @@ class Annotation(proto.Message):
133143
oneof="metadata",
134144
message="SlashCommandMetadata",
135145
)
146+
rich_link_metadata: "RichLinkMetadata" = proto.Field(
147+
proto.MESSAGE,
148+
number=6,
149+
oneof="metadata",
150+
message="RichLinkMetadata",
151+
)
136152

137153

138154
class UserMentionMetadata(proto.Message):
@@ -228,4 +244,73 @@ class Type(proto.Enum):
228244
)
229245

230246

247+
class RichLinkMetadata(proto.Message):
248+
r"""A rich link to a resource.
249+
250+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
251+
252+
Attributes:
253+
uri (str):
254+
The URI of this link.
255+
rich_link_type (google.apps.chat_v1.types.RichLinkMetadata.RichLinkType):
256+
The rich link type.
257+
drive_link_data (google.apps.chat_v1.types.DriveLinkData):
258+
Data for a drive link.
259+
260+
This field is a member of `oneof`_ ``data``.
261+
"""
262+
263+
class RichLinkType(proto.Enum):
264+
r"""The rich link type. More types might be added in the future.
265+
266+
Values:
267+
RICH_LINK_TYPE_UNSPECIFIED (0):
268+
Default value for the enum. Don't use.
269+
DRIVE_FILE (1):
270+
A Google Drive rich link type.
271+
"""
272+
RICH_LINK_TYPE_UNSPECIFIED = 0
273+
DRIVE_FILE = 1
274+
275+
uri: str = proto.Field(
276+
proto.STRING,
277+
number=1,
278+
)
279+
rich_link_type: RichLinkType = proto.Field(
280+
proto.ENUM,
281+
number=2,
282+
enum=RichLinkType,
283+
)
284+
drive_link_data: "DriveLinkData" = proto.Field(
285+
proto.MESSAGE,
286+
number=3,
287+
oneof="data",
288+
message="DriveLinkData",
289+
)
290+
291+
292+
class DriveLinkData(proto.Message):
293+
r"""Data for Google Drive links.
294+
295+
Attributes:
296+
drive_data_ref (google.apps.chat_v1.types.DriveDataRef):
297+
A
298+
`DriveDataRef <https://developers.google.com/chat/api/reference/rest/v1/spaces.messages.attachments#drivedataref>`__
299+
which references a Google Drive file.
300+
mime_type (str):
301+
The mime type of the linked Google Drive
302+
resource.
303+
"""
304+
305+
drive_data_ref: attachment.DriveDataRef = proto.Field(
306+
proto.MESSAGE,
307+
number=1,
308+
message=attachment.DriveDataRef,
309+
)
310+
mime_type: str = proto.Field(
311+
proto.STRING,
312+
number=2,
313+
)
314+
315+
231316
__all__ = tuple(sorted(__protobuf__.manifest))

packages/google-apps-chat/google/apps/chat_v1/types/space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ class GetSpaceRequest(proto.Message):
404404
Attributes:
405405
name (str):
406406
Required. Resource name of the space, in the form
407-
"spaces/*".
407+
``"spaces/*"``.
408408
409409
Format: ``spaces/{space}``
410410
"""

packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7007,6 +7007,14 @@ def test_create_message_rest(request_type):
70077007
"command_id": 1035,
70087008
"triggers_dialog": True,
70097009
},
7010+
"rich_link_metadata": {
7011+
"uri": "uri_value",
7012+
"rich_link_type": 1,
7013+
"drive_link_data": {
7014+
"drive_data_ref": {"drive_file_id": "drive_file_id_value"},
7015+
"mime_type": "mime_type_value",
7016+
},
7017+
},
70107018
}
70117019
],
70127020
"thread": {"name": "name_value", "thread_key": "thread_key_value"},
@@ -7052,7 +7060,7 @@ def test_create_message_rest(request_type):
70527060
"resource_name": "resource_name_value",
70537061
"attachment_upload_token": "attachment_upload_token_value",
70547062
},
7055-
"drive_data_ref": {"drive_file_id": "drive_file_id_value"},
7063+
"drive_data_ref": {},
70567064
"thumbnail_uri": "thumbnail_uri_value",
70577065
"download_uri": "download_uri_value",
70587066
"source": 1,
@@ -8941,6 +8949,14 @@ def test_update_message_rest(request_type):
89418949
"command_id": 1035,
89428950
"triggers_dialog": True,
89438951
},
8952+
"rich_link_metadata": {
8953+
"uri": "uri_value",
8954+
"rich_link_type": 1,
8955+
"drive_link_data": {
8956+
"drive_data_ref": {"drive_file_id": "drive_file_id_value"},
8957+
"mime_type": "mime_type_value",
8958+
},
8959+
},
89448960
}
89458961
],
89468962
"thread": {"name": "name_value", "thread_key": "thread_key_value"},
@@ -8986,7 +9002,7 @@ def test_update_message_rest(request_type):
89869002
"resource_name": "resource_name_value",
89879003
"attachment_upload_token": "attachment_upload_token_value",
89889004
},
8989-
"drive_data_ref": {"drive_file_id": "drive_file_id_value"},
9005+
"drive_data_ref": {},
89909006
"thumbnail_uri": "thumbnail_uri_value",
89919007
"download_uri": "download_uri_value",
89929008
"source": 1,

0 commit comments

Comments
 (0)