pub struct ChatServiceClient<T> { /* private fields */ }
Expand description

Enables developers to build Chat apps and integrations on Google Chat Platform.

Implementations§

source§

impl<T> ChatServiceClient<T>
where T: GrpcService<BoxBody>, T::Error: Into<StdError>, T::ResponseBody: Body<Data = Bytes> + Send + 'static, <T::ResponseBody as Body>::Error: Into<StdError> + Send,

source

pub fn new(inner: T) -> Self

source

pub fn with_origin(inner: T, origin: Uri) -> Self

source

pub fn with_interceptor<F>( inner: T, interceptor: F ) -> ChatServiceClient<InterceptedService<T, F>>
where F: Interceptor, T::ResponseBody: Default, T: Service<Request<BoxBody>, Response = Response<<T as GrpcService<BoxBody>>::ResponseBody>>, <T as Service<Request<BoxBody>>>::Error: Into<StdError> + Send + Sync,

source

pub fn send_compressed(self, encoding: CompressionEncoding) -> Self

Compress requests with the given encoding.

This requires the server to support it otherwise it might respond with an error.

source

pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self

Enable decompressing responses.

source

pub fn max_decoding_message_size(self, limit: usize) -> Self

Limits the maximum size of a decoded message.

Default: 4MB

source

pub fn max_encoding_message_size(self, limit: usize) -> Self

Limits the maximum size of an encoded message.

Default: usize::MAX

source

pub async fn create_message( &mut self, request: impl IntoRequest<CreateMessageRequest> ) -> Result<Response<Message>, Status>

Creates a message in a Google Chat space. For an example, see Send a message.

Calling this method requires authentication and supports the following authentication types:

  • For text messages, user authentication or app authentication are supported.
  • For card messages, only app authentication is supported. (Only Chat apps can create card messages.)
source

pub async fn list_messages( &mut self, request: impl IntoRequest<ListMessagesRequest> ) -> Result<Response<ListMessagesResponse>, Status>

Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. For an example, see List messages. Requires user authentication.

source

pub async fn list_memberships( &mut self, request: impl IntoRequest<ListMembershipsRequest> ) -> Result<Response<ListMembershipsResponse>, Status>

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.

source

pub async fn get_membership( &mut self, request: impl IntoRequest<GetMembershipRequest> ) -> Result<Response<Membership>, Status>

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.

source

pub async fn get_message( &mut self, request: impl IntoRequest<GetMessageRequest> ) -> Result<Response<Message>, Status>

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.

source

pub async fn update_message( &mut self, request: impl IntoRequest<UpdateMessageRequest> ) -> Result<Response<Message>, Status>

Updates a message. There’s a difference between the patch and update methods. The patch method uses a patch request while the update method uses a put request. We recommend using the patch 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.

source

pub async fn delete_message( &mut self, request: impl IntoRequest<DeleteMessageRequest> ) -> Result<Response<()>, Status>

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.

source

pub async fn get_attachment( &mut self, request: impl IntoRequest<GetAttachmentRequest> ) -> Result<Response<Attachment>, Status>

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.

source

pub async fn upload_attachment( &mut self, request: impl IntoRequest<UploadAttachmentRequest> ) -> Result<Response<UploadAttachmentResponse>, Status>

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.

source

pub async fn list_spaces( &mut self, request: impl IntoRequest<ListSpacesRequest> ) -> Result<Response<ListSpacesResponse>, Status>

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.

source

pub async fn get_space( &mut self, request: impl IntoRequest<GetSpaceRequest> ) -> Result<Response<Space>, Status>

Returns details about a space. For an example, see Get details about a space.

Requires authentication. Supports app authentication and user authentication.

source

pub async fn create_space( &mut self, request: impl IntoRequest<CreateSpaceRequest> ) -> Result<Response<Space>, Status>

Creates 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 different displayName. An existing space within the Google Workspace organization might already use this display name.

Requires user authentication.

source

pub async fn set_up_space( &mut self, request: impl IntoRequest<SetUpSpaceRequest> ) -> Result<Response<Space>, Status>

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 member.name in the SetUpSpaceRequest. To add a human user, use users/{user}, where {user} can be the email address for the user. For users in the same Workspace organization {user} can also be the id for the person from the People API, or the id for the user in the Directory API. For example, if the People API Person profile ID for user@example.com is 123456789, you can add the user to the space by setting the membership.member.name to users/user@example.com or users/123456789.

For a space or group chat, if the caller blocks or is blocked by 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 to true 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 different displayName. An existing space within the Google Workspace organization might already use this display name.

Requires user authentication.

source

pub async fn update_space( &mut self, request: impl IntoRequest<UpdateSpaceRequest> ) -> Result<Response<Space>, Status>

Updates a space. For an example, see Update a space.

If you’re updating the displayName field and receive the error message ALREADY_EXISTS, try a different display name.. An existing space within the Google Workspace organization might already use this display name.

Requires user authentication.

source

pub async fn delete_space( &mut self, request: impl IntoRequest<DeleteSpaceRequest> ) -> Result<Response<()>, Status>

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.

source

pub async fn complete_import_space( &mut self, request: impl IntoRequest<CompleteImportSpaceRequest> ) -> Result<Response<CompleteImportSpaceResponse>, Status>

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.

source

pub async fn find_direct_message( &mut self, request: impl IntoRequest<FindDirectMessageRequest> ) -> Result<Response<Space>, Status>

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.

source

pub async fn create_membership( &mut self, request: impl IntoRequest<CreateMembershipRequest> ) -> Result<Response<Membership>, Status>

Creates a human membership or app membership for the calling app. Creating memberships for other apps isn’t supported. For an example, see Invite or add a user or a Google Chat app to a space. 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.

To specify the member to add, set the membership.member.name in the CreateMembershipRequest:

  • To add the calling app to a space or a direct message between two human users, use users/app. Unable to add other apps to the space.

  • To add a human user, use users/{user}, where {user} can be the email address for the user. For users in the same Workspace organization {user} can also be the id for the person from the People API, or the id for the user in the Directory API. For example, if the People API Person profile ID for user@example.com is 123456789, you can add the user to the space by setting the membership.member.name to users/user@example.com or users/123456789.

source

pub async fn update_membership( &mut self, request: impl IntoRequest<UpdateMembershipRequest> ) -> Result<Response<Membership>, Status>

Updates a membership. Requires user authentication.

source

pub async fn delete_membership( &mut self, request: impl IntoRequest<DeleteMembershipRequest> ) -> Result<Response<Membership>, Status>

Deletes a membership. For an example, see Remove a user or a Google Chat app from a space.

Requires user authentication.

source

pub async fn create_reaction( &mut self, request: impl IntoRequest<CreateReactionRequest> ) -> Result<Response<Reaction>, Status>

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.

source

pub async fn list_reactions( &mut self, request: impl IntoRequest<ListReactionsRequest> ) -> Result<Response<ListReactionsResponse>, Status>

Lists reactions to a message. For an example, see List reactions for a message. Requires user authentication.

source

pub async fn delete_reaction( &mut self, request: impl IntoRequest<DeleteReactionRequest> ) -> Result<Response<()>, Status>

Deletes a reaction to a message. Only unicode emojis are supported. For an example, see Delete a reaction. Requires user authentication.

source

pub async fn get_space_read_state( &mut self, request: impl IntoRequest<GetSpaceReadStateRequest> ) -> Result<Response<SpaceReadState>, Status>

Returns details about a user’s read state within a space, used to identify read and unread messages.

Requires user authentication.

source

pub async fn update_space_read_state( &mut self, request: impl IntoRequest<UpdateSpaceReadStateRequest> ) -> Result<Response<SpaceReadState>, Status>

Updates a user’s read state within a space, used to identify read and unread messages.

Requires user authentication.

source

pub async fn get_thread_read_state( &mut self, request: impl IntoRequest<GetThreadReadStateRequest> ) -> Result<Response<ThreadReadState>, Status>

Returns details about a user’s read state within a thread, used to identify read and unread messages.

Requires user authentication.

Trait Implementations§

source§

impl<T: Clone> Clone for ChatServiceClient<T>

source§

fn clone(&self) -> ChatServiceClient<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for ChatServiceClient<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for ChatServiceClient<T>

§

impl<T> RefUnwindSafe for ChatServiceClient<T>
where T: RefUnwindSafe,

§

impl<T> Send for ChatServiceClient<T>
where T: Send,

§

impl<T> Sync for ChatServiceClient<T>
where T: Sync,

§

impl<T> Unpin for ChatServiceClient<T>
where T: Unpin,

§

impl<T> UnwindSafe for ChatServiceClient<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more