Enables developers to build Chat apps and integrations on Google Chat Platform. v1
Package
@google-apps/chatConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of ChatServiceClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;
chatServiceStub
chatServiceStub?: Promise<{
[name: string]: Function;
}>;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
universeDomain
get universeDomain(): string;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
attachmentPath(space, message, attachment)
attachmentPath(space: string, message: string, attachment: string): string;
Return a fully-qualified attachment resource name string.
Parameters | |
---|---|
Name | Description |
space |
string
|
message |
string
|
attachment |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns | |
---|---|
Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
completeImportSpace(request, options)
completeImportSpace(request?: protos.google.chat.v1.ICompleteImportSpaceRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ICompleteImportSpaceResponse,
protos.google.chat.v1.ICompleteImportSpaceRequest | undefined,
{} | undefined
]>;
Completes the [import process](https://developers.google.com/workspace/chat/import-data) for the specified space and makes it visible to users. Requires app authentication and domain-wide delegation. For more information, see [Authorize Google Chat apps to import data](https://developers.google.com/workspace/chat/authorize-import).
Parameters | |
---|---|
Name | Description |
request |
ICompleteImportSpaceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ICompleteImportSpaceResponse,
protos.google.chat.v1.ICompleteImportSpaceRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing CompleteImportSpaceResponse. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the import mode space.
* Format: `spaces/{space}`
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callCompleteImportSpace() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.completeImportSpace(request);
console.log(response);
}
callCompleteImportSpace();
completeImportSpace(request, options, callback)
completeImportSpace(request: protos.google.chat.v1.ICompleteImportSpaceRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.ICompleteImportSpaceResponse, protos.google.chat.v1.ICompleteImportSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICompleteImportSpaceRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.ICompleteImportSpaceResponse, protos.google.chat.v1.ICompleteImportSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
completeImportSpace(request, callback)
completeImportSpace(request: protos.google.chat.v1.ICompleteImportSpaceRequest, callback: Callback<protos.google.chat.v1.ICompleteImportSpaceResponse, protos.google.chat.v1.ICompleteImportSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICompleteImportSpaceRequest
|
callback |
Callback<protos.google.chat.v1.ICompleteImportSpaceResponse, protos.google.chat.v1.ICompleteImportSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createMembership(request, options)
createMembership(request?: protos.google.chat.v1.ICreateMembershipRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMembership,
protos.google.chat.v1.ICreateMembershipRequest | undefined,
{} | undefined
]>;
Creates a human membership or app membership for the calling app. Creating memberships for other apps isn't supported. For an example, see [Invite or add a user or a Google Chat app to a space](https://developers.google.com/workspace/chat/create-members). When creating a membership, if the specified member has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified space. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
To specify the member to add, set the membership.member.name
in the CreateMembershipRequest
:
To add the calling app to a space or a direct message between two human users, use
users/app
. Unable to add other apps to the space.To add a human user, use
users/{user}
, where{user}
can be the email address for the user. For users in the same Workspace organization{user}
can also be theid
for the person from the People API, or theid
for the user in the Directory API. For example, if the People API Person profile ID foruser@example.com
is123456789
, you can add the user to the space by setting themembership.member.name
tousers/user@example.com
orusers/123456789
.
Parameters | |
---|---|
Name | Description |
request |
ICreateMembershipRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMembership,
protos.google.chat.v1.ICreateMembershipRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of the space for which to create the
* membership.
* Format: spaces/{space}
*/
// const parent = 'abc123'
/**
* Required. The membership relation to create.
* The `memberType` field must contain a user with the `user.name` and
* `user.type` fields populated. The server will assign a resource name
* and overwrite anything specified.
* When a Chat app creates a membership relation for a human user, it must use
* the `chat.memberships` scope, set `user.type` to `HUMAN`, and set
* `user.name` with format `users/{user}`, where `{user}` can be the email
* address for the user. For users in the same Workspace organization `{user}`
* can also be the `id` of the
* person (https://developers.google.com/people/api/rest/v1/people) from the
* People API, or the `id` for the user in the Directory API. For example, if
* the People API Person profile ID for `user@example.com` is `123456789`, you
* can add the user to the space by setting the `membership.member.name` to
* `users/user@example.com` or `users/123456789`. When a Chat app creates a
* membership relation for itself, it must use the `chat.memberships.app`
* scope, set `user.type` to `BOT`, and set `user.name` to `users/app`.
*/
// const membership = {}
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callCreateMembership() {
// Construct request
const request = {
parent,
membership,
};
// Run request
const response = await chatClient.createMembership(request);
console.log(response);
}
callCreateMembership();
createMembership(request, options, callback)
createMembership(request: protos.google.chat.v1.ICreateMembershipRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.ICreateMembershipRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateMembershipRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.ICreateMembershipRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createMembership(request, callback)
createMembership(request: protos.google.chat.v1.ICreateMembershipRequest, callback: Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.ICreateMembershipRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateMembershipRequest
|
callback |
Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.ICreateMembershipRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createMessage(request, options)
createMessage(request?: protos.google.chat.v1.ICreateMessageRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMessage,
protos.google.chat.v1.ICreateMessageRequest | undefined,
{} | undefined
]>;
Creates a message in a Google Chat space. For an example, see [Send a message](https://developers.google.com/workspace/chat/create-messages).
Calling this method requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and supports the following authentication types:
- For text messages, user authentication or app authentication are supported. - For card messages, only app authentication is supported. (Only Chat apps can create card messages.)
Parameters | |
---|---|
Name | Description |
request |
ICreateMessageRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMessage,
protos.google.chat.v1.ICreateMessageRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Message. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The resource name of the space in which to create a message.
* Format: `spaces/{space}`
*/
// const parent = 'abc123'
/**
* Required. Message body.
*/
// const message = {}
/**
* Optional. A unique request ID for this message. Specifying an existing
* request ID returns the message created with that ID instead of creating a
* new message.
*/
// const requestId = 'abc123'
/**
* Optional. Specifies whether a message starts a thread or replies to one.
* Only supported in named spaces.
*/
// const messageReplyOption = {}
/**
* Optional. A custom ID for a message. Lets Chat apps get, update, or delete
* a message without needing to store the system-assigned ID in the message's
* resource name (represented in the message `name` field).
* The value for this field must meet the following requirements:
* * Begins with `client-`. For example, `client-custom-name` is a valid
* custom ID, but `custom-name` is not.
* * Contains up to 63 characters and only lowercase letters, numbers, and
* hyphens.
* * Is unique within a space. A Chat app can't use the same custom ID for
* different messages.
* For details, see Name a
* message (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
*/
// const messageId = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callCreateMessage() {
// Construct request
const request = {
parent,
message,
};
// Run request
const response = await chatClient.createMessage(request);
console.log(response);
}
callCreateMessage();
createMessage(request, options, callback)
createMessage(request: protos.google.chat.v1.ICreateMessageRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.ICreateMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateMessageRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.ICreateMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createMessage(request, callback)
createMessage(request: protos.google.chat.v1.ICreateMessageRequest, callback: Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.ICreateMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateMessageRequest
|
callback |
Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.ICreateMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createReaction(request, options)
createReaction(request?: protos.google.chat.v1.ICreateReactionRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IReaction,
protos.google.chat.v1.ICreateReactionRequest | undefined,
{} | undefined
]>;
Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, see [Add a reaction to a message](https://developers.google.com/workspace/chat/create-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
ICreateReactionRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IReaction,
protos.google.chat.v1.ICreateReactionRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Reaction. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The message where the reaction is created.
* Format: `spaces/{space}/messages/{message}`
*/
// const parent = 'abc123'
/**
* Required. The reaction to create.
*/
// const reaction = {}
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callCreateReaction() {
// Construct request
const request = {
parent,
reaction,
};
// Run request
const response = await chatClient.createReaction(request);
console.log(response);
}
callCreateReaction();
createReaction(request, options, callback)
createReaction(request: protos.google.chat.v1.ICreateReactionRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IReaction, protos.google.chat.v1.ICreateReactionRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateReactionRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IReaction, protos.google.chat.v1.ICreateReactionRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createReaction(request, callback)
createReaction(request: protos.google.chat.v1.ICreateReactionRequest, callback: Callback<protos.google.chat.v1.IReaction, protos.google.chat.v1.ICreateReactionRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateReactionRequest
|
callback |
Callback<protos.google.chat.v1.IReaction, protos.google.chat.v1.ICreateReactionRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createSpace(request, options)
createSpace(request?: protos.google.chat.v1.ICreateSpaceRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.ICreateSpaceRequest | undefined,
{} | undefined
]>;
Creates a named space. Spaces grouped by topics aren't supported. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces).
If you receive the error message ALREADY_EXISTS
when creating a space, try a different displayName
. An existing space within the Google Workspace organization might already use this display name.
Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
ICreateSpaceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.ICreateSpaceRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The `displayName` and `spaceType` fields must be populated. Only
* `SpaceType.SPACE` is supported.
* 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.
* The space `name` is assigned on the server so anything specified in this
* field will be ignored.
*/
// const space = {}
/**
* Optional. A unique identifier for this request.
* A random UUID is recommended.
* Specifying an existing request ID returns the space created with that ID
* instead of creating a new space.
* Specifying an existing request ID from the same Chat app with a different
* authenticated user returns an error.
*/
// const requestId = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callCreateSpace() {
// Construct request
const request = {
space,
};
// Run request
const response = await chatClient.createSpace(request);
console.log(response);
}
callCreateSpace();
createSpace(request, options, callback)
createSpace(request: protos.google.chat.v1.ICreateSpaceRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.ICreateSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateSpaceRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.ICreateSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createSpace(request, callback)
createSpace(request: protos.google.chat.v1.ICreateSpaceRequest, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.ICreateSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateSpaceRequest
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.ICreateSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteMembership(request, options)
deleteMembership(request?: protos.google.chat.v1.IDeleteMembershipRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMembership,
protos.google.chat.v1.IDeleteMembershipRequest | undefined,
{} | undefined
]>;
Deletes a membership. For an example, see [Remove a user or a Google Chat app from a space](https://developers.google.com/workspace/chat/delete-members).
Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IDeleteMembershipRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMembership,
protos.google.chat.v1.IDeleteMembershipRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the membership to delete. Chat apps can delete
* human users' or their own memberships. Chat apps can't delete other apps'
* memberships.
* When deleting a human membership, requires the `chat.memberships` scope and
* `spaces/{space}/members/{member}` format. You can use the email as an
* alias for `{member}`. For example,
* `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the
* email of the Google Chat user.
* When deleting an app membership, requires the `chat.memberships.app` scope
* and `spaces/{space}/members/app` format.
* Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`.
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callDeleteMembership() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.deleteMembership(request);
console.log(response);
}
callDeleteMembership();
deleteMembership(request, options, callback)
deleteMembership(request: protos.google.chat.v1.IDeleteMembershipRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IDeleteMembershipRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteMembershipRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IDeleteMembershipRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteMembership(request, callback)
deleteMembership(request: protos.google.chat.v1.IDeleteMembershipRequest, callback: Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IDeleteMembershipRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteMembershipRequest
|
callback |
Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IDeleteMembershipRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteMessage(request, options)
deleteMessage(request?: protos.google.chat.v1.IDeleteMessageRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
protos.google.chat.v1.IDeleteMessageRequest | undefined,
{} | undefined
]>;
Deletes a message. For an example, see [Delete a message](https://developers.google.com/workspace/chat/delete-messages).
Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). When using app authentication, requests can only delete messages created by the calling Chat app.
Parameters | |
---|---|
Name | Description |
request |
IDeleteMessageRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.protobuf.IEmpty,
protos.google.chat.v1.IDeleteMessageRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the message.
* Format: `spaces/{space}/messages/{message}`
* If you've set a custom ID for your message, you can use the value from the
* `clientAssignedMessageId` field for `{message}`. For details, see Name a
* message
* (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
*/
// const name = 'abc123'
/**
* When `true`, deleting a message also deletes its threaded replies. When
* `false`, if a message has threaded replies, deletion fails.
* Only applies when authenticating as a
* user (https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
* Has no effect when authenticating as a Chat app
* (https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
*/
// const force = true
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callDeleteMessage() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.deleteMessage(request);
console.log(response);
}
callDeleteMessage();
deleteMessage(request, options, callback)
deleteMessage(request: protos.google.chat.v1.IDeleteMessageRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteMessageRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteMessage(request, callback)
deleteMessage(request: protos.google.chat.v1.IDeleteMessageRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteMessageRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteReaction(request, options)
deleteReaction(request?: protos.google.chat.v1.IDeleteReactionRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
protos.google.chat.v1.IDeleteReactionRequest | undefined,
{} | undefined
]>;
Deletes a reaction to a message. Only unicode emojis are supported. For an example, see [Delete a reaction](https://developers.google.com/workspace/chat/delete-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IDeleteReactionRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.protobuf.IEmpty,
protos.google.chat.v1.IDeleteReactionRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the reaction to delete.
* Format: `spaces/{space}/messages/{message}/reactions/{reaction}`
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callDeleteReaction() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.deleteReaction(request);
console.log(response);
}
callDeleteReaction();
deleteReaction(request, options, callback)
deleteReaction(request: protos.google.chat.v1.IDeleteReactionRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteReactionRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteReactionRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteReactionRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteReaction(request, callback)
deleteReaction(request: protos.google.chat.v1.IDeleteReactionRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteReactionRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteReactionRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteReactionRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteSpace(request, options)
deleteSpace(request?: protos.google.chat.v1.IDeleteSpaceRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
protos.google.chat.v1.IDeleteSpaceRequest | undefined,
{} | undefined
]>;
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](https://developers.google.com/workspace/chat/delete-spaces). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) from a user who has permission to delete the space.
Parameters | |
---|---|
Name | Description |
request |
IDeleteSpaceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.protobuf.IEmpty,
protos.google.chat.v1.IDeleteSpaceRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the space to delete.
* Format: `spaces/{space}`
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callDeleteSpace() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.deleteSpace(request);
console.log(response);
}
callDeleteSpace();
deleteSpace(request, options, callback)
deleteSpace(request: protos.google.chat.v1.IDeleteSpaceRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteSpaceRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteSpace(request, callback)
deleteSpace(request: protos.google.chat.v1.IDeleteSpaceRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteSpaceRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.chat.v1.IDeleteSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
findDirectMessage(request, options)
findDirectMessage(request?: protos.google.chat.v1.IFindDirectMessageRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.IFindDirectMessageRequest | undefined,
{} | undefined
]>;
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](/chat/api/guides/v1/spaces/find-direct-message).
With [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), returns the direct message space between the specified user and the authenticated user.
With [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), returns the direct message space between the specified user and the calling Chat app.
Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) or [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
Parameters | |
---|---|
Name | Description |
request |
IFindDirectMessageRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.IFindDirectMessageRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the user to find direct message with.
* Format: `users/{user}`, where `{user}` is either the `id` for the
* person (https://developers.google.com/people/api/rest/v1/people) from the
* People API, or the `id` for the
* user (https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
* in the Directory API. For example, if the People API profile ID is
* `123456789`, you can find a direct message with that person by using
* `users/123456789` as the `name`. When authenticated as a
* user (https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
* you can use the email as an alias for `{user}`. For example,
* `users/example@gmail.com` where `example@gmail.com` is the email of the
* Google Chat user.
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callFindDirectMessage() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.findDirectMessage(request);
console.log(response);
}
callFindDirectMessage();
findDirectMessage(request, options, callback)
findDirectMessage(request: protos.google.chat.v1.IFindDirectMessageRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IFindDirectMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IFindDirectMessageRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IFindDirectMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
findDirectMessage(request, callback)
findDirectMessage(request: protos.google.chat.v1.IFindDirectMessageRequest, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IFindDirectMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IFindDirectMessageRequest
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IFindDirectMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getAttachment(request, options)
getAttachment(request?: protos.google.chat.v1.IGetAttachmentRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IAttachment,
protos.google.chat.v1.IGetAttachmentRequest | undefined,
{} | undefined
]>;
Gets the metadata of a message attachment. The attachment data is fetched using the [media API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). For an example, see [Get metadata about a message attachment](https://developers.google.com/workspace/chat/get-media-attachments). Requires [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).
Parameters | |
---|---|
Name | Description |
request |
IGetAttachmentRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IAttachment,
protos.google.chat.v1.IGetAttachmentRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the attachment, in the form
* `spaces/* /messages/* /attachments/*`.
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callGetAttachment() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.getAttachment(request);
console.log(response);
}
callGetAttachment();
getAttachment(request, options, callback)
getAttachment(request: protos.google.chat.v1.IGetAttachmentRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IAttachment, protos.google.chat.v1.IGetAttachmentRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetAttachmentRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IAttachment, protos.google.chat.v1.IGetAttachmentRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getAttachment(request, callback)
getAttachment(request: protos.google.chat.v1.IGetAttachmentRequest, callback: Callback<protos.google.chat.v1.IAttachment, protos.google.chat.v1.IGetAttachmentRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetAttachmentRequest
|
callback |
Callback<protos.google.chat.v1.IAttachment, protos.google.chat.v1.IGetAttachmentRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getMembership(request, options)
getMembership(request?: protos.google.chat.v1.IGetMembershipRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMembership,
protos.google.chat.v1.IGetMembershipRequest | undefined,
{} | undefined
]>;
Returns details about a membership. For an example, see [Get details about a user's or Google Chat app's membership](https://developers.google.com/workspace/chat/get-members).
Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IGetMembershipRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMembership,
protos.google.chat.v1.IGetMembershipRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the membership to retrieve.
* To get the app's own membership, you can optionally use
* `spaces/{space}/members/app`.
* Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`
* When authenticated as a
* user (https://developers.google.com/workspace/chat/authenticate-authorize-chat-user),
* you can use the user's email as an alias for `{member}`. For example,
* `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the
* email of the Google Chat user.
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callGetMembership() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.getMembership(request);
console.log(response);
}
callGetMembership();
getMembership(request, options, callback)
getMembership(request: protos.google.chat.v1.IGetMembershipRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IGetMembershipRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetMembershipRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IGetMembershipRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getMembership(request, callback)
getMembership(request: protos.google.chat.v1.IGetMembershipRequest, callback: Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IGetMembershipRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetMembershipRequest
|
callback |
Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IGetMembershipRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getMessage(request, options)
getMessage(request?: protos.google.chat.v1.IGetMessageRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMessage,
protos.google.chat.v1.IGetMessageRequest | undefined,
{} | undefined
]>;
Returns details about a message. For an example, see [Get details about a message](https://developers.google.com/workspace/chat/get-messages).
Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Note: Might return a message from a blocked member or space.
Parameters | |
---|---|
Name | Description |
request |
IGetMessageRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMessage,
protos.google.chat.v1.IGetMessageRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Message. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the message.
* Format: `spaces/{space}/messages/{message}`
* If you've set a custom ID for your message, you can use the value from the
* `clientAssignedMessageId` field for `{message}`. For details, see Name a
* message
* (https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callGetMessage() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.getMessage(request);
console.log(response);
}
callGetMessage();
getMessage(request, options, callback)
getMessage(request: protos.google.chat.v1.IGetMessageRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.IGetMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetMessageRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.IGetMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getMessage(request, callback)
getMessage(request: protos.google.chat.v1.IGetMessageRequest, callback: Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.IGetMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetMessageRequest
|
callback |
Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.IGetMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
Type | Description |
void |
getSpace(request, options)
getSpace(request?: protos.google.chat.v1.IGetSpaceRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.IGetSpaceRequest | undefined,
{} | undefined
]>;
Returns details about a space. For an example, see [Get details about a space](https://developers.google.com/workspace/chat/get-spaces).
Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IGetSpaceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.IGetSpaceRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the space, in the form "spaces/*".
* Format: `spaces/{space}`
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callGetSpace() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.getSpace(request);
console.log(response);
}
callGetSpace();
getSpace(request, options, callback)
getSpace(request: protos.google.chat.v1.IGetSpaceRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IGetSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetSpaceRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IGetSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getSpace(request, callback)
getSpace(request: protos.google.chat.v1.IGetSpaceRequest, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IGetSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetSpaceRequest
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IGetSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getSpaceReadState(request, options)
getSpaceReadState(request?: protos.google.chat.v1.IGetSpaceReadStateRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ISpaceReadState,
protos.google.chat.v1.IGetSpaceReadStateRequest | undefined,
{} | undefined
]>;
Returns details about a user's read state within a space, used to identify read and unread messages.
Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IGetSpaceReadStateRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ISpaceReadState,
protos.google.chat.v1.IGetSpaceReadStateRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing SpaceReadState. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the space read state to retrieve.
* Only supports getting read state for the calling user.
* To refer to the calling user, set one of the following:
* - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`.
* - Their Workspace email address. For example,
* `users/user@example.com/spaces/{space}/spaceReadState`.
* - Their user id. For example,
* `users/123456789/spaces/{space}/spaceReadState`.
* Format: users/{user}/spaces/{space}/spaceReadState
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callGetSpaceReadState() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.getSpaceReadState(request);
console.log(response);
}
callGetSpaceReadState();
getSpaceReadState(request, options, callback)
getSpaceReadState(request: protos.google.chat.v1.IGetSpaceReadStateRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.ISpaceReadState, protos.google.chat.v1.IGetSpaceReadStateRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetSpaceReadStateRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.ISpaceReadState, protos.google.chat.v1.IGetSpaceReadStateRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getSpaceReadState(request, callback)
getSpaceReadState(request: protos.google.chat.v1.IGetSpaceReadStateRequest, callback: Callback<protos.google.chat.v1.ISpaceReadState, protos.google.chat.v1.IGetSpaceReadStateRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetSpaceReadStateRequest
|
callback |
Callback<protos.google.chat.v1.ISpaceReadState, protos.google.chat.v1.IGetSpaceReadStateRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getThreadReadState(request, options)
getThreadReadState(request?: protos.google.chat.v1.IGetThreadReadStateRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IThreadReadState,
protos.google.chat.v1.IGetThreadReadStateRequest | undefined,
{} | undefined
]>;
Returns details about a user's read state within a thread, used to identify read and unread messages.
Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IGetThreadReadStateRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IThreadReadState,
protos.google.chat.v1.IGetThreadReadStateRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ThreadReadState. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the thread read state to retrieve.
* Only supports getting read state for the calling user.
* To refer to the calling user, set one of the following:
* - The `me` alias. For example,
* `users/me/spaces/{space}/threads/{thread}/threadReadState`.
* - Their Workspace email address. For example,
* `users/user@example.com/spaces/{space}/threads/{thread}/threadReadState`.
* - Their user id. For example,
* `users/123456789/spaces/{space}/threads/{thread}/threadReadState`.
* Format: users/{user}/spaces/{space}/threads/{thread}/threadReadState
*/
// const name = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callGetThreadReadState() {
// Construct request
const request = {
name,
};
// Run request
const response = await chatClient.getThreadReadState(request);
console.log(response);
}
callGetThreadReadState();
getThreadReadState(request, options, callback)
getThreadReadState(request: protos.google.chat.v1.IGetThreadReadStateRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IThreadReadState, protos.google.chat.v1.IGetThreadReadStateRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetThreadReadStateRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IThreadReadState, protos.google.chat.v1.IGetThreadReadStateRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getThreadReadState(request, callback)
getThreadReadState(request: protos.google.chat.v1.IGetThreadReadStateRequest, callback: Callback<protos.google.chat.v1.IThreadReadState, protos.google.chat.v1.IGetThreadReadStateRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetThreadReadStateRequest
|
callback |
Callback<protos.google.chat.v1.IThreadReadState, protos.google.chat.v1.IGetThreadReadStateRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns | |
---|---|
Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
listMemberships(request, options)
listMemberships(request?: protos.google.chat.v1.IListMembershipsRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMembership[],
protos.google.chat.v1.IListMembershipsRequest | null,
protos.google.chat.v1.IListMembershipsResponse
]>;
Lists memberships in a space. For an example, see [List users and Google Chat apps in a space](https://developers.google.com/workspace/chat/list-members). Listing memberships with [app authentication](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](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) lists memberships in spaces that the authenticated user has access to.
Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IListMembershipsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMembership[],
protos.google.chat.v1.IListMembershipsRequest | null,
protos.google.chat.v1.IListMembershipsResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listMemberships(request, options, callback)
listMemberships(request: protos.google.chat.v1.IListMembershipsRequest, options: CallOptions, callback: PaginationCallback<protos.google.chat.v1.IListMembershipsRequest, protos.google.chat.v1.IListMembershipsResponse | null | undefined, protos.google.chat.v1.IMembership>): void;
Parameters | |
---|---|
Name | Description |
request |
IListMembershipsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.chat.v1.IListMembershipsRequest, protos.google.chat.v1.IListMembershipsResponse | null | undefined, protos.google.chat.v1.IMembership>
|
Returns | |
---|---|
Type | Description |
void |
listMemberships(request, callback)
listMemberships(request: protos.google.chat.v1.IListMembershipsRequest, callback: PaginationCallback<protos.google.chat.v1.IListMembershipsRequest, protos.google.chat.v1.IListMembershipsResponse | null | undefined, protos.google.chat.v1.IMembership>): void;
Parameters | |
---|---|
Name | Description |
request |
IListMembershipsRequest
|
callback |
PaginationCallback<protos.google.chat.v1.IListMembershipsRequest, protos.google.chat.v1.IListMembershipsResponse | null | undefined, protos.google.chat.v1.IMembership>
|
Returns | |
---|---|
Type | Description |
void |
listMembershipsAsync(request, options)
listMembershipsAsync(request?: protos.google.chat.v1.IListMembershipsRequest, options?: CallOptions): AsyncIterable<protos.google.chat.v1.IMembership>;
Equivalent to listMemberships
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
IListMembershipsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.chat.v1.IMembership> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/** * 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. * TODO(developer): Uncomment these variables before running the sample. */ /** * Required. The resource name of the space for which to fetch a membership * list. * Format: spaces/{space} */ // const parent = 'abc123' /** * Optional. The maximum number of memberships to return. The service might * return fewer than this value. * If unspecified, at most 100 memberships are returned. * The maximum value is 1000. If you use a value more than 1000, it's * automatically changed to 1000. * Negative values return an `INVALID_ARGUMENT` error. */ // const pageSize = 1234 /** * Optional. A page token, received from a previous call to list memberships. * Provide this parameter to retrieve the subsequent page. * When paginating, all other parameters provided should match the call that * provided the page token. Passing different values to the other parameters * might lead to unexpected results. */ // const pageToken = 'abc123' /** * Optional. A query filter. * You can filter memberships by a member's role * (`role` (https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.members#membershiprole)) * and type * (`member.type` (https://developers.google.com/workspace/chat/api/reference/rest/v1/User#type)). * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. * To filter by type, set `member.type` to `HUMAN` or `BOT`. * To filter by both role and type, use the `AND` operator. To filter by * either role or type, use the `OR` operator. * For example, the following queries are valid: *
* role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" * member.type = "HUMAN" AND role = "ROLE_MANAGER" *
- The following queries are invalid:
- member.type = "HUMAN" AND member.type = "BOT"
- role = "ROLE_MANAGER" AND role = "ROLE_MEMBER"
- Invalid queries are rejected by the server with an
INVALID_ARGUMENT
- error. / // const filter = 'abc123' /*
- Optional. When
true
, also returns memberships associated with a- Google Group google.chat.v1.Membership.group_member, in
- addition to other types of memberships. If a
- filter google.chat.v1.ListMembershipsRequest.filter is set,
- Google Group google.chat.v1.Membership.group_member
- memberships that don't match the filter criteria aren't returned. / // const showGroups = true /*
- Optional. When
true
, also returns memberships associated with- invited google.chat.v1.Membership.MembershipState.INVITED members, in
- addition to other types of memberships. If a
- filter is set,
- invited google.chat.v1.Membership.MembershipState.INVITED memberships
- that don't match the filter criteria aren't returned.
- Currently requires user
authentication (https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). */ // const showInvited = true
// Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client const chatClient = new ChatServiceClient();
async function callListMemberships() { // Construct request const request = { parent, };
// Run request const iterable = chatClient.listMembershipsAsync(request); for await (const response of iterable) { console.log(response); } }
callListMemberships();
listMembershipsStream(request, options)
listMembershipsStream(request?: protos.google.chat.v1.IListMembershipsRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
IListMembershipsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform |
{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
listMessages(request, options)
listMessages(request?: protos.google.chat.v1.IListMessagesRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMessage[],
protos.google.chat.v1.IListMessagesRequest | null,
protos.google.chat.v1.IListMessagesResponse
]>;
Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IListMessagesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMessage[],
protos.google.chat.v1.IListMessagesRequest | null,
protos.google.chat.v1.IListMessagesResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of Message. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listMessages(request, options, callback)
listMessages(request: protos.google.chat.v1.IListMessagesRequest, options: CallOptions, callback: PaginationCallback<protos.google.chat.v1.IListMessagesRequest, protos.google.chat.v1.IListMessagesResponse | null | undefined, protos.google.chat.v1.IMessage>): void;
Parameters | |
---|---|
Name | Description |
request |
IListMessagesRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.chat.v1.IListMessagesRequest, protos.google.chat.v1.IListMessagesResponse | null | undefined, protos.google.chat.v1.IMessage>
|
Returns | |
---|---|
Type | Description |
void |
listMessages(request, callback)
listMessages(request: protos.google.chat.v1.IListMessagesRequest, callback: PaginationCallback<protos.google.chat.v1.IListMessagesRequest, protos.google.chat.v1.IListMessagesResponse | null | undefined, protos.google.chat.v1.IMessage>): void;
Parameters | |
---|---|
Name | Description |
request |
IListMessagesRequest
|
callback |
PaginationCallback<protos.google.chat.v1.IListMessagesRequest, protos.google.chat.v1.IListMessagesResponse | null | undefined, protos.google.chat.v1.IMessage>
|
Returns | |
---|---|
Type | Description |
void |
listMessagesAsync(request, options)
listMessagesAsync(request?: protos.google.chat.v1.IListMessagesRequest, options?: CallOptions): AsyncIterable<protos.google.chat.v1.IMessage>;
Equivalent to listMessages
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
IListMessagesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.chat.v1.IMessage> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Message. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/** * 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. * TODO(developer): Uncomment these variables before running the sample. */ /** * Required. The resource name of the space to list messages from. * Format: `spaces/{space}` */ // const parent = 'abc123' /** * The maximum number of messages returned. The service might return fewer * messages than this value. * If unspecified, at most 25 are returned. * The maximum value is 1000. If you use a value more than 1000, it's * automatically changed to 1000. * Negative values return an `INVALID_ARGUMENT` error. */ // const pageSize = 1234 /** * Optional, if resuming from a previous query. * A page token received from a previous list messages call. Provide this * parameter to retrieve the subsequent page. * When paginating, all other parameters provided should match the call that * provided the page token. Passing different values to the other parameters * might lead to unexpected results. */ // const pageToken = 'abc123' /** * A query filter. * You can filter messages by date (`create_time`) and thread (`thread.name`). * To filter messages by the date they were created, specify the `create_time` * with a timestamp in RFC-3339 (https://www.rfc-editor.org/rfc/rfc3339) * format and double quotation marks. For example, * `"2023-04-21T11:30:00-04:00"`. You can use the greater than operator `>` to * list messages that were created after a timestamp, or the less than * operator `<` to="" list="" messages="" that="" were="" created="" before="" a="" timestamp.="" to="" *="" filter="" messages="" within="" a="" time="" interval,="" use="" the="" `and`="" operator="" between="" two="" *="" timestamps.="" *="" to="" filter="" by="" thread,="" specify="" the="" `thread.name`,="" formatted="" as="" *="" `spaces/{space}/threads/{thread}`.="" you="" can="" only="" specify="" one="" *="" `thread.name`="" per="" query.="" *="" to="" filter="" by="" both="" thread="" and="" date,="" use="" the="" `and`="" operator="" in="" your="" query.="" *="" for="" example,="" the="" following="" queries="" are="" valid:="" *="">
* create_time > "2012-04-21T11:30:00-04:00" * create_time > "2012-04-21T11:30:00-04:00" AND * thread.name = spaces/AAAAAAAAAAA/threads/123 * create_time > "2012-04-21T11:30:00+00:00" AND * create_time < "2013-01-01t00:00:00+00:00"="" and="" *="" thread.name="spaces/AAAAAAAAAAA/threads/123" *="" thread.name="spaces/AAAAAAAAAAA/threads/123" *="">
- Invalid queries are rejected by the server with an
INVALID_ARGUMENT
- error. / // const filter = 'abc123' /*
- Optional, if resuming from a previous query.
- How the list of messages is ordered. Specify a value to order by an
- ordering operation. Valid ordering operation values are as follows:
ASC
for ascending.
DESC
for descending.- The default ordering is
create_time ASC
. / // const orderBy = 'abc123' /*- Whether to include deleted messages. Deleted messages include deleted time
and metadata about their deletion, but message content is unavailable. */ // const showDeleted = true
// Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client const chatClient = new ChatServiceClient();
async function callListMessages() { // Construct request const request = { parent, };
// Run request const iterable = chatClient.listMessagesAsync(request); for await (const response of iterable) { console.log(response); } }
callListMessages();
listMessagesStream(request, options)
listMessagesStream(request?: protos.google.chat.v1.IListMessagesRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
IListMessagesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform |
{Stream} An object stream which emits an object representing Message on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
listReactions(request, options)
listReactions(request?: protos.google.chat.v1.IListReactionsRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IReaction[],
protos.google.chat.v1.IListReactionsRequest | null,
protos.google.chat.v1.IListReactionsResponse
]>;
Lists reactions to a message. For an example, see [List reactions for a message](https://developers.google.com/workspace/chat/list-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IListReactionsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IReaction[],
protos.google.chat.v1.IListReactionsRequest | null,
protos.google.chat.v1.IListReactionsResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of Reaction. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listReactions(request, options, callback)
listReactions(request: protos.google.chat.v1.IListReactionsRequest, options: CallOptions, callback: PaginationCallback<protos.google.chat.v1.IListReactionsRequest, protos.google.chat.v1.IListReactionsResponse | null | undefined, protos.google.chat.v1.IReaction>): void;
Parameters | |
---|---|
Name | Description |
request |
IListReactionsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.chat.v1.IListReactionsRequest, protos.google.chat.v1.IListReactionsResponse | null | undefined, protos.google.chat.v1.IReaction>
|
Returns | |
---|---|
Type | Description |
void |
listReactions(request, callback)
listReactions(request: protos.google.chat.v1.IListReactionsRequest, callback: PaginationCallback<protos.google.chat.v1.IListReactionsRequest, protos.google.chat.v1.IListReactionsResponse | null | undefined, protos.google.chat.v1.IReaction>): void;
Parameters | |
---|---|
Name | Description |
request |
IListReactionsRequest
|
callback |
PaginationCallback<protos.google.chat.v1.IListReactionsRequest, protos.google.chat.v1.IListReactionsResponse | null | undefined, protos.google.chat.v1.IReaction>
|
Returns | |
---|---|
Type | Description |
void |
listReactionsAsync(request, options)
listReactionsAsync(request?: protos.google.chat.v1.IListReactionsRequest, options?: CallOptions): AsyncIterable<protos.google.chat.v1.IReaction>;
Equivalent to listReactions
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
IListReactionsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.chat.v1.IReaction> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Reaction. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/** * 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. * TODO(developer): Uncomment these variables before running the sample. */ /** * Required. The message users reacted to. * Format: `spaces/{space}/messages/{message}` */ // const parent = 'abc123' /** * Optional. The maximum number of reactions returned. The service can return * fewer reactions than this value. If unspecified, the default value is 25. * The maximum value is 200; values above 200 are changed to 200. */ // const pageSize = 1234 /** * Optional. (If resuming from a previous query.) * A page token received from a previous list reactions call. Provide this * to retrieve the subsequent page. * When paginating, the filter value should match the call that provided the * page token. Passing a different value might lead to unexpected results. */ // const pageToken = 'abc123' /** * Optional. A query filter. * You can filter reactions by * emoji (https://developers.google.com/workspace/chat/api/reference/rest/v1/Emoji) * (either `emoji.unicode` or `emoji.custom_emoji.uid`) and * user (https://developers.google.com/workspace/chat/api/reference/rest/v1/User) * (`user.name`). * To filter reactions for multiple emojis or users, join similar fields * with the `OR` operator, such as `emoji.unicode = "🙂" OR emoji.unicode = * "👍"` and `user.name = "users/AAAAAA" OR user.name = "users/BBBBBB"`. * To filter reactions by emoji and user, use the `AND` operator, such as * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. * If your query uses both `AND` and `OR`, group them with parentheses. * For example, the following queries are valid: *
* user.name = "users/{user}" * emoji.unicode = "🙂" * emoji.custom_emoji.uid = "{uid}" * emoji.unicode = "🙂" OR emoji.unicode = "👍" * emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" * emoji.unicode = "🙂" AND user.name = "users/{user}" * (emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}") * AND user.name = "users/{user}" *
- The following queries are invalid:
- emoji.unicode = "🙂" AND emoji.unicode = "👍"
- emoji.unicode = "🙂" AND emoji.custom_emoji.uid = "{uid}"
- emoji.unicode = "🙂" OR user.name = "users/{user}"
- emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}" OR
- user.name = "users/{user}"
- emoji.unicode = "🙂" OR emoji.custom_emoji.uid = "{uid}"
- AND user.name = "users/{user}"
- Invalid queries are rejected by the server with an
INVALID_ARGUMENT
error. */ // const filter = 'abc123'
// Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client const chatClient = new ChatServiceClient();
async function callListReactions() { // Construct request const request = { parent, };
// Run request const iterable = chatClient.listReactionsAsync(request); for await (const response of iterable) { console.log(response); } }
callListReactions();
listReactionsStream(request, options)
listReactionsStream(request?: protos.google.chat.v1.IListReactionsRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
IListReactionsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform |
{Stream} An object stream which emits an object representing Reaction on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
listSpaces(request, options)
listSpaces(request?: protos.google.chat.v1.IListSpacesRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ISpace[],
protos.google.chat.v1.IListSpacesRequest | null,
protos.google.chat.v1.IListSpacesResponse
]>;
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](https://developers.google.com/workspace/chat/list-spaces).
Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed until the first message is sent.
Parameters | |
---|---|
Name | Description |
request |
IListSpacesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ISpace[],
protos.google.chat.v1.IListSpacesRequest | null,
protos.google.chat.v1.IListSpacesResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listSpaces(request, options, callback)
listSpaces(request: protos.google.chat.v1.IListSpacesRequest, options: CallOptions, callback: PaginationCallback<protos.google.chat.v1.IListSpacesRequest, protos.google.chat.v1.IListSpacesResponse | null | undefined, protos.google.chat.v1.ISpace>): void;
Parameters | |
---|---|
Name | Description |
request |
IListSpacesRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.chat.v1.IListSpacesRequest, protos.google.chat.v1.IListSpacesResponse | null | undefined, protos.google.chat.v1.ISpace>
|
Returns | |
---|---|
Type | Description |
void |
listSpaces(request, callback)
listSpaces(request: protos.google.chat.v1.IListSpacesRequest, callback: PaginationCallback<protos.google.chat.v1.IListSpacesRequest, protos.google.chat.v1.IListSpacesResponse | null | undefined, protos.google.chat.v1.ISpace>): void;
Parameters | |
---|---|
Name | Description |
request |
IListSpacesRequest
|
callback |
PaginationCallback<protos.google.chat.v1.IListSpacesRequest, protos.google.chat.v1.IListSpacesResponse | null | undefined, protos.google.chat.v1.ISpace>
|
Returns | |
---|---|
Type | Description |
void |
listSpacesAsync(request, options)
listSpacesAsync(request?: protos.google.chat.v1.IListSpacesRequest, options?: CallOptions): AsyncIterable<protos.google.chat.v1.ISpace>;
Equivalent to listSpaces
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
IListSpacesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.chat.v1.ISpace> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/** * 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. * TODO(developer): Uncomment these variables before running the sample. */ /** * Optional. The maximum number of spaces to return. The service might return * fewer than this value. * If unspecified, at most 100 spaces are returned. * The maximum value is 1000. If you use a value more than 1000, it's * automatically changed to 1000. * Negative values return an `INVALID_ARGUMENT` error. */ // const pageSize = 1234 /** * Optional. A page token, received from a previous list spaces call. * Provide this parameter to retrieve the subsequent page. * When paginating, the filter value should match the call that provided the * page token. Passing a different value may lead to unexpected results. */ // const pageToken = 'abc123' /** * Optional. A query filter. * You can filter spaces by the space type * (`space_type` (https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). * To filter by space type, you must specify valid enum value, such as * `SPACE` or `GROUP_CHAT` (the `space_type` can't be * `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` * operator. * For example, the following queries are valid: *
* space_type = "SPACE" * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" *
- Invalid queries are rejected by the server with an
INVALID_ARGUMENT
error. */ // const filter = 'abc123'
// Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client const chatClient = new ChatServiceClient();
async function callListSpaces() { // Construct request const request = { };
// Run request const iterable = chatClient.listSpacesAsync(request); for await (const response of iterable) { console.log(response); } }
callListSpaces();
listSpacesStream(request, options)
listSpacesStream(request?: protos.google.chat.v1.IListSpacesRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
IListSpacesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform |
{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
matchAttachmentFromAttachmentName(attachmentName)
matchAttachmentFromAttachmentName(attachmentName: string): string | number;
Parse the attachment from Attachment resource.
Parameter | |
---|---|
Name | Description |
attachmentName |
string
A fully-qualified path representing Attachment resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the attachment. |
matchMemberFromMembershipName(membershipName)
matchMemberFromMembershipName(membershipName: string): string | number;
Parse the member from Membership resource.
Parameter | |
---|---|
Name | Description |
membershipName |
string
A fully-qualified path representing Membership resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the member. |
matchMessageFromAttachmentName(attachmentName)
matchMessageFromAttachmentName(attachmentName: string): string | number;
Parse the message from Attachment resource.
Parameter | |
---|---|
Name | Description |
attachmentName |
string
A fully-qualified path representing Attachment resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the message. |
matchMessageFromMessageName(messageName)
matchMessageFromMessageName(messageName: string): string | number;
Parse the message from Message resource.
Parameter | |
---|---|
Name | Description |
messageName |
string
A fully-qualified path representing Message resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the message. |
matchMessageFromQuotedMessageMetadataName(quotedMessageMetadataName)
matchMessageFromQuotedMessageMetadataName(quotedMessageMetadataName: string): string | number;
Parse the message from QuotedMessageMetadata resource.
Parameter | |
---|---|
Name | Description |
quotedMessageMetadataName |
string
A fully-qualified path representing QuotedMessageMetadata resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the message. |
matchMessageFromReactionName(reactionName)
matchMessageFromReactionName(reactionName: string): string | number;
Parse the message from Reaction resource.
Parameter | |
---|---|
Name | Description |
reactionName |
string
A fully-qualified path representing Reaction resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the message. |
matchQuotedMessageMetadataFromQuotedMessageMetadataName(quotedMessageMetadataName)
matchQuotedMessageMetadataFromQuotedMessageMetadataName(quotedMessageMetadataName: string): string | number;
Parse the quoted_message_metadata from QuotedMessageMetadata resource.
Parameter | |
---|---|
Name | Description |
quotedMessageMetadataName |
string
A fully-qualified path representing QuotedMessageMetadata resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the quoted_message_metadata. |
matchReactionFromReactionName(reactionName)
matchReactionFromReactionName(reactionName: string): string | number;
Parse the reaction from Reaction resource.
Parameter | |
---|---|
Name | Description |
reactionName |
string
A fully-qualified path representing Reaction resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the reaction. |
matchSpaceFromAttachmentName(attachmentName)
matchSpaceFromAttachmentName(attachmentName: string): string | number;
Parse the space from Attachment resource.
Parameter | |
---|---|
Name | Description |
attachmentName |
string
A fully-qualified path representing Attachment resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchSpaceFromMembershipName(membershipName)
matchSpaceFromMembershipName(membershipName: string): string | number;
Parse the space from Membership resource.
Parameter | |
---|---|
Name | Description |
membershipName |
string
A fully-qualified path representing Membership resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchSpaceFromMessageName(messageName)
matchSpaceFromMessageName(messageName: string): string | number;
Parse the space from Message resource.
Parameter | |
---|---|
Name | Description |
messageName |
string
A fully-qualified path representing Message resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchSpaceFromQuotedMessageMetadataName(quotedMessageMetadataName)
matchSpaceFromQuotedMessageMetadataName(quotedMessageMetadataName: string): string | number;
Parse the space from QuotedMessageMetadata resource.
Parameter | |
---|---|
Name | Description |
quotedMessageMetadataName |
string
A fully-qualified path representing QuotedMessageMetadata resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchSpaceFromReactionName(reactionName)
matchSpaceFromReactionName(reactionName: string): string | number;
Parse the space from Reaction resource.
Parameter | |
---|---|
Name | Description |
reactionName |
string
A fully-qualified path representing Reaction resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchSpaceFromSpaceName(spaceName)
matchSpaceFromSpaceName(spaceName: string): string | number;
Parse the space from Space resource.
Parameter | |
---|---|
Name | Description |
spaceName |
string
A fully-qualified path representing Space resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchSpaceFromSpaceReadStateName(spaceReadStateName)
matchSpaceFromSpaceReadStateName(spaceReadStateName: string): string | number;
Parse the space from SpaceReadState resource.
Parameter | |
---|---|
Name | Description |
spaceReadStateName |
string
A fully-qualified path representing SpaceReadState resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchSpaceFromThreadName(threadName)
matchSpaceFromThreadName(threadName: string): string | number;
Parse the space from Thread resource.
Parameter | |
---|---|
Name | Description |
threadName |
string
A fully-qualified path representing Thread resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchSpaceFromThreadReadStateName(threadReadStateName)
matchSpaceFromThreadReadStateName(threadReadStateName: string): string | number;
Parse the space from ThreadReadState resource.
Parameter | |
---|---|
Name | Description |
threadReadStateName |
string
A fully-qualified path representing ThreadReadState resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the space. |
matchThreadFromThreadName(threadName)
matchThreadFromThreadName(threadName: string): string | number;
Parse the thread from Thread resource.
Parameter | |
---|---|
Name | Description |
threadName |
string
A fully-qualified path representing Thread resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the thread. |
matchThreadFromThreadReadStateName(threadReadStateName)
matchThreadFromThreadReadStateName(threadReadStateName: string): string | number;
Parse the thread from ThreadReadState resource.
Parameter | |
---|---|
Name | Description |
threadReadStateName |
string
A fully-qualified path representing ThreadReadState resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the thread. |
matchUserFromSpaceReadStateName(spaceReadStateName)
matchUserFromSpaceReadStateName(spaceReadStateName: string): string | number;
Parse the user from SpaceReadState resource.
Parameter | |
---|---|
Name | Description |
spaceReadStateName |
string
A fully-qualified path representing SpaceReadState resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the user. |
matchUserFromThreadReadStateName(threadReadStateName)
matchUserFromThreadReadStateName(threadReadStateName: string): string | number;
Parse the user from ThreadReadState resource.
Parameter | |
---|---|
Name | Description |
threadReadStateName |
string
A fully-qualified path representing ThreadReadState resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the user. |
membershipPath(space, member)
membershipPath(space: string, member: string): string;
Return a fully-qualified membership resource name string.
Parameters | |
---|---|
Name | Description |
space |
string
|
member |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
messagePath(space, message)
messagePath(space: string, message: string): string;
Return a fully-qualified message resource name string.
Parameters | |
---|---|
Name | Description |
space |
string
|
message |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
quotedMessageMetadataPath(space, message, quotedMessageMetadata)
quotedMessageMetadataPath(space: string, message: string, quotedMessageMetadata: string): string;
Return a fully-qualified quotedMessageMetadata resource name string.
Parameters | |
---|---|
Name | Description |
space |
string
|
message |
string
|
quotedMessageMetadata |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
reactionPath(space, message, reaction)
reactionPath(space: string, message: string, reaction: string): string;
Return a fully-qualified reaction resource name string.
Parameters | |
---|---|
Name | Description |
space |
string
|
message |
string
|
reaction |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
setUpSpace(request, options)
setUpSpace(request?: protos.google.chat.v1.ISetUpSpaceRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.ISetUpSpaceRequest | undefined,
{} | undefined
]>;
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](https://developers.google.com/workspace/chat/set-up-spaces).
To specify the human members to add, add memberships with the appropriate member.name
in the SetUpSpaceRequest
. To add a human user, use users/{user}
, where {user}
can be the email address for the user. For users in the same Workspace organization {user}
can also be the id
for the person from the People API, or the id
for the user in the Directory API. For example, if the People API Person profile ID for user@example.com
is 123456789
, you can add the user to the space by setting the membership.member.name
to users/user@example.com
or users/123456789
.
For a space or group chat, if the caller blocks or is blocked by some members, then those members aren't added to the created space.
To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created.
To create a DM between the calling user and the calling app, set Space.singleUserBotDm
to true
and don't specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see [Invite or add a user or app to a space](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](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
ISetUpSpaceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.ISetUpSpaceRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The `Space.spaceType` field is required.
* To create a space, set `Space.spaceType` to `SPACE` and set
* `Space.displayName`. 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.
* To create a group chat, set `Space.spaceType` to
* `GROUP_CHAT`. Don't set `Space.displayName`.
* To create a 1:1 conversation between humans,
* set `Space.spaceType` to `DIRECT_MESSAGE` and set
* `Space.singleUserBotDm` to `false`. Don't set `Space.displayName` or
* `Space.spaceDetails`.
* To create an 1:1 conversation between a human and the calling Chat app, set
* `Space.spaceType` to `DIRECT_MESSAGE` and
* `Space.singleUserBotDm` to `true`. Don't set `Space.displayName` or
* `Space.spaceDetails`.
* If a `DIRECT_MESSAGE` space already exists, that space is returned instead
* of creating a new space.
*/
// const space = {}
/**
* Optional. A unique identifier for this request.
* A random UUID is recommended.
* Specifying an existing request ID returns the space created with that ID
* instead of creating a new space.
* Specifying an existing request ID from the same Chat app with a different
* authenticated user returns an error.
*/
// const requestId = 'abc123'
/**
* Optional. The Google Chat users to invite to join the space. Omit the
* calling user, as they are added automatically.
* The set currently allows up to 20 memberships (in addition to the caller).
* The `Membership.member` field must contain a `user` with `name` populated
* (format: `users/{user}`) and `type` set to `User.Type.HUMAN`. You can only
* add human users when setting up a space (adding Chat apps is only supported
* for direct message setup with the calling app). You can also add members
* using the user's email as an alias for {user}. For example, the `user.name`
* can be `users/example@gmail.com`." To invite Gmail users or users from
* external Google Workspace domains, user's email must be used for
* `{user}`.
* Optional when setting `Space.spaceType` to `SPACE`.
* Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at
* least two memberships.
* Required when setting `Space.spaceType` to `DIRECT_MESSAGE` with a human
* user, along with exactly one membership.
* Must be empty when creating a 1:1 conversation between a human and the
* calling Chat app (when setting `Space.spaceType` to
* `DIRECT_MESSAGE` and `Space.singleUserBotDm` to `true`).
*/
// const memberships = [1,2,3,4]
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callSetUpSpace() {
// Construct request
const request = {
space,
};
// Run request
const response = await chatClient.setUpSpace(request);
console.log(response);
}
callSetUpSpace();
setUpSpace(request, options, callback)
setUpSpace(request: protos.google.chat.v1.ISetUpSpaceRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.ISetUpSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ISetUpSpaceRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.ISetUpSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
setUpSpace(request, callback)
setUpSpace(request: protos.google.chat.v1.ISetUpSpaceRequest, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.ISetUpSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ISetUpSpaceRequest
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.ISetUpSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
spacePath(space)
spacePath(space: string): string;
Return a fully-qualified space resource name string.
Parameter | |
---|---|
Name | Description |
space |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
spaceReadStatePath(user, space)
spaceReadStatePath(user: string, space: string): string;
Return a fully-qualified spaceReadState resource name string.
Parameters | |
---|---|
Name | Description |
user |
string
|
space |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
threadPath(space, thread)
threadPath(space: string, thread: string): string;
Return a fully-qualified thread resource name string.
Parameters | |
---|---|
Name | Description |
space |
string
|
thread |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
threadReadStatePath(user, space, thread)
threadReadStatePath(user: string, space: string, thread: string): string;
Return a fully-qualified threadReadState resource name string.
Parameters | |
---|---|
Name | Description |
user |
string
|
space |
string
|
thread |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
updateMembership(request, options)
updateMembership(request?: protos.google.chat.v1.IUpdateMembershipRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMembership,
protos.google.chat.v1.IUpdateMembershipRequest | undefined,
{} | undefined
]>;
Updates a membership. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users).
Parameters | |
---|---|
Name | Description |
request |
IUpdateMembershipRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMembership,
protos.google.chat.v1.IUpdateMembershipRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The membership to update. Only fields specified by `update_mask`
* are updated.
*/
// const membership = {}
/**
* Required. The field paths to update. Separate multiple values with commas
* or use `*` to update all field paths.
* Currently supported field paths:
* - `role`
*/
// const updateMask = {}
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callUpdateMembership() {
// Construct request
const request = {
membership,
updateMask,
};
// Run request
const response = await chatClient.updateMembership(request);
console.log(response);
}
callUpdateMembership();
updateMembership(request, options, callback)
updateMembership(request: protos.google.chat.v1.IUpdateMembershipRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IUpdateMembershipRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateMembershipRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IUpdateMembershipRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateMembership(request, callback)
updateMembership(request: protos.google.chat.v1.IUpdateMembershipRequest, callback: Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IUpdateMembershipRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateMembershipRequest
|
callback |
Callback<protos.google.chat.v1.IMembership, protos.google.chat.v1.IUpdateMembershipRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateMessage(request, options)
updateMessage(request?: protos.google.chat.v1.IUpdateMessageRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IMessage,
protos.google.chat.v1.IUpdateMessageRequest | undefined,
{} | undefined
]>;
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](https://developers.google.com/workspace/chat/update-messages).
Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). When using app authentication, requests can only update messages created by the calling Chat app.
Parameters | |
---|---|
Name | Description |
request |
IUpdateMessageRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IMessage,
protos.google.chat.v1.IUpdateMessageRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Message. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Message with fields updated.
*/
// const message = {}
/**
* Required. The field paths to update. Separate multiple values with commas
* or use `*` to update all field paths.
* Currently supported field paths:
* - `text`
* - `attachment`
* - `cards` (Requires app
* authentication (/chat/api/guides/auth/service-accounts).)
* - `cards_v2` (Requires app
* authentication (/chat/api/guides/auth/service-accounts).)
* - `accessory_widgets` (Requires app
* authentication (/chat/api/guides/auth/service-accounts).)
*/
// const updateMask = {}
/**
* Optional. If `true` and the message isn't found, a new message is created
* and `updateMask` is ignored. The specified message ID must be
* client-assigned (https://developers.google.com/workspace/chat/create-messages#name_a_created_message)
* or the request fails.
*/
// const allowMissing = true
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callUpdateMessage() {
// Construct request
const request = {
message,
};
// Run request
const response = await chatClient.updateMessage(request);
console.log(response);
}
callUpdateMessage();
updateMessage(request, options, callback)
updateMessage(request: protos.google.chat.v1.IUpdateMessageRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.IUpdateMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateMessageRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.IUpdateMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateMessage(request, callback)
updateMessage(request: protos.google.chat.v1.IUpdateMessageRequest, callback: Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.IUpdateMessageRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateMessageRequest
|
callback |
Callback<protos.google.chat.v1.IMessage, protos.google.chat.v1.IUpdateMessageRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateSpace(request, options)
updateSpace(request?: protos.google.chat.v1.IUpdateSpaceRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.IUpdateSpaceRequest | undefined,
{} | undefined
]>;
Updates a space. For an example, see [Update a space](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.
Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IUpdateSpaceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ISpace,
protos.google.chat.v1.IUpdateSpaceRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Space with fields to be updated. `Space.name` must be
* populated in the form of `spaces/{space}`. Only fields
* specified by `update_mask` are updated.
*/
// const space = {}
/**
* Required. The updated field paths, comma separated if there are
* multiple.
* Currently supported field paths:
* - `display_name` (Only supports changing the display name of a space with
* the `SPACE` type, or when also including the `space_type` mask to change a
* `GROUP_CHAT` space type to `SPACE`. Trying to update the display name of a
* `GROUP_CHAT` or a `DIRECT_MESSAGE` space results in an invalid argument
* error. If you receive the error message `ALREADY_EXISTS` when updating the
* `displayName`, try a different `displayName`. An existing space within the
* Google Workspace organization might already use this display name.)
* - `space_type` (Only supports changing a `GROUP_CHAT` space type to
* `SPACE`. Include `display_name` together
* with `space_type` in the update mask and ensure that the specified space
* has a non-empty display name and the `SPACE` space type. Including the
* `space_type` mask and the `SPACE` type in the specified space when updating
* the display name is optional if the existing space already has the `SPACE`
* type. Trying to update the space type in other ways results in an invalid
* argument error).
* - `space_details`
* - `space_history_state` (Supports turning history on or off for the
* space (https://support.google.com/chat/answer/7664687) if the organization
* allows users to change their history
* setting (https://support.google.com/a/answer/7664184).
* Warning: mutually exclusive with all other field paths.)
* - Developer Preview: `access_settings.audience` (Supports changing the
* access setting (https://support.google.com/chat/answer/11971020) of a
* space. If no audience is specified in the access setting, the space's
* access setting is updated to restricted. Warning: mutually exclusive with
* all other field paths.)
*/
// const updateMask = {}
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callUpdateSpace() {
// Construct request
const request = {
space,
};
// Run request
const response = await chatClient.updateSpace(request);
console.log(response);
}
callUpdateSpace();
updateSpace(request, options, callback)
updateSpace(request: protos.google.chat.v1.IUpdateSpaceRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IUpdateSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateSpaceRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IUpdateSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateSpace(request, callback)
updateSpace(request: protos.google.chat.v1.IUpdateSpaceRequest, callback: Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IUpdateSpaceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateSpaceRequest
|
callback |
Callback<protos.google.chat.v1.ISpace, protos.google.chat.v1.IUpdateSpaceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateSpaceReadState(request, options)
updateSpaceReadState(request?: protos.google.chat.v1.IUpdateSpaceReadStateRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.ISpaceReadState,
protos.google.chat.v1.IUpdateSpaceReadStateRequest | undefined,
{} | undefined
]>;
Updates a user's read state within a space, used to identify read and unread messages.
Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
Parameters | |
---|---|
Name | Description |
request |
IUpdateSpaceReadStateRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.ISpaceReadState,
protos.google.chat.v1.IUpdateSpaceReadStateRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing SpaceReadState. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The space read state and fields to update.
* Only supports updating read state for the calling user.
* To refer to the calling user, set one of the following:
* - The `me` alias. For example, `users/me/spaces/{space}/spaceReadState`.
* - Their Workspace email address. For example,
* `users/user@example.com/spaces/{space}/spaceReadState`.
* - Their user id. For example,
* `users/123456789/spaces/{space}/spaceReadState`.
* Format: users/{user}/spaces/{space}/spaceReadState
*/
// const spaceReadState = {}
/**
* Required. The field paths to update. Currently supported field paths:
* - `last_read_time`
* When the `last_read_time` is before the latest message create time, the
* space appears as unread in the UI.
* To mark the space as read, set `last_read_time` to any value later (larger)
* than the latest message create time. The `last_read_time` is coerced to
* match the latest message create time. Note that the space read state only
* affects the read state of messages that are visible in the space's
* top-level conversation. Replies in threads are unaffected by this
* timestamp, and instead rely on the thread read state.
*/
// const updateMask = {}
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callUpdateSpaceReadState() {
// Construct request
const request = {
spaceReadState,
updateMask,
};
// Run request
const response = await chatClient.updateSpaceReadState(request);
console.log(response);
}
callUpdateSpaceReadState();
updateSpaceReadState(request, options, callback)
updateSpaceReadState(request: protos.google.chat.v1.IUpdateSpaceReadStateRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.ISpaceReadState, protos.google.chat.v1.IUpdateSpaceReadStateRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateSpaceReadStateRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.ISpaceReadState, protos.google.chat.v1.IUpdateSpaceReadStateRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
updateSpaceReadState(request, callback)
updateSpaceReadState(request: protos.google.chat.v1.IUpdateSpaceReadStateRequest, callback: Callback<protos.google.chat.v1.ISpaceReadState, protos.google.chat.v1.IUpdateSpaceReadStateRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUpdateSpaceReadStateRequest
|
callback |
Callback<protos.google.chat.v1.ISpaceReadState, protos.google.chat.v1.IUpdateSpaceReadStateRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
uploadAttachment(request, options)
uploadAttachment(request?: protos.google.chat.v1.IUploadAttachmentRequest, options?: CallOptions): Promise<[
protos.google.chat.v1.IUploadAttachmentResponse,
protos.google.chat.v1.IUploadAttachmentRequest | undefined,
{} | undefined
]>;
Uploads an attachment. For an example, see [Upload media as a file attachment](https://developers.google.com/workspace/chat/upload-media-attachments). Requires user [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
You can upload attachments up to 200 MB. Certain file types aren't supported. For details, see [File types blocked by Google Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat).
Parameters | |
---|---|
Name | Description |
request |
IUploadAttachmentRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.chat.v1.IUploadAttachmentResponse,
protos.google.chat.v1.IUploadAttachmentRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing UploadAttachmentResponse. Please see the documentation for more details and examples. |
/**
* 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.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the Chat space in which the attachment is
* uploaded. Format "spaces/{space}".
*/
// const parent = 'abc123'
/**
* Required. The filename of the attachment, including the file extension.
*/
// const filename = 'abc123'
// Imports the Chat library
const {ChatServiceClient} = require('@google-apps/chat').v1;
// Instantiates a client
const chatClient = new ChatServiceClient();
async function callUploadAttachment() {
// Construct request
const request = {
parent,
filename,
};
// Run request
const response = await chatClient.uploadAttachment(request);
console.log(response);
}
callUploadAttachment();
uploadAttachment(request, options, callback)
uploadAttachment(request: protos.google.chat.v1.IUploadAttachmentRequest, options: CallOptions, callback: Callback<protos.google.chat.v1.IUploadAttachmentResponse, protos.google.chat.v1.IUploadAttachmentRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUploadAttachmentRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.chat.v1.IUploadAttachmentResponse, protos.google.chat.v1.IUploadAttachmentRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
uploadAttachment(request, callback)
uploadAttachment(request: protos.google.chat.v1.IUploadAttachmentRequest, callback: Callback<protos.google.chat.v1.IUploadAttachmentResponse, protos.google.chat.v1.IUploadAttachmentRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IUploadAttachmentRequest
|
callback |
Callback<protos.google.chat.v1.IUploadAttachmentResponse, protos.google.chat.v1.IUploadAttachmentRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |