Documentation
¶
Overview ¶
Package chat is an auto-generated package for the Google Chat API.
The Google Chat API lets you build Chat apps to integrate your services with Google Chat and manage Chat resources such as spaces, members, and messages.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation ¶
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage ¶
To get started with this package, create a client.
// go get cloud.google.com/go/chat/apiv1@latest
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client ¶
The following is an example of making an API call with the newly created client, mentioned above.
req := &chatpb.CompleteImportSpaceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#CompleteImportSpaceRequest.
}
resp, err := c.CompleteImportSpace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
Use of Context ¶
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Index ¶
- func DefaultAuthScopes() []string
- type CallOptions
- type Client
- func (c *Client) Close() error
- func (c *Client) CompleteImportSpace(ctx context.Context, req *chatpb.CompleteImportSpaceRequest, ...) (*chatpb.CompleteImportSpaceResponse, error)
- func (c *Client) Connection() *grpc.ClientConndeprecated
- func (c *Client) CreateCustomEmoji(ctx context.Context, req *chatpb.CreateCustomEmojiRequest, ...) (*chatpb.CustomEmoji, error)
- func (c *Client) CreateMembership(ctx context.Context, req *chatpb.CreateMembershipRequest, ...) (*chatpb.Membership, error)
- func (c *Client) CreateMessage(ctx context.Context, req *chatpb.CreateMessageRequest, opts ...gax.CallOption) (*chatpb.Message, error)
- func (c *Client) CreateReaction(ctx context.Context, req *chatpb.CreateReactionRequest, opts ...gax.CallOption) (*chatpb.Reaction, error)
- func (c *Client) CreateSpace(ctx context.Context, req *chatpb.CreateSpaceRequest, opts ...gax.CallOption) (*chatpb.Space, error)
- func (c *Client) DeleteCustomEmoji(ctx context.Context, req *chatpb.DeleteCustomEmojiRequest, ...) error
- func (c *Client) DeleteMembership(ctx context.Context, req *chatpb.DeleteMembershipRequest, ...) (*chatpb.Membership, error)
- func (c *Client) DeleteMessage(ctx context.Context, req *chatpb.DeleteMessageRequest, opts ...gax.CallOption) error
- func (c *Client) DeleteReaction(ctx context.Context, req *chatpb.DeleteReactionRequest, opts ...gax.CallOption) error
- func (c *Client) DeleteSpace(ctx context.Context, req *chatpb.DeleteSpaceRequest, opts ...gax.CallOption) error
- func (c *Client) FindDirectMessage(ctx context.Context, req *chatpb.FindDirectMessageRequest, ...) (*chatpb.Space, error)
- func (c *Client) GetAttachment(ctx context.Context, req *chatpb.GetAttachmentRequest, opts ...gax.CallOption) (*chatpb.Attachment, error)
- func (c *Client) GetCustomEmoji(ctx context.Context, req *chatpb.GetCustomEmojiRequest, opts ...gax.CallOption) (*chatpb.CustomEmoji, error)
- func (c *Client) GetMembership(ctx context.Context, req *chatpb.GetMembershipRequest, opts ...gax.CallOption) (*chatpb.Membership, error)
- func (c *Client) GetMessage(ctx context.Context, req *chatpb.GetMessageRequest, opts ...gax.CallOption) (*chatpb.Message, error)
- func (c *Client) GetSpace(ctx context.Context, req *chatpb.GetSpaceRequest, opts ...gax.CallOption) (*chatpb.Space, error)
- func (c *Client) GetSpaceEvent(ctx context.Context, req *chatpb.GetSpaceEventRequest, opts ...gax.CallOption) (*chatpb.SpaceEvent, error)
- func (c *Client) GetSpaceNotificationSetting(ctx context.Context, req *chatpb.GetSpaceNotificationSettingRequest, ...) (*chatpb.SpaceNotificationSetting, error)
- func (c *Client) GetSpaceReadState(ctx context.Context, req *chatpb.GetSpaceReadStateRequest, ...) (*chatpb.SpaceReadState, error)
- func (c *Client) GetThreadReadState(ctx context.Context, req *chatpb.GetThreadReadStateRequest, ...) (*chatpb.ThreadReadState, error)
- func (c *Client) ListCustomEmojis(ctx context.Context, req *chatpb.ListCustomEmojisRequest, ...) *CustomEmojiIterator
- func (c *Client) ListMemberships(ctx context.Context, req *chatpb.ListMembershipsRequest, ...) *MembershipIterator
- func (c *Client) ListMessages(ctx context.Context, req *chatpb.ListMessagesRequest, opts ...gax.CallOption) *MessageIterator
- func (c *Client) ListReactions(ctx context.Context, req *chatpb.ListReactionsRequest, opts ...gax.CallOption) *ReactionIterator
- func (c *Client) ListSpaceEvents(ctx context.Context, req *chatpb.ListSpaceEventsRequest, ...) *SpaceEventIterator
- func (c *Client) ListSpaces(ctx context.Context, req *chatpb.ListSpacesRequest, opts ...gax.CallOption) *SpaceIterator
- func (c *Client) SearchSpaces(ctx context.Context, req *chatpb.SearchSpacesRequest, opts ...gax.CallOption) *SpaceIterator
- func (c *Client) SetUpSpace(ctx context.Context, req *chatpb.SetUpSpaceRequest, opts ...gax.CallOption) (*chatpb.Space, error)
- func (c *Client) UpdateMembership(ctx context.Context, req *chatpb.UpdateMembershipRequest, ...) (*chatpb.Membership, error)
- func (c *Client) UpdateMessage(ctx context.Context, req *chatpb.UpdateMessageRequest, opts ...gax.CallOption) (*chatpb.Message, error)
- func (c *Client) UpdateSpace(ctx context.Context, req *chatpb.UpdateSpaceRequest, opts ...gax.CallOption) (*chatpb.Space, error)
- func (c *Client) UpdateSpaceNotificationSetting(ctx context.Context, req *chatpb.UpdateSpaceNotificationSettingRequest, ...) (*chatpb.SpaceNotificationSetting, error)
- func (c *Client) UpdateSpaceReadState(ctx context.Context, req *chatpb.UpdateSpaceReadStateRequest, ...) (*chatpb.SpaceReadState, error)
- func (c *Client) UploadAttachment(ctx context.Context, req *chatpb.UploadAttachmentRequest, ...) (*chatpb.UploadAttachmentResponse, error)
- type CustomEmojiIterator
- type MembershipIterator
- type MessageIterator
- type ReactionIterator
- type SpaceEventIterator
- type SpaceIterator
Examples ¶
- Client.CompleteImportSpace
- Client.CreateCustomEmoji
- Client.CreateMembership
- Client.CreateMessage
- Client.CreateReaction
- Client.CreateSpace
- Client.DeleteCustomEmoji
- Client.DeleteMembership
- Client.DeleteMessage
- Client.DeleteReaction
- Client.DeleteSpace
- Client.FindDirectMessage
- Client.GetAttachment
- Client.GetCustomEmoji
- Client.GetMembership
- Client.GetMessage
- Client.GetSpace
- Client.GetSpaceEvent
- Client.GetSpaceNotificationSetting
- Client.GetSpaceReadState
- Client.GetThreadReadState
- Client.ListCustomEmojis
- Client.ListCustomEmojis (All)
- Client.ListMemberships
- Client.ListMemberships (All)
- Client.ListMessages
- Client.ListMessages (All)
- Client.ListReactions
- Client.ListReactions (All)
- Client.ListSpaceEvents
- Client.ListSpaceEvents (All)
- Client.ListSpaces
- Client.ListSpaces (All)
- Client.SearchSpaces
- Client.SearchSpaces (All)
- Client.SetUpSpace
- Client.UpdateMembership
- Client.UpdateMessage
- Client.UpdateSpace
- Client.UpdateSpaceNotificationSetting
- Client.UpdateSpaceReadState
- Client.UploadAttachment
- NewClient
- NewRESTClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type CallOptions ¶
type CallOptions struct {
CreateMessage []gax.CallOption
ListMessages []gax.CallOption
ListMemberships []gax.CallOption
GetMembership []gax.CallOption
GetMessage []gax.CallOption
UpdateMessage []gax.CallOption
DeleteMessage []gax.CallOption
GetAttachment []gax.CallOption
UploadAttachment []gax.CallOption
ListSpaces []gax.CallOption
SearchSpaces []gax.CallOption
GetSpace []gax.CallOption
CreateSpace []gax.CallOption
SetUpSpace []gax.CallOption
UpdateSpace []gax.CallOption
DeleteSpace []gax.CallOption
CompleteImportSpace []gax.CallOption
FindDirectMessage []gax.CallOption
CreateMembership []gax.CallOption
UpdateMembership []gax.CallOption
DeleteMembership []gax.CallOption
CreateReaction []gax.CallOption
ListReactions []gax.CallOption
DeleteReaction []gax.CallOption
CreateCustomEmoji []gax.CallOption
GetCustomEmoji []gax.CallOption
ListCustomEmojis []gax.CallOption
DeleteCustomEmoji []gax.CallOption
GetSpaceReadState []gax.CallOption
UpdateSpaceReadState []gax.CallOption
GetThreadReadState []gax.CallOption
GetSpaceEvent []gax.CallOption
ListSpaceEvents []gax.CallOption
GetSpaceNotificationSetting []gax.CallOption
UpdateSpaceNotificationSetting []gax.CallOption
}
CallOptions contains the retry settings for each method of Client.
type Client ¶
type Client struct {
// The call options for this service.
CallOptions *CallOptions
// contains filtered or unexported fields
}
Client is a client for interacting with Google Chat API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Enables developers to build Chat apps and integrations on Google Chat Platform.
func NewClient ¶
NewClient creates a new chat service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Enables developers to build Chat apps and integrations on Google Chat Platform.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewRESTClient ¶
NewRESTClient creates a new chat service rest client.
Enables developers to build Chat apps and integrations on Google Chat Platform.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*Client) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) CompleteImportSpace ¶
func (c *Client) CompleteImportSpace(ctx context.Context, req *chatpb.CompleteImportSpaceRequest, opts ...gax.CallOption) (*chatpb.CompleteImportSpaceResponse, error)
CompleteImportSpace completes the import process (at https://developers.google.com/workspace/chat/import-data) for the specified space and makes it visible to users.
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) and domain-wide delegation with the authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.import
For more information, see Authorize Google Chat apps to import data (at https://developers.google.com/workspace/chat/authorize-import).
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.CompleteImportSpaceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#CompleteImportSpaceRequest.
}
resp, err := c.CompleteImportSpace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) Connection
deprecated
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*Client) CreateCustomEmoji ¶ added in v0.13.0
func (c *Client) CreateCustomEmoji(ctx context.Context, req *chatpb.CreateCustomEmojiRequest, opts ...gax.CallOption) (*chatpb.CustomEmoji, error)
CreateCustomEmoji creates a custom emoji.
Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat (at https://support.google.com/chat/answer/12800149) and Manage custom emoji permissions (at https://support.google.com/a/answer/12850085).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.customemojis
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.CreateCustomEmojiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#CreateCustomEmojiRequest.
}
resp, err := c.CreateCustomEmoji(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateMembership ¶
func (c *Client) CreateMembership(ctx context.Context, req *chatpb.CreateMembershipRequest, opts ...gax.CallOption) (*chatpb.Membership, error)
CreateMembership 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.
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
with administrator approval (at https://support.google.com/a?p=chat-app-auth)
and the authorization scope:
https://www.googleapis.com/auth/chat.app.memberships
User
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.app (to add the
calling app to the space)
https://www.googleapis.com/auth/chat.import (import mode spaces
only)
User authentication grants administrator privileges when an
administrator account authenticates, use_admin_access is true, and
the following authorization scope is used:
https://www.googleapis.com/auth/chat.admin.memberships
App authentication is not supported for the following use cases:
Inviting users external to the Workspace organization that owns the space. Adding a Google Group to a space. Adding a Chat app to a space.
For example usage, see:
Invite or add a user to a space (at https://developers.google.com/workspace/chat/create-members#create-user-membership). Invite or add a Google Group to a space (at https://developers.google.com/workspace/chat/create-members#create-group-membership). Add the Chat app to a space (at https://developers.google.com/workspace/chat/create-members#create-membership-calling-api).
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.CreateMembershipRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#CreateMembershipRequest.
}
resp, err := c.CreateMembership(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateMessage ¶
func (c *Client) CreateMessage(ctx context.Context, req *chatpb.CreateMessageRequest, opts ...gax.CallOption) (*chatpb.Message, error)
CreateMessage creates a message in a Google Chat space. For an example, see Send a message (at https://developers.google.com/workspace/chat/create-messages).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: https://www.googleapis.com/auth/chat.bot User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.messages.create https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.import (import mode spaces only)
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.
For webhook (at https://developers.google.com/workspace/chat/quickstart/webhooks) requests, the response doesn’t contain the full message. The response only populates the name and thread.name fields in addition to the information that was in the request.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.CreateMessageRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#CreateMessageRequest.
}
resp, err := c.CreateMessage(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateReaction ¶
func (c *Client) CreateReaction(ctx context.Context, req *chatpb.CreateReactionRequest, opts ...gax.CallOption) (*chatpb.Reaction, error)
CreateReaction creates a reaction and adds it to a message. For an example, see Add a reaction to a message (at https://developers.google.com/workspace/chat/create-reactions).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.messages.reactions.create https://www.googleapis.com/auth/chat.messages.reactions https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.import (import mode spaces only)
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.CreateReactionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#CreateReactionRequest.
}
resp, err := c.CreateReaction(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateSpace ¶
func (c *Client) CreateSpace(ctx context.Context, req *chatpb.CreateSpaceRequest, opts ...gax.CallOption) (*chatpb.Space, error)
CreateSpace creates a space. Can be used to create a named space, or a group chat in Import mode. For an example, see Create a space (at https://developers.google.com/workspace/chat/create-spaces).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with administrator approval (at https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes: https://www.googleapis.com/auth/chat.app.spaces.create https://www.googleapis.com/auth/chat.app.spaces User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.spaces.create https://www.googleapis.com/auth/chat.spaces https://www.googleapis.com/auth/chat.import (import mode spaces only)
When authenticating as an app, the space.customer field must be set in the request.
When authenticating as an app, the Chat app is added as a member of the space. However, unlike human authentication, the Chat app is not added as a space manager. By default, the Chat app can be removed from the space by all space members. To allow only space managers to remove the app from a space, set space.permission_settings.manage_apps to managers_allowed.
Space membership upon creation depends on whether the space is created in Import mode:
Import mode: No members are created. All other modes: The calling user is added as a member. This is: The app itself when using app authentication. The human user when using user authentication.
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.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.CreateSpaceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#CreateSpaceRequest.
}
resp, err := c.CreateSpace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) DeleteCustomEmoji ¶ added in v0.13.0
func (c *Client) DeleteCustomEmoji(ctx context.Context, req *chatpb.DeleteCustomEmojiRequest, opts ...gax.CallOption) error
DeleteCustomEmoji deletes a custom emoji. By default, users can only delete custom emoji they created. Emoji managers (at https://support.google.com/a/answer/12850085) assigned by the administrator can delete any custom emoji in the organization. See Learn about custom emojis in Google Chat (at https://support.google.com/chat/answer/12800149).
Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat (at https://support.google.com/chat/answer/12800149) and Manage custom emoji permissions (at https://support.google.com/a/answer/12850085).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.customemojis
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.DeleteCustomEmojiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#DeleteCustomEmojiRequest.
}
err = c.DeleteCustomEmoji(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteMembership ¶
func (c *Client) DeleteMembership(ctx context.Context, req *chatpb.DeleteMembershipRequest, opts ...gax.CallOption) (*chatpb.Membership, error)
DeleteMembership deletes a membership. For an example, see Remove a user or a Google Chat app from a space (at https://developers.google.com/workspace/chat/delete-members).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
with administrator approval (at https://support.google.com/a?p=chat-app-auth)
and the authorization scope:
https://www.googleapis.com/auth/chat.app.memberships
User
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.app (to remove
the calling app from the space)
https://www.googleapis.com/auth/chat.import (import mode spaces
only)
User authentication grants administrator privileges when an
administrator account authenticates, use_admin_access is true, and
the following authorization scope is used:
https://www.googleapis.com/auth/chat.admin.memberships
App authentication is not supported for the following use cases:
Removing a Google Group from a space. Removing a Chat app from a space.
To delete memberships for space managers, the requester must be a space manager. If you’re using app authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) the Chat app must be the space creator.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.DeleteMembershipRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#DeleteMembershipRequest.
}
resp, err := c.DeleteMembership(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) DeleteMessage ¶
func (c *Client) DeleteMessage(ctx context.Context, req *chatpb.DeleteMessageRequest, opts ...gax.CallOption) error
DeleteMessage deletes a message. For an example, see Delete a message (at https://developers.google.com/workspace/chat/delete-messages).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: https://www.googleapis.com/auth/chat.bot User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.import (import mode spaces only)
When using app authentication, requests can only delete messages created by the calling Chat app.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.DeleteMessageRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#DeleteMessageRequest.
}
err = c.DeleteMessage(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteReaction ¶
func (c *Client) DeleteReaction(ctx context.Context, req *chatpb.DeleteReactionRequest, opts ...gax.CallOption) error
DeleteReaction deletes a reaction to a message. For an example, see Delete a reaction (at https://developers.google.com/workspace/chat/delete-reactions).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.messages.reactions https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.import (import mode spaces only)
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.DeleteReactionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#DeleteReactionRequest.
}
err = c.DeleteReaction(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteSpace ¶
func (c *Client) DeleteSpace(ctx context.Context, req *chatpb.DeleteSpaceRequest, opts ...gax.CallOption) error
DeleteSpace 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 (at https://developers.google.com/workspace/chat/delete-spaces).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
with administrator
approval (at https://support.google.com/a?p=chat-app-auth) and the
authorization scope:
https://www.googleapis.com/auth/chat.app.delete (only in
spaces the app created)
User
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.delete
https://www.googleapis.com/auth/chat.import (import mode spaces
only)
User authentication grants administrator privileges when an
administrator account authenticates, use_admin_access is true, and
the following authorization scope is used:
https://www.googleapis.com/auth/chat.admin.delete
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.DeleteSpaceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#DeleteSpaceRequest.
}
err = c.DeleteSpace(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) FindDirectMessage ¶
func (c *Client) FindDirectMessage(ctx context.Context, req *chatpb.FindDirectMessageRequest, opts ...gax.CallOption) (*chatpb.Space, error)
FindDirectMessage 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 (at /chat/api/guides/v1/spaces/find-direct-message).
With app authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), returns the direct message space between the specified user and the calling Chat app.
With user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), returns the direct message space between the specified user and the authenticated user.
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: https://www.googleapis.com/auth/chat.bot User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.spaces.readonly https://www.googleapis.com/auth/chat.spaces
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.FindDirectMessageRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#FindDirectMessageRequest.
}
resp, err := c.FindDirectMessage(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetAttachment ¶
func (c *Client) GetAttachment(ctx context.Context, req *chatpb.GetAttachmentRequest, opts ...gax.CallOption) (*chatpb.Attachment, error)
GetAttachment gets the metadata of a message attachment. The attachment data is fetched using the media API (at https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). For an example, see Get metadata about a message attachment (at https://developers.google.com/workspace/chat/get-media-attachments).
Requires app authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.bot
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetAttachmentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetAttachmentRequest.
}
resp, err := c.GetAttachment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetCustomEmoji ¶ added in v0.13.0
func (c *Client) GetCustomEmoji(ctx context.Context, req *chatpb.GetCustomEmojiRequest, opts ...gax.CallOption) (*chatpb.CustomEmoji, error)
GetCustomEmoji returns details about a custom emoji.
Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat (at https://support.google.com/chat/answer/12800149) and Manage custom emoji permissions (at https://support.google.com/a/answer/12850085).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.customemojis.readonly https://www.googleapis.com/auth/chat.customemojis
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetCustomEmojiRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetCustomEmojiRequest.
}
resp, err := c.GetCustomEmoji(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetMembership ¶
func (c *Client) GetMembership(ctx context.Context, req *chatpb.GetMembershipRequest, opts ...gax.CallOption) (*chatpb.Membership, error)
GetMembership returns details about a membership. For an example, see Get details about a user’s or Google Chat app’s membership (at https://developers.google.com/workspace/chat/get-members).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.bot
https://www.googleapis.com/auth/chat.app.memberships (requires
administrator approval (at https://support.google.com/a?p=chat-app-auth))
User
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.memberships.readonly
https://www.googleapis.com/auth/chat.memberships
User authentication grants administrator privileges when an
administrator account authenticates, use_admin_access is true, and
one of the following authorization scopes is used:
https://www.googleapis.com/auth/chat.admin.memberships.readonly
https://www.googleapis.com/auth/chat.admin.memberships
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetMembershipRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetMembershipRequest.
}
resp, err := c.GetMembership(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetMessage ¶
func (c *Client) GetMessage(ctx context.Context, req *chatpb.GetMessageRequest, opts ...gax.CallOption) (*chatpb.Message, error)
GetMessage returns details about a message. For an example, see Get details about a message (at https://developers.google.com/workspace/chat/get-messages).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.bot: When using this authorization scope, this method returns details about a message the Chat app has access to, like direct messages and slash commands (at https://developers.google.com/workspace/chat/slash-commands) that invoke the Chat app. https://www.googleapis.com/auth/chat.app.messages.readonly with administrator approval (at https://support.google.com/a?p=chat-app-auth) (available in Developer Preview (at https://developers.google.com/workspace/preview)). When using this authentication scope, this method returns details about a public message in a space. User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.messages.readonly https://www.googleapis.com/auth/chat.messages
Note: Might return a message from a blocked member or space.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetMessageRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetMessageRequest.
}
resp, err := c.GetMessage(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetSpace ¶
func (c *Client) GetSpace(ctx context.Context, req *chatpb.GetSpaceRequest, opts ...gax.CallOption) (*chatpb.Space, error)
GetSpace returns details about a space. For an example, see Get details about a space (at https://developers.google.com/workspace/chat/get-spaces).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.bot
https://www.googleapis.com/auth/chat.app.spaces with administrator
approval (at https://support.google.com/a?p=chat-app-auth)
User
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.spaces.readonly
https://www.googleapis.com/auth/chat.spaces
User authentication grants administrator privileges when an
administrator account authenticates, use_admin_access is true, and
one of the following authorization scopes is used:
https://www.googleapis.com/auth/chat.admin.spaces.readonly
https://www.googleapis.com/auth/chat.admin.spaces
App authentication has the following limitations:
space.access_settings is only populated when using the chat.app.spaces scope. space.predefind_permission_settings and space.permission_settings are only populated when using the chat.app.spaces scope, and only for spaces the app created.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetSpaceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetSpaceRequest.
}
resp, err := c.GetSpace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetSpaceEvent ¶ added in v0.3.0
func (c *Client) GetSpaceEvent(ctx context.Context, req *chatpb.GetSpaceEventRequest, opts ...gax.CallOption) (*chatpb.SpaceEvent, error)
GetSpaceEvent returns an event from a Google Chat space. The event payload (at https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_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.
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize) with an authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) appropriate for reading the requested data:
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with administrator approval (at https://support.google.com/a?p=chat-app-auth) in Developer Preview (at https://developers.google.com/workspace/preview) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.app.spaces https://www.googleapis.com/auth/chat.app.messages.readonly https://www.googleapis.com/auth/chat.app.memberships User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.spaces.readonly https://www.googleapis.com/auth/chat.spaces https://www.googleapis.com/auth/chat.messages.readonly https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.messages.reactions.readonly https://www.googleapis.com/auth/chat.messages.reactions https://www.googleapis.com/auth/chat.memberships.readonly https://www.googleapis.com/auth/chat.memberships
To get an event, the authenticated caller must be a member of the space.
For an example, see Get details about an event from a Google Chat space (at https://developers.google.com/workspace/chat/get-space-event).
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetSpaceEventRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetSpaceEventRequest.
}
resp, err := c.GetSpaceEvent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetSpaceNotificationSetting ¶ added in v0.12.0
func (c *Client) GetSpaceNotificationSetting(ctx context.Context, req *chatpb.GetSpaceNotificationSettingRequest, opts ...gax.CallOption) (*chatpb.SpaceNotificationSetting, error)
GetSpaceNotificationSetting gets the space notification setting. For an example, see Get the caller’s space notification setting (at https://developers.google.com/workspace/chat/get-space-notification-setting).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.users.spacesettings
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetSpaceNotificationSettingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetSpaceNotificationSettingRequest.
}
resp, err := c.GetSpaceNotificationSetting(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetSpaceReadState ¶
func (c *Client) GetSpaceReadState(ctx context.Context, req *chatpb.GetSpaceReadStateRequest, opts ...gax.CallOption) (*chatpb.SpaceReadState, error)
GetSpaceReadState 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 (at https://developers.google.com/workspace/chat/get-space-read-state).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.users.readstate.readonly https://www.googleapis.com/auth/chat.users.readstate
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetSpaceReadStateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetSpaceReadStateRequest.
}
resp, err := c.GetSpaceReadState(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetThreadReadState ¶
func (c *Client) GetThreadReadState(ctx context.Context, req *chatpb.GetThreadReadStateRequest, opts ...gax.CallOption) (*chatpb.ThreadReadState, error)
GetThreadReadState 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 (at https://developers.google.com/workspace/chat/get-thread-read-state).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.users.readstate.readonly https://www.googleapis.com/auth/chat.users.readstate
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.GetThreadReadStateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#GetThreadReadStateRequest.
}
resp, err := c.GetThreadReadState(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListCustomEmojis ¶ added in v0.13.0
func (c *Client) ListCustomEmojis(ctx context.Context, req *chatpb.ListCustomEmojisRequest, opts ...gax.CallOption) *CustomEmojiIterator
ListCustomEmojis lists custom emojis visible to the authenticated user.
Custom emojis are only available for Google Workspace accounts, and the administrator must turn custom emojis on for the organization. For more information, see Learn about custom emojis in Google Chat (at https://support.google.com/chat/answer/12800149) and Manage custom emoji permissions (at https://support.google.com/a/answer/12850085).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.customemojis.readonly https://www.googleapis.com/auth/chat.customemojis
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListCustomEmojisRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListCustomEmojisRequest.
}
it := c.ListCustomEmojis(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*chatpb.ListCustomEmojisResponse)
}
}
Example (All) ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListCustomEmojisRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListCustomEmojisRequest.
}
for resp, err := range c.ListCustomEmojis(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListMemberships ¶
func (c *Client) ListMemberships(ctx context.Context, req *chatpb.ListMembershipsRequest, opts ...gax.CallOption) *MembershipIterator
ListMemberships lists memberships in a space. For an example, see List users and Google Chat apps in a space (at https://developers.google.com/workspace/chat/list-members). Listing memberships with app authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, including its own. Listing memberships with User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) lists memberships in spaces that the authenticated user has access to.
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.bot
https://www.googleapis.com/auth/chat.app.memberships (requires
administrator approval (at https://support.google.com/a?p=chat-app-auth))
User
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.memberships.readonly
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.import (import mode spaces
only)
User authentication grants administrator privileges when an
administrator account authenticates, use_admin_access is true, and
one of the following authorization scopes is used:
https://www.googleapis.com/auth/chat.admin.memberships.readonly
https://www.googleapis.com/auth/chat.admin.memberships
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListMembershipsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListMembershipsRequest.
}
it := c.ListMemberships(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*chatpb.ListMembershipsResponse)
}
}
Example (All) ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListMembershipsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListMembershipsRequest.
}
for resp, err := range c.ListMemberships(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListMessages ¶
func (c *Client) ListMessages(ctx context.Context, req *chatpb.ListMessagesRequest, opts ...gax.CallOption) *MessageIterator
ListMessages lists messages in a space that the caller is a member of, including messages from blocked members and spaces. System messages, like those announcing new space members, aren’t included. 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 (at https://developers.google.com/workspace/chat/api/guides/v1/messages/list).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with administrator approval (at https://support.google.com/a?p=chat-app-auth) in Developer Preview (at https://developers.google.com/workspace/preview) with the authorization scope: https://www.googleapis.com/auth/chat.app.messages.readonly. When using this authentication scope, this method only returns public messages in a space. It doesn’t include private messages. User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.messages.readonly https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.import (import mode spaces only)
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListMessagesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListMessagesRequest.
}
it := c.ListMessages(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*chatpb.ListMessagesResponse)
}
}
Example (All) ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListMessagesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListMessagesRequest.
}
for resp, err := range c.ListMessages(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListReactions ¶
func (c *Client) ListReactions(ctx context.Context, req *chatpb.ListReactionsRequest, opts ...gax.CallOption) *ReactionIterator
ListReactions lists reactions to a message. For an example, see List reactions for a message (at https://developers.google.com/workspace/chat/list-reactions).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.messages.reactions.readonly https://www.googleapis.com/auth/chat.messages.reactions https://www.googleapis.com/auth/chat.messages.readonly https://www.googleapis.com/auth/chat.messages
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListReactionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListReactionsRequest.
}
it := c.ListReactions(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*chatpb.ListReactionsResponse)
}
}
Example (All) ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListReactionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListReactionsRequest.
}
for resp, err := range c.ListReactions(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListSpaceEvents ¶ added in v0.3.0
func (c *Client) ListSpaceEvents(ctx context.Context, req *chatpb.ListSpaceEventsRequest, opts ...gax.CallOption) *SpaceEventIterator
ListSpaceEvents lists events from a Google Chat space. For each event, the payload (at https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_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 empty Membership resource.
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize) with an authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) appropriate for reading the requested data:
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with administrator approval (at https://support.google.com/a?p=chat-app-auth) in Developer Preview (at https://developers.google.com/workspace/preview) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.app.spaces https://www.googleapis.com/auth/chat.app.messages.readonly https://www.googleapis.com/auth/chat.app.memberships User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.spaces.readonly https://www.googleapis.com/auth/chat.spaces https://www.googleapis.com/auth/chat.messages.readonly https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.messages.reactions.readonly https://www.googleapis.com/auth/chat.messages.reactions https://www.googleapis.com/auth/chat.memberships.readonly https://www.googleapis.com/auth/chat.memberships
To list events, the authenticated caller must be a member of the space.
For an example, see List events from a Google Chat space (at https://developers.google.com/workspace/chat/list-space-events).
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListSpaceEventsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListSpaceEventsRequest.
}
it := c.ListSpaceEvents(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*chatpb.ListSpaceEventsResponse)
}
}
Example (All) ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListSpaceEventsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListSpaceEventsRequest.
}
for resp, err := range c.ListSpaceEvents(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListSpaces ¶
func (c *Client) ListSpaces(ctx context.Context, req *chatpb.ListSpacesRequest, opts ...gax.CallOption) *SpaceIterator
ListSpaces 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 (at https://developers.google.com/workspace/chat/list-spaces).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: https://www.googleapis.com/auth/chat.bot User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.spaces.readonly https://www.googleapis.com/auth/chat.spaces
To list all named spaces by Google Workspace organization, use the spaces.search() (at https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) method using Workspace administrator privileges instead.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListSpacesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListSpacesRequest.
}
it := c.ListSpaces(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*chatpb.ListSpacesResponse)
}
}
Example (All) ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.ListSpacesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#ListSpacesRequest.
}
for resp, err := range c.ListSpaces(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) SearchSpaces ¶ added in v0.6.0
func (c *Client) SearchSpaces(ctx context.Context, req *chatpb.SearchSpacesRequest, opts ...gax.CallOption) *SpaceIterator
SearchSpaces returns a list of spaces in a Google Workspace organization based on an administrator’s search. In the request, set use_admin_access to true. For an example, see Search for and manage spaces (at https://developers.google.com/workspace/chat/search-manage-admin).
Requires user authentication with administrator privileges (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges) and one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.admin.spaces.readonly https://www.googleapis.com/auth/chat.admin.spaces
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.SearchSpacesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#SearchSpacesRequest.
}
it := c.SearchSpaces(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*chatpb.SearchSpacesResponse)
}
}
Example (All) ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.SearchSpacesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#SearchSpacesRequest.
}
for resp, err := range c.SearchSpaces(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) SetUpSpace ¶
func (c *Client) SetUpSpace(ctx context.Context, req *chatpb.SetUpSpaceRequest, opts ...gax.CallOption) (*chatpb.Space, error)
SetUpSpace 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 (at https://developers.google.com/workspace/chat/set-up-spaces).
To specify the human members to add, add memberships with the appropriate membership.member.name. 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.
To specify the Google groups to add, add memberships with the appropriate membership.group_member.name. To add or invite a Google group, use groups/{group}, where {group} is the id for the group from the Cloud Identity Groups API. For example, you can use Cloud Identity Groups lookup API (at https://cloud.google.com/identity/docs/reference/rest/v1/groups/lookup) to retrieve the ID 123456789 for group email group@example.com, then you can add the group to the space by setting the membership.group_member.name to groups/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 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 (at https://developers.google.com/workspace/chat/create-members).
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 (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.spaces.create https://www.googleapis.com/auth/chat.spaces
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.SetUpSpaceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#SetUpSpaceRequest.
}
resp, err := c.SetUpSpace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateMembership ¶
func (c *Client) UpdateMembership(ctx context.Context, req *chatpb.UpdateMembershipRequest, opts ...gax.CallOption) (*chatpb.Membership, error)
UpdateMembership updates a membership. For an example, see Update a user’s membership in a space (at https://developers.google.com/workspace/chat/update-members).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
with administrator
approval (at https://support.google.com/a?p=chat-app-auth) and the
authorization scope:
https://www.googleapis.com/auth/chat.app.memberships (only in
spaces the app created)
User
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.import (import mode spaces
only)
User authentication grants administrator privileges when an
administrator account authenticates, use_admin_access is true, and
the following authorization scope is used:
https://www.googleapis.com/auth/chat.admin.memberships
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.UpdateMembershipRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#UpdateMembershipRequest.
}
resp, err := c.UpdateMembership(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateMessage ¶
func (c *Client) UpdateMessage(ctx context.Context, req *chatpb.UpdateMessageRequest, opts ...gax.CallOption) (*chatpb.Message, error)
UpdateMessage 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 (at https://developers.google.com/workspace/chat/update-messages).
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope: https://www.googleapis.com/auth/chat.bot User authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.import (import mode spaces only)
When using app authentication, requests can only update messages created by the calling Chat app.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.UpdateMessageRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#UpdateMessageRequest.
}
resp, err := c.UpdateMessage(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateSpace ¶
func (c *Client) UpdateSpace(ctx context.Context, req *chatpb.UpdateSpaceRequest, opts ...gax.CallOption) (*chatpb.Space, error)
UpdateSpace updates a space. For an example, see Update a space (at https://developers.google.com/workspace/chat/update-spaces).
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.
Supports the following types of authentication (at https://developers.google.com/workspace/chat/authenticate-authorize):
App
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-app)
with administrator approval (at https://support.google.com/a?p=chat-app-auth)
and one of the following authorization scopes:
https://www.googleapis.com/auth/chat.app.spaces
User
authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user)
with one of the following authorization scopes:
https://www.googleapis.com/auth/chat.spaces
https://www.googleapis.com/auth/chat.import (import mode spaces
only)
User authentication grants administrator privileges when an
administrator account authenticates, use_admin_access is true, and
the following authorization scopes is used:
https://www.googleapis.com/auth/chat.admin.spaces
App authentication has the following limitations:
To update either space.predefined_permission_settings or space.permission_settings, the app must be the space creator. Updating the space.access_settings.audience is not supported for app authentication.
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.UpdateSpaceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#UpdateSpaceRequest.
}
resp, err := c.UpdateSpace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateSpaceNotificationSetting ¶ added in v0.12.0
func (c *Client) UpdateSpaceNotificationSetting(ctx context.Context, req *chatpb.UpdateSpaceNotificationSettingRequest, opts ...gax.CallOption) (*chatpb.SpaceNotificationSetting, error)
UpdateSpaceNotificationSetting updates the space notification setting. For an example, see Update the caller’s space notification setting (at https://developers.google.com/workspace/chat/update-space-notification-setting).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.users.spacesettings
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.UpdateSpaceNotificationSettingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#UpdateSpaceNotificationSettingRequest.
}
resp, err := c.UpdateSpaceNotificationSetting(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateSpaceReadState ¶
func (c *Client) UpdateSpaceReadState(ctx context.Context, req *chatpb.UpdateSpaceReadStateRequest, opts ...gax.CallOption) (*chatpb.SpaceReadState, error)
UpdateSpaceReadState 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 (at https://developers.google.com/workspace/chat/update-space-read-state).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the authorization scope (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.users.readstate
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.UpdateSpaceReadStateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#UpdateSpaceReadStateRequest.
}
resp, err := c.UpdateSpaceReadState(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UploadAttachment ¶
func (c *Client) UploadAttachment(ctx context.Context, req *chatpb.UploadAttachmentRequest, opts ...gax.CallOption) (*chatpb.UploadAttachmentResponse, error)
UploadAttachment uploads an attachment. For an example, see Upload media as a file attachment (at https://developers.google.com/workspace/chat/upload-media-attachments).
Requires user authentication (at https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes (at https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
https://www.googleapis.com/auth/chat.messages.create https://www.googleapis.com/auth/chat.messages https://www.googleapis.com/auth/chat.import (import mode spaces only)
You can upload attachments up to 200 MB. Certain file types aren’t supported. For details, see File types blocked by Google Chat (at https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat).
Example ¶
package main
import (
"context"
chat "cloud.google.com/go/chat/apiv1"
chatpb "cloud.google.com/go/chat/apiv1/chatpb"
)
func main() {
ctx := context.Background()
// 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://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := chat.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &chatpb.UploadAttachmentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/chat/apiv1/chatpb#UploadAttachmentRequest.
}
resp, err := c.UploadAttachment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type CustomEmojiIterator ¶ added in v0.13.0
type CustomEmojiIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*chatpb.CustomEmoji, nextPageToken string, err error)
// contains filtered or unexported fields
}
CustomEmojiIterator manages a stream of *chatpb.CustomEmoji.
func (*CustomEmojiIterator) All ¶ added in v0.13.0
func (it *CustomEmojiIterator) All() iter.Seq2[*chatpb.CustomEmoji, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*CustomEmojiIterator) Next ¶ added in v0.13.0
func (it *CustomEmojiIterator) Next() (*chatpb.CustomEmoji, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*CustomEmojiIterator) PageInfo ¶ added in v0.13.0
func (it *CustomEmojiIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type MembershipIterator ¶
type MembershipIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*chatpb.Membership, nextPageToken string, err error)
// contains filtered or unexported fields
}
MembershipIterator manages a stream of *chatpb.Membership.
func (*MembershipIterator) All ¶ added in v0.4.0
func (it *MembershipIterator) All() iter.Seq2[*chatpb.Membership, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*MembershipIterator) Next ¶
func (it *MembershipIterator) Next() (*chatpb.Membership, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*MembershipIterator) PageInfo ¶
func (it *MembershipIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type MessageIterator ¶
type MessageIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*chatpb.Message, nextPageToken string, err error)
// contains filtered or unexported fields
}
MessageIterator manages a stream of *chatpb.Message.
func (*MessageIterator) All ¶ added in v0.4.0
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*MessageIterator) Next ¶
func (it *MessageIterator) Next() (*chatpb.Message, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*MessageIterator) PageInfo ¶
func (it *MessageIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ReactionIterator ¶
type ReactionIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*chatpb.Reaction, nextPageToken string, err error)
// contains filtered or unexported fields
}
ReactionIterator manages a stream of *chatpb.Reaction.
func (*ReactionIterator) All ¶ added in v0.4.0
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ReactionIterator) Next ¶
func (it *ReactionIterator) Next() (*chatpb.Reaction, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ReactionIterator) PageInfo ¶
func (it *ReactionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SpaceEventIterator ¶ added in v0.3.0
type SpaceEventIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*chatpb.SpaceEvent, nextPageToken string, err error)
// contains filtered or unexported fields
}
SpaceEventIterator manages a stream of *chatpb.SpaceEvent.
func (*SpaceEventIterator) All ¶ added in v0.4.0
func (it *SpaceEventIterator) All() iter.Seq2[*chatpb.SpaceEvent, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SpaceEventIterator) Next ¶ added in v0.3.0
func (it *SpaceEventIterator) Next() (*chatpb.SpaceEvent, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*SpaceEventIterator) PageInfo ¶ added in v0.3.0
func (it *SpaceEventIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SpaceIterator ¶
type SpaceIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*chatpb.Space, nextPageToken string, err error)
// contains filtered or unexported fields
}
SpaceIterator manages a stream of *chatpb.Space.
func (*SpaceIterator) All ¶ added in v0.4.0
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SpaceIterator) Next ¶
func (it *SpaceIterator) Next() (*chatpb.Space, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*SpaceIterator) PageInfo ¶
func (it *SpaceIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.