ChatService¶
- class google.apps.chat_v1.services.chat_service.ChatServiceAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.apps.chat_v1.services.chat_service.transports.base.ChatServiceTransport, typing.Callable[[...], google.apps.chat_v1.services.chat_service.transports.base.ChatServiceTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]¶
Enables developers to build Chat apps and integrations on Google Chat Platform.
Instantiates the chat service async client.
- Parameters
credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.
transport (Optional[Union[str,ChatServiceTransport,Callable[..., ChatServiceTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport to use. If a Callable is given, it will be called with the same set of initialization arguments as used in the ChatServiceTransport constructor. If set to None, a transport is chosen automatically.
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –
Custom options for the client.
1. The
api_endpoint
property can be used to override the default endpoint provided by the client whentransport
is not explicitly provided. Only if this property is not set andtransport
was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the
client_cert_source
property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.3. The
universe_domain
property can be used to override the default “googleapis.com” universe. Note thatapi_endpoint
property still takes precedence; anduniverse_domain
is currently not supported for mTLS.client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If
None
, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
- Raises
google.auth.exceptions.MutualTlsChannelError – If mutual TLS transport creation failed for any reason.
- property api_endpoint¶
Return the API endpoint used by the client instance.
- Returns
The API endpoint used by the client instance.
- Return type
- static attachment_path(space: str, message: str, attachment: str) str ¶
Returns a fully-qualified attachment string.
- static common_billing_account_path(billing_account: str) str ¶
Returns a fully-qualified billing_account string.
- static common_location_path(project: str, location: str) str ¶
Returns a fully-qualified location string.
- static common_organization_path(organization: str) str ¶
Returns a fully-qualified organization string.
- async complete_import_space(request: Optional[Union[google.apps.chat_v1.types.space.CompleteImportSpaceRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.CompleteImportSpaceResponse [source]¶
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 data.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_complete_import_space(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.CompleteImportSpaceRequest( name="name_value", ) # Make the request response = await client.complete_import_space(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.CompleteImportSpaceRequest, dict]]) – The request object. Request message for completing the import process for a 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.
- Returns
Response message for completing the import process for a space.
- Return type
- async create_membership(request: Optional[Union[google.apps.chat_v1.types.membership.CreateMembershipRequest, dict]] = None, *, parent: Optional[str] = None, membership: Optional[google.apps.chat_v1.types.membership.Membership] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.membership.Membership [source]¶
Creates a membership for the calling Chat app, a user, or a Google Group. Creating memberships for other Chat apps isn’t supported. When creating a membership, if the specified member 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.
For example usage, see:
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_create_membership(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.CreateMembershipRequest( parent="parent_value", ) # Make the request response = await client.create_membership(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.CreateMembershipRequest, dict]]) – The request object. Request message for creating a membership.
parent (
str
) –Required. The resource name of the space for which to create the membership.
Format: spaces/{space}
This corresponds to the
parent
field on therequest
instance; ifrequest
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 theuser.name
anduser.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 thechat.memberships
scope, setuser.type
toHUMAN
, and setuser.name
with formatusers/{user}
, where{user}
can be the email address for the user. For users in the same Workspace organization{user}
can also be theid
of the person from the People API, or theid
for the user in the Directory API. For example, if the People API Person profile ID foruser@example.com
is123456789
, you can add the user to the space by setting themembership.member.name
tousers/user@example.com
orusers/123456789
. When a Chat app creates a membership relation for itself, it must use thechat.memberships.app
scope, setuser.type
toBOT
, and setuser.name
tousers/app
.This corresponds to the
membership
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
- Return type
- async create_message(request: Optional[Union[google.apps.chat_v1.types.message.CreateMessageRequest, dict]] = None, *, parent: Optional[str] = None, message: Optional[google.apps.chat_v1.types.message.Message] = None, message_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.message.Message [source]¶
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 following image shows how Chat attributes a message when you use app authentication. Chat displays the Chat app as the message sender. The content of the message can contain text (
text
), cards (cardsV2
), and accessory widgets (accessoryWidgets
).The following image shows how Chat attributes a message when you use user authentication. Chat displays the user as the message sender and attributes the Chat app to the message by displaying its name. The content of message can only contain text (
text
).The maximum message size, including the message contents, is 32,000 bytes.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_create_message(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.CreateMessageRequest( parent="parent_value", ) # Make the request response = await client.create_message(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.CreateMessageRequest, dict]]) – The request object. Creates a message.
parent (
str
) –Required. The resource name of the space in which to create a message.
Format:
spaces/{space}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.message (
google.apps.chat_v1.types.Message
) – Required. Message body. This corresponds to themessage
field on therequest
instance; ifrequest
is provided, this should not be set.message_id (
str
) –Optional. A custom ID for a message. Lets Chat apps get, update, or delete a message without needing to store the system-assigned ID in the message’s resource name (represented in the message
name
field).The value for this field must meet the following requirements:
Begins with
client-
. For example,client-custom-name
is a valid custom ID, butcustom-name
is not.Contains up to 63 characters and only lowercase letters, numbers, and hyphens.
Is unique within a space. A Chat app can’t use the same custom ID for different messages.
For details, see Name a message.
This corresponds to the
message_id
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A message in a Google Chat space.
- Return type
- async create_reaction(request: Optional[Union[google.apps.chat_v1.types.reaction.CreateReactionRequest, dict]] = None, *, parent: Optional[str] = None, reaction: Optional[google.apps.chat_v1.types.reaction.Reaction] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.reaction.Reaction [source]¶
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.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_create_reaction(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.CreateReactionRequest( parent="parent_value", ) # Make the request response = await client.create_reaction(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.CreateReactionRequest, dict]]) – The request object. Creates a reaction to a message.
parent (
str
) –Required. The message where the reaction is created.
Format:
spaces/{space}/messages/{message}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.reaction (
google.apps.chat_v1.types.Reaction
) – Required. The reaction to create. This corresponds to thereaction
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A reaction to a message.
- Return type
- async create_space(request: Optional[Union[google.apps.chat_v1.types.space.CreateSpaceRequest, dict]] = None, *, space: Optional[google.apps.chat_v1.types.space.Space] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
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.
If you receive the error message
ALREADY_EXISTS
when creating a space, try a differentdisplayName
. An existing 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
.Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_create_space(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) space = chat_v1.Space() space.predefined_permission_settings = "ANNOUNCEMENT_SPACE" request = chat_v1.CreateSpaceRequest( space=space, ) # Make the request response = await client.create_space(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.CreateSpaceRequest, dict]]) – The request object. A request to create a named space with no members.
space (
google.apps.chat_v1.types.Space
) –Required. The
displayName
andspaceType
fields must be populated. OnlySpaceType.SPACE
is supported.If you receive the error message
ALREADY_EXISTS
, try a differentdisplayName
. 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 ifimportMode
is set to true.The space
name
is assigned on the server so anything specified in this field will be ignored.This corresponds to the
space
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- async delete_membership(request: Optional[Union[google.apps.chat_v1.types.membership.DeleteMembershipRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.membership.Membership [source]¶
Deletes a membership. For an example, see Remove a user or a Google Chat app from a space.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_delete_membership(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.DeleteMembershipRequest( name="name_value", ) # Make the request response = await client.delete_membership(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.DeleteMembershipRequest, dict]]) – The request object. Request to delete a membership in a space.
name (
str
) –Required. Resource name of the membership to delete. Chat apps can delete human users’ or their own memberships. Chat apps can’t delete other apps’ memberships.
When deleting a human membership, requires the
chat.memberships
scope andspaces/{space}/members/{member}
format. You can use the email as an alias for{member}
. For example,spaces/{space}/members/example@gmail.com
whereexample@gmail.com
is the email of the Google Chat user.When deleting an app membership, requires the
chat.memberships.app
scope andspaces/{space}/members/app
format.Format:
spaces/{space}/members/{member}
orspaces/{space}/members/app
.This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
- Return type
- async delete_message(request: Optional[Union[google.apps.chat_v1.types.message.DeleteMessageRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Deletes a message. For an example, see Delete a message.
Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only delete messages created by the calling Chat app.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_delete_message(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.DeleteMessageRequest( name="name_value", ) # Make the request await client.delete_message(request=request)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.DeleteMessageRequest, dict]]) – The request object. Request to delete a message.
name (
str
) –Required. Resource name of the message.
Format:
spaces/{space}/messages/{message}
If you’ve set a custom ID for your message, you can use the value from the
clientAssignedMessageId
field for{message}
. For details, see [Name a message] (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- async delete_reaction(request: Optional[Union[google.apps.chat_v1.types.reaction.DeleteReactionRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Deletes a reaction to a message. Only unicode emojis are supported. For an example, see Delete a reaction. Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_delete_reaction(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.DeleteReactionRequest( name="name_value", ) # Make the request await client.delete_reaction(request=request)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.DeleteReactionRequest, dict]]) – The request object. Deletes a reaction to a message.
name (
str
) –Required. Name of the reaction to delete.
Format:
spaces/{space}/messages/{message}/reactions/{reaction}
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- async delete_space(request: Optional[Union[google.apps.chat_v1.types.space.DeleteSpaceRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
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.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_delete_space(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.DeleteSpaceRequest( name="name_value", ) # Make the request await client.delete_space(request=request)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.DeleteSpaceRequest, dict]]) – The request object. Request for deleting a space.
name (
str
) –Required. Resource name of the space to delete.
Format:
spaces/{space}
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- async find_direct_message(request: Optional[Union[google.apps.chat_v1.types.space.FindDirectMessageRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
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 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.
Requires user authentication or app authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_find_direct_message(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.FindDirectMessageRequest( name="name_value", ) # Make the request response = await client.find_direct_message(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.FindDirectMessageRequest, dict]]) – The request object. A request to get direct message space based on the user resource.
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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- classmethod from_service_account_file(filename: str, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_info(info: dict, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
info.
- Parameters
info (dict) – The service account private key info.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_json(filename: str, *args, **kwargs)¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- async get_attachment(request: Optional[Union[google.apps.chat_v1.types.attachment.GetAttachmentRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.attachment.Attachment [source]¶
Gets the metadata of a message attachment. The attachment data is fetched using the media API. For an example, see Get metadata about a message attachment. Requires app authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_get_attachment(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.GetAttachmentRequest( name="name_value", ) # Make the request response = await client.get_attachment(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.GetAttachmentRequest, dict]]) – The request object. Request to get an attachment.
name (
str
) –Required. Resource name of the attachment, in the form
spaces/{space}/messages/{message}/attachments/{attachment}
.This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
An attachment in Google Chat.
- Return type
- async get_membership(request: Optional[Union[google.apps.chat_v1.types.membership.GetMembershipRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.membership.Membership [source]¶
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.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_get_membership(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.GetMembershipRequest( name="name_value", ) # Make the request response = await client.get_membership(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.GetMembershipRequest, dict]]) – The request object. Request to get a membership of a space.
name (
str
) –Required. Resource name of the membership to retrieve.
To get the app’s own membership by using user authentication, you can optionally use
spaces/{space}/members/app
.Format:
spaces/{space}/members/{member}
orspaces/{space}/members/app
When authenticated as a user, you can use the user’s email as an alias for
{member}
. For example,spaces/{space}/members/example@gmail.com
whereexample@gmail.com
is the email of the Google Chat user.This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
- Return type
- async get_message(request: Optional[Union[google.apps.chat_v1.types.message.GetMessageRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.message.Message [source]¶
Returns details about a message. For an example, see Get details about a message.
Requires authentication. Supports app authentication and user authentication.
Note: Might return a message from a blocked member or space.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_get_message(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.GetMessageRequest( name="name_value", ) # Make the request response = await client.get_message(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.GetMessageRequest, dict]]) – The request object. Request to get a message.
name (
str
) –Required. Resource name of the message.
Format:
spaces/{space}/messages/{message}
If you’ve set a custom ID for your message, you can use the value from the
clientAssignedMessageId
field for{message}
. For details, see [Name a message] (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A message in a Google Chat space.
- Return type
- classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]¶
Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.
The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
- Parameters
client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.
- Returns
- returns the API endpoint and the
client cert source to use.
- Return type
- Raises
google.auth.exceptions.MutualTLSChannelError – If any errors happen.
- async get_space(request: Optional[Union[google.apps.chat_v1.types.space.GetSpaceRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
Returns details about a space. For an example, see Get details about a space.
Requires authentication. Supports app authentication and user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_get_space(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.GetSpaceRequest( name="name_value", ) # Make the request response = await client.get_space(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.GetSpaceRequest, dict]]) – The request object. A request to return a single space.
name (
str
) –Required. Resource name of the space, in the form
spaces/{space}
.Format:
spaces/{space}
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- async get_space_event(request: Optional[Union[google.apps.chat_v1.types.space_event.GetSpaceEventRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space_event.SpaceEvent [source]¶
Returns an event from a Google Chat space. The event payload contains the most recent version of the resource that changed. For example, if you request an event about a new message but the message was later updated, the server returns the updated
Message
resource in the event payload.Note: The
permissionSettings
field is not returned in the Space object of the Space event data for this request.Requires user authentication. To get an event, the authenticated user must be a member of the space.
For an example, see Get details about an event from a Google Chat space.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_get_space_event(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.GetSpaceEventRequest( name="name_value", ) # Make the request response = await client.get_space_event(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.GetSpaceEventRequest, dict]]) – The request object. Request message for getting a space event.
name (
str
) –Required. The resource name of the space event.
Format:
spaces/{space}/spaceEvents/{spaceEvent}
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
- An event that represents a change or activity in a Google Chat space. To
learn more, see [Work with events from Google Chat](https://developers.google.com/workspace/chat/events-overview).
- Return type
- async get_space_read_state(request: Optional[Union[google.apps.chat_v1.types.space_read_state.GetSpaceReadStateRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space_read_state.SpaceReadState [source]¶
Returns details about a user’s read state within a space, used to identify read and unread messages. For an example, see Get details about a user’s space read state.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_get_space_read_state(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.GetSpaceReadStateRequest( name="name_value", ) # Make the request response = await client.get_space_read_state(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.GetSpaceReadStateRequest, dict]]) – The request object. Request message for GetSpaceReadState API.
name (
str
) –Required. Resource name of the space read state to retrieve.
Only supports getting read state for the calling user.
To refer to the calling user, set one of the following:
The
me
alias. For example,users/me/spaces/{space}/spaceReadState
.Their Workspace email address. For example,
users/user@example.com/spaces/{space}/spaceReadState
.Their user id. For example,
users/123456789/spaces/{space}/spaceReadState
.
Format: users/{user}/spaces/{space}/spaceReadState
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A user’s read state within a space, used to identify read and unread messages.
- Return type
- async get_thread_read_state(request: Optional[Union[google.apps.chat_v1.types.thread_read_state.GetThreadReadStateRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.thread_read_state.ThreadReadState [source]¶
Returns details about a user’s read state within a thread, used to identify read and unread messages. For an example, see Get details about a user’s thread read state.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_get_thread_read_state(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.GetThreadReadStateRequest( name="name_value", ) # Make the request response = await client.get_thread_read_state(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.GetThreadReadStateRequest, dict]]) – The request object. Request message for GetThreadReadStateRequest API.
name (
str
) –Required. Resource name of the thread read state to retrieve.
Only supports getting read state for the calling user.
To refer to the calling user, set one of the following:
The
me
alias. For example,users/me/spaces/{space}/threads/{thread}/threadReadState
.Their Workspace email address. For example,
users/user@example.com/spaces/{space}/threads/{thread}/threadReadState
.Their user id. For example,
users/123456789/spaces/{space}/threads/{thread}/threadReadState
.
Format: users/{user}/spaces/{space}/threads/{thread}/threadReadState
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A user’s read state within a thread, used to identify read and unread messages.
- Return type
- classmethod get_transport_class(label: Optional[str] = None) Type[google.apps.chat_v1.services.chat_service.transports.base.ChatServiceTransport] ¶
Returns an appropriate transport class.
- Parameters
label – The name of the desired transport. If none is provided, then the first transport in the registry is used.
- Returns
The transport class to use.
- async list_memberships(request: Optional[Union[google.apps.chat_v1.types.membership.ListMembershipsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListMembershipsAsyncPager [source]¶
Lists memberships in a space. For an example, see List users and Google Chat apps in a space. Listing memberships with app authentication lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, including its own. Listing memberships with User authentication lists memberships in spaces that the authenticated user has access to.
Requires authentication. Supports app authentication and user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_list_memberships(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.ListMembershipsRequest( parent="parent_value", ) # Make the request page_result = client.list_memberships(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.ListMembershipsRequest, dict]]) – The request object. Request message for listing memberships.
parent (
str
) –Required. The resource name of the space for which to fetch a membership list.
Format: spaces/{space}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response to list memberships of the space. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListMembershipsAsyncPager
- async list_messages(request: Optional[Union[google.apps.chat_v1.types.message.ListMessagesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListMessagesAsyncPager [source]¶
Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. If you list messages from a space with no messages, the response is an empty object. When using a REST/HTTP interface, the response contains an empty JSON object,
{}
. For an example, see List messages. Requires user authentication.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_list_messages(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.ListMessagesRequest( parent="parent_value", ) # Make the request page_result = client.list_messages(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.ListMessagesRequest, dict]]) – The request object. Lists messages in the specified space, that the user is a member of.
parent (
str
) –Required. The resource name of the space to list messages from.
Format:
spaces/{space}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response message for listing messages. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListMessagesAsyncPager
- async list_reactions(request: Optional[Union[google.apps.chat_v1.types.reaction.ListReactionsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListReactionsAsyncPager [source]¶
Lists reactions to a message. For an example, see List reactions for a message. Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_list_reactions(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.ListReactionsRequest( parent="parent_value", ) # Make the request page_result = client.list_reactions(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.ListReactionsRequest, dict]]) – The request object. Lists reactions to a message.
parent (
str
) –Required. The message users reacted to.
Format:
spaces/{space}/messages/{message}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response to a list reactions request.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListReactionsAsyncPager
- async list_space_events(request: Optional[Union[google.apps.chat_v1.types.space_event.ListSpaceEventsRequest, dict]] = None, *, parent: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsAsyncPager [source]¶
Lists events from a Google Chat space. For each event, the payload contains the most recent version of the Chat resource. For example, if you list events about new space members, the server returns
Membership
resources that contain the latest membership details. If new members were removed during the requested period, the event payload contains an emptyMembership
resource.Requires user authentication. To list events, the authenticated user must be a member of the space.
For an example, see List events from a Google Chat space.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_list_space_events(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.ListSpaceEventsRequest( parent="parent_value", filter="filter_value", ) # Make the request page_result = client.list_space_events(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.ListSpaceEventsRequest, dict]]) – The request object. Request message for listing space events.
parent (
str
) –Required. Resource name of the Google Chat space where the events occurred.
Format:
spaces/{space}
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.filter (
str
) –Required. A query filter.
You must specify at least one event type (
event_type
) using the has:
operator. To filter by multiple event types, use theOR
operator. Omit batch event types in your filter. The request automatically returns any related batch events. For example, if you filter by new reactions (google.workspace.chat.reaction.v1.created
), the server also returns batch new reactions events (google.workspace.chat.reaction.v1.batchCreated
). For a list of supported event types, see the`SpaceEvents
reference documentation <https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type>`__.Optionally, you can also filter by start time (
start_time
) and end time (end_time
):start_time
: Exclusive timestamp from which to start listing space events. You can list events that occurred up to 28 days ago. If unspecified, lists space events from the past 28 days.end_time
: Inclusive timestamp until which space events are listed. If unspecified, lists events up to the time of the request.
To specify a start or end time, use the equals
=
operator and format in RFC-3339. To filter by bothstart_time
andend_time
, use theAND
operator.For example, the following queries are valid:
start_time="2023-08-23T19:20:33+00:00" AND end_time="2023-08-23T19:21:54+00:00"
start_time="2023-08-23T19:20:33+00:00" AND (event_types:"google.workspace.chat.space.v1.updated" OR event_types:"google.workspace.chat.message.v1.created")
The following queries are invalid:
start_time="2023-08-23T19:20:33+00:00" OR end_time="2023-08-23T19:21:54+00:00"
event_types:"google.workspace.chat.space.v1.updated" AND event_types:"google.workspace.chat.message.v1.created"
Invalid queries are rejected by the server with an
INVALID_ARGUMENT
error.This corresponds to the
filter
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response message for listing space events. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsAsyncPager
- async list_spaces(request: Optional[Union[google.apps.chat_v1.types.space.ListSpacesRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListSpacesAsyncPager [source]¶
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.
Lists spaces visible to the caller or authenticated user. Group chats and DMs aren’t listed until the first message is sent.
To list all named spaces by Google Workspace organization, use the
`spaces.search()
<https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search>`__ method using Workspace administrator privileges instead.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_list_spaces(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.ListSpacesRequest( ) # Make the request page_result = client.list_spaces(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.ListSpacesRequest, dict]]) – The request object. A request to list the spaces the caller is a member of.
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.
- Returns
The response for a list spaces request. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListSpacesAsyncPager
- static parse_attachment_path(path: str) Dict[str, str] ¶
Parses a attachment path into its component segments.
- static parse_common_billing_account_path(path: str) Dict[str, str] ¶
Parse a billing_account path into its component segments.
- static parse_common_folder_path(path: str) Dict[str, str] ¶
Parse a folder path into its component segments.
- static parse_common_location_path(path: str) Dict[str, str] ¶
Parse a location path into its component segments.
- static parse_common_organization_path(path: str) Dict[str, str] ¶
Parse a organization path into its component segments.
- static parse_common_project_path(path: str) Dict[str, str] ¶
Parse a project path into its component segments.
- static parse_membership_path(path: str) Dict[str, str] ¶
Parses a membership path into its component segments.
- static parse_message_path(path: str) Dict[str, str] ¶
Parses a message path into its component segments.
- static parse_quoted_message_metadata_path(path: str) Dict[str, str] ¶
Parses a quoted_message_metadata path into its component segments.
- static parse_reaction_path(path: str) Dict[str, str] ¶
Parses a reaction path into its component segments.
- static parse_space_event_path(path: str) Dict[str, str] ¶
Parses a space_event path into its component segments.
- static parse_space_path(path: str) Dict[str, str] ¶
Parses a space path into its component segments.
- static parse_space_read_state_path(path: str) Dict[str, str] ¶
Parses a space_read_state path into its component segments.
- static parse_thread_path(path: str) Dict[str, str] ¶
Parses a thread path into its component segments.
- static parse_thread_read_state_path(path: str) Dict[str, str] ¶
Parses a thread_read_state path into its component segments.
- static quoted_message_metadata_path(space: str, message: str, quoted_message_metadata: str) str ¶
Returns a fully-qualified quoted_message_metadata string.
- static reaction_path(space: str, message: str, reaction: str) str ¶
Returns a fully-qualified reaction string.
- async search_spaces(request: Optional[Union[google.apps.chat_v1.types.space.SearchSpacesRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.SearchSpacesAsyncPager [source]¶
Returns a list of spaces in a Google Workspace organization based on an administrator’s search. Requires user authentication with administrator privileges. In the request, set
use_admin_access
totrue
.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_search_spaces(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.SearchSpacesRequest( query="query_value", ) # Make the request page_result = client.search_spaces(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.SearchSpacesRequest, dict]]) – The request object. Request to search for a list of spaces based on a query.
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.
- Returns
Response with a list of spaces corresponding to the search spaces request. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.SearchSpacesAsyncPager
- async set_up_space(request: Optional[Union[google.apps.chat_v1.types.space_setup.SetUpSpaceRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn’t be specified as a membership in the request. For an example, see Set up a space with initial members.
To specify the human members to add, add memberships with the appropriate
membership.member.name
. To add a human user, useusers/{user}
, where{user}
can be the email address for the user. For users in the same Workspace organization{user}
can also be theid
for the person from the People API, or theid
for the user in the Directory API. For example, if the People API Person profile ID foruser@example.com
is123456789
, you can add the user to the space by setting themembership.member.name
tousers/user@example.com
orusers/123456789
.To specify the Google groups to add, add memberships with the appropriate
membership.group_member.name
. To add or invite a Google group, usegroups/{group}
, where{group}
is theid
for the group from the Cloud Identity Groups API. For example, you can use Cloud Identity Groups lookup API to retrieve the ID123456789
for group emailgroup@example.com
, then you can add the group to the space by setting themembership.group_member.name
togroups/123456789
. Group email is not supported, and Google groups can only be added as members in named spaces.For a named space or group chat, if the caller blocks, or is blocked by some members, or doesn’t have permission to add some members, then those members aren’t added to the created space.
To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn’t created.
To create a DM between the calling user and the calling app, set
Space.singleUserBotDm
totrue
and don’t specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see Invite or add a user or app to a space.If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned.
Spaces with threaded replies aren’t supported. If you receive the error message
ALREADY_EXISTS
when setting up a space, try a differentdisplayName
. An existing space within the Google Workspace organization might already use this display name.Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_set_up_space(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) space = chat_v1.Space() space.predefined_permission_settings = "ANNOUNCEMENT_SPACE" request = chat_v1.SetUpSpaceRequest( space=space, ) # Make the request response = await client.set_up_space(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.SetUpSpaceRequest, dict]]) – The request object. Request to create a space and add specified users to it.
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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- static space_event_path(space: str, space_event: str) str ¶
Returns a fully-qualified space_event string.
- static space_read_state_path(user: str, space: str) str ¶
Returns a fully-qualified space_read_state string.
- static thread_read_state_path(user: str, space: str, thread: str) str ¶
Returns a fully-qualified thread_read_state string.
- property transport: google.apps.chat_v1.services.chat_service.transports.base.ChatServiceTransport¶
Returns the transport used by the client instance.
- Returns
The transport used by the client instance.
- Return type
ChatServiceTransport
- property universe_domain: str¶
Return the universe domain used by the client instance.
- Returns
- The universe domain used
by the client instance.
- Return type
- async update_membership(request: Optional[Union[google.apps.chat_v1.types.membership.UpdateMembershipRequest, dict]] = None, *, membership: Optional[google.apps.chat_v1.types.membership.Membership] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.membership.Membership [source]¶
Updates a membership. For an example, see Update a user’s membership in a space.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_update_membership(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.UpdateMembershipRequest( ) # Make the request response = await client.update_membership(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.UpdateMembershipRequest, dict]]) – The request object. Request message for updating a membership.
membership (
google.apps.chat_v1.types.Membership
) –Required. The membership to update. Only fields specified by
update_mask
are updated.This corresponds to the
membership
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (
google.protobuf.field_mask_pb2.FieldMask
) –Required. The field paths to update. Separate multiple values with commas or use
*
to update all field paths.Currently supported field paths:
role
This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
- Return type
- async update_message(request: Optional[Union[google.apps.chat_v1.types.message.UpdateMessageRequest, dict]] = None, *, message: Optional[google.apps.chat_v1.types.message.Message] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.message.Message [source]¶
Updates a message. There’s a difference between the
patch
andupdate
methods. Thepatch
method uses apatch
request while theupdate
method uses aput
request. We recommend using thepatch
method. For an example, see Update a message.Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only update messages created by the calling Chat app.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_update_message(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.UpdateMessageRequest( ) # Make the request response = await client.update_message(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.UpdateMessageRequest, dict]]) – The request object. Request to update a message.
message (
google.apps.chat_v1.types.Message
) –Required. Message with fields updated.
This corresponds to the
message
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (
google.protobuf.field_mask_pb2.FieldMask
) –Required. The field paths to update. Separate multiple values with commas or use
*
to update all field paths.Currently supported field paths:
text
attachment
cards
(Requires app authentication.)cards_v2
(Requires app authentication.)accessory_widgets
(Requires app authentication.)
This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A message in a Google Chat space.
- Return type
- async update_space(request: Optional[Union[google.apps.chat_v1.types.space.UpdateSpaceRequest, dict]] = None, *, space: Optional[google.apps.chat_v1.types.space.Space] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
Updates a space. For an example, see Update a space.
If you’re updating the
displayName
field and receive the error messageALREADY_EXISTS
, try a different display name.. An existing space within the Google Workspace organization might already use this display name.Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_update_space(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) space = chat_v1.Space() space.predefined_permission_settings = "ANNOUNCEMENT_SPACE" request = chat_v1.UpdateSpaceRequest( space=space, ) # Make the request response = await client.update_space(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.UpdateSpaceRequest, dict]]) – The request object. A request to update a single space.
space (
google.apps.chat_v1.types.Space
) –Required. Space with fields to be updated.
Space.name
must be populated in the form ofspaces/{space}
. Only fields specified byupdate_mask
are updated.This corresponds to the
space
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (
google.protobuf.field_mask_pb2.FieldMask
) –Required. The updated field paths, comma separated if there are multiple.
You can update the following fields for a space:
space_details
: Updates the space’s description. Supports up to 150 characters.display_name
: Only supports updating the display name for spaces wherespaceType
field isSPACE
. If you receive the error messageALREADY_EXISTS
, try a different value. An existing space within the Google Workspace organization might already use this display name.space_type
: Only supports changing aGROUP_CHAT
space type toSPACE
. Includedisplay_name
together withspace_type
in the update mask and ensure that the specified space has a non-empty display name and theSPACE
space type. Including thespace_type
mask and theSPACE
type in the specified space when updating the display name is optional if the existing space already has theSPACE
type. Trying to update the space type in other ways results in an invalid argument error.space_type
is not supported withuseAdminAccess
.space_history_state
: Updates space history settings by turning history on or off for the space. Only supported if history settings are enabled for the Google Workspace organization. To update the space history state, you must omit all other field masks in your request.space_history_state
is not supported withuseAdminAccess
.access_settings.audience
: Updates the access setting of who can discover the space, join the space, and preview the messages in named space wherespaceType
field isSPACE
. If the existing space has a target audience, you can remove the audience and restrict space access by omitting a value for this field mask. To update access settings for a space, the authenticating user must be a space manager and omit all other field masks in your request. You can’t update this field if the space is in import mode. To learn more, see Make a space discoverable to specific users.access_settings.audience
is not supported withuseAdminAccess
.permission_settings
: Supports changing the permission settings of a space. When updating permission settings, you can only specifypermissionSettings
field masks; you cannot update other field masks at the same time.permissionSettings
is not supported withuseAdminAccess
. The supported field masks include:permission_settings.manageMembersAndGroups
permission_settings.modifySpaceDetails
permission_settings.toggleHistory
permission_settings.useAtMentionAll
permission_settings.manageApps
permission_settings.manageWebhooks
permission_settings.replyMessages
This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- async update_space_read_state(request: Optional[Union[google.apps.chat_v1.types.space_read_state.UpdateSpaceReadStateRequest, dict]] = None, *, space_read_state: Optional[google.apps.chat_v1.types.space_read_state.SpaceReadState] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space_read_state.SpaceReadState [source]¶
Updates a user’s read state within a space, used to identify read and unread messages. For an example, see Update a user’s space read state.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_update_space_read_state(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.UpdateSpaceReadStateRequest( ) # Make the request response = await client.update_space_read_state(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.UpdateSpaceReadStateRequest, dict]]) – The request object. Request message for UpdateSpaceReadState API.
space_read_state (
google.apps.chat_v1.types.SpaceReadState
) –Required. The space read state and fields to update.
Only supports updating read state for the calling user.
To refer to the calling user, set one of the following:
The
me
alias. For example,users/me/spaces/{space}/spaceReadState
.Their Workspace email address. For example,
users/user@example.com/spaces/{space}/spaceReadState
.Their user id. For example,
users/123456789/spaces/{space}/spaceReadState
.
Format: users/{user}/spaces/{space}/spaceReadState
This corresponds to the
space_read_state
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (
google.protobuf.field_mask_pb2.FieldMask
) –Required. The field paths to update. Currently supported field paths:
last_read_time
When the
last_read_time
is before the latest message create time, the space appears as unread in the UI.To mark the space as read, set
last_read_time
to any value later (larger) than the latest message create time. Thelast_read_time
is coerced to match the latest message create time. Note that the space read state only affects the read state of messages that are visible in the space’s top-level conversation. Replies in threads are unaffected by this timestamp, and instead rely on the thread read state.This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A user’s read state within a space, used to identify read and unread messages.
- Return type
- async upload_attachment(request: Optional[Union[google.apps.chat_v1.types.attachment.UploadAttachmentRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.attachment.UploadAttachmentResponse [source]¶
Uploads an attachment. For an example, see Upload media as a file attachment. Requires user authentication.
You can upload attachments up to 200 MB. Certain file types aren’t supported. For details, see File types blocked by Google Chat.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 async def sample_upload_attachment(): # Create a client client = chat_v1.ChatServiceAsyncClient() # Initialize request argument(s) request = chat_v1.UploadAttachmentRequest( parent="parent_value", filename="filename_value", ) # Make the request response = await client.upload_attachment(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.apps.chat_v1.types.UploadAttachmentRequest, dict]]) – The request object. Request to upload an 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.
- Returns
Response of uploading an attachment.
- Return type
- class google.apps.chat_v1.services.chat_service.ChatServiceClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.apps.chat_v1.services.chat_service.transports.base.ChatServiceTransport, typing.Callable[[...], google.apps.chat_v1.services.chat_service.transports.base.ChatServiceTransport]]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]¶
Enables developers to build Chat apps and integrations on Google Chat Platform.
Instantiates the chat service client.
- Parameters
credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.
transport (Optional[Union[str,ChatServiceTransport,Callable[..., ChatServiceTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport. If a Callable is given, it will be called with the same set of initialization arguments as used in the ChatServiceTransport constructor. If set to None, a transport is chosen automatically.
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –
Custom options for the client.
1. The
api_endpoint
property can be used to override the default endpoint provided by the client whentransport
is not explicitly provided. Only if this property is not set andtransport
was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the
client_cert_source
property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.3. The
universe_domain
property can be used to override the default “googleapis.com” universe. Note that theapi_endpoint
property still takes precedence; anduniverse_domain
is currently not supported for mTLS.client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If
None
, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
- Raises
google.auth.exceptions.MutualTLSChannelError – If mutual TLS transport creation failed for any reason.
- __exit__(type, value, traceback)[source]¶
Releases underlying transport’s resources.
Warning
ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!
- property api_endpoint¶
Return the API endpoint used by the client instance.
- Returns
The API endpoint used by the client instance.
- Return type
- static attachment_path(space: str, message: str, attachment: str) str [source]¶
Returns a fully-qualified attachment string.
- static common_billing_account_path(billing_account: str) str [source]¶
Returns a fully-qualified billing_account string.
- static common_location_path(project: str, location: str) str [source]¶
Returns a fully-qualified location string.
- static common_organization_path(organization: str) str [source]¶
Returns a fully-qualified organization string.
- complete_import_space(request: Optional[Union[google.apps.chat_v1.types.space.CompleteImportSpaceRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.CompleteImportSpaceResponse [source]¶
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 data.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_complete_import_space(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.CompleteImportSpaceRequest( name="name_value", ) # Make the request response = client.complete_import_space(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.CompleteImportSpaceRequest, dict]) – The request object. Request message for completing the import process for a 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.
- Returns
Response message for completing the import process for a space.
- Return type
- create_membership(request: Optional[Union[google.apps.chat_v1.types.membership.CreateMembershipRequest, dict]] = None, *, parent: Optional[str] = None, membership: Optional[google.apps.chat_v1.types.membership.Membership] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.membership.Membership [source]¶
Creates a membership for the calling Chat app, a user, or a Google Group. Creating memberships for other Chat apps isn’t supported. When creating a membership, if the specified member 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.
For example usage, see:
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_create_membership(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.CreateMembershipRequest( parent="parent_value", ) # Make the request response = client.create_membership(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.CreateMembershipRequest, dict]) – The request object. Request message for creating a membership.
parent (str) –
Required. The resource name of the space for which to create the membership.
Format: spaces/{space}
This corresponds to the
parent
field on therequest
instance; ifrequest
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 theuser.name
anduser.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 thechat.memberships
scope, setuser.type
toHUMAN
, and setuser.name
with formatusers/{user}
, where{user}
can be the email address for the user. For users in the same Workspace organization{user}
can also be theid
of the person from the People API, or theid
for the user in the Directory API. For example, if the People API Person profile ID foruser@example.com
is123456789
, you can add the user to the space by setting themembership.member.name
tousers/user@example.com
orusers/123456789
. When a Chat app creates a membership relation for itself, it must use thechat.memberships.app
scope, setuser.type
toBOT
, and setuser.name
tousers/app
.This corresponds to the
membership
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
- Return type
- create_message(request: Optional[Union[google.apps.chat_v1.types.message.CreateMessageRequest, dict]] = None, *, parent: Optional[str] = None, message: Optional[google.apps.chat_v1.types.message.Message] = None, message_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.message.Message [source]¶
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 following image shows how Chat attributes a message when you use app authentication. Chat displays the Chat app as the message sender. The content of the message can contain text (
text
), cards (cardsV2
), and accessory widgets (accessoryWidgets
).The following image shows how Chat attributes a message when you use user authentication. Chat displays the user as the message sender and attributes the Chat app to the message by displaying its name. The content of message can only contain text (
text
).The maximum message size, including the message contents, is 32,000 bytes.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_create_message(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.CreateMessageRequest( parent="parent_value", ) # Make the request response = client.create_message(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.CreateMessageRequest, dict]) – The request object. Creates a message.
parent (str) –
Required. The resource name of the space in which to create a message.
Format:
spaces/{space}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.message (google.apps.chat_v1.types.Message) – Required. Message body. This corresponds to the
message
field on therequest
instance; ifrequest
is provided, this should not be set.message_id (str) –
Optional. A custom ID for a message. Lets Chat apps get, update, or delete a message without needing to store the system-assigned ID in the message’s resource name (represented in the message
name
field).The value for this field must meet the following requirements:
Begins with
client-
. For example,client-custom-name
is a valid custom ID, butcustom-name
is not.Contains up to 63 characters and only lowercase letters, numbers, and hyphens.
Is unique within a space. A Chat app can’t use the same custom ID for different messages.
For details, see Name a message.
This corresponds to the
message_id
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A message in a Google Chat space.
- Return type
- create_reaction(request: Optional[Union[google.apps.chat_v1.types.reaction.CreateReactionRequest, dict]] = None, *, parent: Optional[str] = None, reaction: Optional[google.apps.chat_v1.types.reaction.Reaction] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.reaction.Reaction [source]¶
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.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_create_reaction(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.CreateReactionRequest( parent="parent_value", ) # Make the request response = client.create_reaction(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.CreateReactionRequest, dict]) – The request object. Creates a reaction to a message.
parent (str) –
Required. The message where the reaction is created.
Format:
spaces/{space}/messages/{message}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.reaction (google.apps.chat_v1.types.Reaction) – Required. The reaction to create. This corresponds to the
reaction
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A reaction to a message.
- Return type
- create_space(request: Optional[Union[google.apps.chat_v1.types.space.CreateSpaceRequest, dict]] = None, *, space: Optional[google.apps.chat_v1.types.space.Space] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
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.
If you receive the error message
ALREADY_EXISTS
when creating a space, try a differentdisplayName
. An existing 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
.Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_create_space(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) space = chat_v1.Space() space.predefined_permission_settings = "ANNOUNCEMENT_SPACE" request = chat_v1.CreateSpaceRequest( space=space, ) # Make the request response = client.create_space(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.CreateSpaceRequest, dict]) – The request object. A request to create a named space with no members.
space (google.apps.chat_v1.types.Space) –
Required. The
displayName
andspaceType
fields must be populated. OnlySpaceType.SPACE
is supported.If you receive the error message
ALREADY_EXISTS
, try a differentdisplayName
. 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 ifimportMode
is set to true.The space
name
is assigned on the server so anything specified in this field will be ignored.This corresponds to the
space
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- delete_membership(request: Optional[Union[google.apps.chat_v1.types.membership.DeleteMembershipRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.membership.Membership [source]¶
Deletes a membership. For an example, see Remove a user or a Google Chat app from a space.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_delete_membership(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.DeleteMembershipRequest( name="name_value", ) # Make the request response = client.delete_membership(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.DeleteMembershipRequest, dict]) – The request object. Request to delete a membership in a space.
name (str) –
Required. Resource name of the membership to delete. Chat apps can delete human users’ or their own memberships. Chat apps can’t delete other apps’ memberships.
When deleting a human membership, requires the
chat.memberships
scope andspaces/{space}/members/{member}
format. You can use the email as an alias for{member}
. For example,spaces/{space}/members/example@gmail.com
whereexample@gmail.com
is the email of the Google Chat user.When deleting an app membership, requires the
chat.memberships.app
scope andspaces/{space}/members/app
format.Format:
spaces/{space}/members/{member}
orspaces/{space}/members/app
.This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
- Return type
- delete_message(request: Optional[Union[google.apps.chat_v1.types.message.DeleteMessageRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Deletes a message. For an example, see Delete a message.
Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only delete messages created by the calling Chat app.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_delete_message(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.DeleteMessageRequest( name="name_value", ) # Make the request client.delete_message(request=request)
- Parameters
request (Union[google.apps.chat_v1.types.DeleteMessageRequest, dict]) – The request object. Request to delete a message.
name (str) –
Required. Resource name of the message.
Format:
spaces/{space}/messages/{message}
If you’ve set a custom ID for your message, you can use the value from the
clientAssignedMessageId
field for{message}
. For details, see [Name a message] (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- delete_reaction(request: Optional[Union[google.apps.chat_v1.types.reaction.DeleteReactionRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Deletes a reaction to a message. Only unicode emojis are supported. For an example, see Delete a reaction. Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_delete_reaction(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.DeleteReactionRequest( name="name_value", ) # Make the request client.delete_reaction(request=request)
- Parameters
request (Union[google.apps.chat_v1.types.DeleteReactionRequest, dict]) – The request object. Deletes a reaction to a message.
name (str) –
Required. Name of the reaction to delete.
Format:
spaces/{space}/messages/{message}/reactions/{reaction}
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- delete_space(request: Optional[Union[google.apps.chat_v1.types.space.DeleteSpaceRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
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.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_delete_space(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.DeleteSpaceRequest( name="name_value", ) # Make the request client.delete_space(request=request)
- Parameters
request (Union[google.apps.chat_v1.types.DeleteSpaceRequest, dict]) – The request object. Request for deleting a space.
name (str) –
Required. Resource name of the space to delete.
Format:
spaces/{space}
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- find_direct_message(request: Optional[Union[google.apps.chat_v1.types.space.FindDirectMessageRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
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 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.
Requires user authentication or app authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_find_direct_message(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.FindDirectMessageRequest( name="name_value", ) # Make the request response = client.find_direct_message(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.FindDirectMessageRequest, dict]) – The request object. A request to get direct message space based on the user resource.
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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- classmethod from_service_account_file(filename: str, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_info(info: dict, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
info.
- Parameters
info (dict) – The service account private key info.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_json(filename: str, *args, **kwargs)¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- get_attachment(request: Optional[Union[google.apps.chat_v1.types.attachment.GetAttachmentRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.attachment.Attachment [source]¶
Gets the metadata of a message attachment. The attachment data is fetched using the media API. For an example, see Get metadata about a message attachment. Requires app authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_get_attachment(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.GetAttachmentRequest( name="name_value", ) # Make the request response = client.get_attachment(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.GetAttachmentRequest, dict]) – The request object. Request to get an attachment.
name (str) –
Required. Resource name of the attachment, in the form
spaces/{space}/messages/{message}/attachments/{attachment}
.This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
An attachment in Google Chat.
- Return type
- get_membership(request: Optional[Union[google.apps.chat_v1.types.membership.GetMembershipRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.membership.Membership [source]¶
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.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_get_membership(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.GetMembershipRequest( name="name_value", ) # Make the request response = client.get_membership(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.GetMembershipRequest, dict]) – The request object. Request to get a membership of a space.
name (str) –
Required. Resource name of the membership to retrieve.
To get the app’s own membership by using user authentication, you can optionally use
spaces/{space}/members/app
.Format:
spaces/{space}/members/{member}
orspaces/{space}/members/app
When authenticated as a user, you can use the user’s email as an alias for
{member}
. For example,spaces/{space}/members/example@gmail.com
whereexample@gmail.com
is the email of the Google Chat user.This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
- Return type
- get_message(request: Optional[Union[google.apps.chat_v1.types.message.GetMessageRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.message.Message [source]¶
Returns details about a message. For an example, see Get details about a message.
Requires authentication. Supports app authentication and user authentication.
Note: Might return a message from a blocked member or space.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_get_message(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.GetMessageRequest( name="name_value", ) # Make the request response = client.get_message(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.GetMessageRequest, dict]) – The request object. Request to get a message.
name (str) –
Required. Resource name of the message.
Format:
spaces/{space}/messages/{message}
If you’ve set a custom ID for your message, you can use the value from the
clientAssignedMessageId
field for{message}
. For details, see [Name a message] (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A message in a Google Chat space.
- Return type
- classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]¶
Deprecated. Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.
The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
- Parameters
client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.
- Returns
- returns the API endpoint and the
client cert source to use.
- Return type
- Raises
google.auth.exceptions.MutualTLSChannelError – If any errors happen.
- get_space(request: Optional[Union[google.apps.chat_v1.types.space.GetSpaceRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
Returns details about a space. For an example, see Get details about a space.
Requires authentication. Supports app authentication and user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_get_space(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.GetSpaceRequest( name="name_value", ) # Make the request response = client.get_space(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.GetSpaceRequest, dict]) – The request object. A request to return a single space.
name (str) –
Required. Resource name of the space, in the form
spaces/{space}
.Format:
spaces/{space}
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- get_space_event(request: Optional[Union[google.apps.chat_v1.types.space_event.GetSpaceEventRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space_event.SpaceEvent [source]¶
Returns an event from a Google Chat space. The event payload contains the most recent version of the resource that changed. For example, if you request an event about a new message but the message was later updated, the server returns the updated
Message
resource in the event payload.Note: The
permissionSettings
field is not returned in the Space object of the Space event data for this request.Requires user authentication. To get an event, the authenticated user must be a member of the space.
For an example, see Get details about an event from a Google Chat space.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_get_space_event(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.GetSpaceEventRequest( name="name_value", ) # Make the request response = client.get_space_event(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.GetSpaceEventRequest, dict]) – The request object. Request message for getting a space event.
name (str) –
Required. The resource name of the space event.
Format:
spaces/{space}/spaceEvents/{spaceEvent}
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
- An event that represents a change or activity in a Google Chat space. To
learn more, see [Work with events from Google Chat](https://developers.google.com/workspace/chat/events-overview).
- Return type
- get_space_read_state(request: Optional[Union[google.apps.chat_v1.types.space_read_state.GetSpaceReadStateRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space_read_state.SpaceReadState [source]¶
Returns details about a user’s read state within a space, used to identify read and unread messages. For an example, see Get details about a user’s space read state.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_get_space_read_state(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.GetSpaceReadStateRequest( name="name_value", ) # Make the request response = client.get_space_read_state(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.GetSpaceReadStateRequest, dict]) – The request object. Request message for GetSpaceReadState API.
name (str) –
Required. Resource name of the space read state to retrieve.
Only supports getting read state for the calling user.
To refer to the calling user, set one of the following:
The
me
alias. For example,users/me/spaces/{space}/spaceReadState
.Their Workspace email address. For example,
users/user@example.com/spaces/{space}/spaceReadState
.Their user id. For example,
users/123456789/spaces/{space}/spaceReadState
.
Format: users/{user}/spaces/{space}/spaceReadState
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A user’s read state within a space, used to identify read and unread messages.
- Return type
- get_thread_read_state(request: Optional[Union[google.apps.chat_v1.types.thread_read_state.GetThreadReadStateRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.thread_read_state.ThreadReadState [source]¶
Returns details about a user’s read state within a thread, used to identify read and unread messages. For an example, see Get details about a user’s thread read state.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_get_thread_read_state(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.GetThreadReadStateRequest( name="name_value", ) # Make the request response = client.get_thread_read_state(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.GetThreadReadStateRequest, dict]) – The request object. Request message for GetThreadReadStateRequest API.
name (str) –
Required. Resource name of the thread read state to retrieve.
Only supports getting read state for the calling user.
To refer to the calling user, set one of the following:
The
me
alias. For example,users/me/spaces/{space}/threads/{thread}/threadReadState
.Their Workspace email address. For example,
users/user@example.com/spaces/{space}/threads/{thread}/threadReadState
.Their user id. For example,
users/123456789/spaces/{space}/threads/{thread}/threadReadState
.
Format: users/{user}/spaces/{space}/threads/{thread}/threadReadState
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A user’s read state within a thread, used to identify read and unread messages.
- Return type
- list_memberships(request: Optional[Union[google.apps.chat_v1.types.membership.ListMembershipsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListMembershipsPager [source]¶
Lists memberships in a space. For an example, see List users and Google Chat apps in a space. Listing memberships with app authentication lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, including its own. Listing memberships with User authentication lists memberships in spaces that the authenticated user has access to.
Requires authentication. Supports app authentication and user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_list_memberships(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.ListMembershipsRequest( parent="parent_value", ) # Make the request page_result = client.list_memberships(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.apps.chat_v1.types.ListMembershipsRequest, dict]) – The request object. Request message for listing memberships.
parent (str) –
Required. The resource name of the space for which to fetch a membership list.
Format: spaces/{space}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response to list memberships of the space. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListMembershipsPager
- list_messages(request: Optional[Union[google.apps.chat_v1.types.message.ListMessagesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListMessagesPager [source]¶
Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. If you list messages from a space with no messages, the response is an empty object. When using a REST/HTTP interface, the response contains an empty JSON object,
{}
. For an example, see List messages. Requires user authentication.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_list_messages(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.ListMessagesRequest( parent="parent_value", ) # Make the request page_result = client.list_messages(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.apps.chat_v1.types.ListMessagesRequest, dict]) – The request object. Lists messages in the specified space, that the user is a member of.
parent (str) –
Required. The resource name of the space to list messages from.
Format:
spaces/{space}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response message for listing messages. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListMessagesPager
- list_reactions(request: Optional[Union[google.apps.chat_v1.types.reaction.ListReactionsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListReactionsPager [source]¶
Lists reactions to a message. For an example, see List reactions for a message. Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_list_reactions(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.ListReactionsRequest( parent="parent_value", ) # Make the request page_result = client.list_reactions(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.apps.chat_v1.types.ListReactionsRequest, dict]) – The request object. Lists reactions to a message.
parent (str) –
Required. The message users reacted to.
Format:
spaces/{space}/messages/{message}
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response to a list reactions request.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListReactionsPager
- list_space_events(request: Optional[Union[google.apps.chat_v1.types.space_event.ListSpaceEventsRequest, dict]] = None, *, parent: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsPager [source]¶
Lists events from a Google Chat space. For each event, the payload contains the most recent version of the Chat resource. For example, if you list events about new space members, the server returns
Membership
resources that contain the latest membership details. If new members were removed during the requested period, the event payload contains an emptyMembership
resource.Requires user authentication. To list events, the authenticated user must be a member of the space.
For an example, see List events from a Google Chat space.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_list_space_events(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.ListSpaceEventsRequest( parent="parent_value", filter="filter_value", ) # Make the request page_result = client.list_space_events(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.apps.chat_v1.types.ListSpaceEventsRequest, dict]) – The request object. Request message for listing space events.
parent (str) –
Required. Resource name of the Google Chat space where the events occurred.
Format:
spaces/{space}
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.filter (str) –
Required. A query filter.
You must specify at least one event type (
event_type
) using the has:
operator. To filter by multiple event types, use theOR
operator. Omit batch event types in your filter. The request automatically returns any related batch events. For example, if you filter by new reactions (google.workspace.chat.reaction.v1.created
), the server also returns batch new reactions events (google.workspace.chat.reaction.v1.batchCreated
). For a list of supported event types, see the`SpaceEvents
reference documentation <https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type>`__.Optionally, you can also filter by start time (
start_time
) and end time (end_time
):start_time
: Exclusive timestamp from which to start listing space events. You can list events that occurred up to 28 days ago. If unspecified, lists space events from the past 28 days.end_time
: Inclusive timestamp until which space events are listed. If unspecified, lists events up to the time of the request.
To specify a start or end time, use the equals
=
operator and format in RFC-3339. To filter by bothstart_time
andend_time
, use theAND
operator.For example, the following queries are valid:
start_time="2023-08-23T19:20:33+00:00" AND end_time="2023-08-23T19:21:54+00:00"
start_time="2023-08-23T19:20:33+00:00" AND (event_types:"google.workspace.chat.space.v1.updated" OR event_types:"google.workspace.chat.message.v1.created")
The following queries are invalid:
start_time="2023-08-23T19:20:33+00:00" OR end_time="2023-08-23T19:21:54+00:00"
event_types:"google.workspace.chat.space.v1.updated" AND event_types:"google.workspace.chat.message.v1.created"
Invalid queries are rejected by the server with an
INVALID_ARGUMENT
error.This corresponds to the
filter
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response message for listing space events. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsPager
- list_spaces(request: Optional[Union[google.apps.chat_v1.types.space.ListSpacesRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.ListSpacesPager [source]¶
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.
Lists spaces visible to the caller or authenticated user. Group chats and DMs aren’t listed until the first message is sent.
To list all named spaces by Google Workspace organization, use the
`spaces.search()
<https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search>`__ method using Workspace administrator privileges instead.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_list_spaces(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.ListSpacesRequest( ) # Make the request page_result = client.list_spaces(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.apps.chat_v1.types.ListSpacesRequest, dict]) – The request object. A request to list the spaces the caller is a member of.
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.
- Returns
The response for a list spaces request. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.ListSpacesPager
- static membership_path(space: str, member: str) str [source]¶
Returns a fully-qualified membership string.
- static message_path(space: str, message: str) str [source]¶
Returns a fully-qualified message string.
- static parse_attachment_path(path: str) Dict[str, str] [source]¶
Parses a attachment path into its component segments.
- static parse_common_billing_account_path(path: str) Dict[str, str] [source]¶
Parse a billing_account path into its component segments.
- static parse_common_folder_path(path: str) Dict[str, str] [source]¶
Parse a folder path into its component segments.
- static parse_common_location_path(path: str) Dict[str, str] [source]¶
Parse a location path into its component segments.
- static parse_common_organization_path(path: str) Dict[str, str] [source]¶
Parse a organization path into its component segments.
- static parse_common_project_path(path: str) Dict[str, str] [source]¶
Parse a project path into its component segments.
- static parse_membership_path(path: str) Dict[str, str] [source]¶
Parses a membership path into its component segments.
- static parse_message_path(path: str) Dict[str, str] [source]¶
Parses a message path into its component segments.
- static parse_quoted_message_metadata_path(path: str) Dict[str, str] [source]¶
Parses a quoted_message_metadata path into its component segments.
- static parse_reaction_path(path: str) Dict[str, str] [source]¶
Parses a reaction path into its component segments.
- static parse_space_event_path(path: str) Dict[str, str] [source]¶
Parses a space_event path into its component segments.
- static parse_space_path(path: str) Dict[str, str] [source]¶
Parses a space path into its component segments.
- static parse_space_read_state_path(path: str) Dict[str, str] [source]¶
Parses a space_read_state path into its component segments.
- static parse_thread_path(path: str) Dict[str, str] [source]¶
Parses a thread path into its component segments.
- static parse_thread_read_state_path(path: str) Dict[str, str] [source]¶
Parses a thread_read_state path into its component segments.
- static quoted_message_metadata_path(space: str, message: str, quoted_message_metadata: str) str [source]¶
Returns a fully-qualified quoted_message_metadata string.
- static reaction_path(space: str, message: str, reaction: str) str [source]¶
Returns a fully-qualified reaction string.
- search_spaces(request: Optional[Union[google.apps.chat_v1.types.space.SearchSpacesRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.services.chat_service.pagers.SearchSpacesPager [source]¶
Returns a list of spaces in a Google Workspace organization based on an administrator’s search. Requires user authentication with administrator privileges. In the request, set
use_admin_access
totrue
.# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_search_spaces(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.SearchSpacesRequest( query="query_value", ) # Make the request page_result = client.search_spaces(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.apps.chat_v1.types.SearchSpacesRequest, dict]) – The request object. Request to search for a list of spaces based on a query.
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.
- Returns
Response with a list of spaces corresponding to the search spaces request. Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.apps.chat_v1.services.chat_service.pagers.SearchSpacesPager
- set_up_space(request: Optional[Union[google.apps.chat_v1.types.space_setup.SetUpSpaceRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn’t be specified as a membership in the request. For an example, see Set up a space with initial members.
To specify the human members to add, add memberships with the appropriate
membership.member.name
. To add a human user, useusers/{user}
, where{user}
can be the email address for the user. For users in the same Workspace organization{user}
can also be theid
for the person from the People API, or theid
for the user in the Directory API. For example, if the People API Person profile ID foruser@example.com
is123456789
, you can add the user to the space by setting themembership.member.name
tousers/user@example.com
orusers/123456789
.To specify the Google groups to add, add memberships with the appropriate
membership.group_member.name
. To add or invite a Google group, usegroups/{group}
, where{group}
is theid
for the group from the Cloud Identity Groups API. For example, you can use Cloud Identity Groups lookup API to retrieve the ID123456789
for group emailgroup@example.com
, then you can add the group to the space by setting themembership.group_member.name
togroups/123456789
. Group email is not supported, and Google groups can only be added as members in named spaces.For a named space or group chat, if the caller blocks, or is blocked by some members, or doesn’t have permission to add some members, then those members aren’t added to the created space.
To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn’t created.
To create a DM between the calling user and the calling app, set
Space.singleUserBotDm
totrue
and don’t specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see Invite or add a user or app to a space.If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned.
Spaces with threaded replies aren’t supported. If you receive the error message
ALREADY_EXISTS
when setting up a space, try a differentdisplayName
. An existing space within the Google Workspace organization might already use this display name.Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_set_up_space(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) space = chat_v1.Space() space.predefined_permission_settings = "ANNOUNCEMENT_SPACE" request = chat_v1.SetUpSpaceRequest( space=space, ) # Make the request response = client.set_up_space(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.SetUpSpaceRequest, dict]) – The request object. Request to create a space and add specified users to it.
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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- static space_event_path(space: str, space_event: str) str [source]¶
Returns a fully-qualified space_event string.
- static space_read_state_path(user: str, space: str) str [source]¶
Returns a fully-qualified space_read_state string.
- static thread_read_state_path(user: str, space: str, thread: str) str [source]¶
Returns a fully-qualified thread_read_state string.
- property transport: google.apps.chat_v1.services.chat_service.transports.base.ChatServiceTransport¶
Returns the transport used by the client instance.
- Returns
- The transport used by the client
instance.
- Return type
ChatServiceTransport
- property universe_domain: str¶
Return the universe domain used by the client instance.
- Returns
The universe domain used by the client instance.
- Return type
- update_membership(request: Optional[Union[google.apps.chat_v1.types.membership.UpdateMembershipRequest, dict]] = None, *, membership: Optional[google.apps.chat_v1.types.membership.Membership] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.membership.Membership [source]¶
Updates a membership. For an example, see Update a user’s membership in a space.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_update_membership(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.UpdateMembershipRequest( ) # Make the request response = client.update_membership(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.UpdateMembershipRequest, dict]) – The request object. Request message for updating a membership.
membership (google.apps.chat_v1.types.Membership) –
Required. The membership to update. Only fields specified by
update_mask
are updated.This corresponds to the
membership
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (google.protobuf.field_mask_pb2.FieldMask) –
Required. The field paths to update. Separate multiple values with commas or use
*
to update all field paths.Currently supported field paths:
role
This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Represents a membership relation in Google Chat, such as whether a user or Chat app is invited to, part of, or absent from a space.
- Return type
- update_message(request: Optional[Union[google.apps.chat_v1.types.message.UpdateMessageRequest, dict]] = None, *, message: Optional[google.apps.chat_v1.types.message.Message] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.message.Message [source]¶
Updates a message. There’s a difference between the
patch
andupdate
methods. Thepatch
method uses apatch
request while theupdate
method uses aput
request. We recommend using thepatch
method. For an example, see Update a message.Requires authentication. Supports app authentication and user authentication. When using app authentication, requests can only update messages created by the calling Chat app.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_update_message(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.UpdateMessageRequest( ) # Make the request response = client.update_message(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.UpdateMessageRequest, dict]) – The request object. Request to update a message.
message (google.apps.chat_v1.types.Message) –
Required. Message with fields updated.
This corresponds to the
message
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (google.protobuf.field_mask_pb2.FieldMask) –
Required. The field paths to update. Separate multiple values with commas or use
*
to update all field paths.Currently supported field paths:
text
attachment
cards
(Requires app authentication.)cards_v2
(Requires app authentication.)accessory_widgets
(Requires app authentication.)
This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A message in a Google Chat space.
- Return type
- update_space(request: Optional[Union[google.apps.chat_v1.types.space.UpdateSpaceRequest, dict]] = None, *, space: Optional[google.apps.chat_v1.types.space.Space] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space.Space [source]¶
Updates a space. For an example, see Update a space.
If you’re updating the
displayName
field and receive the error messageALREADY_EXISTS
, try a different display name.. An existing space within the Google Workspace organization might already use this display name.Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_update_space(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) space = chat_v1.Space() space.predefined_permission_settings = "ANNOUNCEMENT_SPACE" request = chat_v1.UpdateSpaceRequest( space=space, ) # Make the request response = client.update_space(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.UpdateSpaceRequest, dict]) – The request object. A request to update a single space.
space (google.apps.chat_v1.types.Space) –
Required. Space with fields to be updated.
Space.name
must be populated in the form ofspaces/{space}
. Only fields specified byupdate_mask
are updated.This corresponds to the
space
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (google.protobuf.field_mask_pb2.FieldMask) –
Required. The updated field paths, comma separated if there are multiple.
You can update the following fields for a space:
space_details
: Updates the space’s description. Supports up to 150 characters.display_name
: Only supports updating the display name for spaces wherespaceType
field isSPACE
. If you receive the error messageALREADY_EXISTS
, try a different value. An existing space within the Google Workspace organization might already use this display name.space_type
: Only supports changing aGROUP_CHAT
space type toSPACE
. Includedisplay_name
together withspace_type
in the update mask and ensure that the specified space has a non-empty display name and theSPACE
space type. Including thespace_type
mask and theSPACE
type in the specified space when updating the display name is optional if the existing space already has theSPACE
type. Trying to update the space type in other ways results in an invalid argument error.space_type
is not supported withuseAdminAccess
.space_history_state
: Updates space history settings by turning history on or off for the space. Only supported if history settings are enabled for the Google Workspace organization. To update the space history state, you must omit all other field masks in your request.space_history_state
is not supported withuseAdminAccess
.access_settings.audience
: Updates the access setting of who can discover the space, join the space, and preview the messages in named space wherespaceType
field isSPACE
. If the existing space has a target audience, you can remove the audience and restrict space access by omitting a value for this field mask. To update access settings for a space, the authenticating user must be a space manager and omit all other field masks in your request. You can’t update this field if the space is in import mode. To learn more, see Make a space discoverable to specific users.access_settings.audience
is not supported withuseAdminAccess
.permission_settings
: Supports changing the permission settings of a space. When updating permission settings, you can only specifypermissionSettings
field masks; you cannot update other field masks at the same time.permissionSettings
is not supported withuseAdminAccess
. The supported field masks include:permission_settings.manageMembersAndGroups
permission_settings.modifySpaceDetails
permission_settings.toggleHistory
permission_settings.useAtMentionAll
permission_settings.manageApps
permission_settings.manageWebhooks
permission_settings.replyMessages
This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A space in Google Chat. Spaces are conversations between two or more users or 1:1 messages between a user and a Chat app.
- Return type
- update_space_read_state(request: Optional[Union[google.apps.chat_v1.types.space_read_state.UpdateSpaceReadStateRequest, dict]] = None, *, space_read_state: Optional[google.apps.chat_v1.types.space_read_state.SpaceReadState] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.space_read_state.SpaceReadState [source]¶
Updates a user’s read state within a space, used to identify read and unread messages. For an example, see Update a user’s space read state.
Requires user authentication.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_update_space_read_state(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.UpdateSpaceReadStateRequest( ) # Make the request response = client.update_space_read_state(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.UpdateSpaceReadStateRequest, dict]) – The request object. Request message for UpdateSpaceReadState API.
space_read_state (google.apps.chat_v1.types.SpaceReadState) –
Required. The space read state and fields to update.
Only supports updating read state for the calling user.
To refer to the calling user, set one of the following:
The
me
alias. For example,users/me/spaces/{space}/spaceReadState
.Their Workspace email address. For example,
users/user@example.com/spaces/{space}/spaceReadState
.Their user id. For example,
users/123456789/spaces/{space}/spaceReadState
.
Format: users/{user}/spaces/{space}/spaceReadState
This corresponds to the
space_read_state
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (google.protobuf.field_mask_pb2.FieldMask) –
Required. The field paths to update. Currently supported field paths:
last_read_time
When the
last_read_time
is before the latest message create time, the space appears as unread in the UI.To mark the space as read, set
last_read_time
to any value later (larger) than the latest message create time. Thelast_read_time
is coerced to match the latest message create time. Note that the space read state only affects the read state of messages that are visible in the space’s top-level conversation. Replies in threads are unaffected by this timestamp, and instead rely on the thread read state.This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A user’s read state within a space, used to identify read and unread messages.
- Return type
- upload_attachment(request: Optional[Union[google.apps.chat_v1.types.attachment.UploadAttachmentRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.apps.chat_v1.types.attachment.UploadAttachmentResponse [source]¶
Uploads an attachment. For an example, see Upload media as a file attachment. Requires user authentication.
You can upload attachments up to 200 MB. Certain file types aren’t supported. For details, see File types blocked by Google Chat.
# This snippet has been automatically generated and should be regarded as a # code template only. # It will require modifications to work: # - It may require correct/in-range values for request initialization. # - It may require specifying regional endpoints when creating the service # client as shown in: # https://googleapis.dev/python/google-api-core/latest/client_options.html from google.apps import chat_v1 def sample_upload_attachment(): # Create a client client = chat_v1.ChatServiceClient() # Initialize request argument(s) request = chat_v1.UploadAttachmentRequest( parent="parent_value", filename="filename_value", ) # Make the request response = client.upload_attachment(request=request) # Handle the response print(response)
- Parameters
request (Union[google.apps.chat_v1.types.UploadAttachmentRequest, dict]) – The request object. Request to upload an 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.
- Returns
Response of uploading an attachment.
- Return type
- class google.apps.chat_v1.services.chat_service.pagers.ListMembershipsAsyncPager(method: Callable[[...], Awaitable[google.apps.chat_v1.types.membership.ListMembershipsResponse]], request: google.apps.chat_v1.types.membership.ListMembershipsRequest, response: google.apps.chat_v1.types.membership.ListMembershipsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_memberships
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListMembershipsResponse
object, and provides an__aiter__
method to iterate through itsmemberships
field.If there are more pages, the
__aiter__
method will make additionalListMemberships
requests and continue to iterate through thememberships
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListMembershipsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListMembershipsRequest) – The initial request object.
response (google.apps.chat_v1.types.ListMembershipsResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListMembershipsPager(method: Callable[[...], google.apps.chat_v1.types.membership.ListMembershipsResponse], request: google.apps.chat_v1.types.membership.ListMembershipsRequest, response: google.apps.chat_v1.types.membership.ListMembershipsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_memberships
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListMembershipsResponse
object, and provides an__iter__
method to iterate through itsmemberships
field.If there are more pages, the
__iter__
method will make additionalListMemberships
requests and continue to iterate through thememberships
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListMembershipsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListMembershipsRequest) – The initial request object.
response (google.apps.chat_v1.types.ListMembershipsResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListMessagesAsyncPager(method: Callable[[...], Awaitable[google.apps.chat_v1.types.message.ListMessagesResponse]], request: google.apps.chat_v1.types.message.ListMessagesRequest, response: google.apps.chat_v1.types.message.ListMessagesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_messages
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListMessagesResponse
object, and provides an__aiter__
method to iterate through itsmessages
field.If there are more pages, the
__aiter__
method will make additionalListMessages
requests and continue to iterate through themessages
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListMessagesResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListMessagesRequest) – The initial request object.
response (google.apps.chat_v1.types.ListMessagesResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListMessagesPager(method: Callable[[...], google.apps.chat_v1.types.message.ListMessagesResponse], request: google.apps.chat_v1.types.message.ListMessagesRequest, response: google.apps.chat_v1.types.message.ListMessagesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_messages
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListMessagesResponse
object, and provides an__iter__
method to iterate through itsmessages
field.If there are more pages, the
__iter__
method will make additionalListMessages
requests and continue to iterate through themessages
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListMessagesResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListMessagesRequest) – The initial request object.
response (google.apps.chat_v1.types.ListMessagesResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListReactionsAsyncPager(method: Callable[[...], Awaitable[google.apps.chat_v1.types.reaction.ListReactionsResponse]], request: google.apps.chat_v1.types.reaction.ListReactionsRequest, response: google.apps.chat_v1.types.reaction.ListReactionsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_reactions
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListReactionsResponse
object, and provides an__aiter__
method to iterate through itsreactions
field.If there are more pages, the
__aiter__
method will make additionalListReactions
requests and continue to iterate through thereactions
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListReactionsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListReactionsRequest) – The initial request object.
response (google.apps.chat_v1.types.ListReactionsResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListReactionsPager(method: Callable[[...], google.apps.chat_v1.types.reaction.ListReactionsResponse], request: google.apps.chat_v1.types.reaction.ListReactionsRequest, response: google.apps.chat_v1.types.reaction.ListReactionsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_reactions
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListReactionsResponse
object, and provides an__iter__
method to iterate through itsreactions
field.If there are more pages, the
__iter__
method will make additionalListReactions
requests and continue to iterate through thereactions
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListReactionsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListReactionsRequest) – The initial request object.
response (google.apps.chat_v1.types.ListReactionsResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsAsyncPager(method: Callable[[...], Awaitable[google.apps.chat_v1.types.space_event.ListSpaceEventsResponse]], request: google.apps.chat_v1.types.space_event.ListSpaceEventsRequest, response: google.apps.chat_v1.types.space_event.ListSpaceEventsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_space_events
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListSpaceEventsResponse
object, and provides an__aiter__
method to iterate through itsspace_events
field.If there are more pages, the
__aiter__
method will make additionalListSpaceEvents
requests and continue to iterate through thespace_events
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListSpaceEventsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListSpaceEventsRequest) – The initial request object.
response (google.apps.chat_v1.types.ListSpaceEventsResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListSpaceEventsPager(method: Callable[[...], google.apps.chat_v1.types.space_event.ListSpaceEventsResponse], request: google.apps.chat_v1.types.space_event.ListSpaceEventsRequest, response: google.apps.chat_v1.types.space_event.ListSpaceEventsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_space_events
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListSpaceEventsResponse
object, and provides an__iter__
method to iterate through itsspace_events
field.If there are more pages, the
__iter__
method will make additionalListSpaceEvents
requests and continue to iterate through thespace_events
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListSpaceEventsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListSpaceEventsRequest) – The initial request object.
response (google.apps.chat_v1.types.ListSpaceEventsResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListSpacesAsyncPager(method: Callable[[...], Awaitable[google.apps.chat_v1.types.space.ListSpacesResponse]], request: google.apps.chat_v1.types.space.ListSpacesRequest, response: google.apps.chat_v1.types.space.ListSpacesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_spaces
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListSpacesResponse
object, and provides an__aiter__
method to iterate through itsspaces
field.If there are more pages, the
__aiter__
method will make additionalListSpaces
requests and continue to iterate through thespaces
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListSpacesResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListSpacesRequest) – The initial request object.
response (google.apps.chat_v1.types.ListSpacesResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.ListSpacesPager(method: Callable[[...], google.apps.chat_v1.types.space.ListSpacesResponse], request: google.apps.chat_v1.types.space.ListSpacesRequest, response: google.apps.chat_v1.types.space.ListSpacesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_spaces
requests.This class thinly wraps an initial
google.apps.chat_v1.types.ListSpacesResponse
object, and provides an__iter__
method to iterate through itsspaces
field.If there are more pages, the
__iter__
method will make additionalListSpaces
requests and continue to iterate through thespaces
field on the corresponding responses.All the usual
google.apps.chat_v1.types.ListSpacesResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.ListSpacesRequest) – The initial request object.
response (google.apps.chat_v1.types.ListSpacesResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.SearchSpacesAsyncPager(method: Callable[[...], Awaitable[google.apps.chat_v1.types.space.SearchSpacesResponse]], request: google.apps.chat_v1.types.space.SearchSpacesRequest, response: google.apps.chat_v1.types.space.SearchSpacesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
search_spaces
requests.This class thinly wraps an initial
google.apps.chat_v1.types.SearchSpacesResponse
object, and provides an__aiter__
method to iterate through itsspaces
field.If there are more pages, the
__aiter__
method will make additionalSearchSpaces
requests and continue to iterate through thespaces
field on the corresponding responses.All the usual
google.apps.chat_v1.types.SearchSpacesResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.SearchSpacesRequest) – The initial request object.
response (google.apps.chat_v1.types.SearchSpacesResponse) – The initial response object.
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.
- class google.apps.chat_v1.services.chat_service.pagers.SearchSpacesPager(method: Callable[[...], google.apps.chat_v1.types.space.SearchSpacesResponse], request: google.apps.chat_v1.types.space.SearchSpacesRequest, response: google.apps.chat_v1.types.space.SearchSpacesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
search_spaces
requests.This class thinly wraps an initial
google.apps.chat_v1.types.SearchSpacesResponse
object, and provides an__iter__
method to iterate through itsspaces
field.If there are more pages, the
__iter__
method will make additionalSearchSpaces
requests and continue to iterate through thespaces
field on the corresponding responses.All the usual
google.apps.chat_v1.types.SearchSpacesResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.apps.chat_v1.types.SearchSpacesRequest) – The initial request object.
response (google.apps.chat_v1.types.SearchSpacesResponse) – The initial response object.
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.