diff --git a/packages/google-apps-chat/google/apps/chat/gapic_version.py b/packages/google-apps-chat/google/apps/chat/gapic_version.py index 7a4d810a47da..558c8aab67c5 100644 --- a/packages/google-apps-chat/google/apps/chat/gapic_version.py +++ b/packages/google-apps-chat/google/apps/chat/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.14" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-apps-chat/google/apps/chat_v1/gapic_version.py b/packages/google-apps-chat/google/apps/chat_v1/gapic_version.py index 7a4d810a47da..558c8aab67c5 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/gapic_version.py +++ b/packages/google-apps-chat/google/apps/chat_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.1.14" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/async_client.py b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/async_client.py index 9a1e11ae520b..58f76edd0c60 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/async_client.py +++ b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/async_client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import re from typing import ( Callable, @@ -74,6 +75,15 @@ from .transports.base import DEFAULT_CLIENT_INFO, ChatServiceTransport from .transports.grpc_asyncio import ChatServiceGrpcAsyncIOTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + class ChatServiceAsyncClient: """Enables developers to build Chat apps and @@ -303,6 +313,28 @@ def __init__( client_info=client_info, ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.chat_v1.ChatServiceAsyncClient`.", + extra={ + "serviceName": "google.chat.v1.ChatService", + "universeDomain": getattr( + self._client._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._client._transport, "_credentials") + else { + "serviceName": "google.chat.v1.ChatService", + "credentialsType": None, + }, + ) + async def create_message( self, request: Optional[Union[gc_message.CreateMessageRequest, dict]] = None, @@ -312,16 +344,18 @@ async def create_message( message_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_message.Message: r"""Creates a message in a Google Chat space. For an example, see `Send a message `__. - The ``create()`` method requires either user or app - authentication. Chat attributes the message sender differently - depending on the type of authentication that you use in your - request. + The ``create()`` method requires either `user + authentication `__ + or `app + authentication `__. + Chat attributes the message sender differently depending on the + type of authentication that you use in your request. The following image shows how Chat attributes a message when you use app authentication. Chat displays the Chat app as the @@ -342,6 +376,12 @@ async def create_message( The maximum message size, including the message contents, is 32,000 bytes. + For + `webhook `__ + requests, the response doesn't contain the full message. The + response only populates the ``name`` and ``thread.name`` fields + in addition to the information that was in the request. + .. |Message sent with app authentication async| image:: https://developers.google.com/workspace/chat/images/message-app-auth.svg .. |Message sent with user authentication async| image:: https://developers.google.com/workspace/chat/images/message-user-auth.svg @@ -414,8 +454,10 @@ async def sample_create_message(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Message: @@ -478,7 +520,7 @@ async def list_messages( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListMessagesAsyncPager: r"""Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. If you list @@ -486,6 +528,7 @@ async def list_messages( object. When using a REST/HTTP interface, the response contains an empty JSON object, ``{}``. For an example, see `List messages `__. + Requires `user authentication `__. @@ -532,8 +575,10 @@ async def sample_list_messages(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListMessagesAsyncPager: @@ -608,7 +653,7 @@ async def list_memberships( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListMembershipsAsyncPager: r"""Lists memberships in a space. For an example, see `List users and Google Chat apps in a @@ -622,12 +667,17 @@ async def list_memberships( lists memberships in spaces that the authenticated user has access to. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -673,8 +723,10 @@ async def sample_list_memberships(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListMembershipsAsyncPager: @@ -749,18 +801,23 @@ async def get_membership( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> membership.Membership: r"""Returns details about a membership. For an example, see `Get details about a user's or Google Chat app's membership `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -802,9 +859,7 @@ async def sample_get_membership(): Format: ``spaces/{space}/members/{member}`` or ``spaces/{space}/members/app`` - When `authenticated as a - user `__, - you can use the user's email as an alias for + You can use the user's email as an alias for ``{member}``. For example, ``spaces/{space}/members/example@gmail.com`` where ``example@gmail.com`` is the email of the Google Chat @@ -816,8 +871,10 @@ async def sample_get_membership(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Membership: @@ -880,18 +937,20 @@ async def get_message( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> message.Message: r"""Returns details about a message. For an example, see `Get details about a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ Note: Might return a message from a blocked member or space. @@ -940,8 +999,10 @@ async def sample_get_message(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Message: @@ -1001,7 +1062,7 @@ async def update_message( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_message.Message: r"""Updates a message. There's a difference between the ``patch`` and ``update`` methods. The ``patch`` method uses a ``patch`` @@ -1010,12 +1071,15 @@ async def update_message( `Update a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + When using app authentication, requests can only update messages created by the calling Chat app. @@ -1080,8 +1144,10 @@ async def sample_update_message(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Message: @@ -1144,17 +1210,20 @@ async def delete_message( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a message. For an example, see `Delete a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + When using app authentication, requests can only delete messages created by the calling Chat app. @@ -1200,8 +1269,10 @@ async def sample_delete_message(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -1253,7 +1324,7 @@ async def get_attachment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> attachment.Attachment: r"""Gets the metadata of a message attachment. The attachment data is fetched using the `media @@ -1302,8 +1373,10 @@ async def sample_get_attachment(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Attachment: @@ -1361,11 +1434,12 @@ async def upload_attachment( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> attachment.UploadAttachmentResponse: r"""Uploads an attachment. For an example, see `Upload media as a file attachment `__. + Requires user `authentication `__. @@ -1406,8 +1480,10 @@ async def sample_upload_attachment(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.UploadAttachmentResponse: @@ -1451,22 +1527,21 @@ async def list_spaces( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListSpacesAsyncPager: r"""Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see `List spaces `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ - Lists spaces visible to the caller or authenticated user. Group - chats and DMs aren't listed until the first message is sent. + - `User + authentication `__ To list all named spaces by Google Workspace organization, use the @@ -1506,8 +1581,10 @@ async def sample_list_spaces(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListSpacesAsyncPager: @@ -1561,11 +1638,12 @@ async def search_spaces( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.SearchSpacesAsyncPager: r"""Returns a list of spaces in a Google Workspace organization - based on an administrator's search. Requires `user - authentication with administrator + based on an administrator's search. + + Requires `user authentication with administrator privileges `__. In the request, set ``use_admin_access`` to ``true``. @@ -1603,8 +1681,10 @@ async def sample_search_spaces(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.SearchSpacesAsyncPager: @@ -1659,18 +1739,23 @@ async def get_space( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Returns details about a space. For an example, see `Get details about a space `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -1713,8 +1798,10 @@ async def sample_get_space(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -1777,11 +1864,11 @@ async def create_space( space: Optional[gc_space.Space] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space.Space: r"""Creates a space with no members. Can be used to create a named - space. Spaces grouped by topics aren't supported. For an - example, see `Create a + space, or a group chat in ``Import mode``. For an example, see + `Create a space `__. If you receive the error message ``ALREADY_EXISTS`` when @@ -1789,13 +1876,21 @@ async def create_space( space within the Google Workspace organization might already use this display name. - If you're a member of the `Developer Preview - program `__, - you can create a group chat in import mode using - ``spaceType.GROUP_CHAT``. + Supports the following types of + `authentication `__: - Requires `user - authentication `__. + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + + When authenticating as an app, the ``space.customer`` field must + be set in the request. .. code-block:: python @@ -1832,19 +1927,16 @@ async def sample_create_space(): with no members. space (:class:`google.apps.chat_v1.types.Space`): Required. The ``displayName`` and ``spaceType`` fields - must be populated. Only ``SpaceType.SPACE`` is - supported. + must be populated. Only ``SpaceType.SPACE`` and + ``SpaceType.GROUP_CHAT`` are supported. + ``SpaceType.GROUP_CHAT`` can only be used if + ``importMode`` is set to true. If you receive the error message ``ALREADY_EXISTS``, try a different ``displayName``. An existing space within the Google Workspace organization might already use this display name. - If you're a member of the `Developer Preview - program `__, - ``SpaceType.GROUP_CHAT`` can be used if ``importMode`` - is set to true. - The space ``name`` is assigned on the server so anything specified in this field will be ignored. @@ -1854,8 +1946,10 @@ async def sample_create_space(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -1911,7 +2005,7 @@ async def set_up_space( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified @@ -2008,8 +2102,10 @@ async def sample_set_up_space(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -2053,7 +2149,7 @@ async def update_space( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space.Space: r"""Updates a space. For an example, see `Update a space `__. @@ -2063,8 +2159,21 @@ async def update_space( An existing space within the Google Workspace organization might already use this display name. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -2185,8 +2294,10 @@ async def sample_update_space(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -2253,16 +2364,29 @@ async def delete_space( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see `Delete a space `__. - Requires `user - authentication `__ - from a user who has permission to delete the space. + + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -2301,8 +2425,10 @@ async def sample_delete_space(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -2353,13 +2479,16 @@ async def complete_import_space( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.CompleteImportSpaceResponse: r"""Completes the `import process `__ - for the specified space and makes it visible to users. Requires - app authentication and domain-wide delegation. For more - information, see `Authorize Google Chat apps to import + for the specified space and makes it visible to users. + + Requires `app + authentication `__ + and domain-wide delegation. For more information, see `Authorize + Google Chat apps to import data `__. .. code-block:: python @@ -2395,8 +2524,10 @@ async def sample_complete_import_space(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.CompleteImportSpaceResponse: @@ -2442,27 +2573,31 @@ async def find_direct_message( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Returns the existing direct message with the specified user. If no direct message space is found, returns a ``404 NOT_FOUND`` error. For an example, see `Find a direct message `__. + With `app + authentication `__, + returns the direct message space between the specified user and + the calling Chat app. + With `user authentication `__, returns the direct message space between the specified user and the authenticated user. - With `app - authentication `__, - returns the direct message space between the specified user and - the calling Chat app. + // Supports the following types of + `authentication `__: - Requires `user - authentication `__ - or `app - authentication `__. + - `App + authentication `__ + + - `User + authentication `__ .. code-block:: python @@ -2497,8 +2632,10 @@ async def sample_find_direct_message(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -2542,7 +2679,7 @@ async def create_membership( membership: Optional[gc_membership.Membership] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_membership.Membership: r"""Creates a membership for the calling Chat app, a user, or a Google Group. Creating memberships for other Chat apps isn't @@ -2550,8 +2687,23 @@ async def create_membership( has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified - space. Requires `user - authentication `__. + space. + + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. For example usage, see: @@ -2605,27 +2757,52 @@ async def sample_create_membership(): on the ``request`` instance; if ``request`` is provided, this should not be set. membership (:class:`google.apps.chat_v1.types.Membership`): - Required. The membership relation to create. The - ``memberType`` field must contain a user with the + Required. The membership relation to create. + + The ``memberType`` field must contain a user with the ``user.name`` and ``user.type`` fields populated. The server will assign a resource name and overwrite - anything specified. When a Chat app creates a membership - relation for a human user, it must use the - ``chat.memberships`` scope, set ``user.type`` to - ``HUMAN``, and set ``user.name`` with format - ``users/{user}``, where ``{user}`` can be the email - address for the user. For users in the same Workspace - organization ``{user}`` can also be the ``id`` of the - `person `__ - from the People API, or the ``id`` for the user in the - Directory API. For example, if the People API Person - profile ID for ``user@example.com`` is ``123456789``, - you can add the user to the space by setting the - ``membership.member.name`` to ``users/user@example.com`` - or ``users/123456789``. When a Chat app creates a - membership relation for itself, it must use the - ``chat.memberships.app`` scope, set ``user.type`` to - ``BOT``, and set ``user.name`` to ``users/app``. + anything specified. + + When a Chat app creates a membership relation for a + human user, it must use certain authorization scopes and + set specific values for certain fields: + + - When `authenticating as a + user `__, + the ``chat.memberships`` authorization scope is + required. + + - When `authenticating as an + app `__, + the ``chat.app.memberships`` authorization scope is + required. Authenticating as an app is available in + `Developer + Preview `__. + + - Set ``user.type`` to ``HUMAN``, and set ``user.name`` + with format ``users/{user}``, where ``{user}`` can be + the email address for the user. For users in the same + Workspace organization ``{user}`` can also be the + ``id`` of the + `person `__ + from the People API, or the ``id`` for the user in + the Directory API. For example, if the People API + Person profile ID for ``user@example.com`` is + ``123456789``, you can add the user to the space by + setting the ``membership.member.name`` to + ``users/user@example.com`` or ``users/123456789``. + + Inviting users external to the Workspace organization + that owns the space requires `user + authentication `__. + + When a Chat app creates a membership relation for + itself, it must `authenticate as a + user `__ + and use the ``chat.memberships.app`` scope, set + ``user.type`` to ``BOT``, and set ``user.name`` to + ``users/app``. This corresponds to the ``membership`` field on the ``request`` instance; if ``request`` is provided, this @@ -2633,8 +2810,10 @@ async def sample_create_membership(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Membership: @@ -2700,14 +2879,27 @@ async def update_membership( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_membership.Membership: r"""Updates a membership. For an example, see `Update a user's membership in a space `__. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -2760,8 +2952,10 @@ async def sample_update_membership(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Membership: @@ -2828,14 +3022,27 @@ async def delete_membership( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> membership.Membership: r"""Deletes a membership. For an example, see `Remove a user or a Google Chat app from a space `__. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -2894,8 +3101,10 @@ async def sample_delete_membership(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Membership: @@ -2959,11 +3168,12 @@ async def create_reaction( reaction: Optional[gc_reaction.Reaction] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_reaction.Reaction: r"""Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, see `Add a reaction to a message `__. + Requires `user authentication `__. @@ -2983,8 +3193,12 @@ async def sample_create_reaction(): client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) + reaction = chat_v1.Reaction() + reaction.emoji.unicode = "unicode_value" + request = chat_v1.CreateReactionRequest( parent="parent_value", + reaction=reaction, ) # Make the request @@ -3012,8 +3226,10 @@ async def sample_create_reaction(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Reaction: @@ -3074,11 +3290,12 @@ async def list_reactions( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListReactionsAsyncPager: r"""Lists reactions to a message. For an example, see `List reactions for a message `__. + Requires `user authentication `__. @@ -3123,8 +3340,10 @@ async def sample_list_reactions(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListReactionsAsyncPager: @@ -3199,11 +3418,12 @@ async def delete_reaction( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a reaction to a message. Only unicode emojis are supported. For an example, see `Delete a reaction `__. + Requires `user authentication `__. @@ -3245,8 +3465,10 @@ async def sample_delete_reaction(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -3300,7 +3522,7 @@ async def get_space_read_state( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space_read_state.SpaceReadState: r"""Returns details about a user's read state within a space, used to identify read and unread messages. For an example, see `Get @@ -3365,8 +3587,10 @@ async def sample_get_space_read_state(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.SpaceReadState: @@ -3431,7 +3655,7 @@ async def update_space_read_state( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space_read_state.SpaceReadState: r"""Updates a user's read state within a space, used to identify read and unread messages. For an example, see `Update a user's @@ -3515,8 +3739,10 @@ async def sample_update_space_read_state(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.SpaceReadState: @@ -3584,7 +3810,7 @@ async def get_thread_read_state( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> thread_read_state.ThreadReadState: r"""Returns details about a user's read state within a thread, used to identify read and unread messages. For an example, see `Get @@ -3650,8 +3876,10 @@ async def sample_get_thread_read_state(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.ThreadReadState: @@ -3713,7 +3941,7 @@ async def get_space_event( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space_event.SpaceEvent: r"""Returns an event from a Google Chat space. The `event payload `__ @@ -3775,8 +4003,10 @@ async def sample_get_space_event(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.SpaceEvent: @@ -3839,7 +4069,7 @@ async def list_space_events( filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListSpaceEventsAsyncPager: r"""Lists events from a Google Chat space. For each event, the `payload `__ @@ -3967,8 +4197,10 @@ async def sample_list_space_events(): retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsAsyncPager: diff --git a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/client.py b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/client.py index f38740dd5526..266684cd5ce2 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/client.py +++ b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/client.py @@ -14,6 +14,7 @@ # limitations under the License. # from collections import OrderedDict +import logging as std_logging import os import re from typing import ( @@ -48,6 +49,15 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore @@ -771,6 +781,10 @@ def __init__( # Initialize the universe domain validation. self._is_universe_domain_valid = False + if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER + # Setup logging. + client_logging.initialize_logging() + api_key_value = getattr(self._client_options, "api_key", None) if api_key_value and credentials: raise ValueError( @@ -833,6 +847,29 @@ def __init__( api_audience=self._client_options.api_audience, ) + if "async" not in str(self._transport): + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ): # pragma: NO COVER + _LOGGER.debug( + "Created client `google.chat_v1.ChatServiceClient`.", + extra={ + "serviceName": "google.chat.v1.ChatService", + "universeDomain": getattr( + self._transport._credentials, "universe_domain", "" + ), + "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}", + "credentialsInfo": getattr( + self.transport._credentials, "get_cred_info", lambda: None + )(), + } + if hasattr(self._transport, "_credentials") + else { + "serviceName": "google.chat.v1.ChatService", + "credentialsType": None, + }, + ) + def create_message( self, request: Optional[Union[gc_message.CreateMessageRequest, dict]] = None, @@ -842,16 +879,18 @@ def create_message( message_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_message.Message: r"""Creates a message in a Google Chat space. For an example, see `Send a message `__. - The ``create()`` method requires either user or app - authentication. Chat attributes the message sender differently - depending on the type of authentication that you use in your - request. + The ``create()`` method requires either `user + authentication `__ + or `app + authentication `__. + Chat attributes the message sender differently depending on the + type of authentication that you use in your request. The following image shows how Chat attributes a message when you use app authentication. Chat displays the Chat app as the @@ -872,6 +911,12 @@ def create_message( The maximum message size, including the message contents, is 32,000 bytes. + For + `webhook `__ + requests, the response doesn't contain the full message. The + response only populates the ``name`` and ``thread.name`` fields + in addition to the information that was in the request. + .. |Message sent with app authentication| image:: https://developers.google.com/workspace/chat/images/message-app-auth.svg .. |Message sent with user authentication| image:: https://developers.google.com/workspace/chat/images/message-user-auth.svg @@ -944,8 +989,10 @@ def sample_create_message(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Message: @@ -1005,7 +1052,7 @@ def list_messages( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListMessagesPager: r"""Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. If you list @@ -1013,6 +1060,7 @@ def list_messages( object. When using a REST/HTTP interface, the response contains an empty JSON object, ``{}``. For an example, see `List messages `__. + Requires `user authentication `__. @@ -1059,8 +1107,10 @@ def sample_list_messages(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListMessagesPager: @@ -1132,7 +1182,7 @@ def list_memberships( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListMembershipsPager: r"""Lists memberships in a space. For an example, see `List users and Google Chat apps in a @@ -1146,12 +1196,17 @@ def list_memberships( lists memberships in spaces that the authenticated user has access to. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -1197,8 +1252,10 @@ def sample_list_memberships(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListMembershipsPager: @@ -1270,18 +1327,23 @@ def get_membership( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> membership.Membership: r"""Returns details about a membership. For an example, see `Get details about a user's or Google Chat app's membership `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -1323,9 +1385,7 @@ def sample_get_membership(): Format: ``spaces/{space}/members/{member}`` or ``spaces/{space}/members/app`` - When `authenticated as a - user `__, - you can use the user's email as an alias for + You can use the user's email as an alias for ``{member}``. For example, ``spaces/{space}/members/example@gmail.com`` where ``example@gmail.com`` is the email of the Google Chat @@ -1337,8 +1397,10 @@ def sample_get_membership(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Membership: @@ -1398,18 +1460,20 @@ def get_message( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> message.Message: r"""Returns details about a message. For an example, see `Get details about a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ Note: Might return a message from a blocked member or space. @@ -1458,8 +1522,10 @@ def sample_get_message(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Message: @@ -1516,7 +1582,7 @@ def update_message( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_message.Message: r"""Updates a message. There's a difference between the ``patch`` and ``update`` methods. The ``patch`` method uses a ``patch`` @@ -1525,12 +1591,15 @@ def update_message( `Update a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + When using app authentication, requests can only update messages created by the calling Chat app. @@ -1595,8 +1664,10 @@ def sample_update_message(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Message: @@ -1656,17 +1727,20 @@ def delete_message( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a message. For an example, see `Delete a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + When using app authentication, requests can only delete messages created by the calling Chat app. @@ -1712,8 +1786,10 @@ def sample_delete_message(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -1762,7 +1838,7 @@ def get_attachment( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> attachment.Attachment: r"""Gets the metadata of a message attachment. The attachment data is fetched using the `media @@ -1811,8 +1887,10 @@ def sample_get_attachment(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Attachment: @@ -1867,11 +1945,12 @@ def upload_attachment( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> attachment.UploadAttachmentResponse: r"""Uploads an attachment. For an example, see `Upload media as a file attachment `__. + Requires user `authentication `__. @@ -1912,8 +1991,10 @@ def sample_upload_attachment(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.UploadAttachmentResponse: @@ -1955,22 +2036,21 @@ def list_spaces( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListSpacesPager: r"""Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see `List spaces `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ - Lists spaces visible to the caller or authenticated user. Group - chats and DMs aren't listed until the first message is sent. + - `User + authentication `__ To list all named spaces by Google Workspace organization, use the @@ -2010,8 +2090,10 @@ def sample_list_spaces(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListSpacesPager: @@ -2063,11 +2145,12 @@ def search_spaces( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.SearchSpacesPager: r"""Returns a list of spaces in a Google Workspace organization - based on an administrator's search. Requires `user - authentication with administrator + based on an administrator's search. + + Requires `user authentication with administrator privileges `__. In the request, set ``use_admin_access`` to ``true``. @@ -2105,8 +2188,10 @@ def sample_search_spaces(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.SearchSpacesPager: @@ -2159,18 +2244,23 @@ def get_space( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Returns details about a space. For an example, see `Get details about a space `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -2213,8 +2303,10 @@ def sample_get_space(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -2274,11 +2366,11 @@ def create_space( space: Optional[gc_space.Space] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space.Space: r"""Creates a space with no members. Can be used to create a named - space. Spaces grouped by topics aren't supported. For an - example, see `Create a + space, or a group chat in ``Import mode``. For an example, see + `Create a space `__. If you receive the error message ``ALREADY_EXISTS`` when @@ -2286,13 +2378,21 @@ def create_space( space within the Google Workspace organization might already use this display name. - If you're a member of the `Developer Preview - program `__, - you can create a group chat in import mode using - ``spaceType.GROUP_CHAT``. + Supports the following types of + `authentication `__: - Requires `user - authentication `__. + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + + When authenticating as an app, the ``space.customer`` field must + be set in the request. .. code-block:: python @@ -2329,19 +2429,16 @@ def sample_create_space(): with no members. space (google.apps.chat_v1.types.Space): Required. The ``displayName`` and ``spaceType`` fields - must be populated. Only ``SpaceType.SPACE`` is - supported. + must be populated. Only ``SpaceType.SPACE`` and + ``SpaceType.GROUP_CHAT`` are supported. + ``SpaceType.GROUP_CHAT`` can only be used if + ``importMode`` is set to true. If you receive the error message ``ALREADY_EXISTS``, try a different ``displayName``. An existing space within the Google Workspace organization might already use this display name. - If you're a member of the `Developer Preview - program `__, - ``SpaceType.GROUP_CHAT`` can be used if ``importMode`` - is set to true. - The space ``name`` is assigned on the server so anything specified in this field will be ignored. @@ -2351,8 +2448,10 @@ def sample_create_space(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -2405,7 +2504,7 @@ def set_up_space( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified @@ -2502,8 +2601,10 @@ def sample_set_up_space(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -2545,7 +2646,7 @@ def update_space( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space.Space: r"""Updates a space. For an example, see `Update a space `__. @@ -2555,8 +2656,21 @@ def update_space( An existing space within the Google Workspace organization might already use this display name. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -2677,8 +2791,10 @@ def sample_update_space(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -2742,16 +2858,29 @@ def delete_space( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see `Delete a space `__. - Requires `user - authentication `__ - from a user who has permission to delete the space. + + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -2790,8 +2919,10 @@ def sample_delete_space(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -2839,13 +2970,16 @@ def complete_import_space( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.CompleteImportSpaceResponse: r"""Completes the `import process `__ - for the specified space and makes it visible to users. Requires - app authentication and domain-wide delegation. For more - information, see `Authorize Google Chat apps to import + for the specified space and makes it visible to users. + + Requires `app + authentication `__ + and domain-wide delegation. For more information, see `Authorize + Google Chat apps to import data `__. .. code-block:: python @@ -2881,8 +3015,10 @@ def sample_complete_import_space(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.CompleteImportSpaceResponse: @@ -2926,27 +3062,31 @@ def find_direct_message( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Returns the existing direct message with the specified user. If no direct message space is found, returns a ``404 NOT_FOUND`` error. For an example, see `Find a direct message `__. + With `app + authentication `__, + returns the direct message space between the specified user and + the calling Chat app. + With `user authentication `__, returns the direct message space between the specified user and the authenticated user. - With `app - authentication `__, - returns the direct message space between the specified user and - the calling Chat app. + // Supports the following types of + `authentication `__: - Requires `user - authentication `__ - or `app - authentication `__. + - `App + authentication `__ + + - `User + authentication `__ .. code-block:: python @@ -2981,8 +3121,10 @@ def sample_find_direct_message(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Space: @@ -3024,7 +3166,7 @@ def create_membership( membership: Optional[gc_membership.Membership] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_membership.Membership: r"""Creates a membership for the calling Chat app, a user, or a Google Group. Creating memberships for other Chat apps isn't @@ -3032,8 +3174,23 @@ def create_membership( has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified - space. Requires `user - authentication `__. + space. + + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. For example usage, see: @@ -3087,27 +3244,52 @@ def sample_create_membership(): on the ``request`` instance; if ``request`` is provided, this should not be set. membership (google.apps.chat_v1.types.Membership): - Required. The membership relation to create. The - ``memberType`` field must contain a user with the + Required. The membership relation to create. + + The ``memberType`` field must contain a user with the ``user.name`` and ``user.type`` fields populated. The server will assign a resource name and overwrite - anything specified. When a Chat app creates a membership - relation for a human user, it must use the - ``chat.memberships`` scope, set ``user.type`` to - ``HUMAN``, and set ``user.name`` with format - ``users/{user}``, where ``{user}`` can be the email - address for the user. For users in the same Workspace - organization ``{user}`` can also be the ``id`` of the - `person `__ - from the People API, or the ``id`` for the user in the - Directory API. For example, if the People API Person - profile ID for ``user@example.com`` is ``123456789``, - you can add the user to the space by setting the - ``membership.member.name`` to ``users/user@example.com`` - or ``users/123456789``. When a Chat app creates a - membership relation for itself, it must use the - ``chat.memberships.app`` scope, set ``user.type`` to - ``BOT``, and set ``user.name`` to ``users/app``. + anything specified. + + When a Chat app creates a membership relation for a + human user, it must use certain authorization scopes and + set specific values for certain fields: + + - When `authenticating as a + user `__, + the ``chat.memberships`` authorization scope is + required. + + - When `authenticating as an + app `__, + the ``chat.app.memberships`` authorization scope is + required. Authenticating as an app is available in + `Developer + Preview `__. + + - Set ``user.type`` to ``HUMAN``, and set ``user.name`` + with format ``users/{user}``, where ``{user}`` can be + the email address for the user. For users in the same + Workspace organization ``{user}`` can also be the + ``id`` of the + `person `__ + from the People API, or the ``id`` for the user in + the Directory API. For example, if the People API + Person profile ID for ``user@example.com`` is + ``123456789``, you can add the user to the space by + setting the ``membership.member.name`` to + ``users/user@example.com`` or ``users/123456789``. + + Inviting users external to the Workspace organization + that owns the space requires `user + authentication `__. + + When a Chat app creates a membership relation for + itself, it must `authenticate as a + user `__ + and use the ``chat.memberships.app`` scope, set + ``user.type`` to ``BOT``, and set ``user.name`` to + ``users/app``. This corresponds to the ``membership`` field on the ``request`` instance; if ``request`` is provided, this @@ -3115,8 +3297,10 @@ def sample_create_membership(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Membership: @@ -3179,14 +3363,27 @@ def update_membership( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_membership.Membership: r"""Updates a membership. For an example, see `Update a user's membership in a space `__. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -3239,8 +3436,10 @@ def sample_update_membership(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Membership: @@ -3304,14 +3503,27 @@ def delete_membership( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> membership.Membership: r"""Deletes a membership. For an example, see `Remove a user or a Google Chat app from a space `__. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. .. code-block:: python @@ -3370,8 +3582,10 @@ def sample_delete_membership(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Membership: @@ -3432,11 +3646,12 @@ def create_reaction( reaction: Optional[gc_reaction.Reaction] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_reaction.Reaction: r"""Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, see `Add a reaction to a message `__. + Requires `user authentication `__. @@ -3456,8 +3671,12 @@ def sample_create_reaction(): client = chat_v1.ChatServiceClient() # Initialize request argument(s) + reaction = chat_v1.Reaction() + reaction.emoji.unicode = "unicode_value" + request = chat_v1.CreateReactionRequest( parent="parent_value", + reaction=reaction, ) # Make the request @@ -3485,8 +3704,10 @@ def sample_create_reaction(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.Reaction: @@ -3544,11 +3765,12 @@ def list_reactions( parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListReactionsPager: r"""Lists reactions to a message. For an example, see `List reactions for a message `__. + Requires `user authentication `__. @@ -3593,8 +3815,10 @@ def sample_list_reactions(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListReactionsPager: @@ -3666,11 +3890,12 @@ def delete_reaction( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> None: r"""Deletes a reaction to a message. Only unicode emojis are supported. For an example, see `Delete a reaction `__. + Requires `user authentication `__. @@ -3712,8 +3937,10 @@ def sample_delete_reaction(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ # Create or coerce a protobuf request object. # - Quick check: If we got a request object, we should *not* have @@ -3764,7 +3991,7 @@ def get_space_read_state( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space_read_state.SpaceReadState: r"""Returns details about a user's read state within a space, used to identify read and unread messages. For an example, see `Get @@ -3829,8 +4056,10 @@ def sample_get_space_read_state(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.SpaceReadState: @@ -3892,7 +4121,7 @@ def update_space_read_state( update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space_read_state.SpaceReadState: r"""Updates a user's read state within a space, used to identify read and unread messages. For an example, see `Update a user's @@ -3976,8 +4205,10 @@ def sample_update_space_read_state(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.SpaceReadState: @@ -4042,7 +4273,7 @@ def get_thread_read_state( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> thread_read_state.ThreadReadState: r"""Returns details about a user's read state within a thread, used to identify read and unread messages. For an example, see `Get @@ -4108,8 +4339,10 @@ def sample_get_thread_read_state(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.ThreadReadState: @@ -4168,7 +4401,7 @@ def get_space_event( name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space_event.SpaceEvent: r"""Returns an event from a Google Chat space. The `event payload `__ @@ -4230,8 +4463,10 @@ def sample_get_space_event(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.types.SpaceEvent: @@ -4291,7 +4526,7 @@ def list_space_events( filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pagers.ListSpaceEventsPager: r"""Lists events from a Google Chat space. For each event, the `payload `__ @@ -4419,8 +4654,10 @@ def sample_list_space_events(): retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsPager: diff --git a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/pagers.py b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/pagers.py index 94763fc39240..ef28d4f71052 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/pagers.py +++ b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/pagers.py @@ -67,7 +67,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -81,8 +81,10 @@ def __init__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = message.ListMessagesRequest(request) @@ -141,7 +143,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -155,8 +157,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = message.ListMessagesRequest(request) @@ -219,7 +223,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -233,8 +237,10 @@ def __init__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = membership.ListMembershipsRequest(request) @@ -293,7 +299,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -307,8 +313,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = membership.ListMembershipsRequest(request) @@ -371,7 +379,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -385,8 +393,10 @@ def __init__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = space.ListSpacesRequest(request) @@ -445,7 +455,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -459,8 +469,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = space.ListSpacesRequest(request) @@ -523,7 +535,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -537,8 +549,10 @@ def __init__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = space.SearchSpacesRequest(request) @@ -597,7 +611,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -611,8 +625,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = space.SearchSpacesRequest(request) @@ -675,7 +691,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -689,8 +705,10 @@ def __init__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = reaction.ListReactionsRequest(request) @@ -749,7 +767,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -763,8 +781,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = reaction.ListReactionsRequest(request) @@ -827,7 +847,7 @@ def __init__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiate the pager. @@ -841,8 +861,10 @@ def __init__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = space_event.ListSpaceEventsRequest(request) @@ -901,7 +923,7 @@ def __init__( *, retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = () + metadata: Sequence[Tuple[str, Union[str, bytes]]] = () ): """Instantiates the pager. @@ -915,8 +937,10 @@ def __init__( retry (google.api_core.retry.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ self._method = method self._request = space_event.ListSpaceEventsRequest(request) diff --git a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/grpc.py b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/grpc.py index d02bc6784c2a..7d85a0a227a9 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/grpc.py +++ b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/grpc.py @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import json +import logging as std_logging +import pickle from typing import Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -21,7 +24,10 @@ from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.protobuf import empty_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.apps.chat_v1.types import attachment from google.apps.chat_v1.types import membership @@ -39,6 +45,81 @@ from .base import DEFAULT_CLIENT_INFO, ChatServiceTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER + def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": client_call_details.method, + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + + response = continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = response.result() + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response for {client_call_details.method}.", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ChatServiceGrpcTransport(ChatServiceTransport): """gRPC backend transport for ChatService. @@ -193,7 +274,12 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientInterceptor() + self._logged_channel = grpc.intercept_channel( + self._grpc_channel, self._interceptor + ) + + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @classmethod @@ -258,10 +344,12 @@ def create_message( `Send a message `__. - The ``create()`` method requires either user or app - authentication. Chat attributes the message sender differently - depending on the type of authentication that you use in your - request. + The ``create()`` method requires either `user + authentication `__ + or `app + authentication `__. + Chat attributes the message sender differently depending on the + type of authentication that you use in your request. The following image shows how Chat attributes a message when you use app authentication. Chat displays the Chat app as the @@ -282,6 +370,12 @@ def create_message( The maximum message size, including the message contents, is 32,000 bytes. + For + `webhook `__ + requests, the response doesn't contain the full message. The + response only populates the ``name`` and ``thread.name`` fields + in addition to the information that was in the request. + .. |Message sent with app authentication gRPC| image:: https://developers.google.com/workspace/chat/images/message-app-auth.svg .. |Message sent with user authentication gRPC| image:: https://developers.google.com/workspace/chat/images/message-user-auth.svg @@ -296,7 +390,7 @@ def create_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_message" not in self._stubs: - self._stubs["create_message"] = self.grpc_channel.unary_unary( + self._stubs["create_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CreateMessage", request_serializer=gc_message.CreateMessageRequest.serialize, response_deserializer=gc_message.Message.deserialize, @@ -315,6 +409,7 @@ def list_messages( object. When using a REST/HTTP interface, the response contains an empty JSON object, ``{}``. For an example, see `List messages `__. + Requires `user authentication `__. @@ -329,7 +424,7 @@ def list_messages( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_messages" not in self._stubs: - self._stubs["list_messages"] = self.grpc_channel.unary_unary( + self._stubs["list_messages"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListMessages", request_serializer=message.ListMessagesRequest.serialize, response_deserializer=message.ListMessagesResponse.deserialize, @@ -356,12 +451,17 @@ def list_memberships( lists memberships in spaces that the authenticated user has access to. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.ListMembershipsRequest], @@ -374,7 +474,7 @@ def list_memberships( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_memberships" not in self._stubs: - self._stubs["list_memberships"] = self.grpc_channel.unary_unary( + self._stubs["list_memberships"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListMemberships", request_serializer=membership.ListMembershipsRequest.serialize, response_deserializer=membership.ListMembershipsResponse.deserialize, @@ -391,12 +491,17 @@ def get_membership( details about a user's or Google Chat app's membership `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.GetMembershipRequest], @@ -409,7 +514,7 @@ def get_membership( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_membership" not in self._stubs: - self._stubs["get_membership"] = self.grpc_channel.unary_unary( + self._stubs["get_membership"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetMembership", request_serializer=membership.GetMembershipRequest.serialize, response_deserializer=membership.Membership.deserialize, @@ -424,12 +529,14 @@ def get_message(self) -> Callable[[message.GetMessageRequest], message.Message]: details about a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ Note: Might return a message from a blocked member or space. @@ -444,7 +551,7 @@ def get_message(self) -> Callable[[message.GetMessageRequest], message.Message]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_message" not in self._stubs: - self._stubs["get_message"] = self.grpc_channel.unary_unary( + self._stubs["get_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetMessage", request_serializer=message.GetMessageRequest.serialize, response_deserializer=message.Message.deserialize, @@ -464,12 +571,15 @@ def update_message( `Update a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + When using app authentication, requests can only update messages created by the calling Chat app. @@ -484,7 +594,7 @@ def update_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_message" not in self._stubs: - self._stubs["update_message"] = self.grpc_channel.unary_unary( + self._stubs["update_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UpdateMessage", request_serializer=gc_message.UpdateMessageRequest.serialize, response_deserializer=gc_message.Message.deserialize, @@ -500,12 +610,15 @@ def delete_message( Deletes a message. For an example, see `Delete a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + When using app authentication, requests can only delete messages created by the calling Chat app. @@ -520,7 +633,7 @@ def delete_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_message" not in self._stubs: - self._stubs["delete_message"] = self.grpc_channel.unary_unary( + self._stubs["delete_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/DeleteMessage", request_serializer=message.DeleteMessageRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -552,7 +665,7 @@ def get_attachment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_attachment" not in self._stubs: - self._stubs["get_attachment"] = self.grpc_channel.unary_unary( + self._stubs["get_attachment"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetAttachment", request_serializer=attachment.GetAttachmentRequest.serialize, response_deserializer=attachment.Attachment.deserialize, @@ -570,6 +683,7 @@ def upload_attachment( Uploads an attachment. For an example, see `Upload media as a file attachment `__. + Requires user `authentication `__. @@ -588,7 +702,7 @@ def upload_attachment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_attachment" not in self._stubs: - self._stubs["upload_attachment"] = self.grpc_channel.unary_unary( + self._stubs["upload_attachment"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UploadAttachment", request_serializer=attachment.UploadAttachmentRequest.serialize, response_deserializer=attachment.UploadAttachmentResponse.deserialize, @@ -606,15 +720,14 @@ def list_spaces( see `List spaces `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ - Lists spaces visible to the caller or authenticated user. Group - chats and DMs aren't listed until the first message is sent. + - `User + authentication `__ To list all named spaces by Google Workspace organization, use the @@ -632,7 +745,7 @@ def list_spaces( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_spaces" not in self._stubs: - self._stubs["list_spaces"] = self.grpc_channel.unary_unary( + self._stubs["list_spaces"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListSpaces", request_serializer=space.ListSpacesRequest.serialize, response_deserializer=space.ListSpacesResponse.deserialize, @@ -646,8 +759,9 @@ def search_spaces( r"""Return a callable for the search spaces method over gRPC. Returns a list of spaces in a Google Workspace organization - based on an administrator's search. Requires `user - authentication with administrator + based on an administrator's search. + + Requires `user authentication with administrator privileges `__. In the request, set ``use_admin_access`` to ``true``. @@ -662,7 +776,7 @@ def search_spaces( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_spaces" not in self._stubs: - self._stubs["search_spaces"] = self.grpc_channel.unary_unary( + self._stubs["search_spaces"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/SearchSpaces", request_serializer=space.SearchSpacesRequest.serialize, response_deserializer=space.SearchSpacesResponse.deserialize, @@ -677,12 +791,17 @@ def get_space(self) -> Callable[[space.GetSpaceRequest], space.Space]: about a space `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.GetSpaceRequest], @@ -695,7 +814,7 @@ def get_space(self) -> Callable[[space.GetSpaceRequest], space.Space]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_space" not in self._stubs: - self._stubs["get_space"] = self.grpc_channel.unary_unary( + self._stubs["get_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetSpace", request_serializer=space.GetSpaceRequest.serialize, response_deserializer=space.Space.deserialize, @@ -707,8 +826,8 @@ def create_space(self) -> Callable[[gc_space.CreateSpaceRequest], gc_space.Space r"""Return a callable for the create space method over gRPC. Creates a space with no members. Can be used to create a named - space. Spaces grouped by topics aren't supported. For an - example, see `Create a + space, or a group chat in ``Import mode``. For an example, see + `Create a space `__. If you receive the error message ``ALREADY_EXISTS`` when @@ -716,13 +835,21 @@ def create_space(self) -> Callable[[gc_space.CreateSpaceRequest], gc_space.Space space within the Google Workspace organization might already use this display name. - If you're a member of the `Developer Preview - program `__, - you can create a group chat in import mode using - ``spaceType.GROUP_CHAT``. + Supports the following types of + `authentication `__: - Requires `user - authentication `__. + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + + When authenticating as an app, the ``space.customer`` field must + be set in the request. Returns: Callable[[~.CreateSpaceRequest], @@ -735,7 +862,7 @@ def create_space(self) -> Callable[[gc_space.CreateSpaceRequest], gc_space.Space # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_space" not in self._stubs: - self._stubs["create_space"] = self.grpc_channel.unary_unary( + self._stubs["create_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CreateSpace", request_serializer=gc_space.CreateSpaceRequest.serialize, response_deserializer=gc_space.Space.deserialize, @@ -816,7 +943,7 @@ def set_up_space(self) -> Callable[[space_setup.SetUpSpaceRequest], space.Space] # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_up_space" not in self._stubs: - self._stubs["set_up_space"] = self.grpc_channel.unary_unary( + self._stubs["set_up_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/SetUpSpace", request_serializer=space_setup.SetUpSpaceRequest.serialize, response_deserializer=space.Space.deserialize, @@ -835,8 +962,21 @@ def update_space(self) -> Callable[[gc_space.UpdateSpaceRequest], gc_space.Space An existing space within the Google Workspace organization might already use this display name. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.UpdateSpaceRequest], @@ -849,7 +989,7 @@ def update_space(self) -> Callable[[gc_space.UpdateSpaceRequest], gc_space.Space # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_space" not in self._stubs: - self._stubs["update_space"] = self.grpc_channel.unary_unary( + self._stubs["update_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UpdateSpace", request_serializer=gc_space.UpdateSpaceRequest.serialize, response_deserializer=gc_space.Space.deserialize, @@ -865,9 +1005,22 @@ def delete_space(self) -> Callable[[space.DeleteSpaceRequest], empty_pb2.Empty]: the space and memberships in the space—are also deleted. For an example, see `Delete a space `__. - Requires `user - authentication `__ - from a user who has permission to delete the space. + + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.DeleteSpaceRequest], @@ -880,7 +1033,7 @@ def delete_space(self) -> Callable[[space.DeleteSpaceRequest], empty_pb2.Empty]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_space" not in self._stubs: - self._stubs["delete_space"] = self.grpc_channel.unary_unary( + self._stubs["delete_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/DeleteSpace", request_serializer=space.DeleteSpaceRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -897,9 +1050,12 @@ def complete_import_space( Completes the `import process `__ - for the specified space and makes it visible to users. Requires - app authentication and domain-wide delegation. For more - information, see `Authorize Google Chat apps to import + for the specified space and makes it visible to users. + + Requires `app + authentication `__ + and domain-wide delegation. For more information, see `Authorize + Google Chat apps to import data `__. Returns: @@ -913,7 +1069,7 @@ def complete_import_space( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "complete_import_space" not in self._stubs: - self._stubs["complete_import_space"] = self.grpc_channel.unary_unary( + self._stubs["complete_import_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CompleteImportSpace", request_serializer=space.CompleteImportSpaceRequest.serialize, response_deserializer=space.CompleteImportSpaceResponse.deserialize, @@ -931,20 +1087,24 @@ def find_direct_message( error. For an example, see `Find a direct message `__. + With `app + authentication `__, + returns the direct message space between the specified user and + the calling Chat app. + With `user authentication `__, returns the direct message space between the specified user and the authenticated user. - With `app - authentication `__, - returns the direct message space between the specified user and - the calling Chat app. + // Supports the following types of + `authentication `__: - Requires `user - authentication `__ - or `app - authentication `__. + - `App + authentication `__ + + - `User + authentication `__ Returns: Callable[[~.FindDirectMessageRequest], @@ -957,7 +1117,7 @@ def find_direct_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "find_direct_message" not in self._stubs: - self._stubs["find_direct_message"] = self.grpc_channel.unary_unary( + self._stubs["find_direct_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/FindDirectMessage", request_serializer=space.FindDirectMessageRequest.serialize, response_deserializer=space.Space.deserialize, @@ -976,8 +1136,23 @@ def create_membership( has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified - space. Requires `user - authentication `__. + space. + + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. For example usage, see: @@ -1001,7 +1176,7 @@ def create_membership( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_membership" not in self._stubs: - self._stubs["create_membership"] = self.grpc_channel.unary_unary( + self._stubs["create_membership"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CreateMembership", request_serializer=gc_membership.CreateMembershipRequest.serialize, response_deserializer=gc_membership.Membership.deserialize, @@ -1018,8 +1193,21 @@ def update_membership( membership in a space `__. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.UpdateMembershipRequest], @@ -1032,7 +1220,7 @@ def update_membership( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_membership" not in self._stubs: - self._stubs["update_membership"] = self.grpc_channel.unary_unary( + self._stubs["update_membership"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UpdateMembership", request_serializer=gc_membership.UpdateMembershipRequest.serialize, response_deserializer=gc_membership.Membership.deserialize, @@ -1049,8 +1237,21 @@ def delete_membership( Google Chat app from a space `__. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.DeleteMembershipRequest], @@ -1063,7 +1264,7 @@ def delete_membership( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_membership" not in self._stubs: - self._stubs["delete_membership"] = self.grpc_channel.unary_unary( + self._stubs["delete_membership"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/DeleteMembership", request_serializer=membership.DeleteMembershipRequest.serialize, response_deserializer=membership.Membership.deserialize, @@ -1079,6 +1280,7 @@ def create_reaction( Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, see `Add a reaction to a message `__. + Requires `user authentication `__. @@ -1093,7 +1295,7 @@ def create_reaction( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_reaction" not in self._stubs: - self._stubs["create_reaction"] = self.grpc_channel.unary_unary( + self._stubs["create_reaction"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CreateReaction", request_serializer=gc_reaction.CreateReactionRequest.serialize, response_deserializer=gc_reaction.Reaction.deserialize, @@ -1109,6 +1311,7 @@ def list_reactions( Lists reactions to a message. For an example, see `List reactions for a message `__. + Requires `user authentication `__. @@ -1123,7 +1326,7 @@ def list_reactions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_reactions" not in self._stubs: - self._stubs["list_reactions"] = self.grpc_channel.unary_unary( + self._stubs["list_reactions"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListReactions", request_serializer=reaction.ListReactionsRequest.serialize, response_deserializer=reaction.ListReactionsResponse.deserialize, @@ -1139,6 +1342,7 @@ def delete_reaction( Deletes a reaction to a message. Only unicode emojis are supported. For an example, see `Delete a reaction `__. + Requires `user authentication `__. @@ -1153,7 +1357,7 @@ def delete_reaction( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_reaction" not in self._stubs: - self._stubs["delete_reaction"] = self.grpc_channel.unary_unary( + self._stubs["delete_reaction"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/DeleteReaction", request_serializer=reaction.DeleteReactionRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1187,7 +1391,7 @@ def get_space_read_state( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_space_read_state" not in self._stubs: - self._stubs["get_space_read_state"] = self.grpc_channel.unary_unary( + self._stubs["get_space_read_state"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetSpaceReadState", request_serializer=space_read_state.GetSpaceReadStateRequest.serialize, response_deserializer=space_read_state.SpaceReadState.deserialize, @@ -1222,7 +1426,7 @@ def update_space_read_state( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_space_read_state" not in self._stubs: - self._stubs["update_space_read_state"] = self.grpc_channel.unary_unary( + self._stubs["update_space_read_state"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UpdateSpaceReadState", request_serializer=gc_space_read_state.UpdateSpaceReadStateRequest.serialize, response_deserializer=gc_space_read_state.SpaceReadState.deserialize, @@ -1256,7 +1460,7 @@ def get_thread_read_state( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_thread_read_state" not in self._stubs: - self._stubs["get_thread_read_state"] = self.grpc_channel.unary_unary( + self._stubs["get_thread_read_state"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetThreadReadState", request_serializer=thread_read_state.GetThreadReadStateRequest.serialize, response_deserializer=thread_read_state.ThreadReadState.deserialize, @@ -1299,7 +1503,7 @@ def get_space_event( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_space_event" not in self._stubs: - self._stubs["get_space_event"] = self.grpc_channel.unary_unary( + self._stubs["get_space_event"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetSpaceEvent", request_serializer=space_event.GetSpaceEventRequest.serialize, response_deserializer=space_event.SpaceEvent.deserialize, @@ -1342,7 +1546,7 @@ def list_space_events( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_space_events" not in self._stubs: - self._stubs["list_space_events"] = self.grpc_channel.unary_unary( + self._stubs["list_space_events"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListSpaceEvents", request_serializer=space_event.ListSpaceEventsRequest.serialize, response_deserializer=space_event.ListSpaceEventsResponse.deserialize, @@ -1350,7 +1554,7 @@ def list_space_events( return self._stubs["list_space_events"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def kind(self) -> str: diff --git a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/grpc_asyncio.py b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/grpc_asyncio.py index d871ee9211f9..8512dd48da9f 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/grpc_asyncio.py +++ b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import logging as std_logging +import pickle from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union import warnings @@ -23,8 +26,11 @@ from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.protobuf import empty_pb2 # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore from grpc.experimental import aio # type: ignore +import proto # type: ignore from google.apps.chat_v1.types import attachment from google.apps.chat_v1.types import membership @@ -43,6 +49,82 @@ from .base import DEFAULT_CLIENT_INFO, ChatServiceTransport from .grpc import ChatServiceGrpcTransport +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = std_logging.getLogger(__name__) + + +class _LoggingClientAIOInterceptor( + grpc.aio.UnaryUnaryClientInterceptor +): # pragma: NO COVER + async def intercept_unary_unary(self, continuation, client_call_details, request): + logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + std_logging.DEBUG + ) + if logging_enabled: # pragma: NO COVER + request_metadata = client_call_details.metadata + if isinstance(request, proto.Message): + request_payload = type(request).to_json(request) + elif isinstance(request, google.protobuf.message.Message): + request_payload = MessageToJson(request) + else: + request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" + + request_metadata = { + key: value.decode("utf-8") if isinstance(value, bytes) else value + for key, value in request_metadata + } + grpc_request = { + "payload": request_payload, + "requestMethod": "grpc", + "metadata": dict(request_metadata), + } + _LOGGER.debug( + f"Sending request for {client_call_details.method}", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": str(client_call_details.method), + "request": grpc_request, + "metadata": grpc_request["metadata"], + }, + ) + response = await continuation(client_call_details, request) + if logging_enabled: # pragma: NO COVER + response_metadata = await response.trailing_metadata() + # Convert gRPC metadata `` to list of tuples + metadata = ( + dict([(k, str(v)) for k, v in response_metadata]) + if response_metadata + else None + ) + result = await response + if isinstance(result, proto.Message): + response_payload = type(result).to_json(result) + elif isinstance(result, google.protobuf.message.Message): + response_payload = MessageToJson(result) + else: + response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" + grpc_response = { + "payload": response_payload, + "metadata": metadata, + "status": "OK", + } + _LOGGER.debug( + f"Received response to rpc {client_call_details.method}.", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ChatServiceGrpcAsyncIOTransport(ChatServiceTransport): """gRPC AsyncIO backend transport for ChatService. @@ -240,10 +322,13 @@ def __init__( ], ) - # Wrap messages. This must be done after self._grpc_channel exists + self._interceptor = _LoggingClientAIOInterceptor() + self._grpc_channel._unary_unary_interceptors.append(self._interceptor) + self._logged_channel = self._grpc_channel self._wrap_with_kind = ( "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters ) + # Wrap messages. This must be done after self._logged_channel exists self._prep_wrapped_messages(client_info) @property @@ -266,10 +351,12 @@ def create_message( `Send a message `__. - The ``create()`` method requires either user or app - authentication. Chat attributes the message sender differently - depending on the type of authentication that you use in your - request. + The ``create()`` method requires either `user + authentication `__ + or `app + authentication `__. + Chat attributes the message sender differently depending on the + type of authentication that you use in your request. The following image shows how Chat attributes a message when you use app authentication. Chat displays the Chat app as the @@ -290,6 +377,12 @@ def create_message( The maximum message size, including the message contents, is 32,000 bytes. + For + `webhook `__ + requests, the response doesn't contain the full message. The + response only populates the ``name`` and ``thread.name`` fields + in addition to the information that was in the request. + .. |Message sent with app authentication async gRPC| image:: https://developers.google.com/workspace/chat/images/message-app-auth.svg .. |Message sent with user authentication async gRPC| image:: https://developers.google.com/workspace/chat/images/message-user-auth.svg @@ -304,7 +397,7 @@ def create_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_message" not in self._stubs: - self._stubs["create_message"] = self.grpc_channel.unary_unary( + self._stubs["create_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CreateMessage", request_serializer=gc_message.CreateMessageRequest.serialize, response_deserializer=gc_message.Message.deserialize, @@ -325,6 +418,7 @@ def list_messages( object. When using a REST/HTTP interface, the response contains an empty JSON object, ``{}``. For an example, see `List messages `__. + Requires `user authentication `__. @@ -339,7 +433,7 @@ def list_messages( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_messages" not in self._stubs: - self._stubs["list_messages"] = self.grpc_channel.unary_unary( + self._stubs["list_messages"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListMessages", request_serializer=message.ListMessagesRequest.serialize, response_deserializer=message.ListMessagesResponse.deserialize, @@ -367,12 +461,17 @@ def list_memberships( lists memberships in spaces that the authenticated user has access to. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.ListMembershipsRequest], @@ -385,7 +484,7 @@ def list_memberships( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_memberships" not in self._stubs: - self._stubs["list_memberships"] = self.grpc_channel.unary_unary( + self._stubs["list_memberships"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListMemberships", request_serializer=membership.ListMembershipsRequest.serialize, response_deserializer=membership.ListMembershipsResponse.deserialize, @@ -402,12 +501,17 @@ def get_membership( details about a user's or Google Chat app's membership `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.GetMembershipRequest], @@ -420,7 +524,7 @@ def get_membership( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_membership" not in self._stubs: - self._stubs["get_membership"] = self.grpc_channel.unary_unary( + self._stubs["get_membership"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetMembership", request_serializer=membership.GetMembershipRequest.serialize, response_deserializer=membership.Membership.deserialize, @@ -437,12 +541,14 @@ def get_message( details about a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ Note: Might return a message from a blocked member or space. @@ -457,7 +563,7 @@ def get_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_message" not in self._stubs: - self._stubs["get_message"] = self.grpc_channel.unary_unary( + self._stubs["get_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetMessage", request_serializer=message.GetMessageRequest.serialize, response_deserializer=message.Message.deserialize, @@ -477,12 +583,15 @@ def update_message( `Update a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + When using app authentication, requests can only update messages created by the calling Chat app. @@ -497,7 +606,7 @@ def update_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_message" not in self._stubs: - self._stubs["update_message"] = self.grpc_channel.unary_unary( + self._stubs["update_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UpdateMessage", request_serializer=gc_message.UpdateMessageRequest.serialize, response_deserializer=gc_message.Message.deserialize, @@ -513,12 +622,15 @@ def delete_message( Deletes a message. For an example, see `Delete a message `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + When using app authentication, requests can only delete messages created by the calling Chat app. @@ -533,7 +645,7 @@ def delete_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_message" not in self._stubs: - self._stubs["delete_message"] = self.grpc_channel.unary_unary( + self._stubs["delete_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/DeleteMessage", request_serializer=message.DeleteMessageRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -565,7 +677,7 @@ def get_attachment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_attachment" not in self._stubs: - self._stubs["get_attachment"] = self.grpc_channel.unary_unary( + self._stubs["get_attachment"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetAttachment", request_serializer=attachment.GetAttachmentRequest.serialize, response_deserializer=attachment.Attachment.deserialize, @@ -584,6 +696,7 @@ def upload_attachment( Uploads an attachment. For an example, see `Upload media as a file attachment `__. + Requires user `authentication `__. @@ -602,7 +715,7 @@ def upload_attachment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_attachment" not in self._stubs: - self._stubs["upload_attachment"] = self.grpc_channel.unary_unary( + self._stubs["upload_attachment"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UploadAttachment", request_serializer=attachment.UploadAttachmentRequest.serialize, response_deserializer=attachment.UploadAttachmentResponse.deserialize, @@ -620,15 +733,14 @@ def list_spaces( see `List spaces `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ - Lists spaces visible to the caller or authenticated user. Group - chats and DMs aren't listed until the first message is sent. + - `User + authentication `__ To list all named spaces by Google Workspace organization, use the @@ -646,7 +758,7 @@ def list_spaces( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_spaces" not in self._stubs: - self._stubs["list_spaces"] = self.grpc_channel.unary_unary( + self._stubs["list_spaces"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListSpaces", request_serializer=space.ListSpacesRequest.serialize, response_deserializer=space.ListSpacesResponse.deserialize, @@ -660,8 +772,9 @@ def search_spaces( r"""Return a callable for the search spaces method over gRPC. Returns a list of spaces in a Google Workspace organization - based on an administrator's search. Requires `user - authentication with administrator + based on an administrator's search. + + Requires `user authentication with administrator privileges `__. In the request, set ``use_admin_access`` to ``true``. @@ -676,7 +789,7 @@ def search_spaces( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_spaces" not in self._stubs: - self._stubs["search_spaces"] = self.grpc_channel.unary_unary( + self._stubs["search_spaces"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/SearchSpaces", request_serializer=space.SearchSpacesRequest.serialize, response_deserializer=space.SearchSpacesResponse.deserialize, @@ -691,12 +804,17 @@ def get_space(self) -> Callable[[space.GetSpaceRequest], Awaitable[space.Space]] about a space `__. - Requires - `authentication `__. - Supports `app - authentication `__ - and `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.GetSpaceRequest], @@ -709,7 +827,7 @@ def get_space(self) -> Callable[[space.GetSpaceRequest], Awaitable[space.Space]] # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_space" not in self._stubs: - self._stubs["get_space"] = self.grpc_channel.unary_unary( + self._stubs["get_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetSpace", request_serializer=space.GetSpaceRequest.serialize, response_deserializer=space.Space.deserialize, @@ -723,8 +841,8 @@ def create_space( r"""Return a callable for the create space method over gRPC. Creates a space with no members. Can be used to create a named - space. Spaces grouped by topics aren't supported. For an - example, see `Create a + space, or a group chat in ``Import mode``. For an example, see + `Create a space `__. If you receive the error message ``ALREADY_EXISTS`` when @@ -732,13 +850,21 @@ def create_space( space within the Google Workspace organization might already use this display name. - If you're a member of the `Developer Preview - program `__, - you can create a group chat in import mode using - ``spaceType.GROUP_CHAT``. + Supports the following types of + `authentication `__: - Requires `user - authentication `__. + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + + When authenticating as an app, the ``space.customer`` field must + be set in the request. Returns: Callable[[~.CreateSpaceRequest], @@ -751,7 +877,7 @@ def create_space( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_space" not in self._stubs: - self._stubs["create_space"] = self.grpc_channel.unary_unary( + self._stubs["create_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CreateSpace", request_serializer=gc_space.CreateSpaceRequest.serialize, response_deserializer=gc_space.Space.deserialize, @@ -834,7 +960,7 @@ def set_up_space( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_up_space" not in self._stubs: - self._stubs["set_up_space"] = self.grpc_channel.unary_unary( + self._stubs["set_up_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/SetUpSpace", request_serializer=space_setup.SetUpSpaceRequest.serialize, response_deserializer=space.Space.deserialize, @@ -855,8 +981,21 @@ def update_space( An existing space within the Google Workspace organization might already use this display name. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.UpdateSpaceRequest], @@ -869,7 +1008,7 @@ def update_space( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_space" not in self._stubs: - self._stubs["update_space"] = self.grpc_channel.unary_unary( + self._stubs["update_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UpdateSpace", request_serializer=gc_space.UpdateSpaceRequest.serialize, response_deserializer=gc_space.Space.deserialize, @@ -887,9 +1026,22 @@ def delete_space( the space and memberships in the space—are also deleted. For an example, see `Delete a space `__. - Requires `user - authentication `__ - from a user who has permission to delete the space. + + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.DeleteSpaceRequest], @@ -902,7 +1054,7 @@ def delete_space( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_space" not in self._stubs: - self._stubs["delete_space"] = self.grpc_channel.unary_unary( + self._stubs["delete_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/DeleteSpace", request_serializer=space.DeleteSpaceRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -919,9 +1071,12 @@ def complete_import_space( Completes the `import process `__ - for the specified space and makes it visible to users. Requires - app authentication and domain-wide delegation. For more - information, see `Authorize Google Chat apps to import + for the specified space and makes it visible to users. + + Requires `app + authentication `__ + and domain-wide delegation. For more information, see `Authorize + Google Chat apps to import data `__. Returns: @@ -935,7 +1090,7 @@ def complete_import_space( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "complete_import_space" not in self._stubs: - self._stubs["complete_import_space"] = self.grpc_channel.unary_unary( + self._stubs["complete_import_space"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CompleteImportSpace", request_serializer=space.CompleteImportSpaceRequest.serialize, response_deserializer=space.CompleteImportSpaceResponse.deserialize, @@ -953,20 +1108,24 @@ def find_direct_message( error. For an example, see `Find a direct message `__. + With `app + authentication `__, + returns the direct message space between the specified user and + the calling Chat app. + With `user authentication `__, returns the direct message space between the specified user and the authenticated user. - With `app - authentication `__, - returns the direct message space between the specified user and - the calling Chat app. + // Supports the following types of + `authentication `__: - Requires `user - authentication `__ - or `app - authentication `__. + - `App + authentication `__ + + - `User + authentication `__ Returns: Callable[[~.FindDirectMessageRequest], @@ -979,7 +1138,7 @@ def find_direct_message( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "find_direct_message" not in self._stubs: - self._stubs["find_direct_message"] = self.grpc_channel.unary_unary( + self._stubs["find_direct_message"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/FindDirectMessage", request_serializer=space.FindDirectMessageRequest.serialize, response_deserializer=space.Space.deserialize, @@ -1000,8 +1159,23 @@ def create_membership( has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified - space. Requires `user - authentication `__. + space. + + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. For example usage, see: @@ -1025,7 +1199,7 @@ def create_membership( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_membership" not in self._stubs: - self._stubs["create_membership"] = self.grpc_channel.unary_unary( + self._stubs["create_membership"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CreateMembership", request_serializer=gc_membership.CreateMembershipRequest.serialize, response_deserializer=gc_membership.Membership.deserialize, @@ -1044,8 +1218,21 @@ def update_membership( membership in a space `__. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.UpdateMembershipRequest], @@ -1058,7 +1245,7 @@ def update_membership( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_membership" not in self._stubs: - self._stubs["update_membership"] = self.grpc_channel.unary_unary( + self._stubs["update_membership"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UpdateMembership", request_serializer=gc_membership.UpdateMembershipRequest.serialize, response_deserializer=gc_membership.Membership.deserialize, @@ -1077,8 +1264,21 @@ def delete_membership( Google Chat app from a space `__. - Requires `user - authentication `__. + Supports the following types of + `authentication `__: + + - `App + authentication `__ + with `administrator + approval `__ in + `Developer + Preview `__ + + - `User + authentication `__ + You can authenticate and authorize this method with + administrator privileges by setting the ``use_admin_access`` + field in the request. Returns: Callable[[~.DeleteMembershipRequest], @@ -1091,7 +1291,7 @@ def delete_membership( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_membership" not in self._stubs: - self._stubs["delete_membership"] = self.grpc_channel.unary_unary( + self._stubs["delete_membership"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/DeleteMembership", request_serializer=membership.DeleteMembershipRequest.serialize, response_deserializer=membership.Membership.deserialize, @@ -1107,6 +1307,7 @@ def create_reaction( Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, see `Add a reaction to a message `__. + Requires `user authentication `__. @@ -1121,7 +1322,7 @@ def create_reaction( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_reaction" not in self._stubs: - self._stubs["create_reaction"] = self.grpc_channel.unary_unary( + self._stubs["create_reaction"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/CreateReaction", request_serializer=gc_reaction.CreateReactionRequest.serialize, response_deserializer=gc_reaction.Reaction.deserialize, @@ -1139,6 +1340,7 @@ def list_reactions( Lists reactions to a message. For an example, see `List reactions for a message `__. + Requires `user authentication `__. @@ -1153,7 +1355,7 @@ def list_reactions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_reactions" not in self._stubs: - self._stubs["list_reactions"] = self.grpc_channel.unary_unary( + self._stubs["list_reactions"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListReactions", request_serializer=reaction.ListReactionsRequest.serialize, response_deserializer=reaction.ListReactionsResponse.deserialize, @@ -1169,6 +1371,7 @@ def delete_reaction( Deletes a reaction to a message. Only unicode emojis are supported. For an example, see `Delete a reaction `__. + Requires `user authentication `__. @@ -1183,7 +1386,7 @@ def delete_reaction( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_reaction" not in self._stubs: - self._stubs["delete_reaction"] = self.grpc_channel.unary_unary( + self._stubs["delete_reaction"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/DeleteReaction", request_serializer=reaction.DeleteReactionRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1218,7 +1421,7 @@ def get_space_read_state( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_space_read_state" not in self._stubs: - self._stubs["get_space_read_state"] = self.grpc_channel.unary_unary( + self._stubs["get_space_read_state"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetSpaceReadState", request_serializer=space_read_state.GetSpaceReadStateRequest.serialize, response_deserializer=space_read_state.SpaceReadState.deserialize, @@ -1253,7 +1456,7 @@ def update_space_read_state( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_space_read_state" not in self._stubs: - self._stubs["update_space_read_state"] = self.grpc_channel.unary_unary( + self._stubs["update_space_read_state"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/UpdateSpaceReadState", request_serializer=gc_space_read_state.UpdateSpaceReadStateRequest.serialize, response_deserializer=gc_space_read_state.SpaceReadState.deserialize, @@ -1288,7 +1491,7 @@ def get_thread_read_state( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_thread_read_state" not in self._stubs: - self._stubs["get_thread_read_state"] = self.grpc_channel.unary_unary( + self._stubs["get_thread_read_state"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetThreadReadState", request_serializer=thread_read_state.GetThreadReadStateRequest.serialize, response_deserializer=thread_read_state.ThreadReadState.deserialize, @@ -1333,7 +1536,7 @@ def get_space_event( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_space_event" not in self._stubs: - self._stubs["get_space_event"] = self.grpc_channel.unary_unary( + self._stubs["get_space_event"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/GetSpaceEvent", request_serializer=space_event.GetSpaceEventRequest.serialize, response_deserializer=space_event.SpaceEvent.deserialize, @@ -1377,7 +1580,7 @@ def list_space_events( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_space_events" not in self._stubs: - self._stubs["list_space_events"] = self.grpc_channel.unary_unary( + self._stubs["list_space_events"] = self._logged_channel.unary_unary( "/google.chat.v1.ChatService/ListSpaceEvents", request_serializer=space_event.ListSpaceEventsRequest.serialize, response_deserializer=space_event.ListSpaceEventsResponse.deserialize, @@ -1801,7 +2004,7 @@ def _wrap_method(self, func, *args, **kwargs): return gapic_v1.method_async.wrap_method(func, *args, **kwargs) def close(self): - return self.grpc_channel.close() + return self._logged_channel.close() @property def kind(self) -> str: diff --git a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/rest.py b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/rest.py index e2892374b18c..fe861b816728 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/rest.py +++ b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/rest.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import dataclasses import json # type: ignore +import logging from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings @@ -50,6 +50,14 @@ except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore +try: + from google.api_core import client_logging # type: ignore + + CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER +except ImportError: # pragma: NO COVER + CLIENT_LOGGING_SUPPORTED = False + +_LOGGER = logging.getLogger(__name__) DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, @@ -302,8 +310,10 @@ def post_upload_attachment(self, response): def pre_complete_import_space( self, request: space.CompleteImportSpaceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[space.CompleteImportSpaceRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + space.CompleteImportSpaceRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for complete_import_space Override in a subclass to manipulate the request or metadata @@ -325,8 +335,10 @@ def post_complete_import_space( def pre_create_membership( self, request: gc_membership.CreateMembershipRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[gc_membership.CreateMembershipRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + gc_membership.CreateMembershipRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_membership Override in a subclass to manipulate the request or metadata @@ -348,8 +360,10 @@ def post_create_membership( def pre_create_message( self, request: gc_message.CreateMessageRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[gc_message.CreateMessageRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + gc_message.CreateMessageRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_message Override in a subclass to manipulate the request or metadata @@ -369,8 +383,10 @@ def post_create_message(self, response: gc_message.Message) -> gc_message.Messag def pre_create_reaction( self, request: gc_reaction.CreateReactionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[gc_reaction.CreateReactionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + gc_reaction.CreateReactionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_reaction Override in a subclass to manipulate the request or metadata @@ -390,8 +406,10 @@ def post_create_reaction( return response def pre_create_space( - self, request: gc_space.CreateSpaceRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[gc_space.CreateSpaceRequest, Sequence[Tuple[str, str]]]: + self, + request: gc_space.CreateSpaceRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[gc_space.CreateSpaceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for create_space Override in a subclass to manipulate the request or metadata @@ -411,8 +429,10 @@ def post_create_space(self, response: gc_space.Space) -> gc_space.Space: def pre_delete_membership( self, request: membership.DeleteMembershipRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[membership.DeleteMembershipRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + membership.DeleteMembershipRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_membership Override in a subclass to manipulate the request or metadata @@ -432,8 +452,10 @@ def post_delete_membership( return response def pre_delete_message( - self, request: message.DeleteMessageRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[message.DeleteMessageRequest, Sequence[Tuple[str, str]]]: + self, + request: message.DeleteMessageRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[message.DeleteMessageRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for delete_message Override in a subclass to manipulate the request or metadata @@ -444,8 +466,8 @@ def pre_delete_message( def pre_delete_reaction( self, request: reaction.DeleteReactionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[reaction.DeleteReactionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[reaction.DeleteReactionRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for delete_reaction Override in a subclass to manipulate the request or metadata @@ -454,8 +476,10 @@ def pre_delete_reaction( return request, metadata def pre_delete_space( - self, request: space.DeleteSpaceRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[space.DeleteSpaceRequest, Sequence[Tuple[str, str]]]: + self, + request: space.DeleteSpaceRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[space.DeleteSpaceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for delete_space Override in a subclass to manipulate the request or metadata @@ -466,8 +490,8 @@ def pre_delete_space( def pre_find_direct_message( self, request: space.FindDirectMessageRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[space.FindDirectMessageRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[space.FindDirectMessageRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for find_direct_message Override in a subclass to manipulate the request or metadata @@ -487,8 +511,10 @@ def post_find_direct_message(self, response: space.Space) -> space.Space: def pre_get_attachment( self, request: attachment.GetAttachmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[attachment.GetAttachmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + attachment.GetAttachmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_attachment Override in a subclass to manipulate the request or metadata @@ -510,8 +536,10 @@ def post_get_attachment( def pre_get_membership( self, request: membership.GetMembershipRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[membership.GetMembershipRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + membership.GetMembershipRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_membership Override in a subclass to manipulate the request or metadata @@ -531,8 +559,10 @@ def post_get_membership( return response def pre_get_message( - self, request: message.GetMessageRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[message.GetMessageRequest, Sequence[Tuple[str, str]]]: + self, + request: message.GetMessageRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[message.GetMessageRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_message Override in a subclass to manipulate the request or metadata @@ -550,8 +580,10 @@ def post_get_message(self, response: message.Message) -> message.Message: return response def pre_get_space( - self, request: space.GetSpaceRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[space.GetSpaceRequest, Sequence[Tuple[str, str]]]: + self, + request: space.GetSpaceRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[space.GetSpaceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_space Override in a subclass to manipulate the request or metadata @@ -571,8 +603,10 @@ def post_get_space(self, response: space.Space) -> space.Space: def pre_get_space_event( self, request: space_event.GetSpaceEventRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[space_event.GetSpaceEventRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + space_event.GetSpaceEventRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_space_event Override in a subclass to manipulate the request or metadata @@ -594,8 +628,11 @@ def post_get_space_event( def pre_get_space_read_state( self, request: space_read_state.GetSpaceReadStateRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[space_read_state.GetSpaceReadStateRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + space_read_state.GetSpaceReadStateRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_space_read_state Override in a subclass to manipulate the request or metadata @@ -617,8 +654,11 @@ def post_get_space_read_state( def pre_get_thread_read_state( self, request: thread_read_state.GetThreadReadStateRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[thread_read_state.GetThreadReadStateRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + thread_read_state.GetThreadReadStateRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_thread_read_state Override in a subclass to manipulate the request or metadata @@ -640,8 +680,10 @@ def post_get_thread_read_state( def pre_list_memberships( self, request: membership.ListMembershipsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[membership.ListMembershipsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + membership.ListMembershipsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_memberships Override in a subclass to manipulate the request or metadata @@ -661,8 +703,10 @@ def post_list_memberships( return response def pre_list_messages( - self, request: message.ListMessagesRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[message.ListMessagesRequest, Sequence[Tuple[str, str]]]: + self, + request: message.ListMessagesRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[message.ListMessagesRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for list_messages Override in a subclass to manipulate the request or metadata @@ -684,8 +728,8 @@ def post_list_messages( def pre_list_reactions( self, request: reaction.ListReactionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[reaction.ListReactionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[reaction.ListReactionsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for list_reactions Override in a subclass to manipulate the request or metadata @@ -707,8 +751,10 @@ def post_list_reactions( def pre_list_space_events( self, request: space_event.ListSpaceEventsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[space_event.ListSpaceEventsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + space_event.ListSpaceEventsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_space_events Override in a subclass to manipulate the request or metadata @@ -728,8 +774,10 @@ def post_list_space_events( return response def pre_list_spaces( - self, request: space.ListSpacesRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[space.ListSpacesRequest, Sequence[Tuple[str, str]]]: + self, + request: space.ListSpacesRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[space.ListSpacesRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for list_spaces Override in a subclass to manipulate the request or metadata @@ -749,8 +797,10 @@ def post_list_spaces( return response def pre_search_spaces( - self, request: space.SearchSpacesRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[space.SearchSpacesRequest, Sequence[Tuple[str, str]]]: + self, + request: space.SearchSpacesRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[space.SearchSpacesRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for search_spaces Override in a subclass to manipulate the request or metadata @@ -772,8 +822,8 @@ def post_search_spaces( def pre_set_up_space( self, request: space_setup.SetUpSpaceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[space_setup.SetUpSpaceRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[space_setup.SetUpSpaceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for set_up_space Override in a subclass to manipulate the request or metadata @@ -793,8 +843,10 @@ def post_set_up_space(self, response: space.Space) -> space.Space: def pre_update_membership( self, request: gc_membership.UpdateMembershipRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[gc_membership.UpdateMembershipRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + gc_membership.UpdateMembershipRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_membership Override in a subclass to manipulate the request or metadata @@ -816,8 +868,10 @@ def post_update_membership( def pre_update_message( self, request: gc_message.UpdateMessageRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[gc_message.UpdateMessageRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + gc_message.UpdateMessageRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_message Override in a subclass to manipulate the request or metadata @@ -835,8 +889,10 @@ def post_update_message(self, response: gc_message.Message) -> gc_message.Messag return response def pre_update_space( - self, request: gc_space.UpdateSpaceRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[gc_space.UpdateSpaceRequest, Sequence[Tuple[str, str]]]: + self, + request: gc_space.UpdateSpaceRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[gc_space.UpdateSpaceRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for update_space Override in a subclass to manipulate the request or metadata @@ -856,9 +912,10 @@ def post_update_space(self, response: gc_space.Space) -> gc_space.Space: def pre_update_space_read_state( self, request: gc_space_read_state.UpdateSpaceReadStateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gc_space_read_state.UpdateSpaceReadStateRequest, Sequence[Tuple[str, str]] + gc_space_read_state.UpdateSpaceReadStateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_space_read_state @@ -881,8 +938,10 @@ def post_update_space_read_state( def pre_upload_attachment( self, request: attachment.UploadAttachmentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[attachment.UploadAttachmentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + attachment.UploadAttachmentRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upload_attachment Override in a subclass to manipulate the request or metadata @@ -1024,7 +1083,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.CompleteImportSpaceResponse: r"""Call the complete import space method over HTTP. @@ -1035,8 +1094,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space.CompleteImportSpaceResponse: @@ -1048,6 +1109,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseCompleteImportSpace._get_http_options() ) + request, metadata = self._interceptor.pre_complete_import_space( request, metadata ) @@ -1064,6 +1126,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.CompleteImportSpace", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CompleteImportSpace", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._CompleteImportSpace._get_response( self._host, @@ -1085,7 +1174,31 @@ def __call__( pb_resp = space.CompleteImportSpaceResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_complete_import_space(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space.CompleteImportSpaceResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.complete_import_space", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CompleteImportSpace", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateMembership( @@ -1123,7 +1236,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_membership.Membership: r"""Call the create membership method over HTTP. @@ -1134,8 +1247,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.gc_membership.Membership: @@ -1149,6 +1264,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseCreateMembership._get_http_options() ) + request, metadata = self._interceptor.pre_create_membership( request, metadata ) @@ -1165,6 +1281,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.CreateMembership", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CreateMembership", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._CreateMembership._get_response( self._host, @@ -1186,7 +1329,29 @@ def __call__( pb_resp = gc_membership.Membership.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_membership(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gc_membership.Membership.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.create_membership", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CreateMembership", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateMessage( @@ -1224,7 +1389,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_message.Message: r"""Call the create message method over HTTP. @@ -1234,8 +1399,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.gc_message.Message: @@ -1245,6 +1412,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseCreateMessage._get_http_options() ) + request, metadata = self._interceptor.pre_create_message(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseCreateMessage._get_transcoded_request( http_options, request @@ -1263,6 +1431,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.CreateMessage", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CreateMessage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._CreateMessage._get_response( self._host, @@ -1284,7 +1479,29 @@ def __call__( pb_resp = gc_message.Message.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_message(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gc_message.Message.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.create_message", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CreateMessage", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateReaction( @@ -1322,7 +1539,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_reaction.Reaction: r"""Call the create reaction method over HTTP. @@ -1332,8 +1549,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.gc_reaction.Reaction: @@ -1343,6 +1562,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseCreateReaction._get_http_options() ) + request, metadata = self._interceptor.pre_create_reaction(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseCreateReaction._get_transcoded_request( http_options, request @@ -1357,6 +1577,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.CreateReaction", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CreateReaction", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._CreateReaction._get_response( self._host, @@ -1378,7 +1625,29 @@ def __call__( pb_resp = gc_reaction.Reaction.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_reaction(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gc_reaction.Reaction.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.create_reaction", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CreateReaction", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateSpace( @@ -1416,7 +1685,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space.Space: r"""Call the create space method over HTTP. @@ -1427,8 +1696,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.gc_space.Space: @@ -1442,6 +1713,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseCreateSpace._get_http_options() ) + request, metadata = self._interceptor.pre_create_space(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseCreateSpace._get_transcoded_request( @@ -1462,6 +1734,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.CreateSpace", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CreateSpace", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._CreateSpace._get_response( self._host, @@ -1483,7 +1782,29 @@ def __call__( pb_resp = gc_space.Space.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_space(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gc_space.Space.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.create_space", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "CreateSpace", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteMembership( @@ -1520,7 +1841,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> membership.Membership: r"""Call the delete membership method over HTTP. @@ -1531,8 +1852,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.membership.Membership: @@ -1546,6 +1869,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseDeleteMembership._get_http_options() ) + request, metadata = self._interceptor.pre_delete_membership( request, metadata ) @@ -1558,6 +1882,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.DeleteMembership", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "DeleteMembership", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._DeleteMembership._get_response( self._host, @@ -1578,7 +1929,29 @@ def __call__( pb_resp = membership.Membership.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_delete_membership(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = membership.Membership.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.delete_membership", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "DeleteMembership", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteMessage( @@ -1615,7 +1988,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ): r"""Call the delete message method over HTTP. @@ -1625,13 +1998,16 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseChatServiceRestTransport._BaseDeleteMessage._get_http_options() ) + request, metadata = self._interceptor.pre_delete_message(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseDeleteMessage._get_transcoded_request( http_options, request @@ -1644,6 +2020,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.DeleteMessage", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "DeleteMessage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._DeleteMessage._get_response( self._host, @@ -1693,7 +2096,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ): r"""Call the delete reaction method over HTTP. @@ -1703,13 +2106,16 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseChatServiceRestTransport._BaseDeleteReaction._get_http_options() ) + request, metadata = self._interceptor.pre_delete_reaction(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseDeleteReaction._get_transcoded_request( http_options, request @@ -1720,6 +2126,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.DeleteReaction", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "DeleteReaction", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._DeleteReaction._get_response( self._host, @@ -1769,7 +2202,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ): r"""Call the delete space method over HTTP. @@ -1779,13 +2212,16 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. """ http_options = ( _BaseChatServiceRestTransport._BaseDeleteSpace._get_http_options() ) + request, metadata = self._interceptor.pre_delete_space(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseDeleteSpace._get_transcoded_request( @@ -1800,6 +2236,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = json_format.MessageToJson(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.DeleteSpace", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "DeleteSpace", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._DeleteSpace._get_response( self._host, @@ -1849,7 +2312,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Call the find direct message method over HTTP. @@ -1860,8 +2323,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space.Space: @@ -1875,6 +2340,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseFindDirectMessage._get_http_options() ) + request, metadata = self._interceptor.pre_find_direct_message( request, metadata ) @@ -1887,6 +2353,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.FindDirectMessage", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "FindDirectMessage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._FindDirectMessage._get_response( self._host, @@ -1907,7 +2400,29 @@ def __call__( pb_resp = space.Space.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_find_direct_message(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space.Space.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.find_direct_message", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "FindDirectMessage", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetAttachment( @@ -1944,7 +2459,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> attachment.Attachment: r"""Call the get attachment method over HTTP. @@ -1954,8 +2469,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.attachment.Attachment: @@ -1965,6 +2482,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseGetAttachment._get_http_options() ) + request, metadata = self._interceptor.pre_get_attachment(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseGetAttachment._get_transcoded_request( http_options, request @@ -1977,6 +2495,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.GetAttachment", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetAttachment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._GetAttachment._get_response( self._host, @@ -1997,7 +2542,29 @@ def __call__( pb_resp = attachment.Attachment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_attachment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = attachment.Attachment.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.get_attachment", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetAttachment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetMembership( @@ -2034,7 +2601,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> membership.Membership: r"""Call the get membership method over HTTP. @@ -2045,8 +2612,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.membership.Membership: @@ -2060,6 +2629,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseGetMembership._get_http_options() ) + request, metadata = self._interceptor.pre_get_membership(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseGetMembership._get_transcoded_request( http_options, request @@ -2072,6 +2642,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.GetMembership", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetMembership", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._GetMembership._get_response( self._host, @@ -2092,7 +2689,29 @@ def __call__( pb_resp = membership.Membership.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_membership(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = membership.Membership.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.get_membership", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetMembership", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetMessage( @@ -2129,7 +2748,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> message.Message: r"""Call the get message method over HTTP. @@ -2139,8 +2758,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.message.Message: @@ -2150,6 +2771,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseGetMessage._get_http_options() ) + request, metadata = self._interceptor.pre_get_message(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseGetMessage._get_transcoded_request( @@ -2164,6 +2786,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.GetMessage", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetMessage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._GetMessage._get_response( self._host, @@ -2184,7 +2833,29 @@ def __call__( pb_resp = message.Message.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_message(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = message.Message.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.get_message", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetMessage", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetSpace(_BaseChatServiceRestTransport._BaseGetSpace, ChatServiceRestStub): @@ -2219,7 +2890,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Call the get space method over HTTP. @@ -2229,8 +2900,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space.Space: @@ -2244,6 +2917,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseGetSpace._get_http_options() ) + request, metadata = self._interceptor.pre_get_space(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseGetSpace._get_transcoded_request( @@ -2258,6 +2932,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.GetSpace", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetSpace", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._GetSpace._get_response( self._host, @@ -2278,7 +2979,29 @@ def __call__( pb_resp = space.Space.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_space(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space.Space.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.get_space", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetSpace", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetSpaceEvent( @@ -2315,7 +3038,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space_event.SpaceEvent: r"""Call the get space event method over HTTP. @@ -2326,8 +3049,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space_event.SpaceEvent: @@ -2341,6 +3066,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseGetSpaceEvent._get_http_options() ) + request, metadata = self._interceptor.pre_get_space_event(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseGetSpaceEvent._get_transcoded_request( http_options, request @@ -2353,6 +3079,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.GetSpaceEvent", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetSpaceEvent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._GetSpaceEvent._get_response( self._host, @@ -2373,7 +3126,29 @@ def __call__( pb_resp = space_event.SpaceEvent.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_space_event(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space_event.SpaceEvent.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.get_space_event", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetSpaceEvent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetSpaceReadState( @@ -2410,7 +3185,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space_read_state.SpaceReadState: r"""Call the get space read state method over HTTP. @@ -2421,8 +3196,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space_read_state.SpaceReadState: @@ -2435,6 +3212,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseGetSpaceReadState._get_http_options() ) + request, metadata = self._interceptor.pre_get_space_read_state( request, metadata ) @@ -2447,6 +3225,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.GetSpaceReadState", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetSpaceReadState", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._GetSpaceReadState._get_response( self._host, @@ -2467,7 +3272,29 @@ def __call__( pb_resp = space_read_state.SpaceReadState.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_space_read_state(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space_read_state.SpaceReadState.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.get_space_read_state", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetSpaceReadState", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetThreadReadState( @@ -2504,7 +3331,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> thread_read_state.ThreadReadState: r"""Call the get thread read state method over HTTP. @@ -2515,8 +3342,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.thread_read_state.ThreadReadState: @@ -2529,6 +3358,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseGetThreadReadState._get_http_options() ) + request, metadata = self._interceptor.pre_get_thread_read_state( request, metadata ) @@ -2541,6 +3371,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.GetThreadReadState", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetThreadReadState", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._GetThreadReadState._get_response( self._host, @@ -2561,7 +3418,31 @@ def __call__( pb_resp = thread_read_state.ThreadReadState.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_thread_read_state(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = thread_read_state.ThreadReadState.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.get_thread_read_state", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "GetThreadReadState", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListMemberships( @@ -2598,7 +3479,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> membership.ListMembershipsResponse: r"""Call the list memberships method over HTTP. @@ -2609,8 +3490,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.membership.ListMembershipsResponse: @@ -2622,6 +3505,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseListMemberships._get_http_options() ) + request, metadata = self._interceptor.pre_list_memberships( request, metadata ) @@ -2634,6 +3518,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.ListMemberships", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListMemberships", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._ListMemberships._get_response( self._host, @@ -2654,7 +3565,31 @@ def __call__( pb_resp = membership.ListMembershipsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_memberships(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = membership.ListMembershipsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.list_memberships", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListMemberships", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListMessages( @@ -2691,7 +3626,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> message.ListMessagesResponse: r"""Call the list messages method over HTTP. @@ -2702,8 +3637,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.message.ListMessagesResponse: @@ -2715,6 +3652,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseListMessages._get_http_options() ) + request, metadata = self._interceptor.pre_list_messages(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseListMessages._get_transcoded_request( @@ -2729,6 +3667,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.ListMessages", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListMessages", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._ListMessages._get_response( self._host, @@ -2749,7 +3714,29 @@ def __call__( pb_resp = message.ListMessagesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_messages(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = message.ListMessagesResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.list_messages", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListMessages", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListReactions( @@ -2786,7 +3773,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> reaction.ListReactionsResponse: r"""Call the list reactions method over HTTP. @@ -2796,8 +3783,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.reaction.ListReactionsResponse: @@ -2807,6 +3796,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseListReactions._get_http_options() ) + request, metadata = self._interceptor.pre_list_reactions(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseListReactions._get_transcoded_request( http_options, request @@ -2819,6 +3809,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.ListReactions", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListReactions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._ListReactions._get_response( self._host, @@ -2839,7 +3856,29 @@ def __call__( pb_resp = reaction.ListReactionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_reactions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reaction.ListReactionsResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.list_reactions", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListReactions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListSpaceEvents( @@ -2876,7 +3915,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space_event.ListSpaceEventsResponse: r"""Call the list space events method over HTTP. @@ -2887,8 +3926,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space_event.ListSpaceEventsResponse: @@ -2900,6 +3941,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseListSpaceEvents._get_http_options() ) + request, metadata = self._interceptor.pre_list_space_events( request, metadata ) @@ -2912,6 +3954,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.ListSpaceEvents", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListSpaceEvents", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._ListSpaceEvents._get_response( self._host, @@ -2932,7 +4001,31 @@ def __call__( pb_resp = space_event.ListSpaceEventsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_space_events(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space_event.ListSpaceEventsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.list_space_events", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListSpaceEvents", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListSpaces( @@ -2969,7 +4062,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.ListSpacesResponse: r"""Call the list spaces method over HTTP. @@ -2980,8 +4073,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space.ListSpacesResponse: @@ -2993,6 +4088,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseListSpaces._get_http_options() ) + request, metadata = self._interceptor.pre_list_spaces(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseListSpaces._get_transcoded_request( @@ -3007,6 +4103,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.ListSpaces", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListSpaces", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._ListSpaces._get_response( self._host, @@ -3027,7 +4150,29 @@ def __call__( pb_resp = space.ListSpacesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_spaces(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space.ListSpacesResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.list_spaces", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "ListSpaces", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchSpaces( @@ -3064,7 +4209,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.SearchSpacesResponse: r"""Call the search spaces method over HTTP. @@ -3075,8 +4220,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space.SearchSpacesResponse: @@ -3089,6 +4236,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseSearchSpaces._get_http_options() ) + request, metadata = self._interceptor.pre_search_spaces(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseSearchSpaces._get_transcoded_request( @@ -3103,6 +4251,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.SearchSpaces", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "SearchSpaces", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._SearchSpaces._get_response( self._host, @@ -3123,7 +4298,29 @@ def __call__( pb_resp = space.SearchSpacesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_spaces(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space.SearchSpacesResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.search_spaces", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "SearchSpaces", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SetUpSpace( @@ -3161,7 +4358,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> space.Space: r"""Call the set up space method over HTTP. @@ -3172,8 +4369,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.space.Space: @@ -3187,6 +4386,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseSetUpSpace._get_http_options() ) + request, metadata = self._interceptor.pre_set_up_space(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseSetUpSpace._get_transcoded_request( @@ -3205,6 +4405,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.SetUpSpace", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "SetUpSpace", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._SetUpSpace._get_response( self._host, @@ -3226,7 +4453,29 @@ def __call__( pb_resp = space.Space.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_set_up_space(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = space.Space.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.set_up_space", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "SetUpSpace", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateMembership( @@ -3264,7 +4513,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_membership.Membership: r"""Call the update membership method over HTTP. @@ -3275,8 +4524,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.gc_membership.Membership: @@ -3290,6 +4541,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseUpdateMembership._get_http_options() ) + request, metadata = self._interceptor.pre_update_membership( request, metadata ) @@ -3306,6 +4558,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.UpdateMembership", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UpdateMembership", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._UpdateMembership._get_response( self._host, @@ -3327,7 +4606,29 @@ def __call__( pb_resp = gc_membership.Membership.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_membership(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gc_membership.Membership.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.update_membership", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UpdateMembership", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateMessage( @@ -3365,7 +4666,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_message.Message: r"""Call the update message method over HTTP. @@ -3375,8 +4676,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.gc_message.Message: @@ -3386,6 +4689,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseUpdateMessage._get_http_options() ) + request, metadata = self._interceptor.pre_update_message(request, metadata) transcoded_request = _BaseChatServiceRestTransport._BaseUpdateMessage._get_transcoded_request( http_options, request @@ -3404,6 +4708,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.UpdateMessage", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UpdateMessage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._UpdateMessage._get_response( self._host, @@ -3425,7 +4756,29 @@ def __call__( pb_resp = gc_message.Message.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_message(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gc_message.Message.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.update_message", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UpdateMessage", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateSpace( @@ -3463,7 +4816,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space.Space: r"""Call the update space method over HTTP. @@ -3473,8 +4826,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.gc_space.Space: @@ -3488,6 +4843,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseUpdateSpace._get_http_options() ) + request, metadata = self._interceptor.pre_update_space(request, metadata) transcoded_request = ( _BaseChatServiceRestTransport._BaseUpdateSpace._get_transcoded_request( @@ -3508,6 +4864,33 @@ def __call__( ) ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.UpdateSpace", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UpdateSpace", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._UpdateSpace._get_response( self._host, @@ -3529,7 +4912,29 @@ def __call__( pb_resp = gc_space.Space.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_space(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gc_space.Space.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.update_space", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UpdateSpace", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateSpaceReadState( @@ -3567,7 +4972,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gc_space_read_state.SpaceReadState: r"""Call the update space read state method over HTTP. @@ -3578,8 +4983,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.gc_space_read_state.SpaceReadState: @@ -3592,6 +4999,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseUpdateSpaceReadState._get_http_options() ) + request, metadata = self._interceptor.pre_update_space_read_state( request, metadata ) @@ -3608,6 +5016,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.UpdateSpaceReadState", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UpdateSpaceReadState", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._UpdateSpaceReadState._get_response( self._host, @@ -3629,7 +5064,31 @@ def __call__( pb_resp = gc_space_read_state.SpaceReadState.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_space_read_state(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gc_space_read_state.SpaceReadState.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.update_space_read_state", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UpdateSpaceReadState", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UploadAttachment( @@ -3667,7 +5126,7 @@ def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> attachment.UploadAttachmentResponse: r"""Call the upload attachment method over HTTP. @@ -3677,8 +5136,10 @@ def __call__( retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be + sent along with the request as metadata. Normally, each value must be of type `str`, + but for metadata keys ending with the suffix `-bin`, the corresponding values must + be of type `bytes`. Returns: ~.attachment.UploadAttachmentResponse: @@ -3688,6 +5149,7 @@ def __call__( http_options = ( _BaseChatServiceRestTransport._BaseUploadAttachment._get_http_options() ) + request, metadata = self._interceptor.pre_upload_attachment( request, metadata ) @@ -3704,6 +5166,33 @@ def __call__( transcoded_request ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + request_url = "{host}{uri}".format( + host=self._host, uri=transcoded_request["uri"] + ) + method = transcoded_request["method"] + try: + request_payload = type(request).to_json(request) + except: + request_payload = None + http_request = { + "payload": request_payload, + "requestMethod": method, + "requestUrl": request_url, + "headers": dict(metadata), + } + _LOGGER.debug( + f"Sending request for google.chat_v1.ChatServiceClient.UploadAttachment", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UploadAttachment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ChatServiceRestTransport._UploadAttachment._get_response( self._host, @@ -3725,7 +5214,31 @@ def __call__( pb_resp = attachment.UploadAttachmentResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upload_attachment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = attachment.UploadAttachmentResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": response.status_code, + } + _LOGGER.debug( + "Received response for google.chat_v1.ChatServiceClient.upload_attachment", + extra={ + "serviceName": "google.chat.v1.ChatService", + "rpcName": "UploadAttachment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property diff --git a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/rest_base.py b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/rest_base.py index 116f6c2b56d6..a0bd2de186d5 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/rest_base.py +++ b/packages/google-apps-chat/google/apps/chat_v1/services/chat_service/transports/rest_base.py @@ -1342,7 +1342,9 @@ class _BaseUpdateMessage: def __hash__(self): # pragma: NO COVER return NotImplementedError("__hash__ must be implemented.") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + "updateMask": {}, + } @classmethod def _get_unset_required_fields(cls, message_dict): @@ -1404,7 +1406,9 @@ class _BaseUpdateSpace: def __hash__(self): # pragma: NO COVER return NotImplementedError("__hash__ must be implemented.") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + "updateMask": {}, + } @classmethod def _get_unset_required_fields(cls, message_dict): diff --git a/packages/google-apps-chat/google/apps/chat_v1/types/attachment.py b/packages/google-apps-chat/google/apps/chat_v1/types/attachment.py index c9b2ca2855aa..07c0357606b2 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/types/attachment.py +++ b/packages/google-apps-chat/google/apps/chat_v1/types/attachment.py @@ -44,7 +44,7 @@ class Attachment(proto.Message): Attributes: name (str): - Resource name of the attachment, in the form + Optional. Resource name of the attachment, in the form ``spaces/{space}/messages/{message}/attachments/{attachment}``. content_name (str): Output only. The original file name for the @@ -53,9 +53,10 @@ class Attachment(proto.Message): Output only. The content type (MIME type) of the file. attachment_data_ref (google.apps.chat_v1.types.AttachmentDataRef): - A reference to the attachment data. This - field is used with the media API to download the - attachment data. + Optional. A reference to the attachment data. + This field is used to create or update messages + with attachments, or with the media API to + download the attachment data. This field is a member of `oneof`_ ``data_ref``. drive_data_ref (google.apps.chat_v1.types.DriveDataRef): @@ -152,14 +153,14 @@ class AttachmentDataRef(proto.Message): Attributes: resource_name (str): - The resource name of the attachment data. - This field is used with the media API to + Optional. The resource name of the attachment + data. This field is used with the media API to download the attachment data. attachment_upload_token (str): - Opaque token containing a reference to an - uploaded attachment. Treated by clients as an - opaque string and used to create or update Chat - messages with attachments. + Optional. Opaque token containing a reference + to an uploaded attachment. Treated by clients as + an opaque string and used to create or update + Chat messages with attachments. """ resource_name: str = proto.Field( diff --git a/packages/google-apps-chat/google/apps/chat_v1/types/deletion_metadata.py b/packages/google-apps-chat/google/apps/chat_v1/types/deletion_metadata.py index 1d0204db4006..f32cc4aa3c1a 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/types/deletion_metadata.py +++ b/packages/google-apps-chat/google/apps/chat_v1/types/deletion_metadata.py @@ -37,7 +37,8 @@ class DeletionMetadata(proto.Message): """ class DeletionType(proto.Enum): - r"""Who deleted the message and how it was deleted. + r"""Who deleted the message and how it was deleted. More values + may be added in the future. Values: DELETION_TYPE_UNSPECIFIED (0): diff --git a/packages/google-apps-chat/google/apps/chat_v1/types/membership.py b/packages/google-apps-chat/google/apps/chat_v1/types/membership.py index f0e00c470930..2cefcdffaccc 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/types/membership.py +++ b/packages/google-apps-chat/google/apps/chat_v1/types/membership.py @@ -51,7 +51,8 @@ class Membership(proto.Message): Attributes: name (str): - Resource name of the membership, assigned by the server. + Identifier. Resource name of the membership, assigned by the + server. Format: ``spaces/{space}/members/{member}`` state (google.apps.chat_v1.types.Membership.MembershipState): @@ -63,8 +64,8 @@ class Membership(proto.Message): This field can only be used as input in ``UpdateMembership``. member (google.apps.chat_v1.types.User): - The Google Chat user or app the membership corresponds to. - If your Chat app `authenticates as a + Optional. The Google Chat user or app the membership + corresponds to. If your Chat app `authenticates as a user `__, the output populates the `user `__ @@ -72,8 +73,11 @@ class Membership(proto.Message): This field is a member of `oneof`_ ``memberType``. group_member (google.apps.chat_v1.types.Group): - The Google Group the membership corresponds - to. + Optional. The Google Group the membership corresponds to. + + Reading or mutating memberships for Google Groups requires + `user + authentication `__. This field is a member of `oneof`_ ``memberType``. create_time (google.protobuf.timestamp_pb2.Timestamp): @@ -188,29 +192,54 @@ class CreateMembershipRequest(proto.Message): Format: spaces/{space} membership (google.apps.chat_v1.types.Membership): - Required. The membership relation to create. The - ``memberType`` field must contain a user with the + Required. The membership relation to create. + + The ``memberType`` field must contain a user with the ``user.name`` and ``user.type`` fields populated. The server will assign a resource name and overwrite anything - specified. When a Chat app creates a membership relation for - a human user, it must use the ``chat.memberships`` scope, - set ``user.type`` to ``HUMAN``, and set ``user.name`` with - format ``users/{user}``, where ``{user}`` can be the email - address for the user. For users in the same Workspace - organization ``{user}`` can also be the ``id`` of the - `person `__ - from the People API, or the ``id`` for the user in the - Directory API. For example, if the People API Person profile - ID for ``user@example.com`` is ``123456789``, you can add - the user to the space by setting the - ``membership.member.name`` to ``users/user@example.com`` or - ``users/123456789``. When a Chat app creates a membership - relation for itself, it must use the - ``chat.memberships.app`` scope, set ``user.type`` to - ``BOT``, and set ``user.name`` to ``users/app``. + specified. + + When a Chat app creates a membership relation for a human + user, it must use certain authorization scopes and set + specific values for certain fields: + + - When `authenticating as a + user `__, + the ``chat.memberships`` authorization scope is required. + + - When `authenticating as an + app `__, + the ``chat.app.memberships`` authorization scope is + required. Authenticating as an app is available in + `Developer + Preview `__. + + - Set ``user.type`` to ``HUMAN``, and set ``user.name`` + with format ``users/{user}``, where ``{user}`` can be the + email address for the user. For users in the same + Workspace organization ``{user}`` can also be the ``id`` + of the + `person `__ + from the People API, or the ``id`` for the user in the + Directory API. For example, if the People API Person + profile ID for ``user@example.com`` is ``123456789``, you + can add the user to the space by setting the + ``membership.member.name`` to ``users/user@example.com`` + or ``users/123456789``. + + Inviting users external to the Workspace organization that + owns the space requires `user + authentication `__. + + When a Chat app creates a membership relation for itself, it + must `authenticate as a + user `__ + and use the ``chat.memberships.app`` scope, set + ``user.type`` to ``BOT``, and set ``user.name`` to + ``users/app``. use_admin_access (bool): - When ``true``, the method runs using the user's Google - Workspace administrator privileges. + Optional. When ``true``, the method runs using the user's + Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the `manage chat and spaces conversations @@ -254,8 +283,8 @@ class UpdateMembershipRequest(proto.Message): - ``role`` use_admin_access (bool): - When ``true``, the method runs using the user's Google - Workspace administrator privileges. + Optional. When ``true``, the method runs using the user's + Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the `manage chat and spaces conversations @@ -371,8 +400,8 @@ class ListMembershipsRequest(proto.Message): Currently requires `user authentication `__. use_admin_access (bool): - When ``true``, the method runs using the user's Google - Workspace administrator privileges. + Optional. When ``true``, the method runs using the user's + Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the `manage chat and spaces conversations @@ -458,15 +487,13 @@ class GetMembershipRequest(proto.Message): Format: ``spaces/{space}/members/{member}`` or ``spaces/{space}/members/app`` - When `authenticated as a - user `__, - you can use the user's email as an alias for ``{member}``. + You can use the user's email as an alias for ``{member}``. For example, ``spaces/{space}/members/example@gmail.com`` where ``example@gmail.com`` is the email of the Google Chat user. use_admin_access (bool): - When ``true``, the method runs using the user's Google - Workspace administrator privileges. + Optional. When ``true``, the method runs using the user's + Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the `manage chat and spaces conversations @@ -513,8 +540,8 @@ class DeleteMembershipRequest(proto.Message): Format: ``spaces/{space}/members/{member}`` or ``spaces/{space}/members/app``. use_admin_access (bool): - When ``true``, the method runs using the user's Google - Workspace administrator privileges. + Optional. When ``true``, the method runs using the user's + Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the `manage chat and spaces conversations diff --git a/packages/google-apps-chat/google/apps/chat_v1/types/message.py b/packages/google-apps-chat/google/apps/chat_v1/types/message.py index 56d10d7b3574..612a374dff16 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/types/message.py +++ b/packages/google-apps-chat/google/apps/chat_v1/types/message.py @@ -60,7 +60,7 @@ class Message(proto.Message): Attributes: name (str): - Resource name of the message. + Identifier. Resource name of the message. Format: ``spaces/{space}/messages/{message}`` @@ -102,8 +102,8 @@ class Message(proto.Message): was deleted in Google Chat. If the message is never deleted, this field is empty. text (str): - Plain-text body of the message. The first link to an image, - video, or web page generates a `preview + Optional. Plain-text body of the message. The first link to + an image, video, or web page generates a `preview chip `__. You can also `@mention a Google Chat user `__, @@ -146,7 +146,7 @@ class Message(proto.Message): plain-text body of the message. ``cards`` and ``cards_v2`` can have a maximum size of 32 KB. cards_v2 (MutableSequence[google.apps.chat_v1.types.CardWithId]): - An array of + Optional. An array of `cards `__. Only Chat apps can create cards. If your Chat app @@ -168,15 +168,16 @@ class Message(proto.Message): `Start or reply to a message thread `__. space (google.apps.chat_v1.types.Space): - If your Chat app `authenticates as a + Output only. If your Chat app `authenticates as a user `__, - the output populates the + the output only populates the `space `__ ``name``. fallback_text (str): - A plain-text description of the message's - cards, used when the actual cards can't be - displayed—for example, mobile notifications. + Optional. A plain-text description of the + message's cards, used when the actual cards + can't be displayed—for example, mobile + notifications. action_response (google.apps.chat_v1.types.ActionResponse): Input only. Parameters that a Chat app can use to configure how its response is posted. @@ -187,7 +188,7 @@ class Message(proto.Message): Output only. Slash command information, if applicable. attachment (MutableSequence[google.apps.chat_v1.types.Attachment]): - User-uploaded attachment. + Optional. User-uploaded attachment. matched_url (google.apps.chat_v1.types.MatchedUrl): Output only. A URL in ``spaces.messages.text`` that matches a link preview pattern. For more information, see `Preview @@ -211,11 +212,11 @@ class Message(proto.Message): Output only. The list of emoji reaction summaries on the message. private_message_viewer (google.apps.chat_v1.types.User): - Immutable. Input for creating a message, otherwise output - only. The user that can view the message. When set, the - message is private and only visible to the specified user - and the Chat app. To include this field in your request, you - must call the Chat API using `app + Optional. Immutable. Input for creating a message, otherwise + output only. The user that can view the message. When set, + the message is private and only visible to the specified + user and the Chat app. To include this field in your + request, you must call the Chat API using `app authentication `__ and omit the following: @@ -237,11 +238,11 @@ class Message(proto.Message): Output only. GIF images that are attached to the message. accessory_widgets (MutableSequence[google.apps.chat_v1.types.AccessoryWidget]): - One or more interactive widgets that appear at the bottom of - a message. You can add accessory widgets to messages that - contain text, cards, or both text and cards. Not supported - for messages that contain dialogs. For details, see `Add - interactive widgets at the bottom of a + Optional. One or more interactive widgets that appear at the + bottom of a message. You can add accessory widgets to + messages that contain text, cards, or both text and cards. + Not supported for messages that contain dialogs. For + details, see `Add interactive widgets at the bottom of a message `__. Creating a message with accessory widgets requires [app @@ -429,7 +430,7 @@ class Thread(proto.Message): Attributes: name (str): - Resource name of the thread. + Identifier. Resource name of the thread. Example: ``spaces/{space}/threads/{thread}`` thread_key (str): @@ -524,8 +525,8 @@ class SelectionItems(proto.Message): ) class UpdatedWidget(proto.Message): - r"""The response of the updated widget. - Used to provide autocomplete options for a widget. + r"""For ``selectionInput`` widgets, returns autocomplete suggestions for + a multiselect menu. .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields @@ -632,9 +633,9 @@ class DeleteMessageRequest(proto.Message): ``{message}``. For details, see [Name a message] (https://developers.google.com/workspace/chat/create-messages#name_a_created_message). force (bool): - When ``true``, deleting a message also deletes its threaded - replies. When ``false``, if a message has threaded replies, - deletion fails. + Optional. When ``true``, deleting a message also deletes its + threaded replies. When ``false``, if a message has threaded + replies, deletion fails. Only applies when `authenticating as a user `__. @@ -726,9 +727,14 @@ class CreateMessageRequest(proto.Message): returns the message created with that ID instead of creating a new message. message_reply_option (google.apps.chat_v1.types.CreateMessageRequest.MessageReplyOption): - Optional. Specifies whether a message starts - a thread or replies to one. Only supported in - named spaces. + Optional. Specifies whether a message starts a thread or + replies to one. Only supported in named spaces. + + When `responding to user + interactions `__, + this field is ignored. For interactions within a thread, the + reply is created in the same thread. Otherwise, the reply is + created as a new thread. message_id (str): Optional. A custom ID for a message. Lets Chat apps get, update, or delete a message without needing to store the @@ -816,8 +822,8 @@ class ListMessagesRequest(proto.Message): Format: ``spaces/{space}`` page_size (int): - The maximum number of messages returned. The service might - return fewer messages than this value. + Optional. The maximum number of messages returned. The + service might return fewer messages than this value. If unspecified, at most 25 are returned. @@ -826,18 +832,16 @@ class ListMessagesRequest(proto.Message): Negative values return an ``INVALID_ARGUMENT`` error. page_token (str): - Optional, if resuming from a previous query. - - A page token received from a previous list - messages call. Provide this parameter to - retrieve the subsequent page. + Optional. A page token received from a + previous list messages call. Provide this + parameter to retrieve the subsequent page. When paginating, all other parameters provided should match the call that provided the page token. Passing different values to the other parameters might lead to unexpected results. filter (str): - A query filter. + Optional. A query filter. You can filter messages by date (``create_time``) and thread (``thread.name``). @@ -879,11 +883,9 @@ class ListMessagesRequest(proto.Message): Invalid queries are rejected by the server with an ``INVALID_ARGUMENT`` error. order_by (str): - Optional, if resuming from a previous query. - - How the list of messages is ordered. Specify a value to - order by an ordering operation. Valid ordering operation - values are as follows: + Optional. How the list of messages is ordered. Specify a + value to order by an ordering operation. Valid ordering + operation values are as follows: - ``ASC`` for ascending. @@ -891,10 +893,10 @@ class ListMessagesRequest(proto.Message): The default ordering is ``create_time ASC``. show_deleted (bool): - Whether to include deleted messages. Deleted - messages include deleted time and metadata about - their deletion, but message content is - unavailable. + Optional. Whether to include deleted + messages. Deleted messages include deleted time + and metadata about their deletion, but message + content is unavailable. """ parent: str = proto.Field( diff --git a/packages/google-apps-chat/google/apps/chat_v1/types/reaction.py b/packages/google-apps-chat/google/apps/chat_v1/types/reaction.py index c64f3d2ef5b3..9b2d3c05c5e0 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/types/reaction.py +++ b/packages/google-apps-chat/google/apps/chat_v1/types/reaction.py @@ -41,7 +41,7 @@ class Reaction(proto.Message): Attributes: name (str): - The resource name of the reaction. + Identifier. The resource name of the reaction. Format: ``spaces/{space}/messages/{message}/reactions/{reaction}`` @@ -49,7 +49,7 @@ class Reaction(proto.Message): Output only. The user who created the reaction. emoji (google.apps.chat_v1.types.Emoji): - The emoji used in the reaction. + Required. The emoji used in the reaction. """ name: str = proto.Field( @@ -80,8 +80,8 @@ class Emoji(proto.Message): Attributes: unicode (str): - A basic emoji represented by a unicode - string. + Optional. A basic emoji represented by a + unicode string. This field is a member of `oneof`_ ``content``. custom_emoji (google.apps.chat_v1.types.CustomEmoji): @@ -127,10 +127,11 @@ class EmojiReactionSummary(proto.Message): Attributes: emoji (google.apps.chat_v1.types.Emoji): - Emoji associated with the reactions. + Output only. Emoji associated with the + reactions. reaction_count (int): - The total number of reactions using the - associated emoji. + Output only. The total number of reactions + using the associated emoji. This field is a member of `oneof`_ ``_reaction_count``. """ diff --git a/packages/google-apps-chat/google/apps/chat_v1/types/space.py b/packages/google-apps-chat/google/apps/chat_v1/types/space.py index 694375fc0ebd..d676ebfbe2ad 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/types/space.py +++ b/packages/google-apps-chat/google/apps/chat_v1/types/space.py @@ -55,7 +55,7 @@ class Space(proto.Message): Attributes: name (str): - Resource name of the space. + Identifier. Resource name of the space. Format: ``spaces/{space}`` @@ -70,9 +70,9 @@ class Space(proto.Message): Output only. Deprecated: Use ``space_type`` instead. The type of a space. space_type (google.apps.chat_v1.types.Space.SpaceType): - The type of space. Required when creating a - space or updating the space type of a space. - Output only for other usage. + Optional. The type of space. Required when + creating a space or updating the space type of a + space. Output only for other usage. single_user_bot_dm (bool): Optional. Whether the space is a DM between a Chat app and a single human. @@ -80,7 +80,8 @@ class Space(proto.Message): Output only. Deprecated: Use ``spaceThreadingState`` instead. Whether messages are threaded in this space. display_name (str): - The space's display name. Required when `creating a + Optional. The space's display name. Required when `creating + a space `__ with a ``spaceType`` of ``SPACE``. If you receive the error message ``ALREADY_EXISTS`` when creating a space or updating @@ -92,10 +93,10 @@ class Space(proto.Message): Supports up to 128 characters. external_user_allowed (bool): - Immutable. Whether this space permits any Google Chat user - as a member. Input when creating a space in a Google - Workspace organization. Omit this field when creating spaces - in the following conditions: + Optional. Immutable. Whether this space permits any Google + Chat user as a member. Input when creating a space in a + Google Workspace organization. Omit this field when creating + spaces in the following conditions: - The authenticated user uses a consumer account (unmanaged user account). By default, a space created by a consumer @@ -106,16 +107,19 @@ class Space(proto.Message): Output only. The threading state in the Chat space. space_details (google.apps.chat_v1.types.Space.SpaceDetails): - Details about the space including description - and rules. + Optional. Details about the space including + description and rules. space_history_state (google.apps.chat_v1.types.HistoryState): - The message history state for messages and - threads in this space. + Optional. The message history state for + messages and threads in this space. import_mode (bool): Optional. Whether this space is created in ``Import Mode`` as part of a data migration into Google Workspace. While spaces are being imported, they aren't visible to users until the import is complete. + + Creating a space in ``Import Mode``\ requires `user + authentication `__. create_time (google.protobuf.timestamp_pb2.Timestamp): Optional. Immutable. For spaces created in Chat, the time the space was created. This field is output only, except @@ -167,6 +171,15 @@ class Space(proto.Message): permission settings. This field is a member of `oneof`_ ``space_permission_settings``. + import_mode_expire_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time when the space will be automatically + deleted by the system if it remains in import mode. + + Each space created in import mode must exit this mode before + this expire time using ``spaces.completeImport``. + + This field is only populated for spaces that were created + with import mode. """ class Type(proto.Enum): @@ -285,12 +298,12 @@ class MembershipCount(proto.Message): Attributes: joined_direct_human_user_count (int): - Count of human users that have directly - joined the space, not counting users joined by - having membership in a joined group. + Output only. Count of human users that have + directly joined the space, not counting users + joined by having membership in a joined group. joined_group_count (int): - Count of all groups that have directly joined - the space. + Output only. Count of all groups that have + directly joined the space. """ joined_direct_human_user_count: int = proto.Field( @@ -326,9 +339,24 @@ class AccessSettings(proto.Message): To use the default target audience for the Google Workspace organization, set to ``audiences/default``. + Reading the target audience supports: + + - `User + authentication `__ + + - `App + authentication `__ + with `administrator + approval `__ + with the ``chat.app.spaces`` scope in `Developer + Preview `__. + This field is not populated when using the ``chat.bot`` scope with `app authentication `__. + + Setting the target audience requires `user + authentication `__. """ class AccessState(proto.Enum): @@ -350,6 +378,9 @@ class AccessState(proto.Enum): the space. To learn more, see `Make a space discoverable to specific users `__. + + Creating discoverable spaces requires `user + authentication `__. """ ACCESS_STATE_UNSPECIFIED = 0 PRIVATE = 1 @@ -378,30 +409,32 @@ class PermissionSettings(proto.Message): Attributes: manage_members_and_groups (google.apps.chat_v1.types.Space.PermissionSetting): - Setting for managing members and groups in a - space. + Optional. Setting for managing members and + groups in a space. This field is a member of `oneof`_ ``_manage_members_and_groups``. modify_space_details (google.apps.chat_v1.types.Space.PermissionSetting): - Setting for updating space name, avatar, - description and guidelines. + Optional. Setting for updating space name, + avatar, description and guidelines. This field is a member of `oneof`_ ``_modify_space_details``. toggle_history (google.apps.chat_v1.types.Space.PermissionSetting): - Setting for toggling space history on and - off. + Optional. Setting for toggling space history + on and off. This field is a member of `oneof`_ ``_toggle_history``. use_at_mention_all (google.apps.chat_v1.types.Space.PermissionSetting): - Setting for using @all in a space. + Optional. Setting for using @all in a space. This field is a member of `oneof`_ ``_use_at_mention_all``. manage_apps (google.apps.chat_v1.types.Space.PermissionSetting): - Setting for managing apps in a space. + Optional. Setting for managing apps in a + space. This field is a member of `oneof`_ ``_manage_apps``. manage_webhooks (google.apps.chat_v1.types.Space.PermissionSetting): - Setting for managing webhooks in a space. + Optional. Setting for managing webhooks in a + space. This field is a member of `oneof`_ ``_manage_webhooks``. post_messages (google.apps.chat_v1.types.Space.PermissionSetting): @@ -410,7 +443,8 @@ class PermissionSettings(proto.Message): This field is a member of `oneof`_ ``_post_messages``. reply_messages (google.apps.chat_v1.types.Space.PermissionSetting): - Setting for replying to messages in a space. + Optional. Setting for replying to messages in + a space. This field is a member of `oneof`_ ``_reply_messages``. """ @@ -469,10 +503,11 @@ class PermissionSetting(proto.Message): Attributes: managers_allowed (bool): - Whether spaces managers have this permission. - members_allowed (bool): - Whether non-manager members have this + Optional. Whether spaces managers have this permission. + members_allowed (bool): + Optional. Whether non-manager members have + this permission. """ managers_allowed: bool = proto.Field( @@ -573,6 +608,11 @@ class PermissionSetting(proto.Message): oneof="space_permission_settings", message=PermissionSettings, ) + import_mode_expire_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=28, + message=timestamp_pb2.Timestamp, + ) class CreateSpaceRequest(proto.Message): @@ -581,18 +621,16 @@ class CreateSpaceRequest(proto.Message): Attributes: space (google.apps.chat_v1.types.Space): Required. The ``displayName`` and ``spaceType`` fields must - be populated. Only ``SpaceType.SPACE`` is supported. + be populated. Only ``SpaceType.SPACE`` and + ``SpaceType.GROUP_CHAT`` are supported. + ``SpaceType.GROUP_CHAT`` can only be used if ``importMode`` + is set to true. If you receive the error message ``ALREADY_EXISTS``, try a different ``displayName``. An existing space within the Google Workspace organization might already use this display name. - If you're a member of the `Developer Preview - program `__, - ``SpaceType.GROUP_CHAT`` can be used if ``importMode`` is - set to true. - The space ``name`` is assigned on the server so anything specified in this field will be ignored. request_id (str): @@ -713,8 +751,8 @@ class GetSpaceRequest(proto.Message): Format: ``spaces/{space}`` use_admin_access (bool): - When ``true``, the method runs using the user's Google - Workspace administrator privileges. + Optional. When ``true``, the method runs using the user's + Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the `manage chat and spaces conversations @@ -841,8 +879,8 @@ class UpdateSpaceRequest(proto.Message): - ``permission_settings.manageWebhooks`` - ``permission_settings.replyMessages`` use_admin_access (bool): - When ``true``, the method runs using the user's Google - Workspace administrator privileges. + Optional. When ``true``, the method runs using the user's + Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the `manage chat and spaces conversations @@ -1079,8 +1117,8 @@ class DeleteSpaceRequest(proto.Message): Format: ``spaces/{space}`` use_admin_access (bool): - When ``true``, the method runs using the user's Google - Workspace administrator privileges. + Optional. When ``true``, the method runs using the user's + Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the `manage chat and spaces conversations diff --git a/packages/google-apps-chat/google/apps/chat_v1/types/space_event.py b/packages/google-apps-chat/google/apps/chat_v1/types/space_event.py index 17bf07ba27d7..6c6fcfb052ad 100644 --- a/packages/google-apps-chat/google/apps/chat_v1/types/space_event.py +++ b/packages/google-apps-chat/google/apps/chat_v1/types/space_event.py @@ -399,9 +399,9 @@ class ListSpaceEventsRequest(proto.Message): Negative values return an ``INVALID_ARGUMENT`` error. page_token (str): - A page token, received from a previous list - space events call. Provide this to retrieve the - subsequent page. + Optional. A page token, received from a + previous list space events call. Provide this to + retrieve the subsequent page. When paginating, all other parameters provided to list space events must match the call that diff --git a/packages/google-apps-chat/samples/generated_samples/chat_v1_generated_chat_service_create_reaction_async.py b/packages/google-apps-chat/samples/generated_samples/chat_v1_generated_chat_service_create_reaction_async.py index 11207c61d5a5..6ffc85b4496b 100644 --- a/packages/google-apps-chat/samples/generated_samples/chat_v1_generated_chat_service_create_reaction_async.py +++ b/packages/google-apps-chat/samples/generated_samples/chat_v1_generated_chat_service_create_reaction_async.py @@ -39,8 +39,12 @@ async def sample_create_reaction(): client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) + reaction = chat_v1.Reaction() + reaction.emoji.unicode = "unicode_value" + request = chat_v1.CreateReactionRequest( parent="parent_value", + reaction=reaction, ) # Make the request diff --git a/packages/google-apps-chat/samples/generated_samples/chat_v1_generated_chat_service_create_reaction_sync.py b/packages/google-apps-chat/samples/generated_samples/chat_v1_generated_chat_service_create_reaction_sync.py index fc0a1dcbfa71..8af6d97b1669 100644 --- a/packages/google-apps-chat/samples/generated_samples/chat_v1_generated_chat_service_create_reaction_sync.py +++ b/packages/google-apps-chat/samples/generated_samples/chat_v1_generated_chat_service_create_reaction_sync.py @@ -39,8 +39,12 @@ def sample_create_reaction(): client = chat_v1.ChatServiceClient() # Initialize request argument(s) + reaction = chat_v1.Reaction() + reaction.emoji.unicode = "unicode_value" + request = chat_v1.CreateReactionRequest( parent="parent_value", + reaction=reaction, ) # Make the request diff --git a/packages/google-apps-chat/samples/generated_samples/snippet_metadata_google.chat.v1.json b/packages/google-apps-chat/samples/generated_samples/snippet_metadata_google.chat.v1.json index b4693d56a9b2..55a30ce1c225 100644 --- a/packages/google-apps-chat/samples/generated_samples/snippet_metadata_google.chat.v1.json +++ b/packages/google-apps-chat/samples/generated_samples/snippet_metadata_google.chat.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-apps-chat", - "version": "0.1.14" + "version": "0.1.0" }, "snippets": [ { @@ -43,7 +43,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.CompleteImportSpaceResponse", @@ -119,7 +119,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.CompleteImportSpaceResponse", @@ -204,7 +204,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Membership", @@ -288,7 +288,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Membership", @@ -377,7 +377,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Message", @@ -465,7 +465,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Message", @@ -550,7 +550,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Reaction", @@ -563,12 +563,12 @@ "regionTag": "chat_v1_generated_ChatService_CreateReaction_async", "segments": [ { - "end": 51, + "end": 55, "start": 27, "type": "FULL" }, { - "end": 51, + "end": 55, "start": 27, "type": "SHORT" }, @@ -578,18 +578,18 @@ "type": "CLIENT_INITIALIZATION" }, { - "end": 45, + "end": 49, "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 48, - "start": 46, + "end": 52, + "start": 50, "type": "REQUEST_EXECUTION" }, { - "end": 52, - "start": 49, + "end": 56, + "start": 53, "type": "RESPONSE_HANDLING" } ], @@ -634,7 +634,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Reaction", @@ -647,12 +647,12 @@ "regionTag": "chat_v1_generated_ChatService_CreateReaction_sync", "segments": [ { - "end": 51, + "end": 55, "start": 27, "type": "FULL" }, { - "end": 51, + "end": 55, "start": 27, "type": "SHORT" }, @@ -662,18 +662,18 @@ "type": "CLIENT_INITIALIZATION" }, { - "end": 45, + "end": 49, "start": 41, "type": "REQUEST_INITIALIZATION" }, { - "end": 48, - "start": 46, + "end": 52, + "start": 50, "type": "REQUEST_EXECUTION" }, { - "end": 52, - "start": 49, + "end": 56, + "start": 53, "type": "RESPONSE_HANDLING" } ], @@ -715,7 +715,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -795,7 +795,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -876,7 +876,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Membership", @@ -956,7 +956,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Membership", @@ -1037,7 +1037,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_message" @@ -1114,7 +1114,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_message" @@ -1192,7 +1192,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_reaction" @@ -1269,7 +1269,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_reaction" @@ -1347,7 +1347,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_space" @@ -1424,7 +1424,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_space" @@ -1498,7 +1498,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -1574,7 +1574,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -1655,7 +1655,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Attachment", @@ -1735,7 +1735,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Attachment", @@ -1816,7 +1816,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Membership", @@ -1896,7 +1896,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Membership", @@ -1977,7 +1977,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Message", @@ -2057,7 +2057,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Message", @@ -2138,7 +2138,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.SpaceEvent", @@ -2218,7 +2218,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.SpaceEvent", @@ -2299,7 +2299,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.SpaceReadState", @@ -2379,7 +2379,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.SpaceReadState", @@ -2460,7 +2460,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -2540,7 +2540,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -2621,7 +2621,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.ThreadReadState", @@ -2701,7 +2701,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.ThreadReadState", @@ -2782,7 +2782,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListMembershipsAsyncPager", @@ -2862,7 +2862,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListMembershipsPager", @@ -2943,7 +2943,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListMessagesAsyncPager", @@ -3023,7 +3023,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListMessagesPager", @@ -3104,7 +3104,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListReactionsAsyncPager", @@ -3184,7 +3184,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListReactionsPager", @@ -3269,7 +3269,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsAsyncPager", @@ -3353,7 +3353,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsPager", @@ -3430,7 +3430,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListSpacesAsyncPager", @@ -3506,7 +3506,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.ListSpacesPager", @@ -3583,7 +3583,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.SearchSpacesAsyncPager", @@ -3659,7 +3659,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.services.chat_service.pagers.SearchSpacesPager", @@ -3736,7 +3736,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -3812,7 +3812,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -3897,7 +3897,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Membership", @@ -3981,7 +3981,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Membership", @@ -4066,7 +4066,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Message", @@ -4150,7 +4150,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Message", @@ -4235,7 +4235,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.SpaceReadState", @@ -4319,7 +4319,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.SpaceReadState", @@ -4404,7 +4404,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -4488,7 +4488,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.Space", @@ -4565,7 +4565,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.UploadAttachmentResponse", @@ -4641,7 +4641,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.apps.chat_v1.types.UploadAttachmentResponse", diff --git a/packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.py b/packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.py index b5c828d4d20d..af05fac42229 100644 --- a/packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.py +++ b/packages/google-apps-chat/tests/unit/gapic/chat_v1/test_chat_service.py @@ -11506,6 +11506,7 @@ def test_create_message_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_message(request) @@ -11568,6 +11569,7 @@ def test_create_message_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_message(**mock_args) @@ -11707,6 +11709,7 @@ def test_list_messages_rest_required_fields(request_type=message.ListMessagesReq response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_messages(request) @@ -11763,6 +11766,7 @@ def test_list_messages_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_messages(**mock_args) @@ -11966,6 +11970,7 @@ def test_list_memberships_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_memberships(request) @@ -12023,6 +12028,7 @@ def test_list_memberships_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_memberships(**mock_args) @@ -12217,6 +12223,7 @@ def test_get_membership_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_membership(request) @@ -12262,6 +12269,7 @@ def test_get_membership_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_membership(**mock_args) @@ -12389,6 +12397,7 @@ def test_get_message_rest_required_fields(request_type=message.GetMessageRequest response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_message(request) @@ -12434,6 +12443,7 @@ def test_get_message_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_message(**mock_args) @@ -12566,6 +12576,7 @@ def test_update_message_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_message(request) @@ -12587,7 +12598,12 @@ def test_update_message_rest_unset_required_fields(): "updateMask", ) ) - & set(("message",)) + & set( + ( + "message", + "updateMask", + ) + ) ) @@ -12620,6 +12636,7 @@ def test_update_message_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_message(**mock_args) @@ -12747,6 +12764,7 @@ def test_delete_message_rest_required_fields(request_type=message.DeleteMessageR response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_message(request) @@ -12790,6 +12808,7 @@ def test_delete_message_rest_flattened(): json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_message(**mock_args) @@ -12919,6 +12938,7 @@ def test_get_attachment_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_attachment(request) @@ -12964,6 +12984,7 @@ def test_get_attachment_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_attachment(**mock_args) @@ -13101,6 +13122,7 @@ def test_upload_attachment_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.upload_attachment(request) @@ -13336,6 +13358,7 @@ def test_search_spaces_rest_required_fields(request_type=space.SearchSpacesReque response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.search_spaces(request) @@ -13533,6 +13556,7 @@ def test_get_space_rest_required_fields(request_type=space.GetSpaceRequest): response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_space(request) @@ -13578,6 +13602,7 @@ def test_get_space_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_space(**mock_args) @@ -13703,6 +13728,7 @@ def test_create_space_rest_required_fields(request_type=gc_space.CreateSpaceRequ response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_space(request) @@ -13748,6 +13774,7 @@ def test_create_space_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_space(**mock_args) @@ -13869,6 +13896,7 @@ def test_set_up_space_rest_required_fields(request_type=space_setup.SetUpSpaceRe response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.set_up_space(request) @@ -13989,6 +14017,7 @@ def test_update_space_rest_required_fields(request_type=gc_space.UpdateSpaceRequ response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_space(request) @@ -14010,7 +14039,12 @@ def test_update_space_rest_unset_required_fields(): "useAdminAccess", ) ) - & set(("space",)) + & set( + ( + "space", + "updateMask", + ) + ) ) @@ -14043,6 +14077,7 @@ def test_update_space_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_space(**mock_args) @@ -14170,6 +14205,7 @@ def test_delete_space_rest_required_fields(request_type=space.DeleteSpaceRequest response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_space(request) @@ -14213,6 +14249,7 @@ def test_delete_space_rest_flattened(): json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_space(**mock_args) @@ -14348,6 +14385,7 @@ def test_complete_import_space_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.complete_import_space(request) @@ -14476,6 +14514,7 @@ def test_find_direct_message_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.find_direct_message(request) @@ -14606,6 +14645,7 @@ def test_create_membership_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_membership(request) @@ -14660,6 +14700,7 @@ def test_create_membership_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_membership(**mock_args) @@ -14795,6 +14836,7 @@ def test_update_membership_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_membership(request) @@ -14854,6 +14896,7 @@ def test_update_membership_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_membership(**mock_args) @@ -14989,6 +15032,7 @@ def test_delete_membership_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_membership(request) @@ -15034,6 +15078,7 @@ def test_delete_membership_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_membership(**mock_args) @@ -15164,6 +15209,7 @@ def test_create_reaction_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_reaction(request) @@ -15218,6 +15264,7 @@ def test_create_reaction_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_reaction(**mock_args) @@ -15357,6 +15404,7 @@ def test_list_reactions_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_reactions(request) @@ -15411,6 +15459,7 @@ def test_list_reactions_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_reactions(**mock_args) @@ -15599,6 +15648,7 @@ def test_delete_reaction_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_reaction(request) @@ -15642,6 +15692,7 @@ def test_delete_reaction_rest_flattened(): json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_reaction(**mock_args) @@ -15776,6 +15827,7 @@ def test_get_space_read_state_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_space_read_state(request) @@ -15821,6 +15873,7 @@ def test_get_space_read_state_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_space_read_state(**mock_args) @@ -15954,6 +16007,7 @@ def test_update_space_read_state_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_space_read_state(request) @@ -16010,6 +16064,7 @@ def test_update_space_read_state_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_space_read_state(**mock_args) @@ -16147,6 +16202,7 @@ def test_get_thread_read_state_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_thread_read_state(request) @@ -16194,6 +16250,7 @@ def test_get_thread_read_state_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_thread_read_state(**mock_args) @@ -16325,6 +16382,7 @@ def test_get_space_event_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_space_event(request) @@ -16370,6 +16428,7 @@ def test_get_space_event_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_space_event(**mock_args) @@ -16516,6 +16575,7 @@ def test_list_space_events_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_space_events(request) @@ -16582,6 +16642,7 @@ def test_list_space_events_rest_flattened(): json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_space_events(**mock_args) @@ -18323,6 +18384,7 @@ def test_create_message_rest_bad_request(request_type=gc_message.CreateMessageRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_message(request) @@ -18675,6 +18737,7 @@ def test_create_message_rest_call_success(request_type): "post_messages": {}, "reply_messages": {}, }, + "import_mode_expire_time": {}, }, "fallback_text": "fallback_text_value", "action_response": { @@ -18815,6 +18878,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_message(request) # Establish that the response is the type that we expect. @@ -18861,6 +18925,7 @@ def test_create_message_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = gc_message.Message.to_json(gc_message.Message()) req.return_value.content = return_value @@ -18903,6 +18968,7 @@ def test_list_messages_rest_bad_request(request_type=message.ListMessagesRequest response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_messages(request) @@ -18938,6 +19004,7 @@ def test_list_messages_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_messages(request) # Establish that the response is the type that we expect. @@ -18976,6 +19043,7 @@ def test_list_messages_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = message.ListMessagesResponse.to_json( message.ListMessagesResponse() ) @@ -19022,6 +19090,7 @@ def test_list_memberships_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_memberships(request) @@ -19057,6 +19126,7 @@ def test_list_memberships_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_memberships(request) # Establish that the response is the type that we expect. @@ -19097,6 +19167,7 @@ def test_list_memberships_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = membership.ListMembershipsResponse.to_json( membership.ListMembershipsResponse() ) @@ -19141,6 +19212,7 @@ def test_get_membership_rest_bad_request(request_type=membership.GetMembershipRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_membership(request) @@ -19178,6 +19250,7 @@ def test_get_membership_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_membership(request) # Establish that the response is the type that we expect. @@ -19220,6 +19293,7 @@ def test_get_membership_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = membership.Membership.to_json(membership.Membership()) req.return_value.content = return_value @@ -19262,6 +19336,7 @@ def test_get_message_rest_bad_request(request_type=message.GetMessageRequest): response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_message(request) @@ -19303,6 +19378,7 @@ def test_get_message_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_message(request) # Establish that the response is the type that we expect. @@ -19347,6 +19423,7 @@ def test_get_message_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = message.Message.to_json(message.Message()) req.return_value.content = return_value @@ -19389,6 +19466,7 @@ def test_update_message_rest_bad_request(request_type=gc_message.UpdateMessageRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_message(request) @@ -19741,6 +19819,7 @@ def test_update_message_rest_call_success(request_type): "post_messages": {}, "reply_messages": {}, }, + "import_mode_expire_time": {}, }, "fallback_text": "fallback_text_value", "action_response": { @@ -19881,6 +19960,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_message(request) # Establish that the response is the type that we expect. @@ -19927,6 +20007,7 @@ def test_update_message_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = gc_message.Message.to_json(gc_message.Message()) req.return_value.content = return_value @@ -19969,6 +20050,7 @@ def test_delete_message_rest_bad_request(request_type=message.DeleteMessageReque response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_message(request) @@ -19999,6 +20081,7 @@ def test_delete_message_rest_call_success(request_type): json_return_value = "" response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_message(request) # Establish that the response is the type that we expect. @@ -20033,6 +20116,7 @@ def test_delete_message_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = message.DeleteMessageRequest() metadata = [ @@ -20071,6 +20155,7 @@ def test_get_attachment_rest_bad_request(request_type=attachment.GetAttachmentRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_attachment(request) @@ -20111,6 +20196,7 @@ def test_get_attachment_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_attachment(request) # Establish that the response is the type that we expect. @@ -20156,6 +20242,7 @@ def test_get_attachment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = attachment.Attachment.to_json(attachment.Attachment()) req.return_value.content = return_value @@ -20200,6 +20287,7 @@ def test_upload_attachment_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.upload_attachment(request) @@ -20233,6 +20321,7 @@ def test_upload_attachment_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.upload_attachment(request) # Establish that the response is the type that we expect. @@ -20272,6 +20361,7 @@ def test_upload_attachment_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = attachment.UploadAttachmentResponse.to_json( attachment.UploadAttachmentResponse() ) @@ -20316,6 +20406,7 @@ def test_list_spaces_rest_bad_request(request_type=space.ListSpacesRequest): response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_spaces(request) @@ -20351,6 +20442,7 @@ def test_list_spaces_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_spaces(request) # Establish that the response is the type that we expect. @@ -20389,6 +20481,7 @@ def test_list_spaces_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space.ListSpacesResponse.to_json(space.ListSpacesResponse()) req.return_value.content = return_value @@ -20431,6 +20524,7 @@ def test_search_spaces_rest_bad_request(request_type=space.SearchSpacesRequest): response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.search_spaces(request) @@ -20467,6 +20561,7 @@ def test_search_spaces_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.search_spaces(request) # Establish that the response is the type that we expect. @@ -20506,6 +20601,7 @@ def test_search_spaces_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space.SearchSpacesResponse.to_json(space.SearchSpacesResponse()) req.return_value.content = return_value @@ -20548,6 +20644,7 @@ def test_get_space_rest_bad_request(request_type=space.GetSpaceRequest): response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_space(request) @@ -20595,6 +20692,7 @@ def test_get_space_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_space(request) # Establish that the response is the type that we expect. @@ -20647,6 +20745,7 @@ def test_get_space_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space.Space.to_json(space.Space()) req.return_value.content = return_value @@ -20689,6 +20788,7 @@ def test_create_space_rest_bad_request(request_type=gc_space.CreateSpaceRequest) response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_space(request) @@ -20744,6 +20844,7 @@ def test_create_space_rest_call_success(request_type): "post_messages": {}, "reply_messages": {}, }, + "import_mode_expire_time": {}, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -20842,6 +20943,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_space(request) # Establish that the response is the type that we expect. @@ -20894,6 +20996,7 @@ def test_create_space_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = gc_space.Space.to_json(gc_space.Space()) req.return_value.content = return_value @@ -20936,6 +21039,7 @@ def test_set_up_space_rest_bad_request(request_type=space_setup.SetUpSpaceReques response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.set_up_space(request) @@ -20983,6 +21087,7 @@ def test_set_up_space_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.set_up_space(request) # Establish that the response is the type that we expect. @@ -21035,6 +21140,7 @@ def test_set_up_space_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space.Space.to_json(space.Space()) req.return_value.content = return_value @@ -21077,6 +21183,7 @@ def test_update_space_rest_bad_request(request_type=gc_space.UpdateSpaceRequest) response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_space(request) @@ -21132,6 +21239,7 @@ def test_update_space_rest_call_success(request_type): "post_messages": {}, "reply_messages": {}, }, + "import_mode_expire_time": {}, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -21230,6 +21338,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_space(request) # Establish that the response is the type that we expect. @@ -21282,6 +21391,7 @@ def test_update_space_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = gc_space.Space.to_json(gc_space.Space()) req.return_value.content = return_value @@ -21324,6 +21434,7 @@ def test_delete_space_rest_bad_request(request_type=space.DeleteSpaceRequest): response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_space(request) @@ -21354,6 +21465,7 @@ def test_delete_space_rest_call_success(request_type): json_return_value = "" response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_space(request) # Establish that the response is the type that we expect. @@ -21388,6 +21500,7 @@ def test_delete_space_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = space.DeleteSpaceRequest() metadata = [ @@ -21428,6 +21541,7 @@ def test_complete_import_space_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.complete_import_space(request) @@ -21461,6 +21575,7 @@ def test_complete_import_space_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.complete_import_space(request) # Establish that the response is the type that we expect. @@ -21500,6 +21615,7 @@ def test_complete_import_space_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space.CompleteImportSpaceResponse.to_json( space.CompleteImportSpaceResponse() ) @@ -21546,6 +21662,7 @@ def test_find_direct_message_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.find_direct_message(request) @@ -21593,6 +21710,7 @@ def test_find_direct_message_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.find_direct_message(request) # Establish that the response is the type that we expect. @@ -21645,6 +21763,7 @@ def test_find_direct_message_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space.Space.to_json(space.Space()) req.return_value.content = return_value @@ -21689,6 +21808,7 @@ def test_create_membership_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_membership(request) @@ -21808,6 +21928,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_membership(request) # Establish that the response is the type that we expect. @@ -21850,6 +21971,7 @@ def test_create_membership_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = gc_membership.Membership.to_json(gc_membership.Membership()) req.return_value.content = return_value @@ -21894,6 +22016,7 @@ def test_update_membership_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_membership(request) @@ -22013,6 +22136,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_membership(request) # Establish that the response is the type that we expect. @@ -22055,6 +22179,7 @@ def test_update_membership_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = gc_membership.Membership.to_json(gc_membership.Membership()) req.return_value.content = return_value @@ -22099,6 +22224,7 @@ def test_delete_membership_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_membership(request) @@ -22136,6 +22262,7 @@ def test_delete_membership_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_membership(request) # Establish that the response is the type that we expect. @@ -22178,6 +22305,7 @@ def test_delete_membership_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = membership.Membership.to_json(membership.Membership()) req.return_value.content = return_value @@ -22222,6 +22350,7 @@ def test_create_reaction_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.create_reaction(request) @@ -22335,6 +22464,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.create_reaction(request) # Establish that the response is the type that we expect. @@ -22375,6 +22505,7 @@ def test_create_reaction_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = gc_reaction.Reaction.to_json(gc_reaction.Reaction()) req.return_value.content = return_value @@ -22417,6 +22548,7 @@ def test_list_reactions_rest_bad_request(request_type=reaction.ListReactionsRequ response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_reactions(request) @@ -22452,6 +22584,7 @@ def test_list_reactions_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_reactions(request) # Establish that the response is the type that we expect. @@ -22490,6 +22623,7 @@ def test_list_reactions_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = reaction.ListReactionsResponse.to_json( reaction.ListReactionsResponse() ) @@ -22534,6 +22668,7 @@ def test_delete_reaction_rest_bad_request(request_type=reaction.DeleteReactionRe response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.delete_reaction(request) @@ -22564,6 +22699,7 @@ def test_delete_reaction_rest_call_success(request_type): json_return_value = "" response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.delete_reaction(request) # Establish that the response is the type that we expect. @@ -22598,6 +22734,7 @@ def test_delete_reaction_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = reaction.DeleteReactionRequest() metadata = [ @@ -22638,6 +22775,7 @@ def test_get_space_read_state_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_space_read_state(request) @@ -22673,6 +22811,7 @@ def test_get_space_read_state_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_space_read_state(request) # Establish that the response is the type that we expect. @@ -22713,6 +22852,7 @@ def test_get_space_read_state_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space_read_state.SpaceReadState.to_json( space_read_state.SpaceReadState() ) @@ -22761,6 +22901,7 @@ def test_update_space_read_state_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.update_space_read_state(request) @@ -22871,6 +23012,7 @@ def get_message_fields(field): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.update_space_read_state(request) # Establish that the response is the type that we expect. @@ -22911,6 +23053,7 @@ def test_update_space_read_state_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = gc_space_read_state.SpaceReadState.to_json( gc_space_read_state.SpaceReadState() ) @@ -22959,6 +23102,7 @@ def test_get_thread_read_state_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_thread_read_state(request) @@ -22996,6 +23140,7 @@ def test_get_thread_read_state_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_thread_read_state(request) # Establish that the response is the type that we expect. @@ -23036,6 +23181,7 @@ def test_get_thread_read_state_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = thread_read_state.ThreadReadState.to_json( thread_read_state.ThreadReadState() ) @@ -23082,6 +23228,7 @@ def test_get_space_event_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.get_space_event(request) @@ -23118,6 +23265,7 @@ def test_get_space_event_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.get_space_event(request) # Establish that the response is the type that we expect. @@ -23159,6 +23307,7 @@ def test_get_space_event_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space_event.SpaceEvent.to_json(space_event.SpaceEvent()) req.return_value.content = return_value @@ -23203,6 +23352,7 @@ def test_list_space_events_rest_bad_request( response_value.status_code = 400 response_value.request = mock.Mock() req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} client.list_space_events(request) @@ -23238,6 +23388,7 @@ def test_list_space_events_rest_call_success(request_type): json_return_value = json_format.MessageToJson(return_value) response_value.content = json_return_value.encode("UTF-8") req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.list_space_events(request) # Establish that the response is the type that we expect. @@ -23278,6 +23429,7 @@ def test_list_space_events_rest_interceptors(null_interceptor): req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} return_value = space_event.ListSpaceEventsResponse.to_json( space_event.ListSpaceEventsResponse() )