diff --git a/packages/google-chat/.eslintrc.json b/packages/google-chat/.eslintrc.json index 78215349546..3e8d97ccb39 100644 --- a/packages/google-chat/.eslintrc.json +++ b/packages/google-chat/.eslintrc.json @@ -1,3 +1,4 @@ { - "extends": "./node_modules/gts" + "extends": "./node_modules/gts", + "root": true } diff --git a/packages/google-chat/README.md b/packages/google-chat/README.md index 2d4b65c0c8b..80c39879dc5 100644 --- a/packages/google-chat/README.md +++ b/packages/google-chat/README.md @@ -62,11 +62,13 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ | create membership | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.create_membership.js) | | create message | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.create_message.js) | | create reaction | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.create_reaction.js) | +| create section | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.create_section.js) | | create space | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.create_space.js) | | delete custom emoji | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.delete_custom_emoji.js) | | delete membership | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.delete_membership.js) | | delete message | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.delete_message.js) | | delete reaction | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.delete_reaction.js) | +| delete section | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.delete_section.js) | | delete space | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.delete_space.js) | | find direct message | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.find_direct_message.js) | | get attachment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.get_attachment.js) | @@ -82,12 +84,17 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ | list memberships | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_memberships.js) | | list messages | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_messages.js) | | list reactions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_reactions.js) | +| list section items | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_section_items.js) | +| list sections | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_sections.js) | | list space events | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_space_events.js) | | list spaces | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_spaces.js) | +| move section item | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.move_section_item.js) | +| position section | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.position_section.js) | | search spaces | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.search_spaces.js) | | set up space | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.set_up_space.js) | | update membership | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.update_membership.js) | | update message | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.update_message.js) | +| update section | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.update_section.js) | | update space | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.update_space.js) | | update space notification setting | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.update_space_notification_setting.js) | | update space read state | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.update_space_read_state.js) | diff --git a/packages/google-chat/protos/google/chat/v1/chat_service.proto b/packages/google-chat/protos/google/chat/v1/chat_service.proto index 9bd027c2576..afc37c0bbce 100644 --- a/packages/google-chat/protos/google/chat/v1/chat_service.proto +++ b/packages/google-chat/protos/google/chat/v1/chat_service.proto @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import "google/chat/v1/attachment.proto"; import "google/chat/v1/membership.proto"; import "google/chat/v1/message.proto"; import "google/chat/v1/reaction.proto"; +import "google/chat/v1/section.proto"; import "google/chat/v1/space.proto"; import "google/chat/v1/space_event.proto"; import "google/chat/v1/space_notification_setting.proto"; @@ -51,9 +52,11 @@ service ChatService { "https://www.googleapis.com/auth/chat.admin.spaces.readonly," "https://www.googleapis.com/auth/chat.app.delete," "https://www.googleapis.com/auth/chat.app.memberships," + "https://www.googleapis.com/auth/chat.app.memberships.readonly," "https://www.googleapis.com/auth/chat.app.messages.readonly," "https://www.googleapis.com/auth/chat.app.spaces," "https://www.googleapis.com/auth/chat.app.spaces.create," + "https://www.googleapis.com/auth/chat.app.spaces.readonly," "https://www.googleapis.com/auth/chat.bot," "https://www.googleapis.com/auth/chat.customemojis," "https://www.googleapis.com/auth/chat.customemojis.readonly," @@ -73,6 +76,8 @@ service ChatService { "https://www.googleapis.com/auth/chat.spaces.readonly," "https://www.googleapis.com/auth/chat.users.readstate," "https://www.googleapis.com/auth/chat.users.readstate.readonly," + "https://www.googleapis.com/auth/chat.users.sections," + "https://www.googleapis.com/auth/chat.users.sections.readonly," "https://www.googleapis.com/auth/chat.users.spacesettings"; // Creates a message in a Google Chat space. For an example, see [Send a @@ -142,9 +147,8 @@ service ChatService { // - [App // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) // with [administrator - // approval](https://support.google.com/a?p=chat-app-auth) in - // [Developer Preview](https://developers.google.com/workspace/preview) - // with the authorization scope: + // approval](https://support.google.com/a?p=chat-app-auth) + // with the authorization scope: // - `https://www.googleapis.com/auth/chat.app.messages.readonly`. When // using this authentication scope, this method only returns public // messages in a space. It doesn't include private messages. @@ -253,8 +257,7 @@ service ChatService { // that invoke the Chat app. // - `https://www.googleapis.com/auth/chat.app.messages.readonly` // with [administrator - // approval](https://support.google.com/a?p=chat-app-auth) (available in - // [Developer Preview](https://developers.google.com/workspace/preview)). + // approval](https://support.google.com/a?p=chat-app-auth). // When using this authentication scope, // this method returns details about a public message in a space. // @@ -1074,12 +1077,13 @@ service ChatService { // - [App // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) // with [administrator - // approval](https://support.google.com/a?p=chat-app-auth) in - // [Developer Preview](https://developers.google.com/workspace/preview) - // with one of the following authorization scopes: + // approval](https://support.google.com/a?p=chat-app-auth) + // with one of the following authorization scopes: // - `https://www.googleapis.com/auth/chat.app.spaces` + // - `https://www.googleapis.com/auth/chat.app.spaces.readonly` // - `https://www.googleapis.com/auth/chat.app.messages.readonly` // - `https://www.googleapis.com/auth/chat.app.memberships` + // - `https://www.googleapis.com/auth/chat.app.memberships.readonly` // // - [User // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) @@ -1123,12 +1127,13 @@ service ChatService { // - [App // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) // with [administrator - // approval](https://support.google.com/a?p=chat-app-auth) in - // [Developer Preview](https://developers.google.com/workspace/preview) - // with one of the following authorization scopes: + // approval](https://support.google.com/a?p=chat-app-auth) + // with one of the following authorization scopes: // - `https://www.googleapis.com/auth/chat.app.spaces` + // - `https://www.googleapis.com/auth/chat.app.spaces.readonly` // - `https://www.googleapis.com/auth/chat.app.messages.readonly` // - `https://www.googleapis.com/auth/chat.app.memberships` + // - `https://www.googleapis.com/auth/chat.app.memberships.readonly` // // - [User // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) @@ -1191,4 +1196,139 @@ service ChatService { option (google.api.method_signature) = "space_notification_setting,update_mask"; } + + // Creates a section in Google Chat. Sections help users group conversations + // and customize the list of spaces displayed in Chat navigation panel. Only + // sections of type `CUSTOM_SECTION` can be created. For details, see [Create + // and organize sections in Google + // Chat](https://support.google.com/chat/answer/16059854). + // + // Requires [user + // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + // with the [authorization + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + // + // - `https://www.googleapis.com/auth/chat.users.sections` + rpc CreateSection(CreateSectionRequest) returns (Section) { + option (google.api.http) = { + post: "/v1/{parent=users/*}/sections" + body: "section" + }; + option (google.api.method_signature) = "parent,section"; + } + + // Deletes a section of type `CUSTOM_SECTION`. + // + // If the section contains items, such as spaces, the items are moved to + // Google Chat's default sections and are not deleted. + // + // For details, see [Create and organize sections in Google + // Chat](https://support.google.com/chat/answer/16059854). + // + // Requires [user + // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + // with the [authorization + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + // + // - `https://www.googleapis.com/auth/chat.users.sections` + rpc DeleteSection(DeleteSectionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=users/*/sections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a section. Only sections of type `CUSTOM_SECTION` can be updated. + // For details, see [Create and organize sections in Google + // Chat](https://support.google.com/chat/answer/16059854). + // + // Requires [user + // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + // with the [authorization + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + // + // - `https://www.googleapis.com/auth/chat.users.sections` + rpc UpdateSection(UpdateSectionRequest) returns (Section) { + option (google.api.http) = { + patch: "/v1/{section.name=users/*/sections/*}" + body: "section" + }; + option (google.api.method_signature) = "section,update_mask"; + } + + // Lists sections available to the Chat user. Sections help users group their + // conversations and customize the list of spaces displayed in Chat + // navigation panel. For details, see [Create and organize sections in Google + // Chat](https://support.google.com/chat/answer/16059854). + // + // Requires [user + // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + // with the [authorization + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + // + // - `https://www.googleapis.com/auth/chat.users.sections` + // - `https://www.googleapis.com/auth/chat.users.sections.readonly` + rpc ListSections(ListSectionsRequest) returns (ListSectionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=users/*}/sections" + }; + option (google.api.method_signature) = "parent"; + } + + // Changes the sort order of a section. For details, see [Create and organize + // sections in Google Chat](https://support.google.com/chat/answer/16059854). + // + // Requires [user + // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + // with the [authorization + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + // + // - `https://www.googleapis.com/auth/chat.users.sections` + rpc PositionSection(PositionSectionRequest) + returns (PositionSectionResponse) { + option (google.api.http) = { + post: "/v1/{name=users/*/sections/*}:position" + body: "*" + }; + } + + // Lists items in a section. + // + // Only spaces can be section items. For details, see [Create and organize + // sections in Google Chat](https://support.google.com/chat/answer/16059854). + // + // Requires [user + // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + // with the [authorization + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + // + // - `https://www.googleapis.com/auth/chat.users.sections` + // - `https://www.googleapis.com/auth/chat.users.sections.readonly` + rpc ListSectionItems(ListSectionItemsRequest) + returns (ListSectionItemsResponse) { + option (google.api.http) = { + get: "/v1/{parent=users/*/sections/*}/items" + }; + option (google.api.method_signature) = "parent"; + } + + // Moves an item from one section to another. For example, if a section + // contains spaces, this method can be used to move a space to a different + // section. For details, see [Create and organize sections in Google + // Chat](https://support.google.com/chat/answer/16059854). + // + // Requires [user + // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + // with the [authorization + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + // + // - `https://www.googleapis.com/auth/chat.users.sections` + rpc MoveSectionItem(MoveSectionItemRequest) + returns (MoveSectionItemResponse) { + option (google.api.http) = { + post: "/v1/{name=users/*/sections/*/items/*}:move" + body: "*" + }; + option (google.api.method_signature) = "name,target_section"; + } } diff --git a/packages/google-chat/protos/google/chat/v1/section.proto b/packages/google-chat/protos/google/chat/v1/section.proto new file mode 100644 index 00000000000..2fdbf2e5c0b --- /dev/null +++ b/packages/google-chat/protos/google/chat/v1/section.proto @@ -0,0 +1,344 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.chat.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Apps.Chat.V1"; +option go_package = "cloud.google.com/go/chat/apiv1/chatpb;chatpb"; +option java_multiple_files = true; +option java_outer_classname = "SectionProto"; +option java_package = "com.google.chat.v1"; +option objc_class_prefix = "DYNAPIProto"; +option php_namespace = "Google\\Apps\\Chat\\V1"; +option ruby_package = "Google::Apps::Chat::V1"; +option (google.api.resource_definition) = { + type: "chat.googleapis.com/User" + pattern: "users/{user}" +}; + +// Represents a [section](https://support.google.com/chat/answer/16059854) in +// Google Chat. Sections help users organize their spaces. There are two types +// of sections: +// +// 1. **System Sections:** These are predefined sections managed by Google +// Chat. +// Their resource names are fixed, and they cannot be created, deleted, or +// have their `display_name` modified. Examples include: +// * `users/{user}/sections/default-direct-messages` +// * `users/{user}/sections/default-spaces` +// * `users/{user}/sections/default-apps` +// +// 2. **Custom Sections:** These are sections created and managed by the user. +// Creating a custom section using `CreateSection` **requires** a +// `display_name`. Custom sections can be updated using `UpdateSection` and +// deleted using `DeleteSection`. +message Section { + option (google.api.resource) = { + type: "chat.googleapis.com/Section" + pattern: "users/{user}/sections/{section}" + plural: "sections" + singular: "section" + }; + + // Section types. + enum SectionType { + // Unspecified section type. + SECTION_TYPE_UNSPECIFIED = 0; + + // Custom section. + CUSTOM_SECTION = 1; + + // Default section containing + // [DIRECT_MESSAGE](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype) + // between two human users or + // [GROUP_CHAT](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype) + // spaces that don't belong to any custom section. + DEFAULT_DIRECT_MESSAGES = 2; + + // Default spaces that don't belong to any custom section. + DEFAULT_SPACES = 3; + + // Default section containing a user's installed apps. + DEFAULT_APPS = 6; + } + + // Identifier. Resource name of the section. + // + // For system sections, the section ID is a constant string: + // + // - DEFAULT_DIRECT_MESSAGES: `users/{user}/sections/default-direct-messages` + // - DEFAULT_SPACES: `users/{user}/sections/default-spaces` + // - DEFAULT_APPS: `users/{user}/sections/default-apps` + // + // Format: `users/{user}/sections/{section}` + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Optional. The section's display name. Only populated for sections of type + // `CUSTOM_SECTION`. Supports up to 80 characters. Required when creating a + // `CUSTOM_SECTION`. + string display_name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The order of the section in relation to other sections. + // Sections with a lower `sort_order` value appear before sections with a + // higher value. + int32 sort_order = 3; + + // Required. The type of the section. + SectionType type = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// A user's defined section item. This is used to represent section items, such +// as spaces, grouped under a section. +message SectionItem { + option (google.api.resource) = { + type: "chat.googleapis.com/SectionItem" + pattern: "users/{user}/sections/{section}/items/{item}" + plural: "sectionItems" + singular: "sectionItem" + }; + + // Identifier. The resource name of the section item. + // + // Format: `users/{user}/sections/{section}/items/{item}` + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. The section item. + oneof item { + // Optional. The space resource name. + // + // Format: `spaces/{space}` + string space = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "chat.googleapis.com/Space" } + ]; + } +} + +// Request message for creating a section. +message CreateSectionRequest { + // Required. The parent resource name where the section is created. + // + // Format: `users/{user}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "chat.googleapis.com/User" } + ]; + + // Required. The section to create. + Section section = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for deleting a section. +// [Developer Preview](https://developers.google.com/workspace/preview). +message DeleteSectionRequest { + // Required. The name of the section to delete. + // + // Format: `users/{user}/sections/{section}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "chat.googleapis.com/Section" } + ]; +} + +// Request message for updating a section. +message UpdateSectionRequest { + // Required. The section to update. + Section section = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to specify which fields to update. + // + // Currently supported field paths: + // + // - `display_name` + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for listing sections. +message ListSectionsRequest { + // Required. The parent, which is the user resource name that owns this + // collection of sections. Only supports listing sections for the calling + // user. To refer to the calling user, set one of the following: + // + // - The `me` alias. For example, `users/me`. + // + // - Their Workspace email address. For example, `users/user@example.com`. + // + // - Their user id. For example, `users/123456789`. + // + // Format: `users/{user}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "chat.googleapis.com/User" } + ]; + + // Optional. The maximum number of sections to return. The service may return + // fewer than this value. + // + // If unspecified, at most 10 sections will be returned. + // + // The maximum value is 100. If you use a value more than 100, it's + // automatically changed to 100. + // + // Negative values return an `INVALID_ARGUMENT` error. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous list sections call. + // Provide this 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. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for listing sections. +message ListSectionsResponse { + // The sections from the specified user. + repeated Section sections = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for positioning a section. +message PositionSectionRequest { + // The position of the section. + enum Position { + // Unspecified position. + POSITION_UNSPECIFIED = 0; + + // Start of the list of sections. + START = 1; + + // End of the list of sections. + END = 2; + } + + // Required. The resource name of the section to position. + // + // Format: `users/{user}/sections/{section}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "chat.googleapis.com/Section" } + ]; + + // Required. The new position of the section. + oneof position { + // Optional. The absolute position of the section in the list of sections. + // The position must be greater than 0. If the position is greater than the + // number of sections, the section will be appended to the end of the list. + // This operation inserts the section at the given position and shifts the + // original section at that position, and those below it, to the next + // position. + int32 sort_order = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The relative position of the section in the list of sections. + Position relative_position = 3 [(google.api.field_behavior) = OPTIONAL]; + } +} + +// Response message for positioning a section. +message PositionSectionResponse { + // The updated section. + Section section = 1; +} + +// Request message for listing section items. +message ListSectionItemsRequest { + // Required. The parent, which is the section resource name that owns this + // collection of section items. Only supports listing section items for the + // calling user. + // + // When you're filtering by space, use the wildcard `-` to search across all + // sections. For example, `users/{user}/sections/-`. + // + // Format: `users/{user}/sections/{section}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "chat.googleapis.com/Section" } + ]; + + // Optional. The maximum number of section items to return. The service may + // return fewer than this value. + // + // If unspecified, at most 10 section items will be returned. + // + // The maximum value is 100. If you use a value more than 100, it's + // automatically changed to 100. + // + // Negative values return an `INVALID_ARGUMENT` error. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous list section items call. + // Provide this 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. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A query filter. + // + // Currently only supports filtering by space. + // + // For example, `space = spaces/{space}`. + // + // Invalid queries are rejected with an `INVALID_ARGUMENT` error. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for listing section items. +message ListSectionItemsResponse { + // The section items from the specified section. + repeated SectionItem section_items = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. If + // this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for moving a section item across sections. +message MoveSectionItemRequest { + // Required. The resource name of the section item to move. + // + // Format: `users/{user}/sections/{section}/items/{item}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "chat.googleapis.com/SectionItem" + } + ]; + + // Required. The resource name of the section to move the section item to. + // + // Format: `users/{user}/sections/{section}` + string target_section = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "chat.googleapis.com/Section" } + ]; +} + +// Response message for moving a section item. +message MoveSectionItemResponse { + // The updated section item. + SectionItem section_item = 1; +} diff --git a/packages/google-chat/protos/protos.d.ts b/packages/google-chat/protos/protos.d.ts index 9caa4f1b038..960c8a88bf6 100644 --- a/packages/google-chat/protos/protos.d.ts +++ b/packages/google-chat/protos/protos.d.ts @@ -14738,6 +14738,104 @@ export namespace google { * @returns Promise */ public updateSpaceNotificationSetting(request: google.chat.v1.IUpdateSpaceNotificationSettingRequest): Promise; + + /** + * Calls CreateSection. + * @param request CreateSectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Section + */ + public createSection(request: google.chat.v1.ICreateSectionRequest, callback: google.chat.v1.ChatService.CreateSectionCallback): void; + + /** + * Calls CreateSection. + * @param request CreateSectionRequest message or plain object + * @returns Promise + */ + public createSection(request: google.chat.v1.ICreateSectionRequest): Promise; + + /** + * Calls DeleteSection. + * @param request DeleteSectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteSection(request: google.chat.v1.IDeleteSectionRequest, callback: google.chat.v1.ChatService.DeleteSectionCallback): void; + + /** + * Calls DeleteSection. + * @param request DeleteSectionRequest message or plain object + * @returns Promise + */ + public deleteSection(request: google.chat.v1.IDeleteSectionRequest): Promise; + + /** + * Calls UpdateSection. + * @param request UpdateSectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Section + */ + public updateSection(request: google.chat.v1.IUpdateSectionRequest, callback: google.chat.v1.ChatService.UpdateSectionCallback): void; + + /** + * Calls UpdateSection. + * @param request UpdateSectionRequest message or plain object + * @returns Promise + */ + public updateSection(request: google.chat.v1.IUpdateSectionRequest): Promise; + + /** + * Calls ListSections. + * @param request ListSectionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSectionsResponse + */ + public listSections(request: google.chat.v1.IListSectionsRequest, callback: google.chat.v1.ChatService.ListSectionsCallback): void; + + /** + * Calls ListSections. + * @param request ListSectionsRequest message or plain object + * @returns Promise + */ + public listSections(request: google.chat.v1.IListSectionsRequest): Promise; + + /** + * Calls PositionSection. + * @param request PositionSectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PositionSectionResponse + */ + public positionSection(request: google.chat.v1.IPositionSectionRequest, callback: google.chat.v1.ChatService.PositionSectionCallback): void; + + /** + * Calls PositionSection. + * @param request PositionSectionRequest message or plain object + * @returns Promise + */ + public positionSection(request: google.chat.v1.IPositionSectionRequest): Promise; + + /** + * Calls ListSectionItems. + * @param request ListSectionItemsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSectionItemsResponse + */ + public listSectionItems(request: google.chat.v1.IListSectionItemsRequest, callback: google.chat.v1.ChatService.ListSectionItemsCallback): void; + + /** + * Calls ListSectionItems. + * @param request ListSectionItemsRequest message or plain object + * @returns Promise + */ + public listSectionItems(request: google.chat.v1.IListSectionItemsRequest): Promise; + + /** + * Calls MoveSectionItem. + * @param request MoveSectionItemRequest message or plain object + * @param callback Node-style callback called with the error, if any, and MoveSectionItemResponse + */ + public moveSectionItem(request: google.chat.v1.IMoveSectionItemRequest, callback: google.chat.v1.ChatService.MoveSectionItemCallback): void; + + /** + * Calls MoveSectionItem. + * @param request MoveSectionItemRequest message or plain object + * @returns Promise + */ + public moveSectionItem(request: google.chat.v1.IMoveSectionItemRequest): Promise; } namespace ChatService { @@ -14986,6 +15084,55 @@ export namespace google { * @param [response] SpaceNotificationSetting */ type UpdateSpaceNotificationSettingCallback = (error: (Error|null), response?: google.chat.v1.SpaceNotificationSetting) => void; + + /** + * Callback as used by {@link google.chat.v1.ChatService|createSection}. + * @param error Error, if any + * @param [response] Section + */ + type CreateSectionCallback = (error: (Error|null), response?: google.chat.v1.Section) => void; + + /** + * Callback as used by {@link google.chat.v1.ChatService|deleteSection}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteSectionCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.chat.v1.ChatService|updateSection}. + * @param error Error, if any + * @param [response] Section + */ + type UpdateSectionCallback = (error: (Error|null), response?: google.chat.v1.Section) => void; + + /** + * Callback as used by {@link google.chat.v1.ChatService|listSections}. + * @param error Error, if any + * @param [response] ListSectionsResponse + */ + type ListSectionsCallback = (error: (Error|null), response?: google.chat.v1.ListSectionsResponse) => void; + + /** + * Callback as used by {@link google.chat.v1.ChatService|positionSection}. + * @param error Error, if any + * @param [response] PositionSectionResponse + */ + type PositionSectionCallback = (error: (Error|null), response?: google.chat.v1.PositionSectionResponse) => void; + + /** + * Callback as used by {@link google.chat.v1.ChatService|listSectionItems}. + * @param error Error, if any + * @param [response] ListSectionItemsResponse + */ + type ListSectionItemsCallback = (error: (Error|null), response?: google.chat.v1.ListSectionItemsResponse) => void; + + /** + * Callback as used by {@link google.chat.v1.ChatService|moveSectionItem}. + * @param error Error, if any + * @param [response] MoveSectionItemResponse + */ + type MoveSectionItemCallback = (error: (Error|null), response?: google.chat.v1.MoveSectionItemResponse) => void; } /** Properties of a Membership. */ @@ -22188,6 +22335,1391 @@ export namespace google { HISTORY_ON = 2 } + /** Properties of a Section. */ + interface ISection { + + /** Section name */ + name?: (string|null); + + /** Section displayName */ + displayName?: (string|null); + + /** Section sortOrder */ + sortOrder?: (number|null); + + /** Section type */ + type?: (google.chat.v1.Section.SectionType|keyof typeof google.chat.v1.Section.SectionType|null); + } + + /** Represents a Section. */ + class Section implements ISection { + + /** + * Constructs a new Section. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.ISection); + + /** Section name. */ + public name: string; + + /** Section displayName. */ + public displayName: string; + + /** Section sortOrder. */ + public sortOrder: number; + + /** Section type. */ + public type: (google.chat.v1.Section.SectionType|keyof typeof google.chat.v1.Section.SectionType); + + /** + * Creates a new Section instance using the specified properties. + * @param [properties] Properties to set + * @returns Section instance + */ + public static create(properties?: google.chat.v1.ISection): google.chat.v1.Section; + + /** + * Encodes the specified Section message. Does not implicitly {@link google.chat.v1.Section.verify|verify} messages. + * @param message Section message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.ISection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Section message, length delimited. Does not implicitly {@link google.chat.v1.Section.verify|verify} messages. + * @param message Section message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.ISection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Section message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Section + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.Section; + + /** + * Decodes a Section message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Section + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.Section; + + /** + * Verifies a Section message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Section message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Section + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.Section; + + /** + * Creates a plain object from a Section message. Also converts values to other types if specified. + * @param message Section + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.Section, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Section to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Section + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Section { + + /** SectionType enum. */ + enum SectionType { + SECTION_TYPE_UNSPECIFIED = 0, + CUSTOM_SECTION = 1, + DEFAULT_DIRECT_MESSAGES = 2, + DEFAULT_SPACES = 3, + DEFAULT_APPS = 6 + } + } + + /** Properties of a SectionItem. */ + interface ISectionItem { + + /** SectionItem name */ + name?: (string|null); + + /** SectionItem space */ + space?: (string|null); + } + + /** Represents a SectionItem. */ + class SectionItem implements ISectionItem { + + /** + * Constructs a new SectionItem. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.ISectionItem); + + /** SectionItem name. */ + public name: string; + + /** SectionItem space. */ + public space?: (string|null); + + /** SectionItem item. */ + public item?: "space"; + + /** + * Creates a new SectionItem instance using the specified properties. + * @param [properties] Properties to set + * @returns SectionItem instance + */ + public static create(properties?: google.chat.v1.ISectionItem): google.chat.v1.SectionItem; + + /** + * Encodes the specified SectionItem message. Does not implicitly {@link google.chat.v1.SectionItem.verify|verify} messages. + * @param message SectionItem message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.ISectionItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SectionItem message, length delimited. Does not implicitly {@link google.chat.v1.SectionItem.verify|verify} messages. + * @param message SectionItem message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.ISectionItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SectionItem message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SectionItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.SectionItem; + + /** + * Decodes a SectionItem message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SectionItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.SectionItem; + + /** + * Verifies a SectionItem message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SectionItem message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SectionItem + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.SectionItem; + + /** + * Creates a plain object from a SectionItem message. Also converts values to other types if specified. + * @param message SectionItem + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.SectionItem, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SectionItem to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SectionItem + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateSectionRequest. */ + interface ICreateSectionRequest { + + /** CreateSectionRequest parent */ + parent?: (string|null); + + /** CreateSectionRequest section */ + section?: (google.chat.v1.ISection|null); + } + + /** Represents a CreateSectionRequest. */ + class CreateSectionRequest implements ICreateSectionRequest { + + /** + * Constructs a new CreateSectionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.ICreateSectionRequest); + + /** CreateSectionRequest parent. */ + public parent: string; + + /** CreateSectionRequest section. */ + public section?: (google.chat.v1.ISection|null); + + /** + * Creates a new CreateSectionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSectionRequest instance + */ + public static create(properties?: google.chat.v1.ICreateSectionRequest): google.chat.v1.CreateSectionRequest; + + /** + * Encodes the specified CreateSectionRequest message. Does not implicitly {@link google.chat.v1.CreateSectionRequest.verify|verify} messages. + * @param message CreateSectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.ICreateSectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSectionRequest message, length delimited. Does not implicitly {@link google.chat.v1.CreateSectionRequest.verify|verify} messages. + * @param message CreateSectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.ICreateSectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSectionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.CreateSectionRequest; + + /** + * Decodes a CreateSectionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.CreateSectionRequest; + + /** + * Verifies a CreateSectionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateSectionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSectionRequest + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.CreateSectionRequest; + + /** + * Creates a plain object from a CreateSectionRequest message. Also converts values to other types if specified. + * @param message CreateSectionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.CreateSectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSectionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSectionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteSectionRequest. */ + interface IDeleteSectionRequest { + + /** DeleteSectionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteSectionRequest. */ + class DeleteSectionRequest implements IDeleteSectionRequest { + + /** + * Constructs a new DeleteSectionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IDeleteSectionRequest); + + /** DeleteSectionRequest name. */ + public name: string; + + /** + * Creates a new DeleteSectionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSectionRequest instance + */ + public static create(properties?: google.chat.v1.IDeleteSectionRequest): google.chat.v1.DeleteSectionRequest; + + /** + * Encodes the specified DeleteSectionRequest message. Does not implicitly {@link google.chat.v1.DeleteSectionRequest.verify|verify} messages. + * @param message DeleteSectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IDeleteSectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSectionRequest message, length delimited. Does not implicitly {@link google.chat.v1.DeleteSectionRequest.verify|verify} messages. + * @param message DeleteSectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IDeleteSectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSectionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.DeleteSectionRequest; + + /** + * Decodes a DeleteSectionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.DeleteSectionRequest; + + /** + * Verifies a DeleteSectionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteSectionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSectionRequest + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.DeleteSectionRequest; + + /** + * Creates a plain object from a DeleteSectionRequest message. Also converts values to other types if specified. + * @param message DeleteSectionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.DeleteSectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSectionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteSectionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateSectionRequest. */ + interface IUpdateSectionRequest { + + /** UpdateSectionRequest section */ + section?: (google.chat.v1.ISection|null); + + /** UpdateSectionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateSectionRequest. */ + class UpdateSectionRequest implements IUpdateSectionRequest { + + /** + * Constructs a new UpdateSectionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IUpdateSectionRequest); + + /** UpdateSectionRequest section. */ + public section?: (google.chat.v1.ISection|null); + + /** UpdateSectionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateSectionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateSectionRequest instance + */ + public static create(properties?: google.chat.v1.IUpdateSectionRequest): google.chat.v1.UpdateSectionRequest; + + /** + * Encodes the specified UpdateSectionRequest message. Does not implicitly {@link google.chat.v1.UpdateSectionRequest.verify|verify} messages. + * @param message UpdateSectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IUpdateSectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateSectionRequest message, length delimited. Does not implicitly {@link google.chat.v1.UpdateSectionRequest.verify|verify} messages. + * @param message UpdateSectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IUpdateSectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateSectionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.UpdateSectionRequest; + + /** + * Decodes an UpdateSectionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.UpdateSectionRequest; + + /** + * Verifies an UpdateSectionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateSectionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateSectionRequest + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.UpdateSectionRequest; + + /** + * Creates a plain object from an UpdateSectionRequest message. Also converts values to other types if specified. + * @param message UpdateSectionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.UpdateSectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateSectionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateSectionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSectionsRequest. */ + interface IListSectionsRequest { + + /** ListSectionsRequest parent */ + parent?: (string|null); + + /** ListSectionsRequest pageSize */ + pageSize?: (number|null); + + /** ListSectionsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListSectionsRequest. */ + class ListSectionsRequest implements IListSectionsRequest { + + /** + * Constructs a new ListSectionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IListSectionsRequest); + + /** ListSectionsRequest parent. */ + public parent: string; + + /** ListSectionsRequest pageSize. */ + public pageSize: number; + + /** ListSectionsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListSectionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSectionsRequest instance + */ + public static create(properties?: google.chat.v1.IListSectionsRequest): google.chat.v1.ListSectionsRequest; + + /** + * Encodes the specified ListSectionsRequest message. Does not implicitly {@link google.chat.v1.ListSectionsRequest.verify|verify} messages. + * @param message ListSectionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IListSectionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSectionsRequest message, length delimited. Does not implicitly {@link google.chat.v1.ListSectionsRequest.verify|verify} messages. + * @param message ListSectionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IListSectionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSectionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.ListSectionsRequest; + + /** + * Decodes a ListSectionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.ListSectionsRequest; + + /** + * Verifies a ListSectionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSectionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSectionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.ListSectionsRequest; + + /** + * Creates a plain object from a ListSectionsRequest message. Also converts values to other types if specified. + * @param message ListSectionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.ListSectionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSectionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSectionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSectionsResponse. */ + interface IListSectionsResponse { + + /** ListSectionsResponse sections */ + sections?: (google.chat.v1.ISection[]|null); + + /** ListSectionsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListSectionsResponse. */ + class ListSectionsResponse implements IListSectionsResponse { + + /** + * Constructs a new ListSectionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IListSectionsResponse); + + /** ListSectionsResponse sections. */ + public sections: google.chat.v1.ISection[]; + + /** ListSectionsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListSectionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSectionsResponse instance + */ + public static create(properties?: google.chat.v1.IListSectionsResponse): google.chat.v1.ListSectionsResponse; + + /** + * Encodes the specified ListSectionsResponse message. Does not implicitly {@link google.chat.v1.ListSectionsResponse.verify|verify} messages. + * @param message ListSectionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IListSectionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSectionsResponse message, length delimited. Does not implicitly {@link google.chat.v1.ListSectionsResponse.verify|verify} messages. + * @param message ListSectionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IListSectionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSectionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.ListSectionsResponse; + + /** + * Decodes a ListSectionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.ListSectionsResponse; + + /** + * Verifies a ListSectionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSectionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSectionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.ListSectionsResponse; + + /** + * Creates a plain object from a ListSectionsResponse message. Also converts values to other types if specified. + * @param message ListSectionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.ListSectionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSectionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSectionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PositionSectionRequest. */ + interface IPositionSectionRequest { + + /** PositionSectionRequest name */ + name?: (string|null); + + /** PositionSectionRequest sortOrder */ + sortOrder?: (number|null); + + /** PositionSectionRequest relativePosition */ + relativePosition?: (google.chat.v1.PositionSectionRequest.Position|keyof typeof google.chat.v1.PositionSectionRequest.Position|null); + } + + /** Represents a PositionSectionRequest. */ + class PositionSectionRequest implements IPositionSectionRequest { + + /** + * Constructs a new PositionSectionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IPositionSectionRequest); + + /** PositionSectionRequest name. */ + public name: string; + + /** PositionSectionRequest sortOrder. */ + public sortOrder?: (number|null); + + /** PositionSectionRequest relativePosition. */ + public relativePosition?: (google.chat.v1.PositionSectionRequest.Position|keyof typeof google.chat.v1.PositionSectionRequest.Position|null); + + /** PositionSectionRequest position. */ + public position?: ("sortOrder"|"relativePosition"); + + /** + * Creates a new PositionSectionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns PositionSectionRequest instance + */ + public static create(properties?: google.chat.v1.IPositionSectionRequest): google.chat.v1.PositionSectionRequest; + + /** + * Encodes the specified PositionSectionRequest message. Does not implicitly {@link google.chat.v1.PositionSectionRequest.verify|verify} messages. + * @param message PositionSectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IPositionSectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PositionSectionRequest message, length delimited. Does not implicitly {@link google.chat.v1.PositionSectionRequest.verify|verify} messages. + * @param message PositionSectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IPositionSectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PositionSectionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PositionSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.PositionSectionRequest; + + /** + * Decodes a PositionSectionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PositionSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.PositionSectionRequest; + + /** + * Verifies a PositionSectionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PositionSectionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PositionSectionRequest + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.PositionSectionRequest; + + /** + * Creates a plain object from a PositionSectionRequest message. Also converts values to other types if specified. + * @param message PositionSectionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.PositionSectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PositionSectionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PositionSectionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PositionSectionRequest { + + /** Position enum. */ + enum Position { + POSITION_UNSPECIFIED = 0, + START = 1, + END = 2 + } + } + + /** Properties of a PositionSectionResponse. */ + interface IPositionSectionResponse { + + /** PositionSectionResponse section */ + section?: (google.chat.v1.ISection|null); + } + + /** Represents a PositionSectionResponse. */ + class PositionSectionResponse implements IPositionSectionResponse { + + /** + * Constructs a new PositionSectionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IPositionSectionResponse); + + /** PositionSectionResponse section. */ + public section?: (google.chat.v1.ISection|null); + + /** + * Creates a new PositionSectionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PositionSectionResponse instance + */ + public static create(properties?: google.chat.v1.IPositionSectionResponse): google.chat.v1.PositionSectionResponse; + + /** + * Encodes the specified PositionSectionResponse message. Does not implicitly {@link google.chat.v1.PositionSectionResponse.verify|verify} messages. + * @param message PositionSectionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IPositionSectionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PositionSectionResponse message, length delimited. Does not implicitly {@link google.chat.v1.PositionSectionResponse.verify|verify} messages. + * @param message PositionSectionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IPositionSectionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PositionSectionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PositionSectionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.PositionSectionResponse; + + /** + * Decodes a PositionSectionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PositionSectionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.PositionSectionResponse; + + /** + * Verifies a PositionSectionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PositionSectionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PositionSectionResponse + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.PositionSectionResponse; + + /** + * Creates a plain object from a PositionSectionResponse message. Also converts values to other types if specified. + * @param message PositionSectionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.PositionSectionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PositionSectionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PositionSectionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSectionItemsRequest. */ + interface IListSectionItemsRequest { + + /** ListSectionItemsRequest parent */ + parent?: (string|null); + + /** ListSectionItemsRequest pageSize */ + pageSize?: (number|null); + + /** ListSectionItemsRequest pageToken */ + pageToken?: (string|null); + + /** ListSectionItemsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListSectionItemsRequest. */ + class ListSectionItemsRequest implements IListSectionItemsRequest { + + /** + * Constructs a new ListSectionItemsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IListSectionItemsRequest); + + /** ListSectionItemsRequest parent. */ + public parent: string; + + /** ListSectionItemsRequest pageSize. */ + public pageSize: number; + + /** ListSectionItemsRequest pageToken. */ + public pageToken: string; + + /** ListSectionItemsRequest filter. */ + public filter: string; + + /** + * Creates a new ListSectionItemsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSectionItemsRequest instance + */ + public static create(properties?: google.chat.v1.IListSectionItemsRequest): google.chat.v1.ListSectionItemsRequest; + + /** + * Encodes the specified ListSectionItemsRequest message. Does not implicitly {@link google.chat.v1.ListSectionItemsRequest.verify|verify} messages. + * @param message ListSectionItemsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IListSectionItemsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSectionItemsRequest message, length delimited. Does not implicitly {@link google.chat.v1.ListSectionItemsRequest.verify|verify} messages. + * @param message ListSectionItemsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IListSectionItemsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSectionItemsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSectionItemsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.ListSectionItemsRequest; + + /** + * Decodes a ListSectionItemsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSectionItemsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.ListSectionItemsRequest; + + /** + * Verifies a ListSectionItemsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSectionItemsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSectionItemsRequest + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.ListSectionItemsRequest; + + /** + * Creates a plain object from a ListSectionItemsRequest message. Also converts values to other types if specified. + * @param message ListSectionItemsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.ListSectionItemsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSectionItemsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSectionItemsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSectionItemsResponse. */ + interface IListSectionItemsResponse { + + /** ListSectionItemsResponse sectionItems */ + sectionItems?: (google.chat.v1.ISectionItem[]|null); + + /** ListSectionItemsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListSectionItemsResponse. */ + class ListSectionItemsResponse implements IListSectionItemsResponse { + + /** + * Constructs a new ListSectionItemsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IListSectionItemsResponse); + + /** ListSectionItemsResponse sectionItems. */ + public sectionItems: google.chat.v1.ISectionItem[]; + + /** ListSectionItemsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListSectionItemsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSectionItemsResponse instance + */ + public static create(properties?: google.chat.v1.IListSectionItemsResponse): google.chat.v1.ListSectionItemsResponse; + + /** + * Encodes the specified ListSectionItemsResponse message. Does not implicitly {@link google.chat.v1.ListSectionItemsResponse.verify|verify} messages. + * @param message ListSectionItemsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IListSectionItemsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSectionItemsResponse message, length delimited. Does not implicitly {@link google.chat.v1.ListSectionItemsResponse.verify|verify} messages. + * @param message ListSectionItemsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IListSectionItemsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSectionItemsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSectionItemsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.ListSectionItemsResponse; + + /** + * Decodes a ListSectionItemsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSectionItemsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.ListSectionItemsResponse; + + /** + * Verifies a ListSectionItemsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSectionItemsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSectionItemsResponse + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.ListSectionItemsResponse; + + /** + * Creates a plain object from a ListSectionItemsResponse message. Also converts values to other types if specified. + * @param message ListSectionItemsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.ListSectionItemsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSectionItemsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSectionItemsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MoveSectionItemRequest. */ + interface IMoveSectionItemRequest { + + /** MoveSectionItemRequest name */ + name?: (string|null); + + /** MoveSectionItemRequest targetSection */ + targetSection?: (string|null); + } + + /** Represents a MoveSectionItemRequest. */ + class MoveSectionItemRequest implements IMoveSectionItemRequest { + + /** + * Constructs a new MoveSectionItemRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IMoveSectionItemRequest); + + /** MoveSectionItemRequest name. */ + public name: string; + + /** MoveSectionItemRequest targetSection. */ + public targetSection: string; + + /** + * Creates a new MoveSectionItemRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns MoveSectionItemRequest instance + */ + public static create(properties?: google.chat.v1.IMoveSectionItemRequest): google.chat.v1.MoveSectionItemRequest; + + /** + * Encodes the specified MoveSectionItemRequest message. Does not implicitly {@link google.chat.v1.MoveSectionItemRequest.verify|verify} messages. + * @param message MoveSectionItemRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IMoveSectionItemRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MoveSectionItemRequest message, length delimited. Does not implicitly {@link google.chat.v1.MoveSectionItemRequest.verify|verify} messages. + * @param message MoveSectionItemRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IMoveSectionItemRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MoveSectionItemRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MoveSectionItemRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.MoveSectionItemRequest; + + /** + * Decodes a MoveSectionItemRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MoveSectionItemRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.MoveSectionItemRequest; + + /** + * Verifies a MoveSectionItemRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MoveSectionItemRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MoveSectionItemRequest + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.MoveSectionItemRequest; + + /** + * Creates a plain object from a MoveSectionItemRequest message. Also converts values to other types if specified. + * @param message MoveSectionItemRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.MoveSectionItemRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MoveSectionItemRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MoveSectionItemRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MoveSectionItemResponse. */ + interface IMoveSectionItemResponse { + + /** MoveSectionItemResponse sectionItem */ + sectionItem?: (google.chat.v1.ISectionItem|null); + } + + /** Represents a MoveSectionItemResponse. */ + class MoveSectionItemResponse implements IMoveSectionItemResponse { + + /** + * Constructs a new MoveSectionItemResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.IMoveSectionItemResponse); + + /** MoveSectionItemResponse sectionItem. */ + public sectionItem?: (google.chat.v1.ISectionItem|null); + + /** + * Creates a new MoveSectionItemResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns MoveSectionItemResponse instance + */ + public static create(properties?: google.chat.v1.IMoveSectionItemResponse): google.chat.v1.MoveSectionItemResponse; + + /** + * Encodes the specified MoveSectionItemResponse message. Does not implicitly {@link google.chat.v1.MoveSectionItemResponse.verify|verify} messages. + * @param message MoveSectionItemResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.IMoveSectionItemResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MoveSectionItemResponse message, length delimited. Does not implicitly {@link google.chat.v1.MoveSectionItemResponse.verify|verify} messages. + * @param message MoveSectionItemResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.IMoveSectionItemResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MoveSectionItemResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MoveSectionItemResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.chat.v1.MoveSectionItemResponse; + + /** + * Decodes a MoveSectionItemResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MoveSectionItemResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.chat.v1.MoveSectionItemResponse; + + /** + * Verifies a MoveSectionItemResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MoveSectionItemResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MoveSectionItemResponse + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.MoveSectionItemResponse; + + /** + * Creates a plain object from a MoveSectionItemResponse message. Also converts values to other types if specified. + * @param message MoveSectionItemResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.MoveSectionItemResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MoveSectionItemResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MoveSectionItemResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a SpaceEvent. */ interface ISpaceEvent { diff --git a/packages/google-chat/protos/protos.js b/packages/google-chat/protos/protos.js index 0117c0868e2..0fbfcd375df 100644 --- a/packages/google-chat/protos/protos.js +++ b/packages/google-chat/protos/protos.js @@ -39043,6 +39043,237 @@ * @variation 2 */ + /** + * Callback as used by {@link google.chat.v1.ChatService|createSection}. + * @memberof google.chat.v1.ChatService + * @typedef CreateSectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.chat.v1.Section} [response] Section + */ + + /** + * Calls CreateSection. + * @function createSection + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.ICreateSectionRequest} request CreateSectionRequest message or plain object + * @param {google.chat.v1.ChatService.CreateSectionCallback} callback Node-style callback called with the error, if any, and Section + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ChatService.prototype.createSection = function createSection(request, callback) { + return this.rpcCall(createSection, $root.google.chat.v1.CreateSectionRequest, $root.google.chat.v1.Section, request, callback); + }, "name", { value: "CreateSection" }); + + /** + * Calls CreateSection. + * @function createSection + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.ICreateSectionRequest} request CreateSectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.chat.v1.ChatService|deleteSection}. + * @memberof google.chat.v1.ChatService + * @typedef DeleteSectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteSection. + * @function deleteSection + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IDeleteSectionRequest} request DeleteSectionRequest message or plain object + * @param {google.chat.v1.ChatService.DeleteSectionCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ChatService.prototype.deleteSection = function deleteSection(request, callback) { + return this.rpcCall(deleteSection, $root.google.chat.v1.DeleteSectionRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteSection" }); + + /** + * Calls DeleteSection. + * @function deleteSection + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IDeleteSectionRequest} request DeleteSectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.chat.v1.ChatService|updateSection}. + * @memberof google.chat.v1.ChatService + * @typedef UpdateSectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.chat.v1.Section} [response] Section + */ + + /** + * Calls UpdateSection. + * @function updateSection + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IUpdateSectionRequest} request UpdateSectionRequest message or plain object + * @param {google.chat.v1.ChatService.UpdateSectionCallback} callback Node-style callback called with the error, if any, and Section + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ChatService.prototype.updateSection = function updateSection(request, callback) { + return this.rpcCall(updateSection, $root.google.chat.v1.UpdateSectionRequest, $root.google.chat.v1.Section, request, callback); + }, "name", { value: "UpdateSection" }); + + /** + * Calls UpdateSection. + * @function updateSection + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IUpdateSectionRequest} request UpdateSectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.chat.v1.ChatService|listSections}. + * @memberof google.chat.v1.ChatService + * @typedef ListSectionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.chat.v1.ListSectionsResponse} [response] ListSectionsResponse + */ + + /** + * Calls ListSections. + * @function listSections + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IListSectionsRequest} request ListSectionsRequest message or plain object + * @param {google.chat.v1.ChatService.ListSectionsCallback} callback Node-style callback called with the error, if any, and ListSectionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ChatService.prototype.listSections = function listSections(request, callback) { + return this.rpcCall(listSections, $root.google.chat.v1.ListSectionsRequest, $root.google.chat.v1.ListSectionsResponse, request, callback); + }, "name", { value: "ListSections" }); + + /** + * Calls ListSections. + * @function listSections + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IListSectionsRequest} request ListSectionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.chat.v1.ChatService|positionSection}. + * @memberof google.chat.v1.ChatService + * @typedef PositionSectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.chat.v1.PositionSectionResponse} [response] PositionSectionResponse + */ + + /** + * Calls PositionSection. + * @function positionSection + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IPositionSectionRequest} request PositionSectionRequest message or plain object + * @param {google.chat.v1.ChatService.PositionSectionCallback} callback Node-style callback called with the error, if any, and PositionSectionResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ChatService.prototype.positionSection = function positionSection(request, callback) { + return this.rpcCall(positionSection, $root.google.chat.v1.PositionSectionRequest, $root.google.chat.v1.PositionSectionResponse, request, callback); + }, "name", { value: "PositionSection" }); + + /** + * Calls PositionSection. + * @function positionSection + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IPositionSectionRequest} request PositionSectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.chat.v1.ChatService|listSectionItems}. + * @memberof google.chat.v1.ChatService + * @typedef ListSectionItemsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.chat.v1.ListSectionItemsResponse} [response] ListSectionItemsResponse + */ + + /** + * Calls ListSectionItems. + * @function listSectionItems + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IListSectionItemsRequest} request ListSectionItemsRequest message or plain object + * @param {google.chat.v1.ChatService.ListSectionItemsCallback} callback Node-style callback called with the error, if any, and ListSectionItemsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ChatService.prototype.listSectionItems = function listSectionItems(request, callback) { + return this.rpcCall(listSectionItems, $root.google.chat.v1.ListSectionItemsRequest, $root.google.chat.v1.ListSectionItemsResponse, request, callback); + }, "name", { value: "ListSectionItems" }); + + /** + * Calls ListSectionItems. + * @function listSectionItems + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IListSectionItemsRequest} request ListSectionItemsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.chat.v1.ChatService|moveSectionItem}. + * @memberof google.chat.v1.ChatService + * @typedef MoveSectionItemCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.chat.v1.MoveSectionItemResponse} [response] MoveSectionItemResponse + */ + + /** + * Calls MoveSectionItem. + * @function moveSectionItem + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IMoveSectionItemRequest} request MoveSectionItemRequest message or plain object + * @param {google.chat.v1.ChatService.MoveSectionItemCallback} callback Node-style callback called with the error, if any, and MoveSectionItemResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ChatService.prototype.moveSectionItem = function moveSectionItem(request, callback) { + return this.rpcCall(moveSectionItem, $root.google.chat.v1.MoveSectionItemRequest, $root.google.chat.v1.MoveSectionItemResponse, request, callback); + }, "name", { value: "MoveSectionItem" }); + + /** + * Calls MoveSectionItem. + * @function moveSectionItem + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.IMoveSectionItemRequest} request MoveSectionItemRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return ChatService; })(); @@ -57512,6 +57743,3252 @@ return values; })(); + v1.Section = (function() { + + /** + * Properties of a Section. + * @memberof google.chat.v1 + * @interface ISection + * @property {string|null} [name] Section name + * @property {string|null} [displayName] Section displayName + * @property {number|null} [sortOrder] Section sortOrder + * @property {google.chat.v1.Section.SectionType|null} [type] Section type + */ + + /** + * Constructs a new Section. + * @memberof google.chat.v1 + * @classdesc Represents a Section. + * @implements ISection + * @constructor + * @param {google.chat.v1.ISection=} [properties] Properties to set + */ + function Section(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Section name. + * @member {string} name + * @memberof google.chat.v1.Section + * @instance + */ + Section.prototype.name = ""; + + /** + * Section displayName. + * @member {string} displayName + * @memberof google.chat.v1.Section + * @instance + */ + Section.prototype.displayName = ""; + + /** + * Section sortOrder. + * @member {number} sortOrder + * @memberof google.chat.v1.Section + * @instance + */ + Section.prototype.sortOrder = 0; + + /** + * Section type. + * @member {google.chat.v1.Section.SectionType} type + * @memberof google.chat.v1.Section + * @instance + */ + Section.prototype.type = 0; + + /** + * Creates a new Section instance using the specified properties. + * @function create + * @memberof google.chat.v1.Section + * @static + * @param {google.chat.v1.ISection=} [properties] Properties to set + * @returns {google.chat.v1.Section} Section instance + */ + Section.create = function create(properties) { + return new Section(properties); + }; + + /** + * Encodes the specified Section message. Does not implicitly {@link google.chat.v1.Section.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.Section + * @static + * @param {google.chat.v1.ISection} message Section message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Section.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.sortOrder != null && Object.hasOwnProperty.call(message, "sortOrder")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.sortOrder); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); + return writer; + }; + + /** + * Encodes the specified Section message, length delimited. Does not implicitly {@link google.chat.v1.Section.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.Section + * @static + * @param {google.chat.v1.ISection} message Section message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Section.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Section message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.Section + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.Section} Section + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Section.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.Section(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.sortOrder = reader.int32(); + break; + } + case 4: { + message.type = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Section message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.Section + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.Section} Section + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Section.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Section message. + * @function verify + * @memberof google.chat.v1.Section + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Section.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.sortOrder != null && message.hasOwnProperty("sortOrder")) + if (!$util.isInteger(message.sortOrder)) + return "sortOrder: integer expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 6: + break; + } + return null; + }; + + /** + * Creates a Section message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.Section + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.Section} Section + */ + Section.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.Section) + return object; + var message = new $root.google.chat.v1.Section(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.sortOrder != null) + message.sortOrder = object.sortOrder | 0; + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SECTION_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "CUSTOM_SECTION": + case 1: + message.type = 1; + break; + case "DEFAULT_DIRECT_MESSAGES": + case 2: + message.type = 2; + break; + case "DEFAULT_SPACES": + case 3: + message.type = 3; + break; + case "DEFAULT_APPS": + case 6: + message.type = 6; + break; + } + return message; + }; + + /** + * Creates a plain object from a Section message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.Section + * @static + * @param {google.chat.v1.Section} message Section + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Section.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.sortOrder = 0; + object.type = options.enums === String ? "SECTION_TYPE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.sortOrder != null && message.hasOwnProperty("sortOrder")) + object.sortOrder = message.sortOrder; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.chat.v1.Section.SectionType[message.type] === undefined ? message.type : $root.google.chat.v1.Section.SectionType[message.type] : message.type; + return object; + }; + + /** + * Converts this Section to JSON. + * @function toJSON + * @memberof google.chat.v1.Section + * @instance + * @returns {Object.} JSON object + */ + Section.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Section + * @function getTypeUrl + * @memberof google.chat.v1.Section + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Section.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.Section"; + }; + + /** + * SectionType enum. + * @name google.chat.v1.Section.SectionType + * @enum {number} + * @property {number} SECTION_TYPE_UNSPECIFIED=0 SECTION_TYPE_UNSPECIFIED value + * @property {number} CUSTOM_SECTION=1 CUSTOM_SECTION value + * @property {number} DEFAULT_DIRECT_MESSAGES=2 DEFAULT_DIRECT_MESSAGES value + * @property {number} DEFAULT_SPACES=3 DEFAULT_SPACES value + * @property {number} DEFAULT_APPS=6 DEFAULT_APPS value + */ + Section.SectionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SECTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CUSTOM_SECTION"] = 1; + values[valuesById[2] = "DEFAULT_DIRECT_MESSAGES"] = 2; + values[valuesById[3] = "DEFAULT_SPACES"] = 3; + values[valuesById[6] = "DEFAULT_APPS"] = 6; + return values; + })(); + + return Section; + })(); + + v1.SectionItem = (function() { + + /** + * Properties of a SectionItem. + * @memberof google.chat.v1 + * @interface ISectionItem + * @property {string|null} [name] SectionItem name + * @property {string|null} [space] SectionItem space + */ + + /** + * Constructs a new SectionItem. + * @memberof google.chat.v1 + * @classdesc Represents a SectionItem. + * @implements ISectionItem + * @constructor + * @param {google.chat.v1.ISectionItem=} [properties] Properties to set + */ + function SectionItem(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SectionItem name. + * @member {string} name + * @memberof google.chat.v1.SectionItem + * @instance + */ + SectionItem.prototype.name = ""; + + /** + * SectionItem space. + * @member {string|null|undefined} space + * @memberof google.chat.v1.SectionItem + * @instance + */ + SectionItem.prototype.space = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SectionItem item. + * @member {"space"|undefined} item + * @memberof google.chat.v1.SectionItem + * @instance + */ + Object.defineProperty(SectionItem.prototype, "item", { + get: $util.oneOfGetter($oneOfFields = ["space"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SectionItem instance using the specified properties. + * @function create + * @memberof google.chat.v1.SectionItem + * @static + * @param {google.chat.v1.ISectionItem=} [properties] Properties to set + * @returns {google.chat.v1.SectionItem} SectionItem instance + */ + SectionItem.create = function create(properties) { + return new SectionItem(properties); + }; + + /** + * Encodes the specified SectionItem message. Does not implicitly {@link google.chat.v1.SectionItem.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.SectionItem + * @static + * @param {google.chat.v1.ISectionItem} message SectionItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SectionItem.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.space != null && Object.hasOwnProperty.call(message, "space")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.space); + return writer; + }; + + /** + * Encodes the specified SectionItem message, length delimited. Does not implicitly {@link google.chat.v1.SectionItem.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.SectionItem + * @static + * @param {google.chat.v1.ISectionItem} message SectionItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SectionItem.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SectionItem message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.SectionItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.SectionItem} SectionItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SectionItem.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.SectionItem(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.space = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SectionItem message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.SectionItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.SectionItem} SectionItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SectionItem.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SectionItem message. + * @function verify + * @memberof google.chat.v1.SectionItem + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SectionItem.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.space != null && message.hasOwnProperty("space")) { + properties.item = 1; + if (!$util.isString(message.space)) + return "space: string expected"; + } + return null; + }; + + /** + * Creates a SectionItem message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.SectionItem + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.SectionItem} SectionItem + */ + SectionItem.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.SectionItem) + return object; + var message = new $root.google.chat.v1.SectionItem(); + if (object.name != null) + message.name = String(object.name); + if (object.space != null) + message.space = String(object.space); + return message; + }; + + /** + * Creates a plain object from a SectionItem message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.SectionItem + * @static + * @param {google.chat.v1.SectionItem} message SectionItem + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SectionItem.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.space != null && message.hasOwnProperty("space")) { + object.space = message.space; + if (options.oneofs) + object.item = "space"; + } + return object; + }; + + /** + * Converts this SectionItem to JSON. + * @function toJSON + * @memberof google.chat.v1.SectionItem + * @instance + * @returns {Object.} JSON object + */ + SectionItem.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SectionItem + * @function getTypeUrl + * @memberof google.chat.v1.SectionItem + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SectionItem.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.SectionItem"; + }; + + return SectionItem; + })(); + + v1.CreateSectionRequest = (function() { + + /** + * Properties of a CreateSectionRequest. + * @memberof google.chat.v1 + * @interface ICreateSectionRequest + * @property {string|null} [parent] CreateSectionRequest parent + * @property {google.chat.v1.ISection|null} [section] CreateSectionRequest section + */ + + /** + * Constructs a new CreateSectionRequest. + * @memberof google.chat.v1 + * @classdesc Represents a CreateSectionRequest. + * @implements ICreateSectionRequest + * @constructor + * @param {google.chat.v1.ICreateSectionRequest=} [properties] Properties to set + */ + function CreateSectionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateSectionRequest parent. + * @member {string} parent + * @memberof google.chat.v1.CreateSectionRequest + * @instance + */ + CreateSectionRequest.prototype.parent = ""; + + /** + * CreateSectionRequest section. + * @member {google.chat.v1.ISection|null|undefined} section + * @memberof google.chat.v1.CreateSectionRequest + * @instance + */ + CreateSectionRequest.prototype.section = null; + + /** + * Creates a new CreateSectionRequest instance using the specified properties. + * @function create + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {google.chat.v1.ICreateSectionRequest=} [properties] Properties to set + * @returns {google.chat.v1.CreateSectionRequest} CreateSectionRequest instance + */ + CreateSectionRequest.create = function create(properties) { + return new CreateSectionRequest(properties); + }; + + /** + * Encodes the specified CreateSectionRequest message. Does not implicitly {@link google.chat.v1.CreateSectionRequest.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {google.chat.v1.ICreateSectionRequest} message CreateSectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSectionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.section != null && Object.hasOwnProperty.call(message, "section")) + $root.google.chat.v1.Section.encode(message.section, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateSectionRequest message, length delimited. Does not implicitly {@link google.chat.v1.CreateSectionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {google.chat.v1.ICreateSectionRequest} message CreateSectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSectionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSectionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.CreateSectionRequest} CreateSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSectionRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.CreateSectionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.section = $root.google.chat.v1.Section.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSectionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.CreateSectionRequest} CreateSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSectionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSectionRequest message. + * @function verify + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSectionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.section != null && message.hasOwnProperty("section")) { + var error = $root.google.chat.v1.Section.verify(message.section); + if (error) + return "section." + error; + } + return null; + }; + + /** + * Creates a CreateSectionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.CreateSectionRequest} CreateSectionRequest + */ + CreateSectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.CreateSectionRequest) + return object; + var message = new $root.google.chat.v1.CreateSectionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.section != null) { + if (typeof object.section !== "object") + throw TypeError(".google.chat.v1.CreateSectionRequest.section: object expected"); + message.section = $root.google.chat.v1.Section.fromObject(object.section); + } + return message; + }; + + /** + * Creates a plain object from a CreateSectionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {google.chat.v1.CreateSectionRequest} message CreateSectionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSectionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.section = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.section != null && message.hasOwnProperty("section")) + object.section = $root.google.chat.v1.Section.toObject(message.section, options); + return object; + }; + + /** + * Converts this CreateSectionRequest to JSON. + * @function toJSON + * @memberof google.chat.v1.CreateSectionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSectionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSectionRequest + * @function getTypeUrl + * @memberof google.chat.v1.CreateSectionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSectionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.CreateSectionRequest"; + }; + + return CreateSectionRequest; + })(); + + v1.DeleteSectionRequest = (function() { + + /** + * Properties of a DeleteSectionRequest. + * @memberof google.chat.v1 + * @interface IDeleteSectionRequest + * @property {string|null} [name] DeleteSectionRequest name + */ + + /** + * Constructs a new DeleteSectionRequest. + * @memberof google.chat.v1 + * @classdesc Represents a DeleteSectionRequest. + * @implements IDeleteSectionRequest + * @constructor + * @param {google.chat.v1.IDeleteSectionRequest=} [properties] Properties to set + */ + function DeleteSectionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteSectionRequest name. + * @member {string} name + * @memberof google.chat.v1.DeleteSectionRequest + * @instance + */ + DeleteSectionRequest.prototype.name = ""; + + /** + * Creates a new DeleteSectionRequest instance using the specified properties. + * @function create + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {google.chat.v1.IDeleteSectionRequest=} [properties] Properties to set + * @returns {google.chat.v1.DeleteSectionRequest} DeleteSectionRequest instance + */ + DeleteSectionRequest.create = function create(properties) { + return new DeleteSectionRequest(properties); + }; + + /** + * Encodes the specified DeleteSectionRequest message. Does not implicitly {@link google.chat.v1.DeleteSectionRequest.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {google.chat.v1.IDeleteSectionRequest} message DeleteSectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSectionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteSectionRequest message, length delimited. Does not implicitly {@link google.chat.v1.DeleteSectionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {google.chat.v1.IDeleteSectionRequest} message DeleteSectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSectionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSectionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.DeleteSectionRequest} DeleteSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSectionRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.DeleteSectionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteSectionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.DeleteSectionRequest} DeleteSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSectionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSectionRequest message. + * @function verify + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSectionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteSectionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.DeleteSectionRequest} DeleteSectionRequest + */ + DeleteSectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.DeleteSectionRequest) + return object; + var message = new $root.google.chat.v1.DeleteSectionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteSectionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {google.chat.v1.DeleteSectionRequest} message DeleteSectionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSectionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteSectionRequest to JSON. + * @function toJSON + * @memberof google.chat.v1.DeleteSectionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSectionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteSectionRequest + * @function getTypeUrl + * @memberof google.chat.v1.DeleteSectionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteSectionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.DeleteSectionRequest"; + }; + + return DeleteSectionRequest; + })(); + + v1.UpdateSectionRequest = (function() { + + /** + * Properties of an UpdateSectionRequest. + * @memberof google.chat.v1 + * @interface IUpdateSectionRequest + * @property {google.chat.v1.ISection|null} [section] UpdateSectionRequest section + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSectionRequest updateMask + */ + + /** + * Constructs a new UpdateSectionRequest. + * @memberof google.chat.v1 + * @classdesc Represents an UpdateSectionRequest. + * @implements IUpdateSectionRequest + * @constructor + * @param {google.chat.v1.IUpdateSectionRequest=} [properties] Properties to set + */ + function UpdateSectionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateSectionRequest section. + * @member {google.chat.v1.ISection|null|undefined} section + * @memberof google.chat.v1.UpdateSectionRequest + * @instance + */ + UpdateSectionRequest.prototype.section = null; + + /** + * UpdateSectionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.chat.v1.UpdateSectionRequest + * @instance + */ + UpdateSectionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateSectionRequest instance using the specified properties. + * @function create + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {google.chat.v1.IUpdateSectionRequest=} [properties] Properties to set + * @returns {google.chat.v1.UpdateSectionRequest} UpdateSectionRequest instance + */ + UpdateSectionRequest.create = function create(properties) { + return new UpdateSectionRequest(properties); + }; + + /** + * Encodes the specified UpdateSectionRequest message. Does not implicitly {@link google.chat.v1.UpdateSectionRequest.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {google.chat.v1.IUpdateSectionRequest} message UpdateSectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSectionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.section != null && Object.hasOwnProperty.call(message, "section")) + $root.google.chat.v1.Section.encode(message.section, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateSectionRequest message, length delimited. Does not implicitly {@link google.chat.v1.UpdateSectionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {google.chat.v1.IUpdateSectionRequest} message UpdateSectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSectionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSectionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.UpdateSectionRequest} UpdateSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSectionRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.UpdateSectionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.section = $root.google.chat.v1.Section.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateSectionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.UpdateSectionRequest} UpdateSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSectionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSectionRequest message. + * @function verify + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSectionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.section != null && message.hasOwnProperty("section")) { + var error = $root.google.chat.v1.Section.verify(message.section); + if (error) + return "section." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateSectionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.UpdateSectionRequest} UpdateSectionRequest + */ + UpdateSectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.UpdateSectionRequest) + return object; + var message = new $root.google.chat.v1.UpdateSectionRequest(); + if (object.section != null) { + if (typeof object.section !== "object") + throw TypeError(".google.chat.v1.UpdateSectionRequest.section: object expected"); + message.section = $root.google.chat.v1.Section.fromObject(object.section); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.chat.v1.UpdateSectionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateSectionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {google.chat.v1.UpdateSectionRequest} message UpdateSectionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSectionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.section = null; + object.updateMask = null; + } + if (message.section != null && message.hasOwnProperty("section")) + object.section = $root.google.chat.v1.Section.toObject(message.section, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateSectionRequest to JSON. + * @function toJSON + * @memberof google.chat.v1.UpdateSectionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSectionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateSectionRequest + * @function getTypeUrl + * @memberof google.chat.v1.UpdateSectionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateSectionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.UpdateSectionRequest"; + }; + + return UpdateSectionRequest; + })(); + + v1.ListSectionsRequest = (function() { + + /** + * Properties of a ListSectionsRequest. + * @memberof google.chat.v1 + * @interface IListSectionsRequest + * @property {string|null} [parent] ListSectionsRequest parent + * @property {number|null} [pageSize] ListSectionsRequest pageSize + * @property {string|null} [pageToken] ListSectionsRequest pageToken + */ + + /** + * Constructs a new ListSectionsRequest. + * @memberof google.chat.v1 + * @classdesc Represents a ListSectionsRequest. + * @implements IListSectionsRequest + * @constructor + * @param {google.chat.v1.IListSectionsRequest=} [properties] Properties to set + */ + function ListSectionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSectionsRequest parent. + * @member {string} parent + * @memberof google.chat.v1.ListSectionsRequest + * @instance + */ + ListSectionsRequest.prototype.parent = ""; + + /** + * ListSectionsRequest pageSize. + * @member {number} pageSize + * @memberof google.chat.v1.ListSectionsRequest + * @instance + */ + ListSectionsRequest.prototype.pageSize = 0; + + /** + * ListSectionsRequest pageToken. + * @member {string} pageToken + * @memberof google.chat.v1.ListSectionsRequest + * @instance + */ + ListSectionsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListSectionsRequest instance using the specified properties. + * @function create + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {google.chat.v1.IListSectionsRequest=} [properties] Properties to set + * @returns {google.chat.v1.ListSectionsRequest} ListSectionsRequest instance + */ + ListSectionsRequest.create = function create(properties) { + return new ListSectionsRequest(properties); + }; + + /** + * Encodes the specified ListSectionsRequest message. Does not implicitly {@link google.chat.v1.ListSectionsRequest.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {google.chat.v1.IListSectionsRequest} message ListSectionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSectionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListSectionsRequest message, length delimited. Does not implicitly {@link google.chat.v1.ListSectionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {google.chat.v1.IListSectionsRequest} message ListSectionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSectionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSectionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.ListSectionsRequest} ListSectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSectionsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.ListSectionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSectionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.ListSectionsRequest} ListSectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSectionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSectionsRequest message. + * @function verify + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSectionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListSectionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.ListSectionsRequest} ListSectionsRequest + */ + ListSectionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.ListSectionsRequest) + return object; + var message = new $root.google.chat.v1.ListSectionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListSectionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {google.chat.v1.ListSectionsRequest} message ListSectionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSectionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListSectionsRequest to JSON. + * @function toJSON + * @memberof google.chat.v1.ListSectionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListSectionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSectionsRequest + * @function getTypeUrl + * @memberof google.chat.v1.ListSectionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSectionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.ListSectionsRequest"; + }; + + return ListSectionsRequest; + })(); + + v1.ListSectionsResponse = (function() { + + /** + * Properties of a ListSectionsResponse. + * @memberof google.chat.v1 + * @interface IListSectionsResponse + * @property {Array.|null} [sections] ListSectionsResponse sections + * @property {string|null} [nextPageToken] ListSectionsResponse nextPageToken + */ + + /** + * Constructs a new ListSectionsResponse. + * @memberof google.chat.v1 + * @classdesc Represents a ListSectionsResponse. + * @implements IListSectionsResponse + * @constructor + * @param {google.chat.v1.IListSectionsResponse=} [properties] Properties to set + */ + function ListSectionsResponse(properties) { + this.sections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSectionsResponse sections. + * @member {Array.} sections + * @memberof google.chat.v1.ListSectionsResponse + * @instance + */ + ListSectionsResponse.prototype.sections = $util.emptyArray; + + /** + * ListSectionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.chat.v1.ListSectionsResponse + * @instance + */ + ListSectionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListSectionsResponse instance using the specified properties. + * @function create + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {google.chat.v1.IListSectionsResponse=} [properties] Properties to set + * @returns {google.chat.v1.ListSectionsResponse} ListSectionsResponse instance + */ + ListSectionsResponse.create = function create(properties) { + return new ListSectionsResponse(properties); + }; + + /** + * Encodes the specified ListSectionsResponse message. Does not implicitly {@link google.chat.v1.ListSectionsResponse.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {google.chat.v1.IListSectionsResponse} message ListSectionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSectionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sections != null && message.sections.length) + for (var i = 0; i < message.sections.length; ++i) + $root.google.chat.v1.Section.encode(message.sections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListSectionsResponse message, length delimited. Does not implicitly {@link google.chat.v1.ListSectionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {google.chat.v1.IListSectionsResponse} message ListSectionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSectionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSectionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.ListSectionsResponse} ListSectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSectionsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.ListSectionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.sections && message.sections.length)) + message.sections = []; + message.sections.push($root.google.chat.v1.Section.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSectionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.ListSectionsResponse} ListSectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSectionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSectionsResponse message. + * @function verify + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSectionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sections != null && message.hasOwnProperty("sections")) { + if (!Array.isArray(message.sections)) + return "sections: array expected"; + for (var i = 0; i < message.sections.length; ++i) { + var error = $root.google.chat.v1.Section.verify(message.sections[i]); + if (error) + return "sections." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListSectionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.ListSectionsResponse} ListSectionsResponse + */ + ListSectionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.ListSectionsResponse) + return object; + var message = new $root.google.chat.v1.ListSectionsResponse(); + if (object.sections) { + if (!Array.isArray(object.sections)) + throw TypeError(".google.chat.v1.ListSectionsResponse.sections: array expected"); + message.sections = []; + for (var i = 0; i < object.sections.length; ++i) { + if (typeof object.sections[i] !== "object") + throw TypeError(".google.chat.v1.ListSectionsResponse.sections: object expected"); + message.sections[i] = $root.google.chat.v1.Section.fromObject(object.sections[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListSectionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {google.chat.v1.ListSectionsResponse} message ListSectionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSectionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.sections = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.sections && message.sections.length) { + object.sections = []; + for (var j = 0; j < message.sections.length; ++j) + object.sections[j] = $root.google.chat.v1.Section.toObject(message.sections[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListSectionsResponse to JSON. + * @function toJSON + * @memberof google.chat.v1.ListSectionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListSectionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSectionsResponse + * @function getTypeUrl + * @memberof google.chat.v1.ListSectionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSectionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.ListSectionsResponse"; + }; + + return ListSectionsResponse; + })(); + + v1.PositionSectionRequest = (function() { + + /** + * Properties of a PositionSectionRequest. + * @memberof google.chat.v1 + * @interface IPositionSectionRequest + * @property {string|null} [name] PositionSectionRequest name + * @property {number|null} [sortOrder] PositionSectionRequest sortOrder + * @property {google.chat.v1.PositionSectionRequest.Position|null} [relativePosition] PositionSectionRequest relativePosition + */ + + /** + * Constructs a new PositionSectionRequest. + * @memberof google.chat.v1 + * @classdesc Represents a PositionSectionRequest. + * @implements IPositionSectionRequest + * @constructor + * @param {google.chat.v1.IPositionSectionRequest=} [properties] Properties to set + */ + function PositionSectionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PositionSectionRequest name. + * @member {string} name + * @memberof google.chat.v1.PositionSectionRequest + * @instance + */ + PositionSectionRequest.prototype.name = ""; + + /** + * PositionSectionRequest sortOrder. + * @member {number|null|undefined} sortOrder + * @memberof google.chat.v1.PositionSectionRequest + * @instance + */ + PositionSectionRequest.prototype.sortOrder = null; + + /** + * PositionSectionRequest relativePosition. + * @member {google.chat.v1.PositionSectionRequest.Position|null|undefined} relativePosition + * @memberof google.chat.v1.PositionSectionRequest + * @instance + */ + PositionSectionRequest.prototype.relativePosition = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * PositionSectionRequest position. + * @member {"sortOrder"|"relativePosition"|undefined} position + * @memberof google.chat.v1.PositionSectionRequest + * @instance + */ + Object.defineProperty(PositionSectionRequest.prototype, "position", { + get: $util.oneOfGetter($oneOfFields = ["sortOrder", "relativePosition"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PositionSectionRequest instance using the specified properties. + * @function create + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {google.chat.v1.IPositionSectionRequest=} [properties] Properties to set + * @returns {google.chat.v1.PositionSectionRequest} PositionSectionRequest instance + */ + PositionSectionRequest.create = function create(properties) { + return new PositionSectionRequest(properties); + }; + + /** + * Encodes the specified PositionSectionRequest message. Does not implicitly {@link google.chat.v1.PositionSectionRequest.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {google.chat.v1.IPositionSectionRequest} message PositionSectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PositionSectionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.sortOrder != null && Object.hasOwnProperty.call(message, "sortOrder")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sortOrder); + if (message.relativePosition != null && Object.hasOwnProperty.call(message, "relativePosition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.relativePosition); + return writer; + }; + + /** + * Encodes the specified PositionSectionRequest message, length delimited. Does not implicitly {@link google.chat.v1.PositionSectionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {google.chat.v1.IPositionSectionRequest} message PositionSectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PositionSectionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PositionSectionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.PositionSectionRequest} PositionSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PositionSectionRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.PositionSectionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.sortOrder = reader.int32(); + break; + } + case 3: { + message.relativePosition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PositionSectionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.PositionSectionRequest} PositionSectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PositionSectionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PositionSectionRequest message. + * @function verify + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PositionSectionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.sortOrder != null && message.hasOwnProperty("sortOrder")) { + properties.position = 1; + if (!$util.isInteger(message.sortOrder)) + return "sortOrder: integer expected"; + } + if (message.relativePosition != null && message.hasOwnProperty("relativePosition")) { + if (properties.position === 1) + return "position: multiple values"; + properties.position = 1; + switch (message.relativePosition) { + default: + return "relativePosition: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a PositionSectionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.PositionSectionRequest} PositionSectionRequest + */ + PositionSectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.PositionSectionRequest) + return object; + var message = new $root.google.chat.v1.PositionSectionRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.sortOrder != null) + message.sortOrder = object.sortOrder | 0; + switch (object.relativePosition) { + default: + if (typeof object.relativePosition === "number") { + message.relativePosition = object.relativePosition; + break; + } + break; + case "POSITION_UNSPECIFIED": + case 0: + message.relativePosition = 0; + break; + case "START": + case 1: + message.relativePosition = 1; + break; + case "END": + case 2: + message.relativePosition = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a PositionSectionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {google.chat.v1.PositionSectionRequest} message PositionSectionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PositionSectionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.sortOrder != null && message.hasOwnProperty("sortOrder")) { + object.sortOrder = message.sortOrder; + if (options.oneofs) + object.position = "sortOrder"; + } + if (message.relativePosition != null && message.hasOwnProperty("relativePosition")) { + object.relativePosition = options.enums === String ? $root.google.chat.v1.PositionSectionRequest.Position[message.relativePosition] === undefined ? message.relativePosition : $root.google.chat.v1.PositionSectionRequest.Position[message.relativePosition] : message.relativePosition; + if (options.oneofs) + object.position = "relativePosition"; + } + return object; + }; + + /** + * Converts this PositionSectionRequest to JSON. + * @function toJSON + * @memberof google.chat.v1.PositionSectionRequest + * @instance + * @returns {Object.} JSON object + */ + PositionSectionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PositionSectionRequest + * @function getTypeUrl + * @memberof google.chat.v1.PositionSectionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PositionSectionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.PositionSectionRequest"; + }; + + /** + * Position enum. + * @name google.chat.v1.PositionSectionRequest.Position + * @enum {number} + * @property {number} POSITION_UNSPECIFIED=0 POSITION_UNSPECIFIED value + * @property {number} START=1 START value + * @property {number} END=2 END value + */ + PositionSectionRequest.Position = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "POSITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "START"] = 1; + values[valuesById[2] = "END"] = 2; + return values; + })(); + + return PositionSectionRequest; + })(); + + v1.PositionSectionResponse = (function() { + + /** + * Properties of a PositionSectionResponse. + * @memberof google.chat.v1 + * @interface IPositionSectionResponse + * @property {google.chat.v1.ISection|null} [section] PositionSectionResponse section + */ + + /** + * Constructs a new PositionSectionResponse. + * @memberof google.chat.v1 + * @classdesc Represents a PositionSectionResponse. + * @implements IPositionSectionResponse + * @constructor + * @param {google.chat.v1.IPositionSectionResponse=} [properties] Properties to set + */ + function PositionSectionResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PositionSectionResponse section. + * @member {google.chat.v1.ISection|null|undefined} section + * @memberof google.chat.v1.PositionSectionResponse + * @instance + */ + PositionSectionResponse.prototype.section = null; + + /** + * Creates a new PositionSectionResponse instance using the specified properties. + * @function create + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {google.chat.v1.IPositionSectionResponse=} [properties] Properties to set + * @returns {google.chat.v1.PositionSectionResponse} PositionSectionResponse instance + */ + PositionSectionResponse.create = function create(properties) { + return new PositionSectionResponse(properties); + }; + + /** + * Encodes the specified PositionSectionResponse message. Does not implicitly {@link google.chat.v1.PositionSectionResponse.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {google.chat.v1.IPositionSectionResponse} message PositionSectionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PositionSectionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.section != null && Object.hasOwnProperty.call(message, "section")) + $root.google.chat.v1.Section.encode(message.section, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PositionSectionResponse message, length delimited. Does not implicitly {@link google.chat.v1.PositionSectionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {google.chat.v1.IPositionSectionResponse} message PositionSectionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PositionSectionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PositionSectionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.PositionSectionResponse} PositionSectionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PositionSectionResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.PositionSectionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.section = $root.google.chat.v1.Section.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PositionSectionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.PositionSectionResponse} PositionSectionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PositionSectionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PositionSectionResponse message. + * @function verify + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PositionSectionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.section != null && message.hasOwnProperty("section")) { + var error = $root.google.chat.v1.Section.verify(message.section); + if (error) + return "section." + error; + } + return null; + }; + + /** + * Creates a PositionSectionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.PositionSectionResponse} PositionSectionResponse + */ + PositionSectionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.PositionSectionResponse) + return object; + var message = new $root.google.chat.v1.PositionSectionResponse(); + if (object.section != null) { + if (typeof object.section !== "object") + throw TypeError(".google.chat.v1.PositionSectionResponse.section: object expected"); + message.section = $root.google.chat.v1.Section.fromObject(object.section); + } + return message; + }; + + /** + * Creates a plain object from a PositionSectionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {google.chat.v1.PositionSectionResponse} message PositionSectionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PositionSectionResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.section = null; + if (message.section != null && message.hasOwnProperty("section")) + object.section = $root.google.chat.v1.Section.toObject(message.section, options); + return object; + }; + + /** + * Converts this PositionSectionResponse to JSON. + * @function toJSON + * @memberof google.chat.v1.PositionSectionResponse + * @instance + * @returns {Object.} JSON object + */ + PositionSectionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PositionSectionResponse + * @function getTypeUrl + * @memberof google.chat.v1.PositionSectionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PositionSectionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.PositionSectionResponse"; + }; + + return PositionSectionResponse; + })(); + + v1.ListSectionItemsRequest = (function() { + + /** + * Properties of a ListSectionItemsRequest. + * @memberof google.chat.v1 + * @interface IListSectionItemsRequest + * @property {string|null} [parent] ListSectionItemsRequest parent + * @property {number|null} [pageSize] ListSectionItemsRequest pageSize + * @property {string|null} [pageToken] ListSectionItemsRequest pageToken + * @property {string|null} [filter] ListSectionItemsRequest filter + */ + + /** + * Constructs a new ListSectionItemsRequest. + * @memberof google.chat.v1 + * @classdesc Represents a ListSectionItemsRequest. + * @implements IListSectionItemsRequest + * @constructor + * @param {google.chat.v1.IListSectionItemsRequest=} [properties] Properties to set + */ + function ListSectionItemsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSectionItemsRequest parent. + * @member {string} parent + * @memberof google.chat.v1.ListSectionItemsRequest + * @instance + */ + ListSectionItemsRequest.prototype.parent = ""; + + /** + * ListSectionItemsRequest pageSize. + * @member {number} pageSize + * @memberof google.chat.v1.ListSectionItemsRequest + * @instance + */ + ListSectionItemsRequest.prototype.pageSize = 0; + + /** + * ListSectionItemsRequest pageToken. + * @member {string} pageToken + * @memberof google.chat.v1.ListSectionItemsRequest + * @instance + */ + ListSectionItemsRequest.prototype.pageToken = ""; + + /** + * ListSectionItemsRequest filter. + * @member {string} filter + * @memberof google.chat.v1.ListSectionItemsRequest + * @instance + */ + ListSectionItemsRequest.prototype.filter = ""; + + /** + * Creates a new ListSectionItemsRequest instance using the specified properties. + * @function create + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {google.chat.v1.IListSectionItemsRequest=} [properties] Properties to set + * @returns {google.chat.v1.ListSectionItemsRequest} ListSectionItemsRequest instance + */ + ListSectionItemsRequest.create = function create(properties) { + return new ListSectionItemsRequest(properties); + }; + + /** + * Encodes the specified ListSectionItemsRequest message. Does not implicitly {@link google.chat.v1.ListSectionItemsRequest.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {google.chat.v1.IListSectionItemsRequest} message ListSectionItemsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSectionItemsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListSectionItemsRequest message, length delimited. Does not implicitly {@link google.chat.v1.ListSectionItemsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {google.chat.v1.IListSectionItemsRequest} message ListSectionItemsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSectionItemsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSectionItemsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.ListSectionItemsRequest} ListSectionItemsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSectionItemsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.ListSectionItemsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSectionItemsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.ListSectionItemsRequest} ListSectionItemsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSectionItemsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSectionItemsRequest message. + * @function verify + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSectionItemsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListSectionItemsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.ListSectionItemsRequest} ListSectionItemsRequest + */ + ListSectionItemsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.ListSectionItemsRequest) + return object; + var message = new $root.google.chat.v1.ListSectionItemsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListSectionItemsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {google.chat.v1.ListSectionItemsRequest} message ListSectionItemsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSectionItemsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListSectionItemsRequest to JSON. + * @function toJSON + * @memberof google.chat.v1.ListSectionItemsRequest + * @instance + * @returns {Object.} JSON object + */ + ListSectionItemsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSectionItemsRequest + * @function getTypeUrl + * @memberof google.chat.v1.ListSectionItemsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSectionItemsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.ListSectionItemsRequest"; + }; + + return ListSectionItemsRequest; + })(); + + v1.ListSectionItemsResponse = (function() { + + /** + * Properties of a ListSectionItemsResponse. + * @memberof google.chat.v1 + * @interface IListSectionItemsResponse + * @property {Array.|null} [sectionItems] ListSectionItemsResponse sectionItems + * @property {string|null} [nextPageToken] ListSectionItemsResponse nextPageToken + */ + + /** + * Constructs a new ListSectionItemsResponse. + * @memberof google.chat.v1 + * @classdesc Represents a ListSectionItemsResponse. + * @implements IListSectionItemsResponse + * @constructor + * @param {google.chat.v1.IListSectionItemsResponse=} [properties] Properties to set + */ + function ListSectionItemsResponse(properties) { + this.sectionItems = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSectionItemsResponse sectionItems. + * @member {Array.} sectionItems + * @memberof google.chat.v1.ListSectionItemsResponse + * @instance + */ + ListSectionItemsResponse.prototype.sectionItems = $util.emptyArray; + + /** + * ListSectionItemsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.chat.v1.ListSectionItemsResponse + * @instance + */ + ListSectionItemsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListSectionItemsResponse instance using the specified properties. + * @function create + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {google.chat.v1.IListSectionItemsResponse=} [properties] Properties to set + * @returns {google.chat.v1.ListSectionItemsResponse} ListSectionItemsResponse instance + */ + ListSectionItemsResponse.create = function create(properties) { + return new ListSectionItemsResponse(properties); + }; + + /** + * Encodes the specified ListSectionItemsResponse message. Does not implicitly {@link google.chat.v1.ListSectionItemsResponse.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {google.chat.v1.IListSectionItemsResponse} message ListSectionItemsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSectionItemsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sectionItems != null && message.sectionItems.length) + for (var i = 0; i < message.sectionItems.length; ++i) + $root.google.chat.v1.SectionItem.encode(message.sectionItems[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListSectionItemsResponse message, length delimited. Does not implicitly {@link google.chat.v1.ListSectionItemsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {google.chat.v1.IListSectionItemsResponse} message ListSectionItemsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSectionItemsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSectionItemsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.ListSectionItemsResponse} ListSectionItemsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSectionItemsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.ListSectionItemsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.sectionItems && message.sectionItems.length)) + message.sectionItems = []; + message.sectionItems.push($root.google.chat.v1.SectionItem.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSectionItemsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.ListSectionItemsResponse} ListSectionItemsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSectionItemsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSectionItemsResponse message. + * @function verify + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSectionItemsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sectionItems != null && message.hasOwnProperty("sectionItems")) { + if (!Array.isArray(message.sectionItems)) + return "sectionItems: array expected"; + for (var i = 0; i < message.sectionItems.length; ++i) { + var error = $root.google.chat.v1.SectionItem.verify(message.sectionItems[i]); + if (error) + return "sectionItems." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListSectionItemsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.ListSectionItemsResponse} ListSectionItemsResponse + */ + ListSectionItemsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.ListSectionItemsResponse) + return object; + var message = new $root.google.chat.v1.ListSectionItemsResponse(); + if (object.sectionItems) { + if (!Array.isArray(object.sectionItems)) + throw TypeError(".google.chat.v1.ListSectionItemsResponse.sectionItems: array expected"); + message.sectionItems = []; + for (var i = 0; i < object.sectionItems.length; ++i) { + if (typeof object.sectionItems[i] !== "object") + throw TypeError(".google.chat.v1.ListSectionItemsResponse.sectionItems: object expected"); + message.sectionItems[i] = $root.google.chat.v1.SectionItem.fromObject(object.sectionItems[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListSectionItemsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {google.chat.v1.ListSectionItemsResponse} message ListSectionItemsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSectionItemsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.sectionItems = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.sectionItems && message.sectionItems.length) { + object.sectionItems = []; + for (var j = 0; j < message.sectionItems.length; ++j) + object.sectionItems[j] = $root.google.chat.v1.SectionItem.toObject(message.sectionItems[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListSectionItemsResponse to JSON. + * @function toJSON + * @memberof google.chat.v1.ListSectionItemsResponse + * @instance + * @returns {Object.} JSON object + */ + ListSectionItemsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSectionItemsResponse + * @function getTypeUrl + * @memberof google.chat.v1.ListSectionItemsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSectionItemsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.ListSectionItemsResponse"; + }; + + return ListSectionItemsResponse; + })(); + + v1.MoveSectionItemRequest = (function() { + + /** + * Properties of a MoveSectionItemRequest. + * @memberof google.chat.v1 + * @interface IMoveSectionItemRequest + * @property {string|null} [name] MoveSectionItemRequest name + * @property {string|null} [targetSection] MoveSectionItemRequest targetSection + */ + + /** + * Constructs a new MoveSectionItemRequest. + * @memberof google.chat.v1 + * @classdesc Represents a MoveSectionItemRequest. + * @implements IMoveSectionItemRequest + * @constructor + * @param {google.chat.v1.IMoveSectionItemRequest=} [properties] Properties to set + */ + function MoveSectionItemRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MoveSectionItemRequest name. + * @member {string} name + * @memberof google.chat.v1.MoveSectionItemRequest + * @instance + */ + MoveSectionItemRequest.prototype.name = ""; + + /** + * MoveSectionItemRequest targetSection. + * @member {string} targetSection + * @memberof google.chat.v1.MoveSectionItemRequest + * @instance + */ + MoveSectionItemRequest.prototype.targetSection = ""; + + /** + * Creates a new MoveSectionItemRequest instance using the specified properties. + * @function create + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {google.chat.v1.IMoveSectionItemRequest=} [properties] Properties to set + * @returns {google.chat.v1.MoveSectionItemRequest} MoveSectionItemRequest instance + */ + MoveSectionItemRequest.create = function create(properties) { + return new MoveSectionItemRequest(properties); + }; + + /** + * Encodes the specified MoveSectionItemRequest message. Does not implicitly {@link google.chat.v1.MoveSectionItemRequest.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {google.chat.v1.IMoveSectionItemRequest} message MoveSectionItemRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveSectionItemRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.targetSection != null && Object.hasOwnProperty.call(message, "targetSection")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetSection); + return writer; + }; + + /** + * Encodes the specified MoveSectionItemRequest message, length delimited. Does not implicitly {@link google.chat.v1.MoveSectionItemRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {google.chat.v1.IMoveSectionItemRequest} message MoveSectionItemRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveSectionItemRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MoveSectionItemRequest message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.MoveSectionItemRequest} MoveSectionItemRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveSectionItemRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.MoveSectionItemRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.targetSection = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MoveSectionItemRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.MoveSectionItemRequest} MoveSectionItemRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveSectionItemRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MoveSectionItemRequest message. + * @function verify + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MoveSectionItemRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.targetSection != null && message.hasOwnProperty("targetSection")) + if (!$util.isString(message.targetSection)) + return "targetSection: string expected"; + return null; + }; + + /** + * Creates a MoveSectionItemRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.MoveSectionItemRequest} MoveSectionItemRequest + */ + MoveSectionItemRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.MoveSectionItemRequest) + return object; + var message = new $root.google.chat.v1.MoveSectionItemRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.targetSection != null) + message.targetSection = String(object.targetSection); + return message; + }; + + /** + * Creates a plain object from a MoveSectionItemRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {google.chat.v1.MoveSectionItemRequest} message MoveSectionItemRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MoveSectionItemRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.targetSection = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.targetSection != null && message.hasOwnProperty("targetSection")) + object.targetSection = message.targetSection; + return object; + }; + + /** + * Converts this MoveSectionItemRequest to JSON. + * @function toJSON + * @memberof google.chat.v1.MoveSectionItemRequest + * @instance + * @returns {Object.} JSON object + */ + MoveSectionItemRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MoveSectionItemRequest + * @function getTypeUrl + * @memberof google.chat.v1.MoveSectionItemRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MoveSectionItemRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.MoveSectionItemRequest"; + }; + + return MoveSectionItemRequest; + })(); + + v1.MoveSectionItemResponse = (function() { + + /** + * Properties of a MoveSectionItemResponse. + * @memberof google.chat.v1 + * @interface IMoveSectionItemResponse + * @property {google.chat.v1.ISectionItem|null} [sectionItem] MoveSectionItemResponse sectionItem + */ + + /** + * Constructs a new MoveSectionItemResponse. + * @memberof google.chat.v1 + * @classdesc Represents a MoveSectionItemResponse. + * @implements IMoveSectionItemResponse + * @constructor + * @param {google.chat.v1.IMoveSectionItemResponse=} [properties] Properties to set + */ + function MoveSectionItemResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MoveSectionItemResponse sectionItem. + * @member {google.chat.v1.ISectionItem|null|undefined} sectionItem + * @memberof google.chat.v1.MoveSectionItemResponse + * @instance + */ + MoveSectionItemResponse.prototype.sectionItem = null; + + /** + * Creates a new MoveSectionItemResponse instance using the specified properties. + * @function create + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {google.chat.v1.IMoveSectionItemResponse=} [properties] Properties to set + * @returns {google.chat.v1.MoveSectionItemResponse} MoveSectionItemResponse instance + */ + MoveSectionItemResponse.create = function create(properties) { + return new MoveSectionItemResponse(properties); + }; + + /** + * Encodes the specified MoveSectionItemResponse message. Does not implicitly {@link google.chat.v1.MoveSectionItemResponse.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {google.chat.v1.IMoveSectionItemResponse} message MoveSectionItemResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveSectionItemResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sectionItem != null && Object.hasOwnProperty.call(message, "sectionItem")) + $root.google.chat.v1.SectionItem.encode(message.sectionItem, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MoveSectionItemResponse message, length delimited. Does not implicitly {@link google.chat.v1.MoveSectionItemResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {google.chat.v1.IMoveSectionItemResponse} message MoveSectionItemResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MoveSectionItemResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MoveSectionItemResponse message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.MoveSectionItemResponse} MoveSectionItemResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveSectionItemResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.MoveSectionItemResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sectionItem = $root.google.chat.v1.SectionItem.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MoveSectionItemResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.MoveSectionItemResponse} MoveSectionItemResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MoveSectionItemResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MoveSectionItemResponse message. + * @function verify + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MoveSectionItemResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sectionItem != null && message.hasOwnProperty("sectionItem")) { + var error = $root.google.chat.v1.SectionItem.verify(message.sectionItem); + if (error) + return "sectionItem." + error; + } + return null; + }; + + /** + * Creates a MoveSectionItemResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.MoveSectionItemResponse} MoveSectionItemResponse + */ + MoveSectionItemResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.MoveSectionItemResponse) + return object; + var message = new $root.google.chat.v1.MoveSectionItemResponse(); + if (object.sectionItem != null) { + if (typeof object.sectionItem !== "object") + throw TypeError(".google.chat.v1.MoveSectionItemResponse.sectionItem: object expected"); + message.sectionItem = $root.google.chat.v1.SectionItem.fromObject(object.sectionItem); + } + return message; + }; + + /** + * Creates a plain object from a MoveSectionItemResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {google.chat.v1.MoveSectionItemResponse} message MoveSectionItemResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MoveSectionItemResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.sectionItem = null; + if (message.sectionItem != null && message.hasOwnProperty("sectionItem")) + object.sectionItem = $root.google.chat.v1.SectionItem.toObject(message.sectionItem, options); + return object; + }; + + /** + * Converts this MoveSectionItemResponse to JSON. + * @function toJSON + * @memberof google.chat.v1.MoveSectionItemResponse + * @instance + * @returns {Object.} JSON object + */ + MoveSectionItemResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MoveSectionItemResponse + * @function getTypeUrl + * @memberof google.chat.v1.MoveSectionItemResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MoveSectionItemResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.MoveSectionItemResponse"; + }; + + return MoveSectionItemResponse; + })(); + v1.SpaceEvent = (function() { /** diff --git a/packages/google-chat/protos/protos.json b/packages/google-chat/protos/protos.json index dbe5a7d44bb..70b80dbb207 100644 --- a/packages/google-chat/protos/protos.json +++ b/packages/google-chat/protos/protos.json @@ -2741,7 +2741,9 @@ "java_package": "com.google.chat.v1", "objc_class_prefix": "DYNAPIProto", "php_namespace": "Google\\Apps\\Chat\\V1", - "ruby_package": "Google::Apps::Chat::V1" + "ruby_package": "Google::Apps::Chat::V1", + "(google.api.resource_definition).type": "chat.googleapis.com/User", + "(google.api.resource_definition).pattern": "users/{user}" }, "nested": { "ActionStatus": { @@ -3497,7 +3499,7 @@ "ChatService": { "options": { "(google.api.default_host)": "chat.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/chat.admin.delete,https://www.googleapis.com/auth/chat.admin.memberships,https://www.googleapis.com/auth/chat.admin.memberships.readonly,https://www.googleapis.com/auth/chat.admin.spaces,https://www.googleapis.com/auth/chat.admin.spaces.readonly,https://www.googleapis.com/auth/chat.app.delete,https://www.googleapis.com/auth/chat.app.memberships,https://www.googleapis.com/auth/chat.app.messages.readonly,https://www.googleapis.com/auth/chat.app.spaces,https://www.googleapis.com/auth/chat.app.spaces.create,https://www.googleapis.com/auth/chat.bot,https://www.googleapis.com/auth/chat.customemojis,https://www.googleapis.com/auth/chat.customemojis.readonly,https://www.googleapis.com/auth/chat.delete,https://www.googleapis.com/auth/chat.import,https://www.googleapis.com/auth/chat.memberships,https://www.googleapis.com/auth/chat.memberships.app,https://www.googleapis.com/auth/chat.memberships.readonly,https://www.googleapis.com/auth/chat.messages,https://www.googleapis.com/auth/chat.messages.create,https://www.googleapis.com/auth/chat.messages.reactions,https://www.googleapis.com/auth/chat.messages.reactions.create,https://www.googleapis.com/auth/chat.messages.reactions.readonly,https://www.googleapis.com/auth/chat.messages.readonly,https://www.googleapis.com/auth/chat.spaces,https://www.googleapis.com/auth/chat.spaces.create,https://www.googleapis.com/auth/chat.spaces.readonly,https://www.googleapis.com/auth/chat.users.readstate,https://www.googleapis.com/auth/chat.users.readstate.readonly,https://www.googleapis.com/auth/chat.users.spacesettings" + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/chat.admin.delete,https://www.googleapis.com/auth/chat.admin.memberships,https://www.googleapis.com/auth/chat.admin.memberships.readonly,https://www.googleapis.com/auth/chat.admin.spaces,https://www.googleapis.com/auth/chat.admin.spaces.readonly,https://www.googleapis.com/auth/chat.app.delete,https://www.googleapis.com/auth/chat.app.memberships,https://www.googleapis.com/auth/chat.app.memberships.readonly,https://www.googleapis.com/auth/chat.app.messages.readonly,https://www.googleapis.com/auth/chat.app.spaces,https://www.googleapis.com/auth/chat.app.spaces.create,https://www.googleapis.com/auth/chat.app.spaces.readonly,https://www.googleapis.com/auth/chat.bot,https://www.googleapis.com/auth/chat.customemojis,https://www.googleapis.com/auth/chat.customemojis.readonly,https://www.googleapis.com/auth/chat.delete,https://www.googleapis.com/auth/chat.import,https://www.googleapis.com/auth/chat.memberships,https://www.googleapis.com/auth/chat.memberships.app,https://www.googleapis.com/auth/chat.memberships.readonly,https://www.googleapis.com/auth/chat.messages,https://www.googleapis.com/auth/chat.messages.create,https://www.googleapis.com/auth/chat.messages.reactions,https://www.googleapis.com/auth/chat.messages.reactions.create,https://www.googleapis.com/auth/chat.messages.reactions.readonly,https://www.googleapis.com/auth/chat.messages.readonly,https://www.googleapis.com/auth/chat.spaces,https://www.googleapis.com/auth/chat.spaces.create,https://www.googleapis.com/auth/chat.spaces.readonly,https://www.googleapis.com/auth/chat.users.readstate,https://www.googleapis.com/auth/chat.users.readstate.readonly,https://www.googleapis.com/auth/chat.users.sections,https://www.googleapis.com/auth/chat.users.sections.readonly,https://www.googleapis.com/auth/chat.users.spacesettings" }, "methods": { "CreateMessage": { @@ -4145,6 +4147,136 @@ "(google.api.method_signature)": "space_notification_setting,update_mask" } ] + }, + "CreateSection": { + "requestType": "CreateSectionRequest", + "responseType": "Section", + "options": { + "(google.api.http).post": "/v1/{parent=users/*}/sections", + "(google.api.http).body": "section", + "(google.api.method_signature)": "parent,section" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=users/*}/sections", + "body": "section" + } + }, + { + "(google.api.method_signature)": "parent,section" + } + ] + }, + "DeleteSection": { + "requestType": "DeleteSectionRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=users/*/sections/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=users/*/sections/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateSection": { + "requestType": "UpdateSectionRequest", + "responseType": "Section", + "options": { + "(google.api.http).patch": "/v1/{section.name=users/*/sections/*}", + "(google.api.http).body": "section", + "(google.api.method_signature)": "section,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{section.name=users/*/sections/*}", + "body": "section" + } + }, + { + "(google.api.method_signature)": "section,update_mask" + } + ] + }, + "ListSections": { + "requestType": "ListSectionsRequest", + "responseType": "ListSectionsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=users/*}/sections", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=users/*}/sections" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "PositionSection": { + "requestType": "PositionSectionRequest", + "responseType": "PositionSectionResponse", + "options": { + "(google.api.http).post": "/v1/{name=users/*/sections/*}:position", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=users/*/sections/*}:position", + "body": "*" + } + } + ] + }, + "ListSectionItems": { + "requestType": "ListSectionItemsRequest", + "responseType": "ListSectionItemsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=users/*/sections/*}/items", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=users/*/sections/*}/items" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "MoveSectionItem": { + "requestType": "MoveSectionItemRequest", + "responseType": "MoveSectionItemResponse", + "options": { + "(google.api.http).post": "/v1/{name=users/*/sections/*/items/*}:move", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,target_section" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=users/*/sections/*/items/*}:move", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,target_section" + } + ] } } }, @@ -6038,6 +6170,297 @@ "HISTORY_ON": 2 } }, + "Section": { + "options": { + "(google.api.resource).type": "chat.googleapis.com/Section", + "(google.api.resource).pattern": "users/{user}/sections/{section}", + "(google.api.resource).plural": "sections", + "(google.api.resource).singular": "section" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sortOrder": { + "type": "int32", + "id": 3 + }, + "type": { + "type": "SectionType", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "SectionType": { + "values": { + "SECTION_TYPE_UNSPECIFIED": 0, + "CUSTOM_SECTION": 1, + "DEFAULT_DIRECT_MESSAGES": 2, + "DEFAULT_SPACES": 3, + "DEFAULT_APPS": 6 + } + } + } + }, + "SectionItem": { + "options": { + "(google.api.resource).type": "chat.googleapis.com/SectionItem", + "(google.api.resource).pattern": "users/{user}/sections/{section}/items/{item}", + "(google.api.resource).plural": "sectionItems", + "(google.api.resource).singular": "sectionItem" + }, + "oneofs": { + "item": { + "oneof": [ + "space" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "space": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "chat.googleapis.com/Space" + } + } + } + }, + "CreateSectionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "chat.googleapis.com/User" + } + }, + "section": { + "type": "Section", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteSectionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "chat.googleapis.com/Section" + } + } + } + }, + "UpdateSectionRequest": { + "fields": { + "section": { + "type": "Section", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListSectionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "chat.googleapis.com/User" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSectionsResponse": { + "fields": { + "sections": { + "rule": "repeated", + "type": "Section", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "PositionSectionRequest": { + "oneofs": { + "position": { + "oneof": [ + "sortOrder", + "relativePosition" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "chat.googleapis.com/Section" + } + }, + "sortOrder": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "relativePosition": { + "type": "Position", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Position": { + "values": { + "POSITION_UNSPECIFIED": 0, + "START": 1, + "END": 2 + } + } + } + }, + "PositionSectionResponse": { + "fields": { + "section": { + "type": "Section", + "id": 1 + } + } + }, + "ListSectionItemsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "chat.googleapis.com/Section" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSectionItemsResponse": { + "fields": { + "sectionItems": { + "rule": "repeated", + "type": "SectionItem", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "MoveSectionItemRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "chat.googleapis.com/SectionItem" + } + }, + "targetSection": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "chat.googleapis.com/Section" + } + } + } + }, + "MoveSectionItemResponse": { + "fields": { + "sectionItem": { + "type": "SectionItem", + "id": 1 + } + } + }, "SpaceEvent": { "options": { "(google.api.resource).type": "chat.googleapis.com/SpaceEvent", diff --git a/packages/google-chat/samples/generated/v1/chat_service.create_section.js b/packages/google-chat/samples/generated/v1/chat_service.create_section.js new file mode 100644 index 00000000000..11ef1ea147c --- /dev/null +++ b/packages/google-chat/samples/generated/v1/chat_service.create_section.js @@ -0,0 +1,67 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, section) { + // [START chat_v1_generated_ChatService_CreateSection_async] + /** + * 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 parent resource name where the section is created. + * Format: `users/{user}` + */ + // const parent = 'abc123' + /** + * Required. The section to create. + */ + // const section = {} + + // Imports the Chat library + const {ChatServiceClient} = require('@google-apps/chat').v1; + + // Instantiates a client + const chatClient = new ChatServiceClient(); + + async function callCreateSection() { + // Construct request + const request = { + parent, + section, + }; + + // Run request + const response = await chatClient.createSection(request); + console.log(response); + } + + callCreateSection(); + // [END chat_v1_generated_ChatService_CreateSection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-chat/samples/generated/v1/chat_service.delete_section.js b/packages/google-chat/samples/generated/v1/chat_service.delete_section.js new file mode 100644 index 00000000000..8e9abd4833a --- /dev/null +++ b/packages/google-chat/samples/generated/v1/chat_service.delete_section.js @@ -0,0 +1,62 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START chat_v1_generated_ChatService_DeleteSection_async] + /** + * 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 name of the section to delete. + * Format: `users/{user}/sections/{section}` + */ + // const name = 'abc123' + + // Imports the Chat library + const {ChatServiceClient} = require('@google-apps/chat').v1; + + // Instantiates a client + const chatClient = new ChatServiceClient(); + + async function callDeleteSection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await chatClient.deleteSection(request); + console.log(response); + } + + callDeleteSection(); + // [END chat_v1_generated_ChatService_DeleteSection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-chat/samples/generated/v1/chat_service.list_section_items.js b/packages/google-chat/samples/generated/v1/chat_service.list_section_items.js new file mode 100644 index 00000000000..d18ea458e64 --- /dev/null +++ b/packages/google-chat/samples/generated/v1/chat_service.list_section_items.js @@ -0,0 +1,92 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START chat_v1_generated_ChatService_ListSectionItems_async] + /** + * 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 parent, which is the section resource name that owns this + * collection of section items. Only supports listing section items for the + * calling user. + * When you're filtering by space, use the wildcard `-` to search across all + * sections. For example, `users/{user}/sections/-`. + * Format: `users/{user}/sections/{section}` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of section items to return. The service may + * return fewer than this value. + * If unspecified, at most 10 section items will be returned. + * The maximum value is 100. If you use a value more than 100, it's + * automatically changed to 100. + * Negative values return an `INVALID_ARGUMENT` error. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous list section items call. + * Provide this 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. + * Currently only supports filtering by space. + * For example, `space = spaces/{space}`. + * Invalid queries are rejected 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 callListSectionItems() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = chatClient.listSectionItemsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSectionItems(); + // [END chat_v1_generated_ChatService_ListSectionItems_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-chat/samples/generated/v1/chat_service.list_sections.js b/packages/google-chat/samples/generated/v1/chat_service.list_sections.js new file mode 100644 index 00000000000..a1e7ae1c4c4 --- /dev/null +++ b/packages/google-chat/samples/generated/v1/chat_service.list_sections.js @@ -0,0 +1,86 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START chat_v1_generated_ChatService_ListSections_async] + /** + * 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 parent, which is the user resource name that owns this + * collection of sections. Only supports listing sections for the calling + * user. To refer to the calling user, set one of the following: + * - The `me` alias. For example, `users/me`. + * - Their Workspace email address. For example, `users/user@example.com`. + * - Their user id. For example, `users/123456789`. + * Format: `users/{user}` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of sections to return. The service may return + * fewer than this value. + * If unspecified, at most 10 sections will be returned. + * The maximum value is 100. If you use a value more than 100, it's + * automatically changed to 100. + * Negative values return an `INVALID_ARGUMENT` error. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous list sections call. + * Provide this 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' + + // Imports the Chat library + const {ChatServiceClient} = require('@google-apps/chat').v1; + + // Instantiates a client + const chatClient = new ChatServiceClient(); + + async function callListSections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = chatClient.listSectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSections(); + // [END chat_v1_generated_ChatService_ListSections_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-chat/samples/generated/v1/chat_service.move_section_item.js b/packages/google-chat/samples/generated/v1/chat_service.move_section_item.js new file mode 100644 index 00000000000..8cb15ca5f12 --- /dev/null +++ b/packages/google-chat/samples/generated/v1/chat_service.move_section_item.js @@ -0,0 +1,68 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, targetSection) { + // [START chat_v1_generated_ChatService_MoveSectionItem_async] + /** + * 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 section item to move. + * Format: `users/{user}/sections/{section}/items/{item}` + */ + // const name = 'abc123' + /** + * Required. The resource name of the section to move the section item to. + * Format: `users/{user}/sections/{section}` + */ + // const targetSection = 'abc123' + + // Imports the Chat library + const {ChatServiceClient} = require('@google-apps/chat').v1; + + // Instantiates a client + const chatClient = new ChatServiceClient(); + + async function callMoveSectionItem() { + // Construct request + const request = { + name, + targetSection, + }; + + // Run request + const response = await chatClient.moveSectionItem(request); + console.log(response); + } + + callMoveSectionItem(); + // [END chat_v1_generated_ChatService_MoveSectionItem_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-chat/samples/generated/v1/chat_service.position_section.js b/packages/google-chat/samples/generated/v1/chat_service.position_section.js new file mode 100644 index 00000000000..1a5d8a8da9e --- /dev/null +++ b/packages/google-chat/samples/generated/v1/chat_service.position_section.js @@ -0,0 +1,75 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START chat_v1_generated_ChatService_PositionSection_async] + /** + * 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 section to position. + * Format: `users/{user}/sections/{section}` + */ + // const name = 'abc123' + /** + * Optional. The absolute position of the section in the list of sections. + * The position must be greater than 0. If the position is greater than the + * number of sections, the section will be appended to the end of the list. + * This operation inserts the section at the given position and shifts the + * original section at that position, and those below it, to the next + * position. + */ + // const sortOrder = 1234 + /** + * Optional. The relative position of the section in the list of sections. + */ + // const relativePosition = {} + + // Imports the Chat library + const {ChatServiceClient} = require('@google-apps/chat').v1; + + // Instantiates a client + const chatClient = new ChatServiceClient(); + + async function callPositionSection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await chatClient.positionSection(request); + console.log(response); + } + + callPositionSection(); + // [END chat_v1_generated_ChatService_PositionSection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-chat/samples/generated/v1/chat_service.update_section.js b/packages/google-chat/samples/generated/v1/chat_service.update_section.js new file mode 100644 index 00000000000..4d0dbd13db3 --- /dev/null +++ b/packages/google-chat/samples/generated/v1/chat_service.update_section.js @@ -0,0 +1,68 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(section, updateMask) { + // [START chat_v1_generated_ChatService_UpdateSection_async] + /** + * 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 section to update. + */ + // const section = {} + /** + * Required. The mask to specify which fields to update. + * Currently supported field paths: + * - `display_name` + */ + // const updateMask = {} + + // Imports the Chat library + const {ChatServiceClient} = require('@google-apps/chat').v1; + + // Instantiates a client + const chatClient = new ChatServiceClient(); + + async function callUpdateSection() { + // Construct request + const request = { + section, + updateMask, + }; + + // Run request + const response = await chatClient.updateSection(request); + console.log(response); + } + + callUpdateSection(); + // [END chat_v1_generated_ChatService_UpdateSection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-chat/samples/generated/v1/snippet_metadata_google.chat.v1.json b/packages/google-chat/samples/generated/v1/snippet_metadata_google.chat.v1.json index 2fa1bb14c4d..d8a8bb4e231 100644 --- a/packages/google-chat/samples/generated/v1/snippet_metadata_google.chat.v1.json +++ b/packages/google-chat/samples/generated/v1/snippet_metadata_google.chat.v1.json @@ -75,7 +75,7 @@ "regionTag": "chat_v1_generated_ChatService_ListMessages_async", "title": "ChatService listMessages Sample", "origin": "API_DEFINITION", - "description": " Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. System messages, like those announcing new space members, aren't included. If you list messages from a space with no messages, the response is an empty object. When using a REST/HTTP interface, the response contains an empty JSON object, `{}`. For an example, see [List messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/list). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) with the authorization scope: - `https://www.googleapis.com/auth/chat.app.messages.readonly`. When using this authentication scope, this method only returns public messages in a space. It doesn't include private messages. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.messages.readonly` - `https://www.googleapis.com/auth/chat.messages` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)", + "description": " Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. System messages, like those announcing new space members, aren't included. If you list messages from a space with no messages, the response is an empty object. When using a REST/HTTP interface, the response contains an empty JSON object, `{}`. For an example, see [List messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/list). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with the authorization scope: - `https://www.googleapis.com/auth/chat.app.messages.readonly`. When using this authentication scope, this method only returns public messages in a space. It doesn't include private messages. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.messages.readonly` - `https://www.googleapis.com/auth/chat.messages` - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)", "canonical": true, "file": "chat_service.list_messages.js", "language": "JAVASCRIPT", @@ -243,7 +243,7 @@ "regionTag": "chat_v1_generated_ChatService_GetMessage_async", "title": "ChatService getMessage Sample", "origin": "API_DEFINITION", - "description": " Returns details about a message. For an example, see [Get details about a message](https://developers.google.com/workspace/chat/get-messages). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.bot`: When using this authorization scope, this method returns details about a message the Chat app has access to, like direct messages and [slash commands](https://developers.google.com/workspace/chat/slash-commands) that invoke the Chat app. - `https://www.googleapis.com/auth/chat.app.messages.readonly` with [administrator approval](https://support.google.com/a?p=chat-app-auth) (available in [Developer Preview](https://developers.google.com/workspace/preview)). When using this authentication scope, this method returns details about a public message in a space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.messages.readonly` - `https://www.googleapis.com/auth/chat.messages` Note: Might return a message from a blocked member or space.", + "description": " Returns details about a message. For an example, see [Get details about a message](https://developers.google.com/workspace/chat/get-messages). Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.bot`: When using this authorization scope, this method returns details about a message the Chat app has access to, like direct messages and [slash commands](https://developers.google.com/workspace/chat/slash-commands) that invoke the Chat app. - `https://www.googleapis.com/auth/chat.app.messages.readonly` with [administrator approval](https://support.google.com/a?p=chat-app-auth). When using this authentication scope, this method returns details about a public message in a space. - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.messages.readonly` - `https://www.googleapis.com/auth/chat.messages` Note: Might return a message from a blocked member or space.", "canonical": true, "file": "chat_service.get_message.js", "language": "JAVASCRIPT", @@ -1439,7 +1439,7 @@ "regionTag": "chat_v1_generated_ChatService_GetSpaceEvent_async", "title": "ChatService getSpaceEvent Sample", "origin": "API_DEFINITION", - "description": " Returns an event from a Google Chat space. The [event payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) contains the most recent version of the resource that changed. For example, if you request an event about a new message but the message was later updated, the server returns the updated `Message` resource in the event payload. Note: The `permissionSettings` field is not returned in the Space object of the Space event data for this request. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) with an [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) appropriate for reading the requested data: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.app.spaces` - `https://www.googleapis.com/auth/chat.app.messages.readonly` - `https://www.googleapis.com/auth/chat.app.memberships` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces` - `https://www.googleapis.com/auth/chat.messages.readonly` - `https://www.googleapis.com/auth/chat.messages` - `https://www.googleapis.com/auth/chat.messages.reactions.readonly` - `https://www.googleapis.com/auth/chat.messages.reactions` - `https://www.googleapis.com/auth/chat.memberships.readonly` - `https://www.googleapis.com/auth/chat.memberships` To get an event, the authenticated caller must be a member of the space. For an example, see [Get details about an event from a Google Chat space](https://developers.google.com/workspace/chat/get-space-event).", + "description": " Returns an event from a Google Chat space. The [event payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) contains the most recent version of the resource that changed. For example, if you request an event about a new message but the message was later updated, the server returns the updated `Message` resource in the event payload. Note: The `permissionSettings` field is not returned in the Space object of the Space event data for this request. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) with an [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) appropriate for reading the requested data: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.app.spaces` - `https://www.googleapis.com/auth/chat.app.spaces.readonly` - `https://www.googleapis.com/auth/chat.app.messages.readonly` - `https://www.googleapis.com/auth/chat.app.memberships` - `https://www.googleapis.com/auth/chat.app.memberships.readonly` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces` - `https://www.googleapis.com/auth/chat.messages.readonly` - `https://www.googleapis.com/auth/chat.messages` - `https://www.googleapis.com/auth/chat.messages.reactions.readonly` - `https://www.googleapis.com/auth/chat.messages.reactions` - `https://www.googleapis.com/auth/chat.memberships.readonly` - `https://www.googleapis.com/auth/chat.memberships` To get an event, the authenticated caller must be a member of the space. For an example, see [Get details about an event from a Google Chat space](https://developers.google.com/workspace/chat/get-space-event).", "canonical": true, "file": "chat_service.get_space_event.js", "language": "JAVASCRIPT", @@ -1479,7 +1479,7 @@ "regionTag": "chat_v1_generated_ChatService_ListSpaceEvents_async", "title": "ChatService listSpaceEvents Sample", "origin": "API_DEFINITION", - "description": " Lists events from a Google Chat space. For each event, the [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) contains the most recent version of the Chat resource. For example, if you list events about new space members, the server returns `Membership` resources that contain the latest membership details. If new members were removed during the requested period, the event payload contains an empty `Membership` resource. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) with an [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) appropriate for reading the requested data: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) in [Developer Preview](https://developers.google.com/workspace/preview) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.app.spaces` - `https://www.googleapis.com/auth/chat.app.messages.readonly` - `https://www.googleapis.com/auth/chat.app.memberships` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces` - `https://www.googleapis.com/auth/chat.messages.readonly` - `https://www.googleapis.com/auth/chat.messages` - `https://www.googleapis.com/auth/chat.messages.reactions.readonly` - `https://www.googleapis.com/auth/chat.messages.reactions` - `https://www.googleapis.com/auth/chat.memberships.readonly` - `https://www.googleapis.com/auth/chat.memberships` To list events, the authenticated caller must be a member of the space. For an example, see [List events from a Google Chat space](https://developers.google.com/workspace/chat/list-space-events).", + "description": " Lists events from a Google Chat space. For each event, the [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) contains the most recent version of the Chat resource. For example, if you list events about new space members, the server returns `Membership` resources that contain the latest membership details. If new members were removed during the requested period, the event payload contains an empty `Membership` resource. Supports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) with an [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) appropriate for reading the requested data: - [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with [administrator approval](https://support.google.com/a?p=chat-app-auth) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.app.spaces` - `https://www.googleapis.com/auth/chat.app.spaces.readonly` - `https://www.googleapis.com/auth/chat.app.messages.readonly` - `https://www.googleapis.com/auth/chat.app.memberships` - `https://www.googleapis.com/auth/chat.app.memberships.readonly` - [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes: - `https://www.googleapis.com/auth/chat.spaces.readonly` - `https://www.googleapis.com/auth/chat.spaces` - `https://www.googleapis.com/auth/chat.messages.readonly` - `https://www.googleapis.com/auth/chat.messages` - `https://www.googleapis.com/auth/chat.messages.reactions.readonly` - `https://www.googleapis.com/auth/chat.messages.reactions` - `https://www.googleapis.com/auth/chat.memberships.readonly` - `https://www.googleapis.com/auth/chat.memberships` To list events, the authenticated caller must be a member of the space. For an example, see [List events from a Google Chat space](https://developers.google.com/workspace/chat/list-space-events).", "canonical": true, "file": "chat_service.list_space_events.js", "language": "JAVASCRIPT", @@ -1610,6 +1610,326 @@ } } } + }, + { + "regionTag": "chat_v1_generated_ChatService_CreateSection_async", + "title": "ChatService createSection Sample", + "origin": "API_DEFINITION", + "description": " Creates a section in Google Chat. Sections help users group conversations and customize the list of spaces displayed in Chat navigation panel. Only sections of type `CUSTOM_SECTION` can be created. For details, see [Create and organize sections in Google Chat](https://support.google.com/chat/answer/16059854). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.users.sections`", + "canonical": true, + "file": "chat_service.create_section.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSection", + "fullName": "google.chat.v1.ChatService.CreateSection", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "section", + "type": ".google.chat.v1.Section" + } + ], + "resultType": ".google.chat.v1.Section", + "client": { + "shortName": "ChatServiceClient", + "fullName": "google.chat.v1.ChatServiceClient" + }, + "method": { + "shortName": "CreateSection", + "fullName": "google.chat.v1.ChatService.CreateSection", + "service": { + "shortName": "ChatService", + "fullName": "google.chat.v1.ChatService" + } + } + } + }, + { + "regionTag": "chat_v1_generated_ChatService_DeleteSection_async", + "title": "ChatService deleteSection Sample", + "origin": "API_DEFINITION", + "description": " Deletes a section of type `CUSTOM_SECTION`. If the section contains items, such as spaces, the items are moved to Google Chat's default sections and are not deleted. For details, see [Create and organize sections in Google Chat](https://support.google.com/chat/answer/16059854). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.users.sections`", + "canonical": true, + "file": "chat_service.delete_section.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSection", + "fullName": "google.chat.v1.ChatService.DeleteSection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ChatServiceClient", + "fullName": "google.chat.v1.ChatServiceClient" + }, + "method": { + "shortName": "DeleteSection", + "fullName": "google.chat.v1.ChatService.DeleteSection", + "service": { + "shortName": "ChatService", + "fullName": "google.chat.v1.ChatService" + } + } + } + }, + { + "regionTag": "chat_v1_generated_ChatService_UpdateSection_async", + "title": "ChatService updateSection Sample", + "origin": "API_DEFINITION", + "description": " Updates a section. Only sections of type `CUSTOM_SECTION` can be updated. For details, see [Create and organize sections in Google Chat](https://support.google.com/chat/answer/16059854). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.users.sections`", + "canonical": true, + "file": "chat_service.update_section.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSection", + "fullName": "google.chat.v1.ChatService.UpdateSection", + "async": true, + "parameters": [ + { + "name": "section", + "type": ".google.chat.v1.Section" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.chat.v1.Section", + "client": { + "shortName": "ChatServiceClient", + "fullName": "google.chat.v1.ChatServiceClient" + }, + "method": { + "shortName": "UpdateSection", + "fullName": "google.chat.v1.ChatService.UpdateSection", + "service": { + "shortName": "ChatService", + "fullName": "google.chat.v1.ChatService" + } + } + } + }, + { + "regionTag": "chat_v1_generated_ChatService_ListSections_async", + "title": "ChatService listSections Sample", + "origin": "API_DEFINITION", + "description": " Lists sections available to the Chat user. Sections help users group their conversations and customize the list of spaces displayed in Chat navigation panel. For details, see [Create and organize sections in Google Chat](https://support.google.com/chat/answer/16059854). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.users.sections` - `https://www.googleapis.com/auth/chat.users.sections.readonly`", + "canonical": true, + "file": "chat_service.list_sections.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSections", + "fullName": "google.chat.v1.ChatService.ListSections", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.chat.v1.ListSectionsResponse", + "client": { + "shortName": "ChatServiceClient", + "fullName": "google.chat.v1.ChatServiceClient" + }, + "method": { + "shortName": "ListSections", + "fullName": "google.chat.v1.ChatService.ListSections", + "service": { + "shortName": "ChatService", + "fullName": "google.chat.v1.ChatService" + } + } + } + }, + { + "regionTag": "chat_v1_generated_ChatService_PositionSection_async", + "title": "ChatService positionSection Sample", + "origin": "API_DEFINITION", + "description": " Changes the sort order of a section. For details, see [Create and organize sections in Google Chat](https://support.google.com/chat/answer/16059854). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.users.sections`", + "canonical": true, + "file": "chat_service.position_section.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PositionSection", + "fullName": "google.chat.v1.ChatService.PositionSection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "sort_order", + "type": "TYPE_INT32" + }, + { + "name": "relative_position", + "type": ".google.chat.v1.PositionSectionRequest.Position" + } + ], + "resultType": ".google.chat.v1.PositionSectionResponse", + "client": { + "shortName": "ChatServiceClient", + "fullName": "google.chat.v1.ChatServiceClient" + }, + "method": { + "shortName": "PositionSection", + "fullName": "google.chat.v1.ChatService.PositionSection", + "service": { + "shortName": "ChatService", + "fullName": "google.chat.v1.ChatService" + } + } + } + }, + { + "regionTag": "chat_v1_generated_ChatService_ListSectionItems_async", + "title": "ChatService listSectionItems Sample", + "origin": "API_DEFINITION", + "description": " Lists items in a section. Only spaces can be section items. For details, see [Create and organize sections in Google Chat](https://support.google.com/chat/answer/16059854). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.users.sections` - `https://www.googleapis.com/auth/chat.users.sections.readonly`", + "canonical": true, + "file": "chat_service.list_section_items.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSectionItems", + "fullName": "google.chat.v1.ChatService.ListSectionItems", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.chat.v1.ListSectionItemsResponse", + "client": { + "shortName": "ChatServiceClient", + "fullName": "google.chat.v1.ChatServiceClient" + }, + "method": { + "shortName": "ListSectionItems", + "fullName": "google.chat.v1.ChatService.ListSectionItems", + "service": { + "shortName": "ChatService", + "fullName": "google.chat.v1.ChatService" + } + } + } + }, + { + "regionTag": "chat_v1_generated_ChatService_MoveSectionItem_async", + "title": "ChatService moveSectionItem Sample", + "origin": "API_DEFINITION", + "description": " Moves an item from one section to another. For example, if a section contains spaces, this method can be used to move a space to a different section. For details, see [Create and organize sections in Google Chat](https://support.google.com/chat/answer/16059854). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with the [authorization scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): - `https://www.googleapis.com/auth/chat.users.sections`", + "canonical": true, + "file": "chat_service.move_section_item.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MoveSectionItem", + "fullName": "google.chat.v1.ChatService.MoveSectionItem", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "target_section", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.chat.v1.MoveSectionItemResponse", + "client": { + "shortName": "ChatServiceClient", + "fullName": "google.chat.v1.ChatServiceClient" + }, + "method": { + "shortName": "MoveSectionItem", + "fullName": "google.chat.v1.ChatService.MoveSectionItem", + "service": { + "shortName": "ChatService", + "fullName": "google.chat.v1.ChatService" + } + } + } } ] } diff --git a/packages/google-chat/src/v1/chat_service_client.ts b/packages/google-chat/src/v1/chat_service_client.ts index 36cf9f4dda2..63b4427ab93 100644 --- a/packages/google-chat/src/v1/chat_service_client.ts +++ b/packages/google-chat/src/v1/chat_service_client.ts @@ -196,6 +196,12 @@ export class ChatServiceClient { reactionPathTemplate: new this._gaxModule.PathTemplate( 'spaces/{space}/messages/{message}/reactions/{reaction}' ), + sectionPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/sections/{section}' + ), + sectionItemPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/sections/{section}/items/{item}' + ), spacePathTemplate: new this._gaxModule.PathTemplate( 'spaces/{space}' ), @@ -233,7 +239,11 @@ export class ChatServiceClient { listCustomEmojis: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'customEmojis'), listSpaceEvents: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents') + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents'), + listSections: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sections'), + listSectionItems: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sectionItems') }; // Put together the default options sent with requests. @@ -279,7 +289,7 @@ export class ChatServiceClient { // Iterate over each of the methods that the service provides // and create an API call method for each. const chatServiceStubMethods = - ['createMessage', 'listMessages', 'listMemberships', 'getMembership', 'getMessage', 'updateMessage', 'deleteMessage', 'getAttachment', 'uploadAttachment', 'listSpaces', 'searchSpaces', 'getSpace', 'createSpace', 'setUpSpace', 'updateSpace', 'deleteSpace', 'completeImportSpace', 'findDirectMessage', 'createMembership', 'updateMembership', 'deleteMembership', 'createReaction', 'listReactions', 'deleteReaction', 'createCustomEmoji', 'getCustomEmoji', 'listCustomEmojis', 'deleteCustomEmoji', 'getSpaceReadState', 'updateSpaceReadState', 'getThreadReadState', 'getSpaceEvent', 'listSpaceEvents', 'getSpaceNotificationSetting', 'updateSpaceNotificationSetting']; + ['createMessage', 'listMessages', 'listMemberships', 'getMembership', 'getMessage', 'updateMessage', 'deleteMessage', 'getAttachment', 'uploadAttachment', 'listSpaces', 'searchSpaces', 'getSpace', 'createSpace', 'setUpSpace', 'updateSpace', 'deleteSpace', 'completeImportSpace', 'findDirectMessage', 'createMembership', 'updateMembership', 'deleteMembership', 'createReaction', 'listReactions', 'deleteReaction', 'createCustomEmoji', 'getCustomEmoji', 'listCustomEmojis', 'deleteCustomEmoji', 'getSpaceReadState', 'updateSpaceReadState', 'getThreadReadState', 'getSpaceEvent', 'listSpaceEvents', 'getSpaceNotificationSetting', 'updateSpaceNotificationSetting', 'createSection', 'deleteSection', 'updateSection', 'listSections', 'positionSection', 'listSectionItems', 'moveSectionItem']; for (const methodName of chatServiceStubMethods) { const callPromise = this.chatServiceStub.then( stub => (...args: Array<{}>) => { @@ -367,9 +377,11 @@ export class ChatServiceClient { 'https://www.googleapis.com/auth/chat.admin.spaces.readonly', 'https://www.googleapis.com/auth/chat.app.delete', 'https://www.googleapis.com/auth/chat.app.memberships', + 'https://www.googleapis.com/auth/chat.app.memberships.readonly', 'https://www.googleapis.com/auth/chat.app.messages.readonly', 'https://www.googleapis.com/auth/chat.app.spaces', 'https://www.googleapis.com/auth/chat.app.spaces.create', + 'https://www.googleapis.com/auth/chat.app.spaces.readonly', 'https://www.googleapis.com/auth/chat.bot', 'https://www.googleapis.com/auth/chat.customemojis', 'https://www.googleapis.com/auth/chat.customemojis.readonly', @@ -389,6 +401,8 @@ export class ChatServiceClient { 'https://www.googleapis.com/auth/chat.spaces.readonly', 'https://www.googleapis.com/auth/chat.users.readstate', 'https://www.googleapis.com/auth/chat.users.readstate.readonly', + 'https://www.googleapis.com/auth/chat.users.sections', + 'https://www.googleapis.com/auth/chat.users.sections.readonly', 'https://www.googleapis.com/auth/chat.users.spacesettings' ]; } @@ -747,8 +761,7 @@ export class ChatServiceClient { * that invoke the Chat app. * - `https://www.googleapis.com/auth/chat.app.messages.readonly` * with [administrator - * approval](https://support.google.com/a?p=chat-app-auth) (available in - * [Developer Preview](https://developers.google.com/workspace/preview)). + * approval](https://support.google.com/a?p=chat-app-auth). * When using this authentication scope, * this method returns details about a public message in a space. * @@ -3836,12 +3849,13 @@ export class ChatServiceClient { * - [App * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) * with [administrator - * approval](https://support.google.com/a?p=chat-app-auth) in - * [Developer Preview](https://developers.google.com/workspace/preview) - * with one of the following authorization scopes: + * approval](https://support.google.com/a?p=chat-app-auth) + * with one of the following authorization scopes: * - `https://www.googleapis.com/auth/chat.app.spaces` + * - `https://www.googleapis.com/auth/chat.app.spaces.readonly` * - `https://www.googleapis.com/auth/chat.app.messages.readonly` * - `https://www.googleapis.com/auth/chat.app.memberships` + * - `https://www.googleapis.com/auth/chat.app.memberships.readonly` * * - [User * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) @@ -4174,159 +4188,70 @@ export class ChatServiceClient { throw error; }); } - - /** - * Lists messages in a space that the caller is a member of, including - * messages from blocked members and spaces. System messages, like those - * announcing new space members, aren't included. If you list messages from a - * space with no messages, the response is an empty object. When using a - * REST/HTTP interface, the response contains an empty JSON object, `{}`. - * For an example, see - * [List - * messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/list). - * - * Supports the following types of - * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - * - * - [App - * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - * with [administrator - * approval](https://support.google.com/a?p=chat-app-auth) in - * [Developer Preview](https://developers.google.com/workspace/preview) - * with the authorization scope: - * - `https://www.googleapis.com/auth/chat.app.messages.readonly`. When - * using this authentication scope, this method only returns public - * messages in a space. It doesn't include private messages. +/** + * Creates a section in Google Chat. Sections help users group conversations + * and customize the list of spaces displayed in Chat navigation panel. Only + * sections of type `CUSTOM_SECTION` can be created. For details, see [Create + * and organize sections in Google + * Chat](https://support.google.com/chat/answer/16059854). * - * - [User + * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - * with one of the following authorization scopes: - * - `https://www.googleapis.com/auth/chat.messages.readonly` - * - `https://www.googleapis.com/auth/chat.messages` - * - `https://www.googleapis.com/auth/chat.import` (import mode spaces - * only) + * with the [authorization + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + * + * - `https://www.googleapis.com/auth/chat.users.sections` * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the space to list messages from. - * - * Format: `spaces/{space}` - * @param {number} [request.pageSize] - * Optional. 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. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous list messages call. Provide - * this parameter to retrieve the subsequent page. - * - * When paginating, all other parameters provided should match the call that - * provided the page token. Passing different values to the other parameters - * might lead to unexpected results. - * @param {string} [request.filter] - * Optional. 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. - * @param {string} [request.orderBy] - * Optional. How the list of messages is ordered. Specify a value to order by - * an ordering operation. Valid ordering operation values are as follows: - * - * - `ASC` for ascending. - * - * - `DESC` for descending. + * Required. The parent resource name where the section is created. * - * The default ordering is `create_time ASC`. - * @param {boolean} [request.showDeleted] - * Optional. Whether to include deleted messages. Deleted messages include - * deleted time and metadata about their deletion, but message content is - * unavailable. + * Format: `users/{user}` + * @param {google.chat.v1.Section} request.section + * Required. The section to create. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.chat.v1.Message|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 `listMessagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * The first element of the array is an object representing {@link protos.google.chat.v1.Section|Section}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } * for more details and examples. + * @example include:samples/generated/v1/chat_service.create_section.js + * region_tag:chat_v1_generated_ChatService_CreateSection_async */ - listMessages( - request?: protos.google.chat.v1.IListMessagesRequest, + createSection( + request?: protos.google.chat.v1.ICreateSectionRequest, options?: CallOptions): Promise<[ - protos.google.chat.v1.IMessage[], - protos.google.chat.v1.IListMessagesRequest|null, - protos.google.chat.v1.IListMessagesResponse + protos.google.chat.v1.ISection, + protos.google.chat.v1.ICreateSectionRequest|undefined, {}|undefined ]>; - listMessages( - request: protos.google.chat.v1.IListMessagesRequest, + createSection( + request: protos.google.chat.v1.ICreateSectionRequest, options: CallOptions, - callback: PaginationCallback< - protos.google.chat.v1.IListMessagesRequest, - protos.google.chat.v1.IListMessagesResponse|null|undefined, - protos.google.chat.v1.IMessage>): void; - 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; - listMessages( - request?: protos.google.chat.v1.IListMessagesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.chat.v1.IListMessagesRequest, - protos.google.chat.v1.IListMessagesResponse|null|undefined, - protos.google.chat.v1.IMessage>, - callback?: PaginationCallback< - protos.google.chat.v1.IListMessagesRequest, - protos.google.chat.v1.IListMessagesResponse|null|undefined, - protos.google.chat.v1.IMessage>): + callback: Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.ICreateSectionRequest|null|undefined, + {}|null|undefined>): void; + createSection( + request: protos.google.chat.v1.ICreateSectionRequest, + callback: Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.ICreateSectionRequest|null|undefined, + {}|null|undefined>): void; + createSection( + request?: protos.google.chat.v1.ICreateSectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.ICreateSectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.ICreateSectionRequest|null|undefined, + {}|null|undefined>): Promise<[ - protos.google.chat.v1.IMessage[], - protos.google.chat.v1.IListMessagesRequest|null, - protos.google.chat.v1.IListMessagesResponse + protos.google.chat.v1.ISection, + protos.google.chat.v1.ICreateSectionRequest|undefined, {}|undefined ]>|void { request = request || {}; let options: CallOptions; @@ -4346,427 +4271,428 @@ export class ChatServiceClient { 'parent': request.parent ?? '', }); this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.chat.v1.IListMessagesRequest, - protos.google.chat.v1.IListMessagesResponse|null|undefined, - protos.google.chat.v1.IMessage>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMessages values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + this._log.info('createSection request %j', request); + const wrappedCallback: Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.ICreateSectionRequest|null|undefined, + {}|null|undefined>|undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createSection response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - this._log.info('listMessages request %j', request); - return this.innerApiCalls - .listMessages(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.chat.v1.IMessage[], - protos.google.chat.v1.IListMessagesRequest|null, - protos.google.chat.v1.IListMessagesResponse + return this.innerApiCalls.createSection(request, options, wrappedCallback) + ?.then(([response, options, rawResponse]: [ + protos.google.chat.v1.ISection, + protos.google.chat.v1.ICreateSectionRequest|undefined, + {}|undefined ]) => { - this._log.info('listMessages values %j', response); - return [response, input, output]; + this._log.info('createSection response %j', response); + return [response, options, rawResponse]; + }).catch((error: any) => { + if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { + const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + } + throw error; }); } - /** - * Equivalent to `listMessages`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the space to list messages from. - * - * Format: `spaces/{space}` - * @param {number} [request.pageSize] - * Optional. The maximum number of messages returned. The service might return - * fewer messages than this value. - * - * If unspecified, at most 25 are returned. + * Deletes a section of type `CUSTOM_SECTION`. * - * 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. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous list messages call. Provide - * this parameter to retrieve the subsequent page. - * - * When paginating, all other parameters provided should match the call that - * provided the page token. Passing different values to the other parameters - * might lead to unexpected results. - * @param {string} [request.filter] - * Optional. 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: + * If the section contains items, such as spaces, the items are moved to + * Google Chat's default sections and are not deleted. * - * ``` - * 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 - * ``` + * For details, see [Create and organize sections in Google + * Chat](https://support.google.com/chat/answer/16059854). * - * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` - * error. - * @param {string} [request.orderBy] - * Optional. How the list of messages is ordered. Specify a value to order by - * an ordering operation. Valid ordering operation values are as follows: + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * with the [authorization + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): * - * - `ASC` for ascending. + * - `https://www.googleapis.com/auth/chat.users.sections` * - * - `DESC` for descending. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the section to delete. * - * The default ordering is `create_time ASC`. - * @param {boolean} [request.showDeleted] - * Optional. Whether to include deleted messages. Deleted messages include - * deleted time and metadata about their deletion, but message content is - * unavailable. + * Format: `users/{user}/sections/{section}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.chat.v1.Message|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 `listMessagesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } * for more details and examples. + * @example include:samples/generated/v1/chat_service.delete_section.js + * region_tag:chat_v1_generated_ChatService_DeleteSection_async */ - listMessagesStream( - request?: protos.google.chat.v1.IListMessagesRequest, + deleteSection( + request?: protos.google.chat.v1.IDeleteSectionRequest, options?: CallOptions): - Transform{ + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.chat.v1.IDeleteSectionRequest|undefined, {}|undefined + ]>; + deleteSection( + request: protos.google.chat.v1.IDeleteSectionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.chat.v1.IDeleteSectionRequest|null|undefined, + {}|null|undefined>): void; + deleteSection( + request: protos.google.chat.v1.IDeleteSectionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.chat.v1.IDeleteSectionRequest|null|undefined, + {}|null|undefined>): void; + deleteSection( + request?: protos.google.chat.v1.IDeleteSectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.chat.v1.IDeleteSectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.chat.v1.IDeleteSectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.chat.v1.IDeleteSectionRequest|undefined, {}|undefined + ]>|void { request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers[ 'x-goog-request-params' ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + 'name': request.name ?? '', }); - const defaultCallSettings = this._defaults['listMessages']; - const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listMessages stream %j', request); - return this.descriptors.page.listMessages.createStream( - this.innerApiCalls.listMessages as GaxCall, - request, - callSettings - ); + this._log.info('deleteSection request %j', request); + const wrappedCallback: Callback< + protos.google.protobuf.IEmpty, + protos.google.chat.v1.IDeleteSectionRequest|null|undefined, + {}|null|undefined>|undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteSection response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls.deleteSection(request, options, wrappedCallback) + ?.then(([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.chat.v1.IDeleteSectionRequest|undefined, + {}|undefined + ]) => { + this._log.info('deleteSection response %j', response); + return [response, options, rawResponse]; + }).catch((error: any) => { + if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { + const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + } + throw error; + }); } - /** - * Equivalent to `listMessages`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the space to list messages from. - * - * Format: `spaces/{space}` - * @param {number} [request.pageSize] - * Optional. 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. - * @param {string} [request.pageToken] - * Optional. A page token received from a previous list messages call. Provide - * this parameter to retrieve the subsequent page. - * - * When paginating, all other parameters provided should match the call that - * provided the page token. Passing different values to the other parameters - * might lead to unexpected results. - * @param {string} [request.filter] - * Optional. 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 + * Updates a section. Only sections of type `CUSTOM_SECTION` can be updated. + * For details, see [Create and organize sections in Google + * Chat](https://support.google.com/chat/answer/16059854). * - * thread.name = spaces/AAAAAAAAAAA/threads/123 - * ``` + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * with the [authorization + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): * - * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` - * error. - * @param {string} [request.orderBy] - * Optional. How the list of messages is ordered. Specify a value to order by - * an ordering operation. Valid ordering operation values are as follows: + * - `https://www.googleapis.com/auth/chat.users.sections` * - * - `ASC` for ascending. + * @param {Object} request + * The request object that will be sent. + * @param {google.chat.v1.Section} request.section + * Required. The section to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to specify which fields to update. * - * - `DESC` for descending. + * Currently supported field paths: * - * The default ordering is `create_time ASC`. - * @param {boolean} [request.showDeleted] - * Optional. Whether to include deleted messages. Deleted messages include - * deleted time and metadata about their deletion, but message content is - * unavailable. + * - `display_name` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.chat.v1.Message|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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.chat.v1.Section|Section}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } * for more details and examples. - * @example include:samples/generated/v1/chat_service.list_messages.js - * region_tag:chat_v1_generated_ChatService_ListMessages_async + * @example include:samples/generated/v1/chat_service.update_section.js + * region_tag:chat_v1_generated_ChatService_UpdateSection_async */ - listMessagesAsync( - request?: protos.google.chat.v1.IListMessagesRequest, + updateSection( + request?: protos.google.chat.v1.IUpdateSectionRequest, options?: CallOptions): - AsyncIterable{ + Promise<[ + protos.google.chat.v1.ISection, + protos.google.chat.v1.IUpdateSectionRequest|undefined, {}|undefined + ]>; + updateSection( + request: protos.google.chat.v1.IUpdateSectionRequest, + options: CallOptions, + callback: Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.IUpdateSectionRequest|null|undefined, + {}|null|undefined>): void; + updateSection( + request: protos.google.chat.v1.IUpdateSectionRequest, + callback: Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.IUpdateSectionRequest|null|undefined, + {}|null|undefined>): void; + updateSection( + request?: protos.google.chat.v1.IUpdateSectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.IUpdateSectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.IUpdateSectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.chat.v1.ISection, + protos.google.chat.v1.IUpdateSectionRequest|undefined, {}|undefined + ]>|void { request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers[ 'x-goog-request-params' ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + 'section.name': request.section!.name ?? '', }); - const defaultCallSettings = this._defaults['listMessages']; - const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listMessages iterate %j', request); - return this.descriptors.page.listMessages.asyncIterate( - this.innerApiCalls['listMessages'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; + this._log.info('updateSection request %j', request); + const wrappedCallback: Callback< + protos.google.chat.v1.ISection, + protos.google.chat.v1.IUpdateSectionRequest|null|undefined, + {}|null|undefined>|undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateSection response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls.updateSection(request, options, wrappedCallback) + ?.then(([response, options, rawResponse]: [ + protos.google.chat.v1.ISection, + protos.google.chat.v1.IUpdateSectionRequest|undefined, + {}|undefined + ]) => { + this._log.info('updateSection response %j', response); + return [response, options, rawResponse]; + }).catch((error: any) => { + if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { + const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + } + throw error; + }); } - /** - * 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. - * - * Supports the following types of - * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): - * - * - [App - * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - * with one of the following authorization scopes: - * - `https://www.googleapis.com/auth/chat.bot` - * - `https://www.googleapis.com/auth/chat.app.memberships` (requires - * [administrator approval](https://support.google.com/a?p=chat-app-auth)) +/** + * Changes the sort order of a section. For details, see [Create and organize + * sections in Google Chat](https://support.google.com/chat/answer/16059854). * - * - [User + * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - * with one of the following authorization scopes: - * - `https://www.googleapis.com/auth/chat.memberships.readonly` - * - `https://www.googleapis.com/auth/chat.memberships` - * - `https://www.googleapis.com/auth/chat.import` (import mode spaces - * only) - * - User authentication grants administrator privileges when an - * administrator account authenticates, `use_admin_access` is `true`, and - * one of the following authorization scopes is used: - * - `https://www.googleapis.com/auth/chat.admin.memberships.readonly` - * - `https://www.googleapis.com/auth/chat.admin.memberships` + * with the [authorization + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + * + * - `https://www.googleapis.com/auth/chat.users.sections` * * @param {Object} request * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the space for which to fetch a membership - * list. - * - * Format: spaces/{space} - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.filter] - * 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`. You can also - * filter for `member.type` using the `!=` operator. - * - * To filter by both role and type, use the `AND` operator. To filter by - * either role or type, use the `OR` operator. - * - * Either `member.type = "HUMAN"` or `member.type != "BOT"` is required - * when `use_admin_access` is set to true. Other member type filters will be - * rejected. - * - * For example, the following queries are valid: - * - * ``` - * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" - * member.type = "HUMAN" AND role = "ROLE_MANAGER" - * - * member.type != "BOT" - * ``` - * - * The following queries are invalid: - * - * ``` - * member.type = "HUMAN" AND member.type = "BOT" - * role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" - * ``` + * @param {string} request.name + * Required. The resource name of the section to position. + * + * Format: `users/{user}/sections/{section}` + * @param {number} [request.sortOrder] + * Optional. The absolute position of the section in the list of sections. + * The position must be greater than 0. If the position is greater than the + * number of sections, the section will be appended to the end of the list. + * This operation inserts the section at the given position and shifts the + * original section at that position, and those below it, to the next + * position. + * @param {google.chat.v1.PositionSectionRequest.Position} [request.relativePosition] + * Optional. The relative position of the section in the list of sections. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.chat.v1.PositionSectionResponse|PositionSectionResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/chat_service.position_section.js + * region_tag:chat_v1_generated_ChatService_PositionSection_async + */ + positionSection( + request?: protos.google.chat.v1.IPositionSectionRequest, + options?: CallOptions): + Promise<[ + protos.google.chat.v1.IPositionSectionResponse, + protos.google.chat.v1.IPositionSectionRequest|undefined, {}|undefined + ]>; + positionSection( + request: protos.google.chat.v1.IPositionSectionRequest, + options: CallOptions, + callback: Callback< + protos.google.chat.v1.IPositionSectionResponse, + protos.google.chat.v1.IPositionSectionRequest|null|undefined, + {}|null|undefined>): void; + positionSection( + request: protos.google.chat.v1.IPositionSectionRequest, + callback: Callback< + protos.google.chat.v1.IPositionSectionResponse, + protos.google.chat.v1.IPositionSectionRequest|null|undefined, + {}|null|undefined>): void; + positionSection( + request?: protos.google.chat.v1.IPositionSectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.chat.v1.IPositionSectionResponse, + protos.google.chat.v1.IPositionSectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.chat.v1.IPositionSectionResponse, + protos.google.chat.v1.IPositionSectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.chat.v1.IPositionSectionResponse, + protos.google.chat.v1.IPositionSectionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize().catch(err => {throw err}); + this._log.info('positionSection request %j', request); + const wrappedCallback: Callback< + protos.google.chat.v1.IPositionSectionResponse, + protos.google.chat.v1.IPositionSectionRequest|null|undefined, + {}|null|undefined>|undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('positionSection response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls.positionSection(request, options, wrappedCallback) + ?.then(([response, options, rawResponse]: [ + protos.google.chat.v1.IPositionSectionResponse, + protos.google.chat.v1.IPositionSectionRequest|undefined, + {}|undefined + ]) => { + this._log.info('positionSection response %j', response); + return [response, options, rawResponse]; + }).catch((error: any) => { + if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { + const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + } + throw error; + }); + } +/** + * Moves an item from one section to another. For example, if a section + * contains spaces, this method can be used to move a space to a different + * section. For details, see [Create and organize sections in Google + * Chat](https://support.google.com/chat/answer/16059854). * - * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` - * error. - * @param {boolean} [request.showGroups] - * Optional. When `true`, also returns memberships associated with a - * {@link protos.google.chat.v1.Membership.group_member|Google Group}, in - * addition to other types of memberships. If a - * {@link protos.google.chat.v1.ListMembershipsRequest.filter|filter} is set, - * {@link protos.google.chat.v1.Membership.group_member|Google Group} - * memberships that don't match the filter criteria aren't returned. - * @param {boolean} [request.showInvited] - * Optional. When `true`, also returns memberships associated with - * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|invited} members, in - * addition to other types of memberships. If a - * filter is set, - * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|invited} memberships - * that don't match the filter criteria aren't returned. + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * with the [authorization + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): * - * Currently requires [user - * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). - * @param {boolean} [request.useAdminAccess] - * Optional. When `true`, the method runs using the user's Google Workspace - * administrator privileges. + * - `https://www.googleapis.com/auth/chat.users.sections` * - * The calling user must be a Google Workspace administrator with the - * [manage chat and spaces conversations - * privilege](https://support.google.com/a/answer/13369245). + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the section item to move. * - * Requires either the `chat.admin.memberships.readonly` or - * `chat.admin.memberships` [OAuth 2.0 - * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * Format: `users/{user}/sections/{section}/items/{item}` + * @param {string} request.targetSection + * Required. The resource name of the section to move the section item to. * - * Listing app memberships in a space isn't supported when using admin access. + * Format: `users/{user}/sections/{section}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.chat.v1.Membership|Membership}. - * 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 `listMembershipsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * The first element of the array is an object representing {@link protos.google.chat.v1.MoveSectionItemResponse|MoveSectionItemResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } * for more details and examples. + * @example include:samples/generated/v1/chat_service.move_section_item.js + * region_tag:chat_v1_generated_ChatService_MoveSectionItem_async */ - listMemberships( - request?: protos.google.chat.v1.IListMembershipsRequest, + moveSectionItem( + request?: protos.google.chat.v1.IMoveSectionItemRequest, options?: CallOptions): Promise<[ - protos.google.chat.v1.IMembership[], - protos.google.chat.v1.IListMembershipsRequest|null, - protos.google.chat.v1.IListMembershipsResponse + protos.google.chat.v1.IMoveSectionItemResponse, + protos.google.chat.v1.IMoveSectionItemRequest|undefined, {}|undefined ]>; - listMemberships( - request: protos.google.chat.v1.IListMembershipsRequest, + moveSectionItem( + request: protos.google.chat.v1.IMoveSectionItemRequest, options: CallOptions, - callback: PaginationCallback< - protos.google.chat.v1.IListMembershipsRequest, - protos.google.chat.v1.IListMembershipsResponse|null|undefined, - protos.google.chat.v1.IMembership>): void; - 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; - listMemberships( - request?: protos.google.chat.v1.IListMembershipsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.chat.v1.IListMembershipsRequest, - protos.google.chat.v1.IListMembershipsResponse|null|undefined, - protos.google.chat.v1.IMembership>, - callback?: PaginationCallback< - protos.google.chat.v1.IListMembershipsRequest, - protos.google.chat.v1.IListMembershipsResponse|null|undefined, - protos.google.chat.v1.IMembership>): + callback: Callback< + protos.google.chat.v1.IMoveSectionItemResponse, + protos.google.chat.v1.IMoveSectionItemRequest|null|undefined, + {}|null|undefined>): void; + moveSectionItem( + request: protos.google.chat.v1.IMoveSectionItemRequest, + callback: Callback< + protos.google.chat.v1.IMoveSectionItemResponse, + protos.google.chat.v1.IMoveSectionItemRequest|null|undefined, + {}|null|undefined>): void; + moveSectionItem( + request?: protos.google.chat.v1.IMoveSectionItemRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.chat.v1.IMoveSectionItemResponse, + protos.google.chat.v1.IMoveSectionItemRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.chat.v1.IMoveSectionItemResponse, + protos.google.chat.v1.IMoveSectionItemRequest|null|undefined, + {}|null|undefined>): Promise<[ - protos.google.chat.v1.IMembership[], - protos.google.chat.v1.IListMembershipsRequest|null, - protos.google.chat.v1.IListMembershipsResponse + protos.google.chat.v1.IMoveSectionItemResponse, + protos.google.chat.v1.IMoveSectionItemRequest|undefined, {}|undefined ]>|void { request = request || {}; let options: CallOptions; @@ -4783,53 +4709,85 @@ export class ChatServiceClient { options.otherArgs.headers[ 'x-goog-request-params' ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + 'name': request.name ?? '', }); this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.chat.v1.IListMembershipsRequest, - protos.google.chat.v1.IListMembershipsResponse|null|undefined, - protos.google.chat.v1.IMembership>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMemberships values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + this._log.info('moveSectionItem request %j', request); + const wrappedCallback: Callback< + protos.google.chat.v1.IMoveSectionItemResponse, + protos.google.chat.v1.IMoveSectionItemRequest|null|undefined, + {}|null|undefined>|undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('moveSectionItem response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - this._log.info('listMemberships request %j', request); - return this.innerApiCalls - .listMemberships(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.chat.v1.IMembership[], - protos.google.chat.v1.IListMembershipsRequest|null, - protos.google.chat.v1.IListMembershipsResponse + return this.innerApiCalls.moveSectionItem(request, options, wrappedCallback) + ?.then(([response, options, rawResponse]: [ + protos.google.chat.v1.IMoveSectionItemResponse, + protos.google.chat.v1.IMoveSectionItemRequest|undefined, + {}|undefined ]) => { - this._log.info('listMemberships values %j', response); - return [response, input, output]; + this._log.info('moveSectionItem response %j', response); + return [response, options, rawResponse]; + }).catch((error: any) => { + if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { + const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + } + throw error; }); } -/** - * Equivalent to `listMemberships`, but returns a NodeJS Stream object. + /** + * Lists messages in a space that the caller is a member of, including + * messages from blocked members and spaces. System messages, like those + * announcing new space members, aren't included. If you list messages from a + * space with no messages, the response is an empty object. When using a + * REST/HTTP interface, the response contains an empty JSON object, `{}`. + * For an example, see + * [List + * messages](https://developers.google.com/workspace/chat/api/guides/v1/messages/list). + * + * Supports the following types of + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): + * + * - [App + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * with [administrator + * approval](https://support.google.com/a?p=chat-app-auth) + * with the authorization scope: + * - `https://www.googleapis.com/auth/chat.app.messages.readonly`. When + * using this authentication scope, this method only returns public + * messages in a space. It doesn't include private messages. + * + * - [User + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * with one of the following authorization scopes: + * - `https://www.googleapis.com/auth/chat.messages.readonly` + * - `https://www.googleapis.com/auth/chat.messages` + * - `https://www.googleapis.com/auth/chat.import` (import mode spaces + * only) + * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the space for which to fetch a membership - * list. + * Required. The resource name of the space to list messages from. * - * Format: spaces/{space} + * Format: `spaces/{space}` * @param {number} [request.pageSize] - * Optional. The maximum number of memberships to return. The service might - * return fewer than this value. + * Optional. The maximum number of messages returned. The service might return + * fewer messages than this value. * - * If unspecified, at most 100 memberships are returned. + * 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. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous call to list memberships. - * Provide this parameter to retrieve the subsequent page. + * Optional. A page token received from a previous list messages call. Provide + * this parameter to retrieve the subsequent page. * * When paginating, all other parameters provided should match the call that * provided the page token. Passing different values to the other parameters @@ -4837,87 +4795,111 @@ export class ChatServiceClient { * @param {string} [request.filter] * 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`. + * You can filter messages by date (`create_time`) and thread (`thread.name`). * - * To filter by type, set `member.type` to `HUMAN` or `BOT`. You can also - * filter for `member.type` using the `!=` operator. + * 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 both role and type, use the `AND` operator. To filter by - * either role or type, use the `OR` operator. + * To filter by thread, specify the `thread.name`, formatted as + * `spaces/{space}/threads/{thread}`. You can only specify one + * `thread.name` per query. * - * Either `member.type = "HUMAN"` or `member.type != "BOT"` is required - * when `use_admin_access` is set to true. Other member type filters will be - * rejected. + * To filter by both thread and date, use the `AND` operator in your query. * * For example, the following queries are valid: * * ``` - * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" - * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * create_time > "2012-04-21T11:30:00-04:00" * - * member.type != "BOT" - * ``` + * create_time > "2012-04-21T11:30:00-04:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 * - * The following queries are invalid: + * create_time > "2012-04-21T11:30:00+00:00" AND * - * ``` - * member.type = "HUMAN" AND member.type = "BOT" - * role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" + * 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. - * @param {boolean} [request.showGroups] - * Optional. When `true`, also returns memberships associated with a - * {@link protos.google.chat.v1.Membership.group_member|Google Group}, in - * addition to other types of memberships. If a - * {@link protos.google.chat.v1.ListMembershipsRequest.filter|filter} is set, - * {@link protos.google.chat.v1.Membership.group_member|Google Group} - * memberships that don't match the filter criteria aren't returned. - * @param {boolean} [request.showInvited] - * Optional. When `true`, also returns memberships associated with - * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|invited} members, in - * addition to other types of memberships. If a - * filter is set, - * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|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). - * @param {boolean} [request.useAdminAccess] - * Optional. When `true`, the method runs using the user's Google Workspace - * administrator privileges. + * @param {string} [request.orderBy] + * Optional. How the list of messages is ordered. Specify a value to order by + * an ordering operation. Valid ordering operation values are as follows: * - * The calling user must be a Google Workspace administrator with the - * [manage chat and spaces conversations - * privilege](https://support.google.com/a/answer/13369245). + * - `ASC` for ascending. * - * Requires either the `chat.admin.memberships.readonly` or - * `chat.admin.memberships` [OAuth 2.0 - * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * - `DESC` for descending. * - * Listing app memberships in a space isn't supported when using admin access. + * The default ordering is `create_time ASC`. + * @param {boolean} [request.showDeleted] + * Optional. Whether to include deleted messages. Deleted messages include + * deleted time and metadata about their deletion, but message content is + * unavailable. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.chat.v1.Membership|Membership} on 'data' event. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.chat.v1.Message|Message}. * 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 `listMembershipsAsync()` + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMessagesAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - listMembershipsStream( - request?: protos.google.chat.v1.IListMembershipsRequest, + listMessages( + request?: protos.google.chat.v1.IListMessagesRequest, options?: CallOptions): - Transform{ + Promise<[ + protos.google.chat.v1.IMessage[], + protos.google.chat.v1.IListMessagesRequest|null, + protos.google.chat.v1.IListMessagesResponse + ]>; + 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; + 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; + listMessages( + request?: protos.google.chat.v1.IListMessagesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.chat.v1.IListMessagesRequest, + protos.google.chat.v1.IListMessagesResponse|null|undefined, + protos.google.chat.v1.IMessage>, + callback?: PaginationCallback< + protos.google.chat.v1.IListMessagesRequest, + protos.google.chat.v1.IListMessagesResponse|null|undefined, + protos.google.chat.v1.IMessage>): + Promise<[ + protos.google.chat.v1.IMessage[], + protos.google.chat.v1.IListMessagesRequest|null, + protos.google.chat.v1.IListMessagesResponse + ]>|void { request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; @@ -4926,41 +4908,50 @@ export class ChatServiceClient { ] = this._gaxModule.routingHeader.fromParams({ 'parent': request.parent ?? '', }); - const defaultCallSettings = this._defaults['listMemberships']; - const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listMemberships stream %j', request); - return this.descriptors.page.listMemberships.createStream( - this.innerApiCalls.listMemberships as GaxCall, - request, - callSettings - ); + const wrappedCallback: PaginationCallback< + protos.google.chat.v1.IListMessagesRequest, + protos.google.chat.v1.IListMessagesResponse|null|undefined, + protos.google.chat.v1.IMessage>|undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listMessages values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listMessages request %j', request); + return this.innerApiCalls + .listMessages(request, options, wrappedCallback) + ?.then(([response, input, output]: [ + protos.google.chat.v1.IMessage[], + protos.google.chat.v1.IListMessagesRequest|null, + protos.google.chat.v1.IListMessagesResponse + ]) => { + this._log.info('listMessages values %j', response); + return [response, input, output]; + }); } /** - * Equivalent to `listMemberships`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * Equivalent to `listMessages`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the space for which to fetch a membership - * list. + * Required. The resource name of the space to list messages from. * - * Format: spaces/{space} + * Format: `spaces/{space}` * @param {number} [request.pageSize] - * Optional. The maximum number of memberships to return. The service might - * return fewer than this value. + * Optional. The maximum number of messages returned. The service might return + * fewer messages than this value. * - * If unspecified, at most 100 memberships are returned. + * 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. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous call to list memberships. - * Provide this parameter to retrieve the subsequent page. + * Optional. A page token received from a previous list messages call. Provide + * this parameter to retrieve the subsequent page. * * When paginating, all other parameters provided should match the call that * provided the page token. Passing different values to the other parameters @@ -4968,87 +4959,183 @@ export class ChatServiceClient { * @param {string} [request.filter] * 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`. + * You can filter messages by date (`create_time`) and thread (`thread.name`). * - * To filter by type, set `member.type` to `HUMAN` or `BOT`. You can also - * filter for `member.type` using the `!=` operator. + * 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 both role and type, use the `AND` operator. To filter by - * either role or type, use the `OR` operator. + * To filter by thread, specify the `thread.name`, formatted as + * `spaces/{space}/threads/{thread}`. You can only specify one + * `thread.name` per query. * - * Either `member.type = "HUMAN"` or `member.type != "BOT"` is required - * when `use_admin_access` is set to true. Other member type filters will be - * rejected. + * To filter by both thread and date, use the `AND` operator in your query. * * For example, the following queries are valid: * * ``` - * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" - * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * create_time > "2012-04-21T11:30:00-04:00" * - * member.type != "BOT" - * ``` + * create_time > "2012-04-21T11:30:00-04:00" AND + * thread.name = spaces/AAAAAAAAAAA/threads/123 * - * The following queries are invalid: + * create_time > "2012-04-21T11:30:00+00:00" AND * - * ``` - * member.type = "HUMAN" AND member.type = "BOT" - * role = "ROLE_MANAGER" AND role = "ROLE_MEMBER" + * 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. - * @param {boolean} [request.showGroups] - * Optional. When `true`, also returns memberships associated with a - * {@link protos.google.chat.v1.Membership.group_member|Google Group}, in - * addition to other types of memberships. If a - * {@link protos.google.chat.v1.ListMembershipsRequest.filter|filter} is set, - * {@link protos.google.chat.v1.Membership.group_member|Google Group} - * memberships that don't match the filter criteria aren't returned. - * @param {boolean} [request.showInvited] - * Optional. When `true`, also returns memberships associated with - * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|invited} members, in - * addition to other types of memberships. If a - * filter is set, - * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|invited} memberships - * that don't match the filter criteria aren't returned. + * @param {string} [request.orderBy] + * Optional. How the list of messages is ordered. Specify a value to order by + * an ordering operation. Valid ordering operation values are as follows: * - * Currently requires [user - * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). - * @param {boolean} [request.useAdminAccess] - * Optional. When `true`, the method runs using the user's Google Workspace - * administrator privileges. + * - `ASC` for ascending. * - * The calling user must be a Google Workspace administrator with the - * [manage chat and spaces conversations - * privilege](https://support.google.com/a/answer/13369245). + * - `DESC` for descending. * - * Requires either the `chat.admin.memberships.readonly` or - * `chat.admin.memberships` [OAuth 2.0 - * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * The default ordering is `create_time ASC`. + * @param {boolean} [request.showDeleted] + * Optional. Whether to include deleted messages. Deleted messages include + * deleted time and metadata about their deletion, but message content is + * unavailable. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.chat.v1.Message|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 `listMessagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMessagesStream( + request?: protos.google.chat.v1.IListMessagesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listMessages stream %j', request); + return this.descriptors.page.listMessages.createStream( + this.innerApiCalls.listMessages as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMessages`, but returns an iterable object. * - * Listing app memberships in a space isn't supported when using admin access. + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the space to list messages from. + * + * Format: `spaces/{space}` + * @param {number} [request.pageSize] + * Optional. 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. + * @param {string} [request.pageToken] + * Optional. A page token received from a previous list messages call. Provide + * this parameter to retrieve the subsequent page. + * + * When paginating, all other parameters provided should match the call that + * provided the page token. Passing different values to the other parameters + * might lead to unexpected results. + * @param {string} [request.filter] + * Optional. 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. + * @param {string} [request.orderBy] + * Optional. How the list of messages is ordered. Specify a value to order by + * an ordering operation. Valid ordering operation values are as follows: + * + * - `ASC` for ascending. + * + * - `DESC` for descending. + * + * The default ordering is `create_time ASC`. + * @param {boolean} [request.showDeleted] + * Optional. Whether to include deleted messages. Deleted messages include + * deleted time and metadata about their deletion, but message content is + * unavailable. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.chat.v1.Membership|Membership}. The API will be called under the hood as needed, once per the page, + * {@link protos.google.chat.v1.Message|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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. - * @example include:samples/generated/v1/chat_service.list_memberships.js - * region_tag:chat_v1_generated_ChatService_ListMemberships_async + * @example include:samples/generated/v1/chat_service.list_messages.js + * region_tag:chat_v1_generated_ChatService_ListMessages_async */ - listMembershipsAsync( - request?: protos.google.chat.v1.IListMembershipsRequest, + listMessagesAsync( + request?: protos.google.chat.v1.IListMessagesRequest, options?: CallOptions): - AsyncIterable{ + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -5058,125 +5145,191 @@ export class ChatServiceClient { ] = this._gaxModule.routingHeader.fromParams({ 'parent': request.parent ?? '', }); - const defaultCallSettings = this._defaults['listMemberships']; + const defaultCallSettings = this._defaults['listMessages']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listMemberships iterate %j', request); - return this.descriptors.page.listMemberships.asyncIterate( - this.innerApiCalls['listMemberships'] as GaxCall, + this._log.info('listMessages iterate %j', request); + return this.descriptors.page.listMessages.asyncIterate( + this.innerApiCalls['listMessages'] as GaxCall, request as {}, callSettings - ) as AsyncIterable; + ) as AsyncIterable; } /** - * 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). + * 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. * * Supports the following types of * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): * * - [App * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - * with the authorization scope: + * with one of the following authorization scopes: * - `https://www.googleapis.com/auth/chat.bot` + * - `https://www.googleapis.com/auth/chat.app.memberships` (requires + * [administrator approval](https://support.google.com/a?p=chat-app-auth)) * * - [User * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) * with one of the following authorization scopes: - * - `https://www.googleapis.com/auth/chat.spaces.readonly` - * - `https://www.googleapis.com/auth/chat.spaces` - * - * To list all named spaces by Google Workspace organization, use the - * [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) - * method using Workspace administrator privileges instead. + * - `https://www.googleapis.com/auth/chat.memberships.readonly` + * - `https://www.googleapis.com/auth/chat.memberships` + * - `https://www.googleapis.com/auth/chat.import` (import mode spaces + * only) + * - User authentication grants administrator privileges when an + * administrator account authenticates, `use_admin_access` is `true`, and + * one of the following authorization scopes is used: + * - `https://www.googleapis.com/auth/chat.admin.memberships.readonly` + * - `https://www.googleapis.com/auth/chat.admin.memberships` * * @param {Object} request * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the space for which to fetch a membership + * list. + * + * Format: spaces/{space} * @param {number} [request.pageSize] - * Optional. The maximum number of spaces to return. The service might return - * fewer than this value. + * Optional. The maximum number of memberships to return. The service might + * return fewer than this value. * - * If unspecified, at most 100 spaces are returned. + * 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. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous list spaces call. + * Optional. A page token, received from a previous call to list memberships. * 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. + * 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. * @param {string} [request.filter] * 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)). + * 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 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. + * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. + * + * To filter by type, set `member.type` to `HUMAN` or `BOT`. You can also + * filter for `member.type` using the `!=` operator. + * + * To filter by both role and type, use the `AND` operator. To filter by + * either role or type, use the `OR` operator. + * + * Either `member.type = "HUMAN"` or `member.type != "BOT"` is required + * when `use_admin_access` is set to true. Other member type filters will be + * rejected. * * For example, the following queries are valid: * * ``` - * space_type = "SPACE" - * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" + * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" + * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * + * member.type != "BOT" + * ``` + * + * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.chat.v1.Space|Space}. - * 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 `listSpacesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - 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 - ]>; - listSpaces( - request: protos.google.chat.v1.IListSpacesRequest, - options: CallOptions, + * @param {boolean} [request.showGroups] + * Optional. When `true`, also returns memberships associated with a + * {@link protos.google.chat.v1.Membership.group_member|Google Group}, in + * addition to other types of memberships. If a + * {@link protos.google.chat.v1.ListMembershipsRequest.filter|filter} is set, + * {@link protos.google.chat.v1.Membership.group_member|Google Group} + * memberships that don't match the filter criteria aren't returned. + * @param {boolean} [request.showInvited] + * Optional. When `true`, also returns memberships associated with + * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|invited} members, in + * addition to other types of memberships. If a + * filter is set, + * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|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). + * @param {boolean} [request.useAdminAccess] + * Optional. When `true`, the method runs using the user's Google Workspace + * administrator privileges. + * + * The calling user must be a Google Workspace administrator with the + * [manage chat and spaces conversations + * privilege](https://support.google.com/a/answer/13369245). + * + * Requires either the `chat.admin.memberships.readonly` or + * `chat.admin.memberships` [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * + * Listing app memberships in a space isn't supported when using admin access. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.chat.v1.Membership|Membership}. + * 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 `listMembershipsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + 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 + ]>; + listMemberships( + request: protos.google.chat.v1.IListMembershipsRequest, + options: CallOptions, callback: PaginationCallback< - protos.google.chat.v1.IListSpacesRequest, - protos.google.chat.v1.IListSpacesResponse|null|undefined, - protos.google.chat.v1.ISpace>): void; - listSpaces( - request: protos.google.chat.v1.IListSpacesRequest, + protos.google.chat.v1.IListMembershipsRequest, + protos.google.chat.v1.IListMembershipsResponse|null|undefined, + protos.google.chat.v1.IMembership>): void; + listMemberships( + request: protos.google.chat.v1.IListMembershipsRequest, callback: PaginationCallback< - protos.google.chat.v1.IListSpacesRequest, - protos.google.chat.v1.IListSpacesResponse|null|undefined, - protos.google.chat.v1.ISpace>): void; - listSpaces( - request?: protos.google.chat.v1.IListSpacesRequest, + protos.google.chat.v1.IListMembershipsRequest, + protos.google.chat.v1.IListMembershipsResponse|null|undefined, + protos.google.chat.v1.IMembership>): void; + listMemberships( + request?: protos.google.chat.v1.IListMembershipsRequest, optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.chat.v1.IListSpacesRequest, - protos.google.chat.v1.IListSpacesResponse|null|undefined, - protos.google.chat.v1.ISpace>, + protos.google.chat.v1.IListMembershipsRequest, + protos.google.chat.v1.IListMembershipsResponse|null|undefined, + protos.google.chat.v1.IMembership>, callback?: PaginationCallback< - protos.google.chat.v1.IListSpacesRequest, - protos.google.chat.v1.IListSpacesResponse|null|undefined, - protos.google.chat.v1.ISpace>): + protos.google.chat.v1.IListMembershipsRequest, + protos.google.chat.v1.IListMembershipsResponse|null|undefined, + protos.google.chat.v1.IMembership>): Promise<[ - protos.google.chat.v1.ISpace[], - protos.google.chat.v1.IListSpacesRequest|null, - protos.google.chat.v1.IListSpacesResponse + protos.google.chat.v1.IMembership[], + protos.google.chat.v1.IListMembershipsRequest|null, + protos.google.chat.v1.IListMembershipsResponse ]>|void { request = request || {}; let options: CallOptions; @@ -5190,311 +5343,356 @@ export class ChatServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize().catch(err => {throw err}); const wrappedCallback: PaginationCallback< - protos.google.chat.v1.IListSpacesRequest, - protos.google.chat.v1.IListSpacesResponse|null|undefined, - protos.google.chat.v1.ISpace>|undefined = callback + protos.google.chat.v1.IListMembershipsRequest, + protos.google.chat.v1.IListMembershipsResponse|null|undefined, + protos.google.chat.v1.IMembership>|undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSpaces values %j', values); + this._log.info('listMemberships values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('listSpaces request %j', request); + this._log.info('listMemberships request %j', request); return this.innerApiCalls - .listSpaces(request, options, wrappedCallback) + .listMemberships(request, options, wrappedCallback) ?.then(([response, input, output]: [ - protos.google.chat.v1.ISpace[], - protos.google.chat.v1.IListSpacesRequest|null, - protos.google.chat.v1.IListSpacesResponse + protos.google.chat.v1.IMembership[], + protos.google.chat.v1.IListMembershipsRequest|null, + protos.google.chat.v1.IListMembershipsResponse ]) => { - this._log.info('listSpaces values %j', response); + this._log.info('listMemberships values %j', response); return [response, input, output]; }); } /** - * Equivalent to `listSpaces`, but returns a NodeJS Stream object. + * Equivalent to `listMemberships`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the space for which to fetch a membership + * list. + * + * Format: spaces/{space} * @param {number} [request.pageSize] - * Optional. The maximum number of spaces to return. The service might return - * fewer than this value. + * Optional. The maximum number of memberships to return. The service might + * return fewer than this value. * - * If unspecified, at most 100 spaces are returned. + * 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. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous list spaces call. + * Optional. A page token, received from a previous call to list memberships. * 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. + * 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. * @param {string} [request.filter] * 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)). + * 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 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. + * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. + * + * To filter by type, set `member.type` to `HUMAN` or `BOT`. You can also + * filter for `member.type` using the `!=` operator. + * + * To filter by both role and type, use the `AND` operator. To filter by + * either role or type, use the `OR` operator. + * + * Either `member.type = "HUMAN"` or `member.type != "BOT"` is required + * when `use_admin_access` is set to true. Other member type filters will be + * rejected. * * For example, the following queries are valid: * * ``` - * space_type = "SPACE" - * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" + * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" + * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * + * member.type != "BOT" + * ``` + * + * 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. + * @param {boolean} [request.showGroups] + * Optional. When `true`, also returns memberships associated with a + * {@link protos.google.chat.v1.Membership.group_member|Google Group}, in + * addition to other types of memberships. If a + * {@link protos.google.chat.v1.ListMembershipsRequest.filter|filter} is set, + * {@link protos.google.chat.v1.Membership.group_member|Google Group} + * memberships that don't match the filter criteria aren't returned. + * @param {boolean} [request.showInvited] + * Optional. When `true`, also returns memberships associated with + * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|invited} members, in + * addition to other types of memberships. If a + * filter is set, + * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|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). + * @param {boolean} [request.useAdminAccess] + * Optional. When `true`, the method runs using the user's Google Workspace + * administrator privileges. + * + * The calling user must be a Google Workspace administrator with the + * [manage chat and spaces conversations + * privilege](https://support.google.com/a/answer/13369245). + * + * Requires either the `chat.admin.memberships.readonly` or + * `chat.admin.memberships` [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * + * Listing app memberships in a space isn't supported when using admin access. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.chat.v1.Space|Space} on 'data' event. + * An object stream which emits an object representing {@link protos.google.chat.v1.Membership|Membership} 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 `listSpacesAsync()` + * We recommend using `listMembershipsAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - listSpacesStream( - request?: protos.google.chat.v1.IListSpacesRequest, + listMembershipsStream( + request?: protos.google.chat.v1.IListMembershipsRequest, options?: CallOptions): Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSpaces']; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMemberships']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listSpaces stream %j', request); - return this.descriptors.page.listSpaces.createStream( - this.innerApiCalls.listSpaces as GaxCall, + this._log.info('listMemberships stream %j', request); + return this.descriptors.page.listMemberships.createStream( + this.innerApiCalls.listMemberships as GaxCall, request, callSettings ); } /** - * Equivalent to `listSpaces`, but returns an iterable object. + * Equivalent to `listMemberships`, but returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the space for which to fetch a membership + * list. + * + * Format: spaces/{space} * @param {number} [request.pageSize] - * Optional. The maximum number of spaces to return. The service might return - * fewer than this value. + * Optional. The maximum number of memberships to return. The service might + * return fewer than this value. * - * If unspecified, at most 100 spaces are returned. + * 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. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous list spaces call. + * Optional. A page token, received from a previous call to list memberships. * 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. + * 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. * @param {string} [request.filter] * 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)). + * 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 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. + * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. * - * For example, the following queries are valid: + * To filter by type, set `member.type` to `HUMAN` or `BOT`. You can also + * filter for `member.type` using the `!=` operator. * - * ``` - * space_type = "SPACE" - * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" + * To filter by both role and type, use the `AND` operator. To filter by + * either role or type, use the `OR` operator. + * + * Either `member.type = "HUMAN"` or `member.type != "BOT"` is required + * when `use_admin_access` is set to true. Other member type filters will be + * rejected. + * + * For example, the following queries are valid: + * + * ``` + * role = "ROLE_MANAGER" OR role = "ROLE_MEMBER" + * member.type = "HUMAN" AND role = "ROLE_MANAGER" + * + * member.type != "BOT" + * ``` + * + * 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. + * @param {boolean} [request.showGroups] + * Optional. When `true`, also returns memberships associated with a + * {@link protos.google.chat.v1.Membership.group_member|Google Group}, in + * addition to other types of memberships. If a + * {@link protos.google.chat.v1.ListMembershipsRequest.filter|filter} is set, + * {@link protos.google.chat.v1.Membership.group_member|Google Group} + * memberships that don't match the filter criteria aren't returned. + * @param {boolean} [request.showInvited] + * Optional. When `true`, also returns memberships associated with + * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|invited} members, in + * addition to other types of memberships. If a + * filter is set, + * {@link protos.google.chat.v1.Membership.MembershipState.INVITED|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). + * @param {boolean} [request.useAdminAccess] + * Optional. When `true`, the method runs using the user's Google Workspace + * administrator privileges. + * + * The calling user must be a Google Workspace administrator with the + * [manage chat and spaces conversations + * privilege](https://support.google.com/a/answer/13369245). + * + * Requires either the `chat.admin.memberships.readonly` or + * `chat.admin.memberships` [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * + * Listing app memberships in a space isn't supported when using admin access. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.chat.v1.Space|Space}. The API will be called under the hood as needed, once per the page, + * {@link protos.google.chat.v1.Membership|Membership}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. - * @example include:samples/generated/v1/chat_service.list_spaces.js - * region_tag:chat_v1_generated_ChatService_ListSpaces_async + * @example include:samples/generated/v1/chat_service.list_memberships.js + * region_tag:chat_v1_generated_ChatService_ListMemberships_async */ - listSpacesAsync( - request?: protos.google.chat.v1.IListSpacesRequest, + listMembershipsAsync( + request?: protos.google.chat.v1.IListMembershipsRequest, options?: CallOptions): - AsyncIterable{ + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSpaces']; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMemberships']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listSpaces iterate %j', request); - return this.descriptors.page.listSpaces.asyncIterate( - this.innerApiCalls['listSpaces'] as GaxCall, + this._log.info('listMemberships iterate %j', request); + return this.descriptors.page.listMemberships.asyncIterate( + this.innerApiCalls['listMemberships'] as GaxCall, request as {}, callSettings - ) as AsyncIterable; + ) as AsyncIterable; } /** - * Returns a list of spaces in a Google Workspace organization based on an - * administrator's search. In the request, set `use_admin_access` to `true`. - * For an example, see [Search for and manage - * spaces](https://developers.google.com/workspace/chat/search-manage-admin). - * - * Requires [user - * authentication with administrator - * privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges) - * and one of the following [authorization - * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + * 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). * - * - `https://www.googleapis.com/auth/chat.admin.spaces.readonly` - * - `https://www.googleapis.com/auth/chat.admin.spaces` + * Supports the following types of + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize): * - * @param {Object} request - * The request object that will be sent. - * @param {boolean} request.useAdminAccess - * When `true`, the method runs using the user's Google Workspace - * administrator privileges. + * - [App + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * with the authorization scope: + * - `https://www.googleapis.com/auth/chat.bot` * - * The calling user must be a Google Workspace administrator with the - * [manage chat and spaces conversations - * privilege](https://support.google.com/a/answer/13369245). + * - [User + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * with one of the following authorization scopes: + * - `https://www.googleapis.com/auth/chat.spaces.readonly` + * - `https://www.googleapis.com/auth/chat.spaces` * - * Requires either the `chat.admin.spaces.readonly` or `chat.admin.spaces` - * [OAuth 2.0 - * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * To list all named spaces by Google Workspace organization, use the + * [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) + * method using Workspace administrator privileges instead. * - * This method currently only supports admin access, thus only `true` is - * accepted for this field. - * @param {number} request.pageSize - * The maximum number of spaces to return. The service may return fewer than - * this value. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * 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. - * @param {string} request.pageToken - * A token, received from the previous search spaces 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. - * @param {string} request.query - * Required. A search query. - * - * You can search by using the following parameters: - * - * - `create_time` - * - `customer` - * - `display_name` - * - `external_user_allowed` - * - `last_active_time` - * - `space_history_state` - * - `space_type` - * - * `create_time` and `last_active_time` accept a timestamp in - * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the supported - * comparison operators are: `=`, `<`, `>`, `<=`, `>=`. - * - * `customer` is required and is used to indicate which customer - * to fetch spaces from. `customers/my_customer` is the only supported value. - * - * `display_name` only accepts the `HAS` (`:`) operator. The text to - * match is first tokenized into tokens and each token is prefix-matched - * case-insensitively and independently as a substring anywhere in the space's - * `display_name`. For example, `Fun Eve` matches `Fun event` or `The - * evening was fun`, but not `notFun event` or `even`. - * - * `external_user_allowed` accepts either `true` or `false`. * - * `space_history_state` only accepts values from the [`historyState`] - * (https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#Space.HistoryState) - * field of a `space` resource. + * Negative values return an `INVALID_ARGUMENT` error. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous list spaces call. + * Provide this parameter to retrieve the subsequent page. * - * `space_type` is required and the only valid value is `SPACE`. + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value may lead to unexpected results. + * @param {string} [request.filter] + * Optional. A query filter. * - * Across different fields, only `AND` operators are supported. A valid - * example is `space_type = "SPACE" AND display_name:"Hello"` and an invalid - * example is `space_type = "SPACE" OR display_name:"Hello"`. + * You can filter spaces by the space type + * ([`space_type`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). * - * Among the same field, - * `space_type` doesn't support `AND` or `OR` operators. - * `display_name`, 'space_history_state', and 'external_user_allowed' only - * support `OR` operators. - * `last_active_time` and `create_time` support both `AND` and `OR` operators. - * `AND` can only be used to represent an interval, such as `last_active_time - * < "2022-01-01T00:00:00+00:00" AND last_active_time > - * "2023-01-01T00:00:00+00:00"`. + * 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. * - * The following example queries are valid: + * For example, the following queries are valid: * * ``` - * customer = "customers/my_customer" AND space_type = "SPACE" - * - * customer = "customers/my_customer" AND space_type = "SPACE" AND - * display_name:"Hello World" - * - * customer = "customers/my_customer" AND space_type = "SPACE" AND - * (last_active_time < "2020-01-01T00:00:00+00:00" OR last_active_time > - * "2022-01-01T00:00:00+00:00") - * - * customer = "customers/my_customer" AND space_type = "SPACE" AND - * (display_name:"Hello World" OR display_name:"Fun event") AND - * (last_active_time > "2020-01-01T00:00:00+00:00" AND last_active_time < - * "2022-01-01T00:00:00+00:00") - * - * customer = "customers/my_customer" AND space_type = "SPACE" AND - * (create_time > "2019-01-01T00:00:00+00:00" AND create_time < - * "2020-01-01T00:00:00+00:00") AND (external_user_allowed = "true") AND - * (space_history_state = "HISTORY_ON" OR space_history_state = "HISTORY_OFF") + * space_type = "SPACE" + * spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE" * ``` - * @param {string} [request.orderBy] - * Optional. How the list of spaces is ordered. - * - * Supported attributes to order by are: - * - * - `membership_count.joined_direct_human_user_count` — Denotes the count of - * human users that have directly joined a space. - * - `last_active_time` — Denotes the time when last eligible item is added to - * any topic of this space. - * - `create_time` — Denotes the time of the space creation. - * - * Valid ordering operation values are: - * - * - `ASC` for ascending. Default value. - * - * - `DESC` for descending. * - * The supported syntax are: - * - * - `membership_count.joined_direct_human_user_count DESC` - * - `membership_count.joined_direct_human_user_count ASC` - * - `last_active_time DESC` - * - `last_active_time ASC` - * - `create_time DESC` - * - `create_time ASC` + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -5502,46 +5700,46 @@ export class ChatServiceClient { * 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 `searchSpacesAsync()` + * We recommend using `listSpacesAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - searchSpaces( - request?: protos.google.chat.v1.ISearchSpacesRequest, + listSpaces( + request?: protos.google.chat.v1.IListSpacesRequest, options?: CallOptions): Promise<[ protos.google.chat.v1.ISpace[], - protos.google.chat.v1.ISearchSpacesRequest|null, - protos.google.chat.v1.ISearchSpacesResponse + protos.google.chat.v1.IListSpacesRequest|null, + protos.google.chat.v1.IListSpacesResponse ]>; - searchSpaces( - request: protos.google.chat.v1.ISearchSpacesRequest, + listSpaces( + request: protos.google.chat.v1.IListSpacesRequest, options: CallOptions, callback: PaginationCallback< - protos.google.chat.v1.ISearchSpacesRequest, - protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.IListSpacesRequest, + protos.google.chat.v1.IListSpacesResponse|null|undefined, protos.google.chat.v1.ISpace>): void; - searchSpaces( - request: protos.google.chat.v1.ISearchSpacesRequest, + listSpaces( + request: protos.google.chat.v1.IListSpacesRequest, callback: PaginationCallback< - protos.google.chat.v1.ISearchSpacesRequest, - protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.IListSpacesRequest, + protos.google.chat.v1.IListSpacesResponse|null|undefined, protos.google.chat.v1.ISpace>): void; - searchSpaces( - request?: protos.google.chat.v1.ISearchSpacesRequest, + listSpaces( + request?: protos.google.chat.v1.IListSpacesRequest, optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.chat.v1.ISearchSpacesRequest, - protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.IListSpacesRequest, + protos.google.chat.v1.IListSpacesResponse|null|undefined, protos.google.chat.v1.ISpace>, callback?: PaginationCallback< - protos.google.chat.v1.ISearchSpacesRequest, - protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.IListSpacesRequest, + protos.google.chat.v1.IListSpacesResponse|null|undefined, protos.google.chat.v1.ISpace>): Promise<[ protos.google.chat.v1.ISpace[], - protos.google.chat.v1.ISearchSpacesRequest|null, - protos.google.chat.v1.ISearchSpacesResponse + protos.google.chat.v1.IListSpacesRequest|null, + protos.google.chat.v1.IListSpacesResponse ]>|void { request = request || {}; let options: CallOptions; @@ -5557,29 +5755,184 @@ export class ChatServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize().catch(err => {throw err}); const wrappedCallback: PaginationCallback< - protos.google.chat.v1.ISearchSpacesRequest, - protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.IListSpacesRequest, + protos.google.chat.v1.IListSpacesResponse|null|undefined, protos.google.chat.v1.ISpace>|undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('searchSpaces values %j', values); + this._log.info('listSpaces values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('searchSpaces request %j', request); + this._log.info('listSpaces request %j', request); return this.innerApiCalls - .searchSpaces(request, options, wrappedCallback) + .listSpaces(request, options, wrappedCallback) ?.then(([response, input, output]: [ protos.google.chat.v1.ISpace[], - protos.google.chat.v1.ISearchSpacesRequest|null, - protos.google.chat.v1.ISearchSpacesResponse + protos.google.chat.v1.IListSpacesRequest|null, + protos.google.chat.v1.IListSpacesResponse ]) => { - this._log.info('searchSpaces values %j', response); + this._log.info('listSpaces values %j', response); return [response, input, output]; }); } /** - * Equivalent to `searchSpaces`, but returns a NodeJS Stream object. + * Equivalent to `listSpaces`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.filter] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.chat.v1.Space|Space} 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 `listSpacesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSpacesStream( + request?: protos.google.chat.v1.IListSpacesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listSpaces']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listSpaces stream %j', request); + return this.descriptors.page.listSpaces.createStream( + this.innerApiCalls.listSpaces as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSpaces`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.filter] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.chat.v1.Space|Space}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/chat_service.list_spaces.js + * region_tag:chat_v1_generated_ChatService_ListSpaces_async + */ + listSpacesAsync( + request?: protos.google.chat.v1.IListSpacesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listSpaces']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listSpaces iterate %j', request); + return this.descriptors.page.listSpaces.asyncIterate( + this.innerApiCalls['listSpaces'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns a list of spaces in a Google Workspace organization based on an + * administrator's search. In the request, set `use_admin_access` to `true`. + * For an example, see [Search for and manage + * spaces](https://developers.google.com/workspace/chat/search-manage-admin). + * + * Requires [user + * authentication with administrator + * privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges) + * and one of the following [authorization + * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + * + * - `https://www.googleapis.com/auth/chat.admin.spaces.readonly` + * - `https://www.googleapis.com/auth/chat.admin.spaces` + * * @param {Object} request * The request object that will be sent. * @param {boolean} request.useAdminAccess @@ -5707,28 +6060,238 @@ export class ChatServiceClient { * - `create_time ASC` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.chat.v1.Space|Space} on 'data' event. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.chat.v1.Space|Space}. * 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. + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. * We recommend using `searchSpacesAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - searchSpacesStream( + searchSpaces( request?: protos.google.chat.v1.ISearchSpacesRequest, options?: CallOptions): - Transform{ + Promise<[ + protos.google.chat.v1.ISpace[], + protos.google.chat.v1.ISearchSpacesRequest|null, + protos.google.chat.v1.ISearchSpacesResponse + ]>; + searchSpaces( + request: protos.google.chat.v1.ISearchSpacesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.chat.v1.ISearchSpacesRequest, + protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.ISpace>): void; + searchSpaces( + request: protos.google.chat.v1.ISearchSpacesRequest, + callback: PaginationCallback< + protos.google.chat.v1.ISearchSpacesRequest, + protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.ISpace>): void; + searchSpaces( + request?: protos.google.chat.v1.ISearchSpacesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.chat.v1.ISearchSpacesRequest, + protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.ISpace>, + callback?: PaginationCallback< + protos.google.chat.v1.ISearchSpacesRequest, + protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.ISpace>): + Promise<[ + protos.google.chat.v1.ISpace[], + protos.google.chat.v1.ISearchSpacesRequest|null, + protos.google.chat.v1.ISearchSpacesResponse + ]>|void { request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['searchSpaces']; - const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('searchSpaces stream %j', request); - return this.descriptors.page.searchSpaces.createStream( + const wrappedCallback: PaginationCallback< + protos.google.chat.v1.ISearchSpacesRequest, + protos.google.chat.v1.ISearchSpacesResponse|null|undefined, + protos.google.chat.v1.ISpace>|undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('searchSpaces values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('searchSpaces request %j', request); + return this.innerApiCalls + .searchSpaces(request, options, wrappedCallback) + ?.then(([response, input, output]: [ + protos.google.chat.v1.ISpace[], + protos.google.chat.v1.ISearchSpacesRequest|null, + protos.google.chat.v1.ISearchSpacesResponse + ]) => { + this._log.info('searchSpaces values %j', response); + return [response, input, output]; + }); + } + +/** + * Equivalent to `searchSpaces`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {boolean} request.useAdminAccess + * When `true`, the method runs using the user's Google Workspace + * administrator privileges. + * + * The calling user must be a Google Workspace administrator with the + * [manage chat and spaces conversations + * privilege](https://support.google.com/a/answer/13369245). + * + * Requires either the `chat.admin.spaces.readonly` or `chat.admin.spaces` + * [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * + * This method currently only supports admin access, thus only `true` is + * accepted for this field. + * @param {number} request.pageSize + * The maximum number of spaces to return. The service may 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. + * @param {string} request.pageToken + * A token, received from the previous search spaces 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. + * @param {string} request.query + * Required. A search query. + * + * You can search by using the following parameters: + * + * - `create_time` + * - `customer` + * - `display_name` + * - `external_user_allowed` + * - `last_active_time` + * - `space_history_state` + * - `space_type` + * + * `create_time` and `last_active_time` accept a timestamp in + * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the supported + * comparison operators are: `=`, `<`, `>`, `<=`, `>=`. + * + * `customer` is required and is used to indicate which customer + * to fetch spaces from. `customers/my_customer` is the only supported value. + * + * `display_name` only accepts the `HAS` (`:`) operator. The text to + * match is first tokenized into tokens and each token is prefix-matched + * case-insensitively and independently as a substring anywhere in the space's + * `display_name`. For example, `Fun Eve` matches `Fun event` or `The + * evening was fun`, but not `notFun event` or `even`. + * + * `external_user_allowed` accepts either `true` or `false`. + * + * `space_history_state` only accepts values from the [`historyState`] + * (https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#Space.HistoryState) + * field of a `space` resource. + * + * `space_type` is required and the only valid value is `SPACE`. + * + * Across different fields, only `AND` operators are supported. A valid + * example is `space_type = "SPACE" AND display_name:"Hello"` and an invalid + * example is `space_type = "SPACE" OR display_name:"Hello"`. + * + * Among the same field, + * `space_type` doesn't support `AND` or `OR` operators. + * `display_name`, 'space_history_state', and 'external_user_allowed' only + * support `OR` operators. + * `last_active_time` and `create_time` support both `AND` and `OR` operators. + * `AND` can only be used to represent an interval, such as `last_active_time + * < "2022-01-01T00:00:00+00:00" AND last_active_time > + * "2023-01-01T00:00:00+00:00"`. + * + * The following example queries are valid: + * + * ``` + * customer = "customers/my_customer" AND space_type = "SPACE" + * + * customer = "customers/my_customer" AND space_type = "SPACE" AND + * display_name:"Hello World" + * + * customer = "customers/my_customer" AND space_type = "SPACE" AND + * (last_active_time < "2020-01-01T00:00:00+00:00" OR last_active_time > + * "2022-01-01T00:00:00+00:00") + * + * customer = "customers/my_customer" AND space_type = "SPACE" AND + * (display_name:"Hello World" OR display_name:"Fun event") AND + * (last_active_time > "2020-01-01T00:00:00+00:00" AND last_active_time < + * "2022-01-01T00:00:00+00:00") + * + * customer = "customers/my_customer" AND space_type = "SPACE" AND + * (create_time > "2019-01-01T00:00:00+00:00" AND create_time < + * "2020-01-01T00:00:00+00:00") AND (external_user_allowed = "true") AND + * (space_history_state = "HISTORY_ON" OR space_history_state = "HISTORY_OFF") + * ``` + * @param {string} [request.orderBy] + * Optional. How the list of spaces is ordered. + * + * Supported attributes to order by are: + * + * - `membership_count.joined_direct_human_user_count` — Denotes the count of + * human users that have directly joined a space. + * - `last_active_time` — Denotes the time when last eligible item is added to + * any topic of this space. + * - `create_time` — Denotes the time of the space creation. + * + * Valid ordering operation values are: + * + * - `ASC` for ascending. Default value. + * + * - `DESC` for descending. + * + * The supported syntax are: + * + * - `membership_count.joined_direct_human_user_count DESC` + * - `membership_count.joined_direct_human_user_count ASC` + * - `last_active_time DESC` + * - `last_active_time ASC` + * - `create_time DESC` + * - `create_time ASC` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.chat.v1.Space|Space} 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 `searchSpacesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + searchSpacesStream( + request?: protos.google.chat.v1.ISearchSpacesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['searchSpaces']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('searchSpaces stream %j', request); + return this.descriptors.page.searchSpaces.createStream( this.innerApiCalls.searchSpaces as GaxCall, request, callSettings @@ -5844,180 +6407,842 @@ export class ChatServiceClient { * * Supported attributes to order by are: * - * - `membership_count.joined_direct_human_user_count` — Denotes the count of - * human users that have directly joined a space. - * - `last_active_time` — Denotes the time when last eligible item is added to - * any topic of this space. - * - `create_time` — Denotes the time of the space creation. + * - `membership_count.joined_direct_human_user_count` — Denotes the count of + * human users that have directly joined a space. + * - `last_active_time` — Denotes the time when last eligible item is added to + * any topic of this space. + * - `create_time` — Denotes the time of the space creation. + * + * Valid ordering operation values are: + * + * - `ASC` for ascending. Default value. + * + * - `DESC` for descending. + * + * The supported syntax are: + * + * - `membership_count.joined_direct_human_user_count DESC` + * - `membership_count.joined_direct_human_user_count ASC` + * - `last_active_time DESC` + * - `last_active_time ASC` + * - `create_time DESC` + * - `create_time ASC` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.chat.v1.Space|Space}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/chat_service.search_spaces.js + * region_tag:chat_v1_generated_ChatService_SearchSpaces_async + */ + searchSpacesAsync( + request?: protos.google.chat.v1.ISearchSpacesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['searchSpaces']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('searchSpaces iterate %j', request); + return this.descriptors.page.searchSpaces.asyncIterate( + this.innerApiCalls['searchSpaces'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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) + * with one of the following [authorization + * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + * + * - `https://www.googleapis.com/auth/chat.messages.reactions.readonly` + * - `https://www.googleapis.com/auth/chat.messages.reactions` + * - `https://www.googleapis.com/auth/chat.messages.readonly` + * - `https://www.googleapis.com/auth/chat.messages` + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The message users reacted to. + * + * Format: `spaces/{space}/messages/{message}` + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.filter] + * 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 with an `INVALID_ARGUMENT` error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.chat.v1.Reaction|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 `listReactionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + 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 + ]>; + 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; + 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; + listReactions( + request?: protos.google.chat.v1.IListReactionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.chat.v1.IListReactionsRequest, + protos.google.chat.v1.IListReactionsResponse|null|undefined, + protos.google.chat.v1.IReaction>, + callback?: PaginationCallback< + protos.google.chat.v1.IListReactionsRequest, + protos.google.chat.v1.IListReactionsResponse|null|undefined, + protos.google.chat.v1.IReaction>): + Promise<[ + protos.google.chat.v1.IReaction[], + protos.google.chat.v1.IListReactionsRequest|null, + protos.google.chat.v1.IListReactionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize().catch(err => {throw err}); + const wrappedCallback: PaginationCallback< + protos.google.chat.v1.IListReactionsRequest, + protos.google.chat.v1.IListReactionsResponse|null|undefined, + protos.google.chat.v1.IReaction>|undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listReactions values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listReactions request %j', request); + return this.innerApiCalls + .listReactions(request, options, wrappedCallback) + ?.then(([response, input, output]: [ + protos.google.chat.v1.IReaction[], + protos.google.chat.v1.IListReactionsRequest|null, + protos.google.chat.v1.IListReactionsResponse + ]) => { + this._log.info('listReactions values %j', response); + return [response, input, output]; + }); + } + +/** + * Equivalent to `listReactions`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The message users reacted to. + * + * Format: `spaces/{space}/messages/{message}` + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.filter] + * 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 with an `INVALID_ARGUMENT` error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.chat.v1.Reaction|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 `listReactionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listReactionsStream( + request?: protos.google.chat.v1.IListReactionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listReactions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listReactions stream %j', request); + return this.descriptors.page.listReactions.createStream( + this.innerApiCalls.listReactions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listReactions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The message users reacted to. + * + * Format: `spaces/{space}/messages/{message}` + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.filter] + * 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 with an `INVALID_ARGUMENT` error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.chat.v1.Reaction|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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/chat_service.list_reactions.js + * region_tag:chat_v1_generated_ChatService_ListReactions_async + */ + listReactionsAsync( + request?: protos.google.chat.v1.IListReactionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listReactions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listReactions iterate %j', request); + return this.descriptors.page.listReactions.asyncIterate( + this.innerApiCalls['listReactions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists custom emojis visible to the authenticated user. + * + * Custom emojis are only available for Google Workspace accounts, and the + * administrator must turn custom emojis on for the organization. For more + * information, see [Learn about custom emojis in Google + * Chat](https://support.google.com/chat/answer/12800149) and + * [Manage custom emoji + * permissions](https://support.google.com/a/answer/12850085). + * + * Requires [user + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) + * with one of the following [authorization + * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + * + * - `https://www.googleapis.com/auth/chat.customemojis.readonly` + * - `https://www.googleapis.com/auth/chat.customemojis` + * + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of custom emojis returned. The service can + * return fewer custom emojis than this value. If unspecified, the default + * value is 25. The maximum value is 200; values above 200 are changed to 200. + * @param {string} [request.pageToken] + * Optional. (If resuming from a previous query.) + * + * A page token received from a previous list custom emoji 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. + * @param {string} [request.filter] + * Optional. A query filter. + * + * Supports filtering by creator. + * + * To filter by creator, you must specify a valid value. Currently only + * `creator("users/me")` and `NOT creator("users/me")` are accepted to filter + * custom emojis by whether they were created by the calling user or not. + * + * For example, the following query returns custom emojis created by the + * caller: + * ``` + * creator("users/me") + * ``` + * + * Invalid queries are rejected with an `INVALID_ARGUMENT` error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.chat.v1.CustomEmoji|CustomEmoji}. + * 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 `listCustomEmojisAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCustomEmojis( + request?: protos.google.chat.v1.IListCustomEmojisRequest, + options?: CallOptions): + Promise<[ + protos.google.chat.v1.ICustomEmoji[], + protos.google.chat.v1.IListCustomEmojisRequest|null, + protos.google.chat.v1.IListCustomEmojisResponse + ]>; + listCustomEmojis( + request: protos.google.chat.v1.IListCustomEmojisRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.chat.v1.IListCustomEmojisRequest, + protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, + protos.google.chat.v1.ICustomEmoji>): void; + listCustomEmojis( + request: protos.google.chat.v1.IListCustomEmojisRequest, + callback: PaginationCallback< + protos.google.chat.v1.IListCustomEmojisRequest, + protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, + protos.google.chat.v1.ICustomEmoji>): void; + listCustomEmojis( + request?: protos.google.chat.v1.IListCustomEmojisRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.chat.v1.IListCustomEmojisRequest, + protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, + protos.google.chat.v1.ICustomEmoji>, + callback?: PaginationCallback< + protos.google.chat.v1.IListCustomEmojisRequest, + protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, + protos.google.chat.v1.ICustomEmoji>): + Promise<[ + protos.google.chat.v1.ICustomEmoji[], + protos.google.chat.v1.IListCustomEmojisRequest|null, + protos.google.chat.v1.IListCustomEmojisResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize().catch(err => {throw err}); + const wrappedCallback: PaginationCallback< + protos.google.chat.v1.IListCustomEmojisRequest, + protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, + protos.google.chat.v1.ICustomEmoji>|undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listCustomEmojis values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listCustomEmojis request %j', request); + return this.innerApiCalls + .listCustomEmojis(request, options, wrappedCallback) + ?.then(([response, input, output]: [ + protos.google.chat.v1.ICustomEmoji[], + protos.google.chat.v1.IListCustomEmojisRequest|null, + protos.google.chat.v1.IListCustomEmojisResponse + ]) => { + this._log.info('listCustomEmojis values %j', response); + return [response, input, output]; + }); + } + +/** + * Equivalent to `listCustomEmojis`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of custom emojis returned. The service can + * return fewer custom emojis than this value. If unspecified, the default + * value is 25. The maximum value is 200; values above 200 are changed to 200. + * @param {string} [request.pageToken] + * Optional. (If resuming from a previous query.) + * + * A page token received from a previous list custom emoji 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. + * @param {string} [request.filter] + * Optional. A query filter. + * + * Supports filtering by creator. + * + * To filter by creator, you must specify a valid value. Currently only + * `creator("users/me")` and `NOT creator("users/me")` are accepted to filter + * custom emojis by whether they were created by the calling user or not. + * + * For example, the following query returns custom emojis created by the + * caller: + * ``` + * creator("users/me") + * ``` + * + * Invalid queries are rejected with an `INVALID_ARGUMENT` error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.chat.v1.CustomEmoji|CustomEmoji} 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 `listCustomEmojisAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listCustomEmojisStream( + request?: protos.google.chat.v1.IListCustomEmojisRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listCustomEmojis']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listCustomEmojis stream %j', request); + return this.descriptors.page.listCustomEmojis.createStream( + this.innerApiCalls.listCustomEmojis as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCustomEmojis`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of custom emojis returned. The service can + * return fewer custom emojis than this value. If unspecified, the default + * value is 25. The maximum value is 200; values above 200 are changed to 200. + * @param {string} [request.pageToken] + * Optional. (If resuming from a previous query.) + * + * A page token received from a previous list custom emoji call. Provide this + * to retrieve the subsequent page. * - * Valid ordering operation values are: + * When paginating, the filter value should match the call that provided the + * page token. Passing a different value might lead to unexpected results. + * @param {string} [request.filter] + * Optional. A query filter. * - * - `ASC` for ascending. Default value. + * Supports filtering by creator. * - * - `DESC` for descending. + * To filter by creator, you must specify a valid value. Currently only + * `creator("users/me")` and `NOT creator("users/me")` are accepted to filter + * custom emojis by whether they were created by the calling user or not. * - * The supported syntax are: + * For example, the following query returns custom emojis created by the + * caller: + * ``` + * creator("users/me") + * ``` * - * - `membership_count.joined_direct_human_user_count DESC` - * - `membership_count.joined_direct_human_user_count ASC` - * - `last_active_time DESC` - * - `last_active_time ASC` - * - `create_time DESC` - * - `create_time ASC` + * Invalid queries are rejected with an `INVALID_ARGUMENT` error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.chat.v1.Space|Space}. The API will be called under the hood as needed, once per the page, + * {@link protos.google.chat.v1.CustomEmoji|CustomEmoji}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. - * @example include:samples/generated/v1/chat_service.search_spaces.js - * region_tag:chat_v1_generated_ChatService_SearchSpaces_async + * @example include:samples/generated/v1/chat_service.list_custom_emojis.js + * region_tag:chat_v1_generated_ChatService_ListCustomEmojis_async */ - searchSpacesAsync( - request?: protos.google.chat.v1.ISearchSpacesRequest, + listCustomEmojisAsync( + request?: protos.google.chat.v1.IListCustomEmojisRequest, options?: CallOptions): - AsyncIterable{ + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['searchSpaces']; + const defaultCallSettings = this._defaults['listCustomEmojis']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('searchSpaces iterate %j', request); - return this.descriptors.page.searchSpaces.asyncIterate( - this.innerApiCalls['searchSpaces'] as GaxCall, + this._log.info('listCustomEmojis iterate %j', request); + return this.descriptors.page.listCustomEmojis.asyncIterate( + this.innerApiCalls['listCustomEmojis'] as GaxCall, request as {}, callSettings - ) as AsyncIterable; + ) as AsyncIterable; } /** - * Lists reactions to a message. For an example, see - * [List reactions for a - * message](https://developers.google.com/workspace/chat/list-reactions). + * Lists events from a Google Chat space. For each event, the + * [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) + * contains the most recent version of the Chat resource. For example, if you + * list events about new space members, the server returns `Membership` + * resources that contain the latest membership details. If new members were + * removed during the requested period, the event payload contains an empty + * `Membership` resource. * - * Requires [user + * Supports the following types of + * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) + * with an + * [authorization + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) + * appropriate for reading the requested data: + * + * - [App + * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) + * with [administrator + * approval](https://support.google.com/a?p=chat-app-auth) + * with one of the following authorization scopes: + * - `https://www.googleapis.com/auth/chat.app.spaces` + * - `https://www.googleapis.com/auth/chat.app.spaces.readonly` + * - `https://www.googleapis.com/auth/chat.app.messages.readonly` + * - `https://www.googleapis.com/auth/chat.app.memberships` + * - `https://www.googleapis.com/auth/chat.app.memberships.readonly` + * + * - [User * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - * with one of the following [authorization - * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + * with one of the following authorization scopes: + * - `https://www.googleapis.com/auth/chat.spaces.readonly` + * - `https://www.googleapis.com/auth/chat.spaces` + * - `https://www.googleapis.com/auth/chat.messages.readonly` + * - `https://www.googleapis.com/auth/chat.messages` + * - `https://www.googleapis.com/auth/chat.messages.reactions.readonly` + * - `https://www.googleapis.com/auth/chat.messages.reactions` + * - `https://www.googleapis.com/auth/chat.memberships.readonly` + * - `https://www.googleapis.com/auth/chat.memberships` * - * - `https://www.googleapis.com/auth/chat.messages.reactions.readonly` - * - `https://www.googleapis.com/auth/chat.messages.reactions` - * - `https://www.googleapis.com/auth/chat.messages.readonly` - * - `https://www.googleapis.com/auth/chat.messages` + * To list events, the authenticated caller must be a member of the space. + * + * For an example, see [List events from a Google Chat + * space](https://developers.google.com/workspace/chat/list-space-events). * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The message users reacted to. + * Required. Resource name of the [Google Chat + * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) + * where the events occurred. * - * Format: `spaces/{space}/messages/{message}` + * Format: `spaces/{space}`. * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. (If resuming from a previous query.) + * Optional. The maximum number of space events returned. The service might + * return fewer than this value. * - * A page token received from a previous list reactions call. Provide this - * to retrieve the subsequent page. + * Negative values return an `INVALID_ARGUMENT` error. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous list space events 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. - * @param {string} [request.filter] - * Optional. A query filter. + * When paginating, all other parameters provided to list space events must + * match the call that provided the page token. Passing different values to + * the other parameters might lead to unexpected results. + * @param {string} request.filter + * Required. 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`). + * You must specify at least one event type (`event_type`) + * using the has `:` operator. To filter by multiple event types, use the `OR` + * operator. Omit batch event types in your filter. The request automatically + * returns any related batch events. For example, if you filter by new + * reactions + * (`google.workspace.chat.reaction.v1.created`), the server also returns + * batch new reactions events + * (`google.workspace.chat.reaction.v1.batchCreated`). For a list of supported + * event types, see the [`SpaceEvents` reference + * documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type). * - * 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"`. + * Optionally, you can also filter by start time (`start_time`) and + * end time (`end_time`): * - * To filter reactions by emoji and user, use the `AND` operator, such as - * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. + * * `start_time`: Exclusive timestamp from which to start listing space + * events. + * You can list events that occurred up to 28 days ago. If unspecified, lists + * space events from the past 28 days. + * * `end_time`: Inclusive timestamp until which space events are listed. + * If unspecified, lists events up to the time of the request. * - * If your query uses both `AND` and `OR`, group them with parentheses. + * To specify a start or end time, use the equals `=` operator and format in + * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both + * `start_time` and `end_time`, use the `AND` operator. * * 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}" + * start_time="2023-08-23T19:20:33+00:00" AND + * end_time="2023-08-23T19:21:54+00:00" + * ``` + * ``` + * start_time="2023-08-23T19:20:33+00:00" AND + * (event_types:"google.workspace.chat.space.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created") * ``` * * The following queries are invalid: * * ``` - * 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}" + * start_time="2023-08-23T19:20:33+00:00" OR + * end_time="2023-08-23T19:21:54+00:00" + * ``` + * ``` + * event_types:"google.workspace.chat.space.v1.updated" AND + * event_types:"google.workspace.chat.message.v1.created" * ``` * - * Invalid queries are rejected with an `INVALID_ARGUMENT` error. + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.chat.v1.Reaction|Reaction}. + * The first element of the array is Array of {@link protos.google.chat.v1.SpaceEvent|SpaceEvent}. * 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 `listReactionsAsync()` + * We recommend using `listSpaceEventsAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - listReactions( - request?: protos.google.chat.v1.IListReactionsRequest, + listSpaceEvents( + request?: protos.google.chat.v1.IListSpaceEventsRequest, options?: CallOptions): Promise<[ - protos.google.chat.v1.IReaction[], - protos.google.chat.v1.IListReactionsRequest|null, - protos.google.chat.v1.IListReactionsResponse + protos.google.chat.v1.ISpaceEvent[], + protos.google.chat.v1.IListSpaceEventsRequest|null, + protos.google.chat.v1.IListSpaceEventsResponse ]>; - listReactions( - request: protos.google.chat.v1.IListReactionsRequest, + listSpaceEvents( + request: protos.google.chat.v1.IListSpaceEventsRequest, options: CallOptions, callback: PaginationCallback< - protos.google.chat.v1.IListReactionsRequest, - protos.google.chat.v1.IListReactionsResponse|null|undefined, - protos.google.chat.v1.IReaction>): void; - listReactions( - request: protos.google.chat.v1.IListReactionsRequest, + protos.google.chat.v1.IListSpaceEventsRequest, + protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, + protos.google.chat.v1.ISpaceEvent>): void; + listSpaceEvents( + request: protos.google.chat.v1.IListSpaceEventsRequest, callback: PaginationCallback< - protos.google.chat.v1.IListReactionsRequest, - protos.google.chat.v1.IListReactionsResponse|null|undefined, - protos.google.chat.v1.IReaction>): void; - listReactions( - request?: protos.google.chat.v1.IListReactionsRequest, + protos.google.chat.v1.IListSpaceEventsRequest, + protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, + protos.google.chat.v1.ISpaceEvent>): void; + listSpaceEvents( + request?: protos.google.chat.v1.IListSpaceEventsRequest, optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.chat.v1.IListReactionsRequest, - protos.google.chat.v1.IListReactionsResponse|null|undefined, - protos.google.chat.v1.IReaction>, + protos.google.chat.v1.IListSpaceEventsRequest, + protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, + protos.google.chat.v1.ISpaceEvent>, callback?: PaginationCallback< - protos.google.chat.v1.IListReactionsRequest, - protos.google.chat.v1.IListReactionsResponse|null|undefined, - protos.google.chat.v1.IReaction>): + protos.google.chat.v1.IListSpaceEventsRequest, + protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, + protos.google.chat.v1.ISpaceEvent>): Promise<[ - protos.google.chat.v1.IReaction[], - protos.google.chat.v1.IListReactionsRequest|null, - protos.google.chat.v1.IListReactionsResponse + protos.google.chat.v1.ISpaceEvent[], + protos.google.chat.v1.IListSpaceEventsRequest|null, + protos.google.chat.v1.IListSpaceEventsResponse ]>|void { request = request || {}; let options: CallOptions; @@ -6038,104 +7263,115 @@ export class ChatServiceClient { }); this.initialize().catch(err => {throw err}); const wrappedCallback: PaginationCallback< - protos.google.chat.v1.IListReactionsRequest, - protos.google.chat.v1.IListReactionsResponse|null|undefined, - protos.google.chat.v1.IReaction>|undefined = callback + protos.google.chat.v1.IListSpaceEventsRequest, + protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, + protos.google.chat.v1.ISpaceEvent>|undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listReactions values %j', values); + this._log.info('listSpaceEvents values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('listReactions request %j', request); + this._log.info('listSpaceEvents request %j', request); return this.innerApiCalls - .listReactions(request, options, wrappedCallback) + .listSpaceEvents(request, options, wrappedCallback) ?.then(([response, input, output]: [ - protos.google.chat.v1.IReaction[], - protos.google.chat.v1.IListReactionsRequest|null, - protos.google.chat.v1.IListReactionsResponse + protos.google.chat.v1.ISpaceEvent[], + protos.google.chat.v1.IListSpaceEventsRequest|null, + protos.google.chat.v1.IListSpaceEventsResponse ]) => { - this._log.info('listReactions values %j', response); + this._log.info('listSpaceEvents values %j', response); return [response, input, output]; }); } /** - * Equivalent to `listReactions`, but returns a NodeJS Stream object. + * Equivalent to `listSpaceEvents`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The message users reacted to. + * Required. Resource name of the [Google Chat + * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) + * where the events occurred. * - * Format: `spaces/{space}/messages/{message}` + * Format: `spaces/{space}`. * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. (If resuming from a previous query.) + * Optional. The maximum number of space events returned. The service might + * return fewer than this value. * - * A page token received from a previous list reactions call. Provide this - * to retrieve the subsequent page. + * Negative values return an `INVALID_ARGUMENT` error. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous list space events 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. - * @param {string} [request.filter] - * Optional. A query filter. + * When paginating, all other parameters provided to list space events must + * match the call that provided the page token. Passing different values to + * the other parameters might lead to unexpected results. + * @param {string} request.filter + * Required. 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`). + * You must specify at least one event type (`event_type`) + * using the has `:` operator. To filter by multiple event types, use the `OR` + * operator. Omit batch event types in your filter. The request automatically + * returns any related batch events. For example, if you filter by new + * reactions + * (`google.workspace.chat.reaction.v1.created`), the server also returns + * batch new reactions events + * (`google.workspace.chat.reaction.v1.batchCreated`). For a list of supported + * event types, see the [`SpaceEvents` reference + * documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type). * - * 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"`. + * Optionally, you can also filter by start time (`start_time`) and + * end time (`end_time`): * - * To filter reactions by emoji and user, use the `AND` operator, such as - * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. + * * `start_time`: Exclusive timestamp from which to start listing space + * events. + * You can list events that occurred up to 28 days ago. If unspecified, lists + * space events from the past 28 days. + * * `end_time`: Inclusive timestamp until which space events are listed. + * If unspecified, lists events up to the time of the request. * - * If your query uses both `AND` and `OR`, group them with parentheses. + * To specify a start or end time, use the equals `=` operator and format in + * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both + * `start_time` and `end_time`, use the `AND` operator. * * 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}" + * start_time="2023-08-23T19:20:33+00:00" AND + * end_time="2023-08-23T19:21:54+00:00" + * ``` + * ``` + * start_time="2023-08-23T19:20:33+00:00" AND + * (event_types:"google.workspace.chat.space.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created") * ``` * * The following queries are invalid: * * ``` - * 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}" + * start_time="2023-08-23T19:20:33+00:00" OR + * end_time="2023-08-23T19:21:54+00:00" + * ``` + * ``` + * event_types:"google.workspace.chat.space.v1.updated" AND + * event_types:"google.workspace.chat.message.v1.created" * ``` * - * Invalid queries are rejected with an `INVALID_ARGUMENT` error. + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.chat.v1.Reaction|Reaction} on 'data' event. + * An object stream which emits an object representing {@link protos.google.chat.v1.SpaceEvent|SpaceEvent} 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 `listReactionsAsync()` + * We recommend using `listSpaceEventsAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - listReactionsStream( - request?: protos.google.chat.v1.IListReactionsRequest, + listSpaceEventsStream( + request?: protos.google.chat.v1.IListSpaceEventsRequest, options?: CallOptions): Transform{ request = request || {}; @@ -6147,99 +7383,110 @@ export class ChatServiceClient { ] = this._gaxModule.routingHeader.fromParams({ 'parent': request.parent ?? '', }); - const defaultCallSettings = this._defaults['listReactions']; + const defaultCallSettings = this._defaults['listSpaceEvents']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listReactions stream %j', request); - return this.descriptors.page.listReactions.createStream( - this.innerApiCalls.listReactions as GaxCall, + this._log.info('listSpaceEvents stream %j', request); + return this.descriptors.page.listSpaceEvents.createStream( + this.innerApiCalls.listSpaceEvents as GaxCall, request, callSettings ); } /** - * Equivalent to `listReactions`, but returns an iterable object. + * Equivalent to `listSpaceEvents`, but returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The message users reacted to. + * Required. Resource name of the [Google Chat + * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) + * where the events occurred. * - * Format: `spaces/{space}/messages/{message}` + * Format: `spaces/{space}`. * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. (If resuming from a previous query.) + * Optional. The maximum number of space events returned. The service might + * return fewer than this value. * - * A page token received from a previous list reactions call. Provide this - * to retrieve the subsequent page. + * Negative values return an `INVALID_ARGUMENT` error. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous list space events 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. - * @param {string} [request.filter] - * Optional. A query filter. + * When paginating, all other parameters provided to list space events must + * match the call that provided the page token. Passing different values to + * the other parameters might lead to unexpected results. + * @param {string} request.filter + * Required. 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`). + * You must specify at least one event type (`event_type`) + * using the has `:` operator. To filter by multiple event types, use the `OR` + * operator. Omit batch event types in your filter. The request automatically + * returns any related batch events. For example, if you filter by new + * reactions + * (`google.workspace.chat.reaction.v1.created`), the server also returns + * batch new reactions events + * (`google.workspace.chat.reaction.v1.batchCreated`). For a list of supported + * event types, see the [`SpaceEvents` reference + * documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type). * - * 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"`. + * Optionally, you can also filter by start time (`start_time`) and + * end time (`end_time`): * - * To filter reactions by emoji and user, use the `AND` operator, such as - * `emoji.unicode = "🙂" AND user.name = "users/AAAAAA"`. + * * `start_time`: Exclusive timestamp from which to start listing space + * events. + * You can list events that occurred up to 28 days ago. If unspecified, lists + * space events from the past 28 days. + * * `end_time`: Inclusive timestamp until which space events are listed. + * If unspecified, lists events up to the time of the request. * - * If your query uses both `AND` and `OR`, group them with parentheses. + * To specify a start or end time, use the equals `=` operator and format in + * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both + * `start_time` and `end_time`, use the `AND` operator. * * 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}" + * start_time="2023-08-23T19:20:33+00:00" AND + * end_time="2023-08-23T19:21:54+00:00" + * ``` + * ``` + * start_time="2023-08-23T19:20:33+00:00" AND + * (event_types:"google.workspace.chat.space.v1.updated" OR + * event_types:"google.workspace.chat.message.v1.created") * ``` * * The following queries are invalid: * * ``` - * 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}" + * start_time="2023-08-23T19:20:33+00:00" OR + * end_time="2023-08-23T19:21:54+00:00" + * ``` + * ``` + * event_types:"google.workspace.chat.space.v1.updated" AND + * event_types:"google.workspace.chat.message.v1.created" * ``` * - * Invalid queries are rejected with an `INVALID_ARGUMENT` error. + * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` + * error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.chat.v1.Reaction|Reaction}. The API will be called under the hood as needed, once per the page, + * {@link protos.google.chat.v1.SpaceEvent|SpaceEvent}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. - * @example include:samples/generated/v1/chat_service.list_reactions.js - * region_tag:chat_v1_generated_ChatService_ListReactions_async + * @example include:samples/generated/v1/chat_service.list_space_events.js + * region_tag:chat_v1_generated_ChatService_ListSpaceEvents_async */ - listReactionsAsync( - request?: protos.google.chat.v1.IListReactionsRequest, + listSpaceEventsAsync( + request?: protos.google.chat.v1.IListSpaceEventsRequest, options?: CallOptions): - AsyncIterable{ + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -6249,111 +7496,108 @@ export class ChatServiceClient { ] = this._gaxModule.routingHeader.fromParams({ 'parent': request.parent ?? '', }); - const defaultCallSettings = this._defaults['listReactions']; + const defaultCallSettings = this._defaults['listSpaceEvents']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listReactions iterate %j', request); - return this.descriptors.page.listReactions.asyncIterate( - this.innerApiCalls['listReactions'] as GaxCall, + this._log.info('listSpaceEvents iterate %j', request); + return this.descriptors.page.listSpaceEvents.asyncIterate( + this.innerApiCalls['listSpaceEvents'] as GaxCall, request as {}, callSettings - ) as AsyncIterable; + ) as AsyncIterable; } /** - * Lists custom emojis visible to the authenticated user. - * - * Custom emojis are only available for Google Workspace accounts, and the - * administrator must turn custom emojis on for the organization. For more - * information, see [Learn about custom emojis in Google - * Chat](https://support.google.com/chat/answer/12800149) and - * [Manage custom emoji - * permissions](https://support.google.com/a/answer/12850085). + * Lists sections available to the Chat user. Sections help users group their + * conversations and customize the list of spaces displayed in Chat + * navigation panel. For details, see [Create and organize sections in Google + * Chat](https://support.google.com/chat/answer/16059854). * * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - * with one of the following [authorization - * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): + * with the [authorization + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): * - * - `https://www.googleapis.com/auth/chat.customemojis.readonly` - * - `https://www.googleapis.com/auth/chat.customemojis` + * - `https://www.googleapis.com/auth/chat.users.sections` + * - `https://www.googleapis.com/auth/chat.users.sections.readonly` * * @param {Object} request * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of custom emojis returned. The service can - * return fewer custom emojis than this value. If unspecified, the default - * value is 25. The maximum value is 200; values above 200 are changed to 200. - * @param {string} [request.pageToken] - * Optional. (If resuming from a previous query.) + * @param {string} request.parent + * Required. The parent, which is the user resource name that owns this + * collection of sections. Only supports listing sections for the calling + * user. To refer to the calling user, set one of the following: * - * A page token received from a previous list custom emoji call. Provide this - * to retrieve the subsequent page. + * - The `me` alias. For example, `users/me`. * - * When paginating, the filter value should match the call that provided the - * page token. Passing a different value might lead to unexpected results. - * @param {string} [request.filter] - * Optional. A query filter. + * - Their Workspace email address. For example, `users/user@example.com`. * - * Supports filtering by creator. + * - Their user id. For example, `users/123456789`. * - * To filter by creator, you must specify a valid value. Currently only - * `creator("users/me")` and `NOT creator("users/me")` are accepted to filter - * custom emojis by whether they were created by the calling user or not. + * Format: `users/{user}` + * @param {number} [request.pageSize] + * Optional. The maximum number of sections to return. The service may return + * fewer than this value. * - * For example, the following query returns custom emojis created by the - * caller: - * ``` - * creator("users/me") - * ``` + * If unspecified, at most 10 sections will be returned. * - * Invalid queries are rejected with an `INVALID_ARGUMENT` error. + * The maximum value is 100. If you use a value more than 100, it's + * automatically changed to 100. + * + * Negative values return an `INVALID_ARGUMENT` error. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous list sections call. + * Provide this 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. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.chat.v1.CustomEmoji|CustomEmoji}. + * The first element of the array is Array of {@link protos.google.chat.v1.Section|Section}. * 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 `listCustomEmojisAsync()` + * We recommend using `listSectionsAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - listCustomEmojis( - request?: protos.google.chat.v1.IListCustomEmojisRequest, + listSections( + request?: protos.google.chat.v1.IListSectionsRequest, options?: CallOptions): Promise<[ - protos.google.chat.v1.ICustomEmoji[], - protos.google.chat.v1.IListCustomEmojisRequest|null, - protos.google.chat.v1.IListCustomEmojisResponse + protos.google.chat.v1.ISection[], + protos.google.chat.v1.IListSectionsRequest|null, + protos.google.chat.v1.IListSectionsResponse ]>; - listCustomEmojis( - request: protos.google.chat.v1.IListCustomEmojisRequest, + listSections( + request: protos.google.chat.v1.IListSectionsRequest, options: CallOptions, callback: PaginationCallback< - protos.google.chat.v1.IListCustomEmojisRequest, - protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, - protos.google.chat.v1.ICustomEmoji>): void; - listCustomEmojis( - request: protos.google.chat.v1.IListCustomEmojisRequest, + protos.google.chat.v1.IListSectionsRequest, + protos.google.chat.v1.IListSectionsResponse|null|undefined, + protos.google.chat.v1.ISection>): void; + listSections( + request: protos.google.chat.v1.IListSectionsRequest, callback: PaginationCallback< - protos.google.chat.v1.IListCustomEmojisRequest, - protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, - protos.google.chat.v1.ICustomEmoji>): void; - listCustomEmojis( - request?: protos.google.chat.v1.IListCustomEmojisRequest, + protos.google.chat.v1.IListSectionsRequest, + protos.google.chat.v1.IListSectionsResponse|null|undefined, + protos.google.chat.v1.ISection>): void; + listSections( + request?: protos.google.chat.v1.IListSectionsRequest, optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.chat.v1.IListCustomEmojisRequest, - protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, - protos.google.chat.v1.ICustomEmoji>, + protos.google.chat.v1.IListSectionsRequest, + protos.google.chat.v1.IListSectionsResponse|null|undefined, + protos.google.chat.v1.ISection>, callback?: PaginationCallback< - protos.google.chat.v1.IListCustomEmojisRequest, - protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, - protos.google.chat.v1.ICustomEmoji>): + protos.google.chat.v1.IListSectionsRequest, + protos.google.chat.v1.IListSectionsResponse|null|undefined, + protos.google.chat.v1.ISection>): Promise<[ - protos.google.chat.v1.ICustomEmoji[], - protos.google.chat.v1.IListCustomEmojisRequest|null, - protos.google.chat.v1.IListCustomEmojisResponse + protos.google.chat.v1.ISection[], + protos.google.chat.v1.IListSectionsRequest|null, + protos.google.chat.v1.IListSectionsResponse ]>|void { request = request || {}; let options: CallOptions; @@ -6367,318 +7611,269 @@ export class ChatServiceClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); this.initialize().catch(err => {throw err}); const wrappedCallback: PaginationCallback< - protos.google.chat.v1.IListCustomEmojisRequest, - protos.google.chat.v1.IListCustomEmojisResponse|null|undefined, - protos.google.chat.v1.ICustomEmoji>|undefined = callback + protos.google.chat.v1.IListSectionsRequest, + protos.google.chat.v1.IListSectionsResponse|null|undefined, + protos.google.chat.v1.ISection>|undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listCustomEmojis values %j', values); + this._log.info('listSections values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('listCustomEmojis request %j', request); + this._log.info('listSections request %j', request); return this.innerApiCalls - .listCustomEmojis(request, options, wrappedCallback) + .listSections(request, options, wrappedCallback) ?.then(([response, input, output]: [ - protos.google.chat.v1.ICustomEmoji[], - protos.google.chat.v1.IListCustomEmojisRequest|null, - protos.google.chat.v1.IListCustomEmojisResponse + protos.google.chat.v1.ISection[], + protos.google.chat.v1.IListSectionsRequest|null, + protos.google.chat.v1.IListSectionsResponse ]) => { - this._log.info('listCustomEmojis values %j', response); + this._log.info('listSections values %j', response); return [response, input, output]; }); } /** - * Equivalent to `listCustomEmojis`, but returns a NodeJS Stream object. + * Equivalent to `listSections`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of custom emojis returned. The service can - * return fewer custom emojis than this value. If unspecified, the default - * value is 25. The maximum value is 200; values above 200 are changed to 200. - * @param {string} [request.pageToken] - * Optional. (If resuming from a previous query.) + * @param {string} request.parent + * Required. The parent, which is the user resource name that owns this + * collection of sections. Only supports listing sections for the calling + * user. To refer to the calling user, set one of the following: * - * A page token received from a previous list custom emoji call. Provide this - * to retrieve the subsequent page. + * - The `me` alias. For example, `users/me`. * - * When paginating, the filter value should match the call that provided the - * page token. Passing a different value might lead to unexpected results. - * @param {string} [request.filter] - * Optional. A query filter. + * - Their Workspace email address. For example, `users/user@example.com`. * - * Supports filtering by creator. + * - Their user id. For example, `users/123456789`. * - * To filter by creator, you must specify a valid value. Currently only - * `creator("users/me")` and `NOT creator("users/me")` are accepted to filter - * custom emojis by whether they were created by the calling user or not. + * Format: `users/{user}` + * @param {number} [request.pageSize] + * Optional. The maximum number of sections to return. The service may return + * fewer than this value. * - * For example, the following query returns custom emojis created by the - * caller: - * ``` - * creator("users/me") - * ``` + * If unspecified, at most 10 sections will be returned. * - * Invalid queries are rejected with an `INVALID_ARGUMENT` error. + * The maximum value is 100. If you use a value more than 100, it's + * automatically changed to 100. + * + * Negative values return an `INVALID_ARGUMENT` error. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous list sections call. + * Provide this 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. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.chat.v1.CustomEmoji|CustomEmoji} on 'data' event. + * An object stream which emits an object representing {@link protos.google.chat.v1.Section|Section} 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 `listCustomEmojisAsync()` + * We recommend using `listSectionsAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - listCustomEmojisStream( - request?: protos.google.chat.v1.IListCustomEmojisRequest, + listSectionsStream( + request?: protos.google.chat.v1.IListSectionsRequest, options?: CallOptions): Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listCustomEmojis']; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSections']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listCustomEmojis stream %j', request); - return this.descriptors.page.listCustomEmojis.createStream( - this.innerApiCalls.listCustomEmojis as GaxCall, + this._log.info('listSections stream %j', request); + return this.descriptors.page.listSections.createStream( + this.innerApiCalls.listSections as GaxCall, request, callSettings ); } /** - * Equivalent to `listCustomEmojis`, but returns an iterable object. + * Equivalent to `listSections`, but returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of custom emojis returned. The service can - * return fewer custom emojis than this value. If unspecified, the default - * value is 25. The maximum value is 200; values above 200 are changed to 200. - * @param {string} [request.pageToken] - * Optional. (If resuming from a previous query.) + * @param {string} request.parent + * Required. The parent, which is the user resource name that owns this + * collection of sections. Only supports listing sections for the calling + * user. To refer to the calling user, set one of the following: * - * A page token received from a previous list custom emoji call. Provide this - * to retrieve the subsequent page. + * - The `me` alias. For example, `users/me`. * - * When paginating, the filter value should match the call that provided the - * page token. Passing a different value might lead to unexpected results. - * @param {string} [request.filter] - * Optional. A query filter. + * - Their Workspace email address. For example, `users/user@example.com`. * - * Supports filtering by creator. + * - Their user id. For example, `users/123456789`. * - * To filter by creator, you must specify a valid value. Currently only - * `creator("users/me")` and `NOT creator("users/me")` are accepted to filter - * custom emojis by whether they were created by the calling user or not. + * Format: `users/{user}` + * @param {number} [request.pageSize] + * Optional. The maximum number of sections to return. The service may return + * fewer than this value. * - * For example, the following query returns custom emojis created by the - * caller: - * ``` - * creator("users/me") - * ``` + * If unspecified, at most 10 sections will be returned. * - * Invalid queries are rejected with an `INVALID_ARGUMENT` error. + * The maximum value is 100. If you use a value more than 100, it's + * automatically changed to 100. + * + * Negative values return an `INVALID_ARGUMENT` error. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous list sections call. + * Provide this 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. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.chat.v1.CustomEmoji|CustomEmoji}. The API will be called under the hood as needed, once per the page, + * {@link protos.google.chat.v1.Section|Section}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. - * @example include:samples/generated/v1/chat_service.list_custom_emojis.js - * region_tag:chat_v1_generated_ChatService_ListCustomEmojis_async + * @example include:samples/generated/v1/chat_service.list_sections.js + * region_tag:chat_v1_generated_ChatService_ListSections_async */ - listCustomEmojisAsync( - request?: protos.google.chat.v1.IListCustomEmojisRequest, + listSectionsAsync( + request?: protos.google.chat.v1.IListSectionsRequest, options?: CallOptions): - AsyncIterable{ + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listCustomEmojis']; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSections']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listCustomEmojis iterate %j', request); - return this.descriptors.page.listCustomEmojis.asyncIterate( - this.innerApiCalls['listCustomEmojis'] as GaxCall, + this._log.info('listSections iterate %j', request); + return this.descriptors.page.listSections.asyncIterate( + this.innerApiCalls['listSections'] as GaxCall, request as {}, callSettings - ) as AsyncIterable; + ) as AsyncIterable; } /** - * Lists events from a Google Chat space. For each event, the - * [payload](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.oneof_payload) - * contains the most recent version of the Chat resource. For example, if you - * list events about new space members, the server returns `Membership` - * resources that contain the latest membership details. If new members were - * removed during the requested period, the event payload contains an empty - * `Membership` resource. - * - * Supports the following types of - * [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) - * with an - * [authorization - * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes) - * appropriate for reading the requested data: + * Lists items in a section. * - * - [App - * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) - * with [administrator - * approval](https://support.google.com/a?p=chat-app-auth) in - * [Developer Preview](https://developers.google.com/workspace/preview) - * with one of the following authorization scopes: - * - `https://www.googleapis.com/auth/chat.app.spaces` - * - `https://www.googleapis.com/auth/chat.app.messages.readonly` - * - `https://www.googleapis.com/auth/chat.app.memberships` + * Only spaces can be section items. For details, see [Create and organize + * sections in Google Chat](https://support.google.com/chat/answer/16059854). * - * - [User + * Requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) - * with one of the following authorization scopes: - * - `https://www.googleapis.com/auth/chat.spaces.readonly` - * - `https://www.googleapis.com/auth/chat.spaces` - * - `https://www.googleapis.com/auth/chat.messages.readonly` - * - `https://www.googleapis.com/auth/chat.messages` - * - `https://www.googleapis.com/auth/chat.messages.reactions.readonly` - * - `https://www.googleapis.com/auth/chat.messages.reactions` - * - `https://www.googleapis.com/auth/chat.memberships.readonly` - * - `https://www.googleapis.com/auth/chat.memberships` - * - * To list events, the authenticated caller must be a member of the space. + * with the [authorization + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes): * - * For an example, see [List events from a Google Chat - * space](https://developers.google.com/workspace/chat/list-space-events). + * - `https://www.googleapis.com/auth/chat.users.sections` + * - `https://www.googleapis.com/auth/chat.users.sections.readonly` * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. Resource name of the [Google Chat - * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) - * where the events occurred. + * Required. The parent, which is the section resource name that owns this + * collection of section items. Only supports listing section items for the + * calling user. * - * Format: `spaces/{space}`. + * When you're filtering by space, use the wildcard `-` to search across all + * sections. For example, `users/{user}/sections/-`. + * + * Format: `users/{user}/sections/{section}` * @param {number} [request.pageSize] - * Optional. The maximum number of space events returned. The service might + * Optional. The maximum number of section items to return. The service may * return fewer than this value. * + * If unspecified, at most 10 section items will be returned. + * + * The maximum value is 100. If you use a value more than 100, it's + * automatically changed to 100. + * * Negative values return an `INVALID_ARGUMENT` error. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous list space events call. + * Optional. A page token, received from a previous list section items call. * Provide this to retrieve the subsequent page. * - * When paginating, all other parameters provided to list space events must - * match the call that provided the page token. Passing different values to - * the other parameters might lead to unexpected results. - * @param {string} request.filter - * Required. A query filter. - * - * You must specify at least one event type (`event_type`) - * using the has `:` operator. To filter by multiple event types, use the `OR` - * operator. Omit batch event types in your filter. The request automatically - * returns any related batch events. For example, if you filter by new - * reactions - * (`google.workspace.chat.reaction.v1.created`), the server also returns - * batch new reactions events - * (`google.workspace.chat.reaction.v1.batchCreated`). For a list of supported - * event types, see the [`SpaceEvents` reference - * documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type). - * - * Optionally, you can also filter by start time (`start_time`) and - * end time (`end_time`): - * - * * `start_time`: Exclusive timestamp from which to start listing space - * events. - * You can list events that occurred up to 28 days ago. If unspecified, lists - * space events from the past 28 days. - * * `end_time`: Inclusive timestamp until which space events are listed. - * If unspecified, lists events up to the time of the request. - * - * To specify a start or end time, use the equals `=` operator and format in - * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both - * `start_time` and `end_time`, use the `AND` operator. - * - * For example, the following queries are valid: - * - * ``` - * start_time="2023-08-23T19:20:33+00:00" AND - * end_time="2023-08-23T19:21:54+00:00" - * ``` - * ``` - * start_time="2023-08-23T19:20:33+00:00" AND - * (event_types:"google.workspace.chat.space.v1.updated" OR - * event_types:"google.workspace.chat.message.v1.created") - * ``` + * 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. + * @param {string} [request.filter] + * Optional. A query filter. * - * The following queries are invalid: + * Currently only supports filtering by space. * - * ``` - * start_time="2023-08-23T19:20:33+00:00" OR - * end_time="2023-08-23T19:21:54+00:00" - * ``` - * ``` - * event_types:"google.workspace.chat.space.v1.updated" AND - * event_types:"google.workspace.chat.message.v1.created" - * ``` + * For example, `space = spaces/{space}`. * - * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` - * error. + * Invalid queries are rejected with an `INVALID_ARGUMENT` error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.chat.v1.SpaceEvent|SpaceEvent}. + * The first element of the array is Array of {@link protos.google.chat.v1.SectionItem|SectionItem}. * 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 `listSpaceEventsAsync()` + * We recommend using `listSectionItemsAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - listSpaceEvents( - request?: protos.google.chat.v1.IListSpaceEventsRequest, + listSectionItems( + request?: protos.google.chat.v1.IListSectionItemsRequest, options?: CallOptions): Promise<[ - protos.google.chat.v1.ISpaceEvent[], - protos.google.chat.v1.IListSpaceEventsRequest|null, - protos.google.chat.v1.IListSpaceEventsResponse + protos.google.chat.v1.ISectionItem[], + protos.google.chat.v1.IListSectionItemsRequest|null, + protos.google.chat.v1.IListSectionItemsResponse ]>; - listSpaceEvents( - request: protos.google.chat.v1.IListSpaceEventsRequest, + listSectionItems( + request: protos.google.chat.v1.IListSectionItemsRequest, options: CallOptions, callback: PaginationCallback< - protos.google.chat.v1.IListSpaceEventsRequest, - protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, - protos.google.chat.v1.ISpaceEvent>): void; - listSpaceEvents( - request: protos.google.chat.v1.IListSpaceEventsRequest, + protos.google.chat.v1.IListSectionItemsRequest, + protos.google.chat.v1.IListSectionItemsResponse|null|undefined, + protos.google.chat.v1.ISectionItem>): void; + listSectionItems( + request: protos.google.chat.v1.IListSectionItemsRequest, callback: PaginationCallback< - protos.google.chat.v1.IListSpaceEventsRequest, - protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, - protos.google.chat.v1.ISpaceEvent>): void; - listSpaceEvents( - request?: protos.google.chat.v1.IListSpaceEventsRequest, + protos.google.chat.v1.IListSectionItemsRequest, + protos.google.chat.v1.IListSectionItemsResponse|null|undefined, + protos.google.chat.v1.ISectionItem>): void; + listSectionItems( + request?: protos.google.chat.v1.IListSectionItemsRequest, optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.chat.v1.IListSpaceEventsRequest, - protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, - protos.google.chat.v1.ISpaceEvent>, + protos.google.chat.v1.IListSectionItemsRequest, + protos.google.chat.v1.IListSectionItemsResponse|null|undefined, + protos.google.chat.v1.ISectionItem>, callback?: PaginationCallback< - protos.google.chat.v1.IListSpaceEventsRequest, - protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, - protos.google.chat.v1.ISpaceEvent>): + protos.google.chat.v1.IListSectionItemsRequest, + protos.google.chat.v1.IListSectionItemsResponse|null|undefined, + protos.google.chat.v1.ISectionItem>): Promise<[ - protos.google.chat.v1.ISpaceEvent[], - protos.google.chat.v1.IListSpaceEventsRequest|null, - protos.google.chat.v1.IListSpaceEventsResponse + protos.google.chat.v1.ISectionItem[], + protos.google.chat.v1.IListSectionItemsRequest|null, + protos.google.chat.v1.IListSectionItemsResponse ]>|void { request = request || {}; let options: CallOptions; @@ -6699,115 +7894,78 @@ export class ChatServiceClient { }); this.initialize().catch(err => {throw err}); const wrappedCallback: PaginationCallback< - protos.google.chat.v1.IListSpaceEventsRequest, - protos.google.chat.v1.IListSpaceEventsResponse|null|undefined, - protos.google.chat.v1.ISpaceEvent>|undefined = callback + protos.google.chat.v1.IListSectionItemsRequest, + protos.google.chat.v1.IListSectionItemsResponse|null|undefined, + protos.google.chat.v1.ISectionItem>|undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSpaceEvents values %j', values); + this._log.info('listSectionItems values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; - this._log.info('listSpaceEvents request %j', request); + this._log.info('listSectionItems request %j', request); return this.innerApiCalls - .listSpaceEvents(request, options, wrappedCallback) + .listSectionItems(request, options, wrappedCallback) ?.then(([response, input, output]: [ - protos.google.chat.v1.ISpaceEvent[], - protos.google.chat.v1.IListSpaceEventsRequest|null, - protos.google.chat.v1.IListSpaceEventsResponse + protos.google.chat.v1.ISectionItem[], + protos.google.chat.v1.IListSectionItemsRequest|null, + protos.google.chat.v1.IListSectionItemsResponse ]) => { - this._log.info('listSpaceEvents values %j', response); + this._log.info('listSectionItems values %j', response); return [response, input, output]; }); } /** - * Equivalent to `listSpaceEvents`, but returns a NodeJS Stream object. + * Equivalent to `listSectionItems`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. Resource name of the [Google Chat - * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) - * where the events occurred. + * Required. The parent, which is the section resource name that owns this + * collection of section items. Only supports listing section items for the + * calling user. * - * Format: `spaces/{space}`. + * When you're filtering by space, use the wildcard `-` to search across all + * sections. For example, `users/{user}/sections/-`. + * + * Format: `users/{user}/sections/{section}` * @param {number} [request.pageSize] - * Optional. The maximum number of space events returned. The service might + * Optional. The maximum number of section items to return. The service may * return fewer than this value. * + * If unspecified, at most 10 section items will be returned. + * + * The maximum value is 100. If you use a value more than 100, it's + * automatically changed to 100. + * * Negative values return an `INVALID_ARGUMENT` error. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous list space events call. + * Optional. A page token, received from a previous list section items call. * Provide this to retrieve the subsequent page. * - * When paginating, all other parameters provided to list space events must - * match the call that provided the page token. Passing different values to - * the other parameters might lead to unexpected results. - * @param {string} request.filter - * Required. A query filter. - * - * You must specify at least one event type (`event_type`) - * using the has `:` operator. To filter by multiple event types, use the `OR` - * operator. Omit batch event types in your filter. The request automatically - * returns any related batch events. For example, if you filter by new - * reactions - * (`google.workspace.chat.reaction.v1.created`), the server also returns - * batch new reactions events - * (`google.workspace.chat.reaction.v1.batchCreated`). For a list of supported - * event types, see the [`SpaceEvents` reference - * documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type). - * - * Optionally, you can also filter by start time (`start_time`) and - * end time (`end_time`): - * - * * `start_time`: Exclusive timestamp from which to start listing space - * events. - * You can list events that occurred up to 28 days ago. If unspecified, lists - * space events from the past 28 days. - * * `end_time`: Inclusive timestamp until which space events are listed. - * If unspecified, lists events up to the time of the request. - * - * To specify a start or end time, use the equals `=` operator and format in - * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both - * `start_time` and `end_time`, use the `AND` operator. - * - * For example, the following queries are valid: - * - * ``` - * start_time="2023-08-23T19:20:33+00:00" AND - * end_time="2023-08-23T19:21:54+00:00" - * ``` - * ``` - * start_time="2023-08-23T19:20:33+00:00" AND - * (event_types:"google.workspace.chat.space.v1.updated" OR - * event_types:"google.workspace.chat.message.v1.created") - * ``` + * 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. + * @param {string} [request.filter] + * Optional. A query filter. * - * The following queries are invalid: + * Currently only supports filtering by space. * - * ``` - * start_time="2023-08-23T19:20:33+00:00" OR - * end_time="2023-08-23T19:21:54+00:00" - * ``` - * ``` - * event_types:"google.workspace.chat.space.v1.updated" AND - * event_types:"google.workspace.chat.message.v1.created" - * ``` + * For example, `space = spaces/{space}`. * - * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` - * error. + * Invalid queries are rejected with an `INVALID_ARGUMENT` error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.chat.v1.SpaceEvent|SpaceEvent} on 'data' event. + * An object stream which emits an object representing {@link protos.google.chat.v1.SectionItem|SectionItem} 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 `listSpaceEventsAsync()` + * We recommend using `listSectionItemsAsync()` * method described below for async iteration which you can stop as needed. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. */ - listSpaceEventsStream( - request?: protos.google.chat.v1.IListSpaceEventsRequest, + listSectionItemsStream( + request?: protos.google.chat.v1.IListSectionItemsRequest, options?: CallOptions): Transform{ request = request || {}; @@ -6819,110 +7977,73 @@ export class ChatServiceClient { ] = this._gaxModule.routingHeader.fromParams({ 'parent': request.parent ?? '', }); - const defaultCallSettings = this._defaults['listSpaceEvents']; + const defaultCallSettings = this._defaults['listSectionItems']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listSpaceEvents stream %j', request); - return this.descriptors.page.listSpaceEvents.createStream( - this.innerApiCalls.listSpaceEvents as GaxCall, + this._log.info('listSectionItems stream %j', request); + return this.descriptors.page.listSectionItems.createStream( + this.innerApiCalls.listSectionItems as GaxCall, request, callSettings ); } /** - * Equivalent to `listSpaceEvents`, but returns an iterable object. + * Equivalent to `listSectionItems`, but returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. Resource name of the [Google Chat - * space](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) - * where the events occurred. + * Required. The parent, which is the section resource name that owns this + * collection of section items. Only supports listing section items for the + * calling user. * - * Format: `spaces/{space}`. + * When you're filtering by space, use the wildcard `-` to search across all + * sections. For example, `users/{user}/sections/-`. + * + * Format: `users/{user}/sections/{section}` * @param {number} [request.pageSize] - * Optional. The maximum number of space events returned. The service might + * Optional. The maximum number of section items to return. The service may * return fewer than this value. * + * If unspecified, at most 10 section items will be returned. + * + * The maximum value is 100. If you use a value more than 100, it's + * automatically changed to 100. + * * Negative values return an `INVALID_ARGUMENT` error. * @param {string} [request.pageToken] - * Optional. A page token, received from a previous list space events call. + * Optional. A page token, received from a previous list section items call. * Provide this to retrieve the subsequent page. * - * When paginating, all other parameters provided to list space events must - * match the call that provided the page token. Passing different values to - * the other parameters might lead to unexpected results. - * @param {string} request.filter - * Required. A query filter. - * - * You must specify at least one event type (`event_type`) - * using the has `:` operator. To filter by multiple event types, use the `OR` - * operator. Omit batch event types in your filter. The request automatically - * returns any related batch events. For example, if you filter by new - * reactions - * (`google.workspace.chat.reaction.v1.created`), the server also returns - * batch new reactions events - * (`google.workspace.chat.reaction.v1.batchCreated`). For a list of supported - * event types, see the [`SpaceEvents` reference - * documentation](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.spaceEvents#SpaceEvent.FIELDS.event_type). - * - * Optionally, you can also filter by start time (`start_time`) and - * end time (`end_time`): - * - * * `start_time`: Exclusive timestamp from which to start listing space - * events. - * You can list events that occurred up to 28 days ago. If unspecified, lists - * space events from the past 28 days. - * * `end_time`: Inclusive timestamp until which space events are listed. - * If unspecified, lists events up to the time of the request. - * - * To specify a start or end time, use the equals `=` operator and format in - * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339). To filter by both - * `start_time` and `end_time`, use the `AND` operator. - * - * For example, the following queries are valid: - * - * ``` - * start_time="2023-08-23T19:20:33+00:00" AND - * end_time="2023-08-23T19:21:54+00:00" - * ``` - * ``` - * start_time="2023-08-23T19:20:33+00:00" AND - * (event_types:"google.workspace.chat.space.v1.updated" OR - * event_types:"google.workspace.chat.message.v1.created") - * ``` + * 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. + * @param {string} [request.filter] + * Optional. A query filter. * - * The following queries are invalid: + * Currently only supports filtering by space. * - * ``` - * start_time="2023-08-23T19:20:33+00:00" OR - * end_time="2023-08-23T19:21:54+00:00" - * ``` - * ``` - * event_types:"google.workspace.chat.space.v1.updated" AND - * event_types:"google.workspace.chat.message.v1.created" - * ``` + * For example, `space = spaces/{space}`. * - * Invalid queries are rejected by the server with an `INVALID_ARGUMENT` - * error. + * Invalid queries are rejected with an `INVALID_ARGUMENT` error. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.chat.v1.SpaceEvent|SpaceEvent}. The API will be called under the hood as needed, once per the page, + * {@link protos.google.chat.v1.SectionItem|SectionItem}. 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 {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } * for more details and examples. - * @example include:samples/generated/v1/chat_service.list_space_events.js - * region_tag:chat_v1_generated_ChatService_ListSpaceEvents_async + * @example include:samples/generated/v1/chat_service.list_section_items.js + * region_tag:chat_v1_generated_ChatService_ListSectionItems_async */ - listSpaceEventsAsync( - request?: protos.google.chat.v1.IListSpaceEventsRequest, + listSectionItemsAsync( + request?: protos.google.chat.v1.IListSectionItemsRequest, options?: CallOptions): - AsyncIterable{ + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -6932,15 +8053,15 @@ export class ChatServiceClient { ] = this._gaxModule.routingHeader.fromParams({ 'parent': request.parent ?? '', }); - const defaultCallSettings = this._defaults['listSpaceEvents']; + const defaultCallSettings = this._defaults['listSectionItems']; const callSettings = defaultCallSettings.merge(options); this.initialize().catch(err => {throw err}); - this._log.info('listSpaceEvents iterate %j', request); - return this.descriptors.page.listSpaceEvents.asyncIterate( - this.innerApiCalls['listSpaceEvents'] as GaxCall, + this._log.info('listSectionItems iterate %j', request); + return this.descriptors.page.listSectionItems.asyncIterate( + this.innerApiCalls['listSectionItems'] as GaxCall, request as {}, callSettings - ) as AsyncIterable; + ) as AsyncIterable; } // -------------------- // -- Path templates -- @@ -7188,6 +8309,91 @@ export class ChatServiceClient { return this.pathTemplates.reactionPathTemplate.match(reactionName).reaction; } + /** + * Return a fully-qualified section resource name string. + * + * @param {string} user + * @param {string} section + * @returns {string} Resource name string. + */ + sectionPath(user:string,section:string) { + return this.pathTemplates.sectionPathTemplate.render({ + user: user, + section: section, + }); + } + + /** + * Parse the user from Section resource. + * + * @param {string} sectionName + * A fully-qualified path representing Section resource. + * @returns {string} A string representing the user. + */ + matchUserFromSectionName(sectionName: string) { + return this.pathTemplates.sectionPathTemplate.match(sectionName).user; + } + + /** + * Parse the section from Section resource. + * + * @param {string} sectionName + * A fully-qualified path representing Section resource. + * @returns {string} A string representing the section. + */ + matchSectionFromSectionName(sectionName: string) { + return this.pathTemplates.sectionPathTemplate.match(sectionName).section; + } + + /** + * Return a fully-qualified sectionItem resource name string. + * + * @param {string} user + * @param {string} section + * @param {string} item + * @returns {string} Resource name string. + */ + sectionItemPath(user:string,section:string,item:string) { + return this.pathTemplates.sectionItemPathTemplate.render({ + user: user, + section: section, + item: item, + }); + } + + /** + * Parse the user from SectionItem resource. + * + * @param {string} sectionItemName + * A fully-qualified path representing SectionItem resource. + * @returns {string} A string representing the user. + */ + matchUserFromSectionItemName(sectionItemName: string) { + return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).user; + } + + /** + * Parse the section from SectionItem resource. + * + * @param {string} sectionItemName + * A fully-qualified path representing SectionItem resource. + * @returns {string} A string representing the section. + */ + matchSectionFromSectionItemName(sectionItemName: string) { + return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).section; + } + + /** + * Parse the item from SectionItem resource. + * + * @param {string} sectionItemName + * A fully-qualified path representing SectionItem resource. + * @returns {string} A string representing the item. + */ + matchItemFromSectionItemName(sectionItemName: string) { + return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).item; + } + /** * Return a fully-qualified space resource name string. * diff --git a/packages/google-chat/src/v1/chat_service_client_config.json b/packages/google-chat/src/v1/chat_service_client_config.json index 25fdd834f08..515728f70d9 100644 --- a/packages/google-chat/src/v1/chat_service_client_config.json +++ b/packages/google-chat/src/v1/chat_service_client_config.json @@ -206,6 +206,41 @@ "timeout_millis": 30000, "retry_codes_name": "unavailable", "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateSection": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteSection": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateSection": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListSections": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "PositionSection": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListSectionItems": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "MoveSectionItem": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" } } } diff --git a/packages/google-chat/src/v1/chat_service_proto_list.json b/packages/google-chat/src/v1/chat_service_proto_list.json index 47d96aad967..9326ee238a5 100644 --- a/packages/google-chat/src/v1/chat_service_proto_list.json +++ b/packages/google-chat/src/v1/chat_service_proto_list.json @@ -13,6 +13,7 @@ "../../protos/google/chat/v1/membership.proto", "../../protos/google/chat/v1/message.proto", "../../protos/google/chat/v1/reaction.proto", + "../../protos/google/chat/v1/section.proto", "../../protos/google/chat/v1/slash_command.proto", "../../protos/google/chat/v1/space.proto", "../../protos/google/chat/v1/space_event.proto", diff --git a/packages/google-chat/src/v1/gapic_metadata.json b/packages/google-chat/src/v1/gapic_metadata.json index 2118048515f..47c640fc0be 100644 --- a/packages/google-chat/src/v1/gapic_metadata.json +++ b/packages/google-chat/src/v1/gapic_metadata.json @@ -150,6 +150,31 @@ "updateSpaceNotificationSetting" ] }, + "CreateSection": { + "methods": [ + "createSection" + ] + }, + "DeleteSection": { + "methods": [ + "deleteSection" + ] + }, + "UpdateSection": { + "methods": [ + "updateSection" + ] + }, + "PositionSection": { + "methods": [ + "positionSection" + ] + }, + "MoveSectionItem": { + "methods": [ + "moveSectionItem" + ] + }, "ListMessages": { "methods": [ "listMessages", @@ -198,6 +223,20 @@ "listSpaceEventsStream", "listSpaceEventsAsync" ] + }, + "ListSections": { + "methods": [ + "listSections", + "listSectionsStream", + "listSectionsAsync" + ] + }, + "ListSectionItems": { + "methods": [ + "listSectionItems", + "listSectionItemsStream", + "listSectionItemsAsync" + ] } } }, @@ -344,6 +383,31 @@ "updateSpaceNotificationSetting" ] }, + "CreateSection": { + "methods": [ + "createSection" + ] + }, + "DeleteSection": { + "methods": [ + "deleteSection" + ] + }, + "UpdateSection": { + "methods": [ + "updateSection" + ] + }, + "PositionSection": { + "methods": [ + "positionSection" + ] + }, + "MoveSectionItem": { + "methods": [ + "moveSectionItem" + ] + }, "ListMessages": { "methods": [ "listMessages", @@ -392,6 +456,20 @@ "listSpaceEventsStream", "listSpaceEventsAsync" ] + }, + "ListSections": { + "methods": [ + "listSections", + "listSectionsStream", + "listSectionsAsync" + ] + }, + "ListSectionItems": { + "methods": [ + "listSectionItems", + "listSectionItemsStream", + "listSectionItemsAsync" + ] } } } diff --git a/packages/google-chat/system-test/install.ts b/packages/google-chat/system-test/install.ts index 394f3362d20..f66069aa394 100644 --- a/packages/google-chat/system-test/install.ts +++ b/packages/google-chat/system-test/install.ts @@ -40,7 +40,7 @@ describe('📦 pack-n-play test', () => { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() } }; await packNTest(options); diff --git a/packages/google-chat/test/gapic_chat_service_v1.ts b/packages/google-chat/test/gapic_chat_service_v1.ts index 52eafda33dd..d338c3a2876 100644 --- a/packages/google-chat/test/gapic_chat_service_v1.ts +++ b/packages/google-chat/test/gapic_chat_service_v1.ts @@ -3171,6 +3171,550 @@ describe('v1.ChatServiceClient', () => { }); }); + describe('createSection', () => { + it('invokes createSection without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.CreateSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.CreateSectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.chat.v1.Section() + ); + client.innerApiCalls.createSection = stubSimpleCall(expectedResponse); + const [response] = await client.createSection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSection without error using callback', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.CreateSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.CreateSectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.chat.v1.Section() + ); + client.innerApiCalls.createSection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSection( + request, + (err?: Error|null, result?: protos.google.chat.v1.ISection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSection with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.CreateSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.CreateSectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSection(request), expectedError); + const actualRequest = (client.innerApiCalls.createSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSection with closed client', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.CreateSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.CreateSectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch(err => {throw err}); + await assert.rejects(client.createSection(request), expectedError); + }); + }); + + describe('deleteSection', () => { + it('invokes deleteSection without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.DeleteSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.DeleteSectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSection = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSection without error using callback', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.DeleteSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.DeleteSectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSection( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSection with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.DeleteSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.DeleteSectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSection(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSection with closed client', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.DeleteSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.DeleteSectionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch(err => {throw err}); + await assert.rejects(client.deleteSection(request), expectedError); + }); + }); + + describe('updateSection', () => { + it('invokes updateSection without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.UpdateSectionRequest() + ); + request.section ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.UpdateSectionRequest', ['section', 'name']); + request.section.name = defaultValue1; + const expectedHeaderRequestParams = `section.name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.chat.v1.Section() + ); + client.innerApiCalls.updateSection = stubSimpleCall(expectedResponse); + const [response] = await client.updateSection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSection without error using callback', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.UpdateSectionRequest() + ); + request.section ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.UpdateSectionRequest', ['section', 'name']); + request.section.name = defaultValue1; + const expectedHeaderRequestParams = `section.name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.chat.v1.Section() + ); + client.innerApiCalls.updateSection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSection( + request, + (err?: Error|null, result?: protos.google.chat.v1.ISection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSection with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.UpdateSectionRequest() + ); + request.section ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.UpdateSectionRequest', ['section', 'name']); + request.section.name = defaultValue1; + const expectedHeaderRequestParams = `section.name=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSection(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSection with closed client', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.UpdateSectionRequest() + ); + request.section ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.UpdateSectionRequest', ['section', 'name']); + request.section.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch(err => {throw err}); + await assert.rejects(client.updateSection(request), expectedError); + }); + }); + + describe('positionSection', () => { + it('invokes positionSection without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.PositionSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.PositionSectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.chat.v1.PositionSectionResponse() + ); + client.innerApiCalls.positionSection = stubSimpleCall(expectedResponse); + const [response] = await client.positionSection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.positionSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.positionSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes positionSection without error using callback', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.PositionSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.PositionSectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.chat.v1.PositionSectionResponse() + ); + client.innerApiCalls.positionSection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.positionSection( + request, + (err?: Error|null, result?: protos.google.chat.v1.IPositionSectionResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.positionSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.positionSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes positionSection with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.PositionSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.PositionSectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.positionSection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.positionSection(request), expectedError); + const actualRequest = (client.innerApiCalls.positionSection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.positionSection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes positionSection with closed client', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.PositionSectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.PositionSectionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch(err => {throw err}); + await assert.rejects(client.positionSection(request), expectedError); + }); + }); + + describe('moveSectionItem', () => { + it('invokes moveSectionItem without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.MoveSectionItemRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.MoveSectionItemRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.chat.v1.MoveSectionItemResponse() + ); + client.innerApiCalls.moveSectionItem = stubSimpleCall(expectedResponse); + const [response] = await client.moveSectionItem(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveSectionItem as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveSectionItem as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveSectionItem without error using callback', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.MoveSectionItemRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.MoveSectionItemRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.chat.v1.MoveSectionItemResponse() + ); + client.innerApiCalls.moveSectionItem = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.moveSectionItem( + request, + (err?: Error|null, result?: protos.google.chat.v1.IMoveSectionItemResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.moveSectionItem as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveSectionItem as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveSectionItem with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.MoveSectionItemRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.MoveSectionItemRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.moveSectionItem = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.moveSectionItem(request), expectedError); + const actualRequest = (client.innerApiCalls.moveSectionItem as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.moveSectionItem as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes moveSectionItem with closed client', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.MoveSectionItemRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.MoveSectionItemRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch(err => {throw err}); + await assert.rejects(client.moveSectionItem(request), expectedError); + }); + }); + describe('listMessages', () => { it('invokes listMessages without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ @@ -3179,49 +3723,525 @@ describe('v1.ChatServiceClient', () => { }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMessagesRequest() + new protos.google.chat.v1.ListMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Message()), + ]; + client.innerApiCalls.listMessages = stubSimpleCall(expectedResponse); + const [response] = await client.listMessages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessages without error using callback', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Message()), + ]; + client.innerApiCalls.listMessages = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMessages( + request, + (err?: Error|null, result?: protos.google.chat.v1.IMessage[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessages with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMessages(request), expectedError); + const actualRequest = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessagesStream without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Message()), + ]; + client.descriptors.page.listMessages.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.chat.v1.Message[] = []; + stream.on('data', (response: protos.google.chat.v1.Message) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); + assert( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMessagesStream with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listMessages.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.chat.v1.Message[] = []; + stream.on('data', (response: protos.google.chat.v1.Message) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); + assert( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMessages without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Message()), + ]; + client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.IMessage[] = []; + const iterable = client.listMessagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMessages with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMessagesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMessagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.chat.v1.IMessage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMemberships', () => { + it('invokes listMemberships without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMembershipsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Message()), - generateSampleMessage(new protos.google.chat.v1.Message()), - generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + ]; + client.innerApiCalls.listMemberships = stubSimpleCall(expectedResponse); + const [response] = await client.listMemberships(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMemberships without error using callback', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + ]; + client.innerApiCalls.listMemberships = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMemberships( + request, + (err?: Error|null, result?: protos.google.chat.v1.IMembership[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMemberships with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMemberships = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMemberships(request), expectedError); + const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMembershipsStream without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + ]; + client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.chat.v1.Membership[] = []; + stream.on('data', (response: protos.google.chat.v1.Membership) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); + assert( + (client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMembershipsStream with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMembershipsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.chat.v1.Membership[] = []; + stream.on('data', (response: protos.google.chat.v1.Membership) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); + assert( + (client.descriptors.page.listMemberships.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMemberships without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Membership()), + ]; + client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.IMembership[] = []; + const iterable = client.listMembershipsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMemberships with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListMembershipsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMembershipsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.chat.v1.IMembership[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSpaces', () => { + it('invokes listSpaces without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.ListSpacesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), ]; - client.innerApiCalls.listMessages = stubSimpleCall(expectedResponse); - const [response] = await client.listMessages(request); + client.innerApiCalls.listSpaces = stubSimpleCall(expectedResponse); + const [response] = await client.listSpaces(request); assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listMessages without error using callback', async () => { + it('invokes listSpaces without error using callback', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMessagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Message()), - generateSampleMessage(new protos.google.chat.v1.Message()), - generateSampleMessage(new protos.google.chat.v1.Message()), + new protos.google.chat.v1.ListSpacesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), ]; - client.innerApiCalls.listMessages = stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.listSpaces = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listMessages( + client.listSpaces( request, - (err?: Error|null, result?: protos.google.chat.v1.IMessage[]|null) => { + (err?: Error|null, result?: protos.google.chat.v1.ISpace[]|null) => { if (err) { reject(err); } else { @@ -3231,61 +4251,41 @@ describe('v1.ChatServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listMessages with error', async () => { + it('invokes listSpaces with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMessagesRequest() + new protos.google.chat.v1.ListSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.innerApiCalls.listMessages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMessages(request), expectedError); - const actualRequest = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMessages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + client.innerApiCalls.listSpaces = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSpaces(request), expectedError); }); - it('invokes listMessagesStream without error', async () => { + it('invokes listSpacesStream without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMessagesRequest() + new protos.google.chat.v1.ListSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Message()), - generateSampleMessage(new protos.google.chat.v1.Message()), - generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), ]; - client.descriptors.page.listMessages.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMessagesStream(request); + client.descriptors.page.listSpaces.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSpacesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Message[] = []; - stream.on('data', (response: protos.google.chat.v1.Message) => { + const responses: protos.google.chat.v1.Space[] = []; + stream.on('data', (response: protos.google.chat.v1.Space) => { responses.push(response); }); stream.on('end', () => { @@ -3297,35 +4297,25 @@ describe('v1.ChatServiceClient', () => { }); const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); - assert( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + assert((client.descriptors.page.listSpaces.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpaces, request)); }); - it('invokes listMessagesStream with error', async () => { + it('invokes listSpacesStream with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMessagesRequest() + new protos.google.chat.v1.ListSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listMessages.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMessagesStream(request); + client.descriptors.page.listSpaces.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSpacesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Message[] = []; - stream.on('data', (response: protos.google.chat.v1.Message) => { + const responses: protos.google.chat.v1.Space[] = []; + stream.on('data', (response: protos.google.chat.v1.Space) => { responses.push(response); }); stream.on('end', () => { @@ -3336,137 +4326,97 @@ describe('v1.ChatServiceClient', () => { }); }); await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMessages, request)); - assert( - (client.descriptors.page.listMessages.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + assert((client.descriptors.page.listSpaces.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpaces, request)); }); - it('uses async iteration with listMessages without error', async () => { + it('uses async iteration with listSpaces without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMessagesRequest() + new protos.google.chat.v1.ListSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Message()), - generateSampleMessage(new protos.google.chat.v1.Message()), - generateSampleMessage(new protos.google.chat.v1.Message()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), ]; - client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.chat.v1.IMessage[] = []; - const iterable = client.listMessagesAsync(request); + client.descriptors.page.listSpaces.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.ISpace[] = []; + const iterable = client.listSpacesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) + (client.descriptors.page.listSpaces.asyncIterate as SinonStub) .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); }); - it('uses async iteration with listMessages with error', async () => { + it('uses async iteration with listSpaces with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMessagesRequest() + new protos.google.chat.v1.ListSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMessagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listMessages.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMessagesAsync(request); + client.descriptors.page.listSpaces.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSpacesAsync(request); await assert.rejects(async () => { - const responses: protos.google.chat.v1.IMessage[] = []; + const responses: protos.google.chat.v1.ISpace[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) + (client.descriptors.page.listSpaces.asyncIterate as SinonStub) .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMessages.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); }); }); - describe('listMemberships', () => { - it('invokes listMemberships without error', async () => { + describe('searchSpaces', () => { + it('invokes searchSpaces without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Membership()), - generateSampleMessage(new protos.google.chat.v1.Membership()), - generateSampleMessage(new protos.google.chat.v1.Membership()), + new protos.google.chat.v1.SearchSpacesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), ]; - client.innerApiCalls.listMemberships = stubSimpleCall(expectedResponse); - const [response] = await client.listMemberships(request); + client.innerApiCalls.searchSpaces = stubSimpleCall(expectedResponse); + const [response] = await client.searchSpaces(request); assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listMemberships without error using callback', async () => { + it('invokes searchSpaces without error using callback', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Membership()), - generateSampleMessage(new protos.google.chat.v1.Membership()), - generateSampleMessage(new protos.google.chat.v1.Membership()), + new protos.google.chat.v1.SearchSpacesRequest() + );const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), ]; - client.innerApiCalls.listMemberships = stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.searchSpaces = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listMemberships( + client.searchSpaces( request, - (err?: Error|null, result?: protos.google.chat.v1.IMembership[]|null) => { + (err?: Error|null, result?: protos.google.chat.v1.ISpace[]|null) => { if (err) { reject(err); } else { @@ -3476,61 +4426,41 @@ describe('v1.ChatServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listMemberships with error', async () => { + it('invokes searchSpaces with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMembershipsRequest() + new protos.google.chat.v1.SearchSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.innerApiCalls.listMemberships = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMemberships(request), expectedError); - const actualRequest = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMemberships as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + client.innerApiCalls.searchSpaces = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchSpaces(request), expectedError); }); - it('invokes listMembershipsStream without error', async () => { + it('invokes searchSpacesStream without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); - const request = generateSampleMessage( - new protos.google.chat.v1.ListMembershipsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const request = generateSampleMessage( + new protos.google.chat.v1.SearchSpacesRequest() + ); const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Membership()), - generateSampleMessage(new protos.google.chat.v1.Membership()), - generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), ]; - client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMembershipsStream(request); + client.descriptors.page.searchSpaces.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchSpacesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Membership[] = []; - stream.on('data', (response: protos.google.chat.v1.Membership) => { + const responses: protos.google.chat.v1.Space[] = []; + stream.on('data', (response: protos.google.chat.v1.Space) => { responses.push(response); }); stream.on('end', () => { @@ -3542,35 +4472,25 @@ describe('v1.ChatServiceClient', () => { }); const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); - assert( - (client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + assert((client.descriptors.page.searchSpaces.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchSpaces, request)); }); - it('invokes listMembershipsStream with error', async () => { + it('invokes searchSpacesStream with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMembershipsRequest() + new protos.google.chat.v1.SearchSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listMemberships.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMembershipsStream(request); + client.descriptors.page.searchSpaces.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchSpacesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Membership[] = []; - stream.on('data', (response: protos.google.chat.v1.Membership) => { + const responses: protos.google.chat.v1.Space[] = []; + stream.on('data', (response: protos.google.chat.v1.Space) => { responses.push(response); }); stream.on('end', () => { @@ -3581,123 +4501,111 @@ describe('v1.ChatServiceClient', () => { }); }); await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMemberships, request)); - assert( - (client.descriptors.page.listMemberships.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + assert((client.descriptors.page.searchSpaces.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchSpaces, request)); }); - it('uses async iteration with listMemberships without error', async () => { + it('uses async iteration with searchSpaces without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMembershipsRequest() + new protos.google.chat.v1.SearchSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Membership()), - generateSampleMessage(new protos.google.chat.v1.Membership()), - generateSampleMessage(new protos.google.chat.v1.Membership()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Space()), ]; - client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.chat.v1.IMembership[] = []; - const iterable = client.listMembershipsAsync(request); + client.descriptors.page.searchSpaces.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.ISpace[] = []; + const iterable = client.searchSpacesAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + (client.descriptors.page.searchSpaces.asyncIterate as SinonStub) .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); }); - it('uses async iteration with listMemberships with error', async () => { + it('uses async iteration with searchSpaces with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListMembershipsRequest() + new protos.google.chat.v1.SearchSpacesRequest() ); - const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListMembershipsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listMemberships.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMembershipsAsync(request); + client.descriptors.page.searchSpaces.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchSpacesAsync(request); await assert.rejects(async () => { - const responses: protos.google.chat.v1.IMembership[] = []; + const responses: protos.google.chat.v1.ISpace[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) + (client.descriptors.page.searchSpaces.asyncIterate as SinonStub) .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMemberships.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); }); }); - describe('listSpaces', () => { - it('invokes listSpaces without error', async () => { + describe('listReactions', () => { + it('invokes listReactions without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpacesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), + new protos.google.chat.v1.ListReactionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), ]; - client.innerApiCalls.listSpaces = stubSimpleCall(expectedResponse); - const [response] = await client.listSpaces(request); + client.innerApiCalls.listReactions = stubSimpleCall(expectedResponse); + const [response] = await client.listReactions(request); assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listReactions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReactions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listSpaces without error using callback', async () => { + it('invokes listReactions without error using callback', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpacesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), + new protos.google.chat.v1.ListReactionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), ]; - client.innerApiCalls.listSpaces = stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.listReactions = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listSpaces( + client.listReactions( request, - (err?: Error|null, result?: protos.google.chat.v1.ISpace[]|null) => { + (err?: Error|null, result?: protos.google.chat.v1.IReaction[]|null) => { if (err) { reject(err); } else { @@ -3707,41 +4615,61 @@ describe('v1.ChatServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listReactions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReactions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listSpaces with error', async () => { + it('invokes listReactions with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpacesRequest() + new protos.google.chat.v1.ListReactionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.innerApiCalls.listSpaces = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSpaces(request), expectedError); + client.innerApiCalls.listReactions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listReactions(request), expectedError); + const actualRequest = (client.innerApiCalls.listReactions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listReactions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listSpacesStream without error', async () => { + it('invokes listReactionsStream without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpacesRequest() + new protos.google.chat.v1.ListReactionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), ]; - client.descriptors.page.listSpaces.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSpacesStream(request); + client.descriptors.page.listReactions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listReactionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Space[] = []; - stream.on('data', (response: protos.google.chat.v1.Space) => { + const responses: protos.google.chat.v1.Reaction[] = []; + stream.on('data', (response: protos.google.chat.v1.Reaction) => { responses.push(response); }); stream.on('end', () => { @@ -3753,25 +4681,35 @@ describe('v1.ChatServiceClient', () => { }); const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSpaces.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpaces, request)); + assert((client.descriptors.page.listReactions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReactions, request)); + assert( + (client.descriptors.page.listReactions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); - it('invokes listSpacesStream with error', async () => { + it('invokes listReactionsStream with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpacesRequest() + new protos.google.chat.v1.ListReactionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listSpaces.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSpacesStream(request); + client.descriptors.page.listReactions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listReactionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Space[] = []; - stream.on('data', (response: protos.google.chat.v1.Space) => { + const responses: protos.google.chat.v1.Reaction[] = []; + stream.on('data', (response: protos.google.chat.v1.Reaction) => { responses.push(response); }); stream.on('end', () => { @@ -3782,97 +4720,123 @@ describe('v1.ChatServiceClient', () => { }); }); await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSpaces.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpaces, request)); + assert((client.descriptors.page.listReactions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listReactions, request)); + assert( + (client.descriptors.page.listReactions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); - it('uses async iteration with listSpaces without error', async () => { + it('uses async iteration with listReactions without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpacesRequest() + new protos.google.chat.v1.ListReactionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.Reaction()), ]; - client.descriptors.page.listSpaces.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.chat.v1.ISpace[] = []; - const iterable = client.listSpacesAsync(request); + client.descriptors.page.listReactions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.IReaction[] = []; + const iterable = client.listReactionsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listSpaces.asyncIterate as SinonStub) + (client.descriptors.page.listReactions.asyncIterate as SinonStub) .getCall(0).args[1], request); + assert( + (client.descriptors.page.listReactions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); - it('uses async iteration with listSpaces with error', async () => { + it('uses async iteration with listReactions with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpacesRequest() + new protos.google.chat.v1.ListReactionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listSpaces.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSpacesAsync(request); + client.descriptors.page.listReactions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listReactionsAsync(request); await assert.rejects(async () => { - const responses: protos.google.chat.v1.ISpace[] = []; + const responses: protos.google.chat.v1.IReaction[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listSpaces.asyncIterate as SinonStub) + (client.descriptors.page.listReactions.asyncIterate as SinonStub) .getCall(0).args[1], request); + assert( + (client.descriptors.page.listReactions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); }); - describe('searchSpaces', () => { - it('invokes searchSpaces without error', async () => { + describe('listCustomEmojis', () => { + it('invokes listCustomEmojis without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.SearchSpacesRequest() + new protos.google.chat.v1.ListCustomEmojisRequest() );const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), ]; - client.innerApiCalls.searchSpaces = stubSimpleCall(expectedResponse); - const [response] = await client.searchSpaces(request); + client.innerApiCalls.listCustomEmojis = stubSimpleCall(expectedResponse); + const [response] = await client.listCustomEmojis(request); assert.deepStrictEqual(response, expectedResponse); }); - it('invokes searchSpaces without error using callback', async () => { + it('invokes listCustomEmojis without error using callback', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.SearchSpacesRequest() + new protos.google.chat.v1.ListCustomEmojisRequest() );const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), ]; - client.innerApiCalls.searchSpaces = stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.listCustomEmojis = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.searchSpaces( + client.listCustomEmojis( request, - (err?: Error|null, result?: protos.google.chat.v1.ISpace[]|null) => { + (err?: Error|null, result?: protos.google.chat.v1.ICustomEmoji[]|null) => { if (err) { reject(err); } else { @@ -3884,39 +4848,39 @@ describe('v1.ChatServiceClient', () => { assert.deepStrictEqual(response, expectedResponse); }); - it('invokes searchSpaces with error', async () => { + it('invokes listCustomEmojis with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.SearchSpacesRequest() + new protos.google.chat.v1.ListCustomEmojisRequest() ); const expectedError = new Error('expected'); - client.innerApiCalls.searchSpaces = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchSpaces(request), expectedError); + client.innerApiCalls.listCustomEmojis = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCustomEmojis(request), expectedError); }); - it('invokes searchSpacesStream without error', async () => { + it('invokes listCustomEmojisStream without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.SearchSpacesRequest() + new protos.google.chat.v1.ListCustomEmojisRequest() ); const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), ]; - client.descriptors.page.searchSpaces.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchSpacesStream(request); + client.descriptors.page.listCustomEmojis.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCustomEmojisStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Space[] = []; - stream.on('data', (response: protos.google.chat.v1.Space) => { + const responses: protos.google.chat.v1.CustomEmoji[] = []; + stream.on('data', (response: protos.google.chat.v1.CustomEmoji) => { responses.push(response); }); stream.on('end', () => { @@ -3928,25 +4892,25 @@ describe('v1.ChatServiceClient', () => { }); const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchSpaces.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchSpaces, request)); + assert((client.descriptors.page.listCustomEmojis.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCustomEmojis, request)); }); - it('invokes searchSpacesStream with error', async () => { + it('invokes listCustomEmojisStream with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.SearchSpacesRequest() + new protos.google.chat.v1.ListCustomEmojisRequest() ); const expectedError = new Error('expected'); - client.descriptors.page.searchSpaces.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchSpacesStream(request); + client.descriptors.page.listCustomEmojis.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCustomEmojisStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Space[] = []; - stream.on('data', (response: protos.google.chat.v1.Space) => { + const responses: protos.google.chat.v1.CustomEmoji[] = []; + stream.on('data', (response: protos.google.chat.v1.CustomEmoji) => { responses.push(response); }); stream.on('end', () => { @@ -3957,111 +4921,111 @@ describe('v1.ChatServiceClient', () => { }); }); await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchSpaces.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchSpaces, request)); + assert((client.descriptors.page.listCustomEmojis.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCustomEmojis, request)); }); - it('uses async iteration with searchSpaces without error', async () => { + it('uses async iteration with listCustomEmojis without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.SearchSpacesRequest() + new protos.google.chat.v1.ListCustomEmojisRequest() ); const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), - generateSampleMessage(new protos.google.chat.v1.Space()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), ]; - client.descriptors.page.searchSpaces.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.chat.v1.ISpace[] = []; - const iterable = client.searchSpacesAsync(request); + client.descriptors.page.listCustomEmojis.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.ICustomEmoji[] = []; + const iterable = client.listCustomEmojisAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.searchSpaces.asyncIterate as SinonStub) + (client.descriptors.page.listCustomEmojis.asyncIterate as SinonStub) .getCall(0).args[1], request); }); - it('uses async iteration with searchSpaces with error', async () => { + it('uses async iteration with listCustomEmojis with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.SearchSpacesRequest() + new protos.google.chat.v1.ListCustomEmojisRequest() ); const expectedError = new Error('expected'); - client.descriptors.page.searchSpaces.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchSpacesAsync(request); + client.descriptors.page.listCustomEmojis.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCustomEmojisAsync(request); await assert.rejects(async () => { - const responses: protos.google.chat.v1.ISpace[] = []; + const responses: protos.google.chat.v1.ICustomEmoji[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.searchSpaces.asyncIterate as SinonStub) + (client.descriptors.page.listCustomEmojis.asyncIterate as SinonStub) .getCall(0).args[1], request); }); }); - describe('listReactions', () => { - it('invokes listReactions without error', async () => { + describe('listSpaceEvents', () => { + it('invokes listSpaceEvents without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListReactionsRequest() + new protos.google.chat.v1.ListSpaceEventsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Reaction()), - generateSampleMessage(new protos.google.chat.v1.Reaction()), - generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), ]; - client.innerApiCalls.listReactions = stubSimpleCall(expectedResponse); - const [response] = await client.listReactions(request); + client.innerApiCalls.listSpaceEvents = stubSimpleCall(expectedResponse); + const [response] = await client.listSpaceEvents(request); assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReactions as SinonStub) + const actualRequest = (client.innerApiCalls.listSpaceEvents as SinonStub) .getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReactions as SinonStub) + const actualHeaderRequestParams = (client.innerApiCalls.listSpaceEvents as SinonStub) .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listReactions without error using callback', async () => { + it('invokes listSpaceEvents without error using callback', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListReactionsRequest() + new protos.google.chat.v1.ListSpaceEventsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Reaction()), - generateSampleMessage(new protos.google.chat.v1.Reaction()), - generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), ]; - client.innerApiCalls.listReactions = stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.listSpaceEvents = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listReactions( + client.listSpaceEvents( request, - (err?: Error|null, result?: protos.google.chat.v1.IReaction[]|null) => { + (err?: Error|null, result?: protos.google.chat.v1.ISpaceEvent[]|null) => { if (err) { reject(err); } else { @@ -4071,61 +5035,61 @@ describe('v1.ChatServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReactions as SinonStub) + const actualRequest = (client.innerApiCalls.listSpaceEvents as SinonStub) .getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReactions as SinonStub) + const actualHeaderRequestParams = (client.innerApiCalls.listSpaceEvents as SinonStub) .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listReactions with error', async () => { + it('invokes listSpaceEvents with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListReactionsRequest() + new protos.google.chat.v1.ListSpaceEventsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.innerApiCalls.listReactions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listReactions(request), expectedError); - const actualRequest = (client.innerApiCalls.listReactions as SinonStub) + client.innerApiCalls.listSpaceEvents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSpaceEvents(request), expectedError); + const actualRequest = (client.innerApiCalls.listSpaceEvents as SinonStub) .getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReactions as SinonStub) + const actualHeaderRequestParams = (client.innerApiCalls.listSpaceEvents as SinonStub) .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listReactionsStream without error', async () => { + it('invokes listSpaceEventsStream without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListReactionsRequest() + new protos.google.chat.v1.ListSpaceEventsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Reaction()), - generateSampleMessage(new protos.google.chat.v1.Reaction()), - generateSampleMessage(new protos.google.chat.v1.Reaction()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), ]; - client.descriptors.page.listReactions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listReactionsStream(request); + client.descriptors.page.listSpaceEvents.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSpaceEventsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Reaction[] = []; - stream.on('data', (response: protos.google.chat.v1.Reaction) => { + const responses: protos.google.chat.v1.SpaceEvent[] = []; + stream.on('data', (response: protos.google.chat.v1.SpaceEvent) => { responses.push(response); }); stream.on('end', () => { @@ -4137,35 +5101,35 @@ describe('v1.ChatServiceClient', () => { }); const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listReactions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReactions, request)); + assert((client.descriptors.page.listSpaceEvents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpaceEvents, request)); assert( - (client.descriptors.page.listReactions.createStream as SinonStub) + (client.descriptors.page.listSpaceEvents.createStream as SinonStub) .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) ); }); - it('invokes listReactionsStream with error', async () => { + it('invokes listSpaceEventsStream with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListReactionsRequest() + new protos.google.chat.v1.ListSpaceEventsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listReactions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listReactionsStream(request); + client.descriptors.page.listSpaceEvents.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSpaceEventsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.Reaction[] = []; - stream.on('data', (response: protos.google.chat.v1.Reaction) => { + const responses: protos.google.chat.v1.SpaceEvent[] = []; + stream.on('data', (response: protos.google.chat.v1.SpaceEvent) => { responses.push(response); }); stream.on('end', () => { @@ -4176,79 +5140,79 @@ describe('v1.ChatServiceClient', () => { }); }); await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listReactions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReactions, request)); + assert((client.descriptors.page.listSpaceEvents.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpaceEvents, request)); assert( - (client.descriptors.page.listReactions.createStream as SinonStub) + (client.descriptors.page.listSpaceEvents.createStream as SinonStub) .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) ); }); - it('uses async iteration with listReactions without error', async () => { + it('uses async iteration with listSpaceEvents without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListReactionsRequest() + new protos.google.chat.v1.ListSpaceEventsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.Reaction()), - generateSampleMessage(new protos.google.chat.v1.Reaction()), - generateSampleMessage(new protos.google.chat.v1.Reaction()), - ]; - client.descriptors.page.listReactions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.chat.v1.IReaction[] = []; - const iterable = client.listReactionsAsync(request); + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + ]; + client.descriptors.page.listSpaceEvents.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.ISpaceEvent[] = []; + const iterable = client.listSpaceEventsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listReactions.asyncIterate as SinonStub) + (client.descriptors.page.listSpaceEvents.asyncIterate as SinonStub) .getCall(0).args[1], request); assert( - (client.descriptors.page.listReactions.asyncIterate as SinonStub) + (client.descriptors.page.listSpaceEvents.asyncIterate as SinonStub) .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) ); }); - it('uses async iteration with listReactions with error', async () => { + it('uses async iteration with listSpaceEvents with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListReactionsRequest() + new protos.google.chat.v1.ListSpaceEventsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListReactionsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listReactions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReactionsAsync(request); + client.descriptors.page.listSpaceEvents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSpaceEventsAsync(request); await assert.rejects(async () => { - const responses: protos.google.chat.v1.IReaction[] = []; + const responses: protos.google.chat.v1.ISpaceEvent[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listReactions.asyncIterate as SinonStub) + (client.descriptors.page.listSpaceEvents.asyncIterate as SinonStub) .getCall(0).args[1], request); assert( - (client.descriptors.page.listReactions.asyncIterate as SinonStub) + (client.descriptors.page.listSpaceEvents.asyncIterate as SinonStub) .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) @@ -4256,43 +5220,57 @@ describe('v1.ChatServiceClient', () => { }); }); - describe('listCustomEmojis', () => { - it('invokes listCustomEmojis without error', async () => { + describe('listSections', () => { + it('invokes listSections without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListCustomEmojisRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + new protos.google.chat.v1.ListSectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListSectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Section()), + generateSampleMessage(new protos.google.chat.v1.Section()), + generateSampleMessage(new protos.google.chat.v1.Section()), ]; - client.innerApiCalls.listCustomEmojis = stubSimpleCall(expectedResponse); - const [response] = await client.listCustomEmojis(request); + client.innerApiCalls.listSections = stubSimpleCall(expectedResponse); + const [response] = await client.listSections(request); assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listCustomEmojis without error using callback', async () => { + it('invokes listSections without error using callback', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListCustomEmojisRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + new protos.google.chat.v1.ListSectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListSectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.chat.v1.Section()), + generateSampleMessage(new protos.google.chat.v1.Section()), + generateSampleMessage(new protos.google.chat.v1.Section()), ]; - client.innerApiCalls.listCustomEmojis = stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.listSections = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listCustomEmojis( + client.listSections( request, - (err?: Error|null, result?: protos.google.chat.v1.ICustomEmoji[]|null) => { + (err?: Error|null, result?: protos.google.chat.v1.ISection[]|null) => { if (err) { reject(err); } else { @@ -4302,41 +5280,61 @@ describe('v1.ChatServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listCustomEmojis with error', async () => { + it('invokes listSections with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListCustomEmojisRequest() + new protos.google.chat.v1.ListSectionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListSectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.innerApiCalls.listCustomEmojis = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCustomEmojis(request), expectedError); + client.innerApiCalls.listSections = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSections(request), expectedError); + const actualRequest = (client.innerApiCalls.listSections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listCustomEmojisStream without error', async () => { + it('invokes listSectionsStream without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListCustomEmojisRequest() + new protos.google.chat.v1.ListSectionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListSectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.Section()), + generateSampleMessage(new protos.google.chat.v1.Section()), + generateSampleMessage(new protos.google.chat.v1.Section()), ]; - client.descriptors.page.listCustomEmojis.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCustomEmojisStream(request); + client.descriptors.page.listSections.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSectionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.CustomEmoji[] = []; - stream.on('data', (response: protos.google.chat.v1.CustomEmoji) => { + const responses: protos.google.chat.v1.Section[] = []; + stream.on('data', (response: protos.google.chat.v1.Section) => { responses.push(response); }); stream.on('end', () => { @@ -4348,25 +5346,35 @@ describe('v1.ChatServiceClient', () => { }); const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCustomEmojis.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCustomEmojis, request)); + assert((client.descriptors.page.listSections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSections, request)); + assert( + (client.descriptors.page.listSections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); - it('invokes listCustomEmojisStream with error', async () => { + it('invokes listSectionsStream with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListCustomEmojisRequest() + new protos.google.chat.v1.ListSectionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListSectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listCustomEmojis.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCustomEmojisStream(request); + client.descriptors.page.listSections.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSectionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.CustomEmoji[] = []; - stream.on('data', (response: protos.google.chat.v1.CustomEmoji) => { + const responses: protos.google.chat.v1.Section[] = []; + stream.on('data', (response: protos.google.chat.v1.Section) => { responses.push(response); }); stream.on('end', () => { @@ -4377,111 +5385,137 @@ describe('v1.ChatServiceClient', () => { }); }); await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCustomEmojis.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCustomEmojis, request)); + assert((client.descriptors.page.listSections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSections, request)); + assert( + (client.descriptors.page.listSections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); - it('uses async iteration with listCustomEmojis without error', async () => { + it('uses async iteration with listSections without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListCustomEmojisRequest() + new protos.google.chat.v1.ListSectionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListSectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), - generateSampleMessage(new protos.google.chat.v1.CustomEmoji()), + generateSampleMessage(new protos.google.chat.v1.Section()), + generateSampleMessage(new protos.google.chat.v1.Section()), + generateSampleMessage(new protos.google.chat.v1.Section()), ]; - client.descriptors.page.listCustomEmojis.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.chat.v1.ICustomEmoji[] = []; - const iterable = client.listCustomEmojisAsync(request); + client.descriptors.page.listSections.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.ISection[] = []; + const iterable = client.listSectionsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listCustomEmojis.asyncIterate as SinonStub) + (client.descriptors.page.listSections.asyncIterate as SinonStub) .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); - it('uses async iteration with listCustomEmojis with error', async () => { + it('uses async iteration with listSections with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListCustomEmojisRequest() + new protos.google.chat.v1.ListSectionsRequest() ); + const defaultValue1 = + getTypeDefaultValue('.google.chat.v1.ListSectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listCustomEmojis.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCustomEmojisAsync(request); + client.descriptors.page.listSections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSectionsAsync(request); await assert.rejects(async () => { - const responses: protos.google.chat.v1.ICustomEmoji[] = []; + const responses: protos.google.chat.v1.ISection[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listCustomEmojis.asyncIterate as SinonStub) + (client.descriptors.page.listSections.asyncIterate as SinonStub) .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); }); - describe('listSpaceEvents', () => { - it('invokes listSpaceEvents without error', async () => { + describe('listSectionItems', () => { + it('invokes listSectionItems without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpaceEventsRequest() + new protos.google.chat.v1.ListSectionItemsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSectionItemsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), ]; - client.innerApiCalls.listSpaceEvents = stubSimpleCall(expectedResponse); - const [response] = await client.listSpaceEvents(request); + client.innerApiCalls.listSectionItems = stubSimpleCall(expectedResponse); + const [response] = await client.listSectionItems(request); assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSpaceEvents as SinonStub) + const actualRequest = (client.innerApiCalls.listSectionItems as SinonStub) .getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpaceEvents as SinonStub) + const actualHeaderRequestParams = (client.innerApiCalls.listSectionItems as SinonStub) .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listSpaceEvents without error using callback', async () => { + it('invokes listSectionItems without error using callback', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpaceEventsRequest() + new protos.google.chat.v1.ListSectionItemsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSectionItemsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), ]; - client.innerApiCalls.listSpaceEvents = stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.listSectionItems = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listSpaceEvents( + client.listSectionItems( request, - (err?: Error|null, result?: protos.google.chat.v1.ISpaceEvent[]|null) => { + (err?: Error|null, result?: protos.google.chat.v1.ISectionItem[]|null) => { if (err) { reject(err); } else { @@ -4491,61 +5525,61 @@ describe('v1.ChatServiceClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSpaceEvents as SinonStub) + const actualRequest = (client.innerApiCalls.listSectionItems as SinonStub) .getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpaceEvents as SinonStub) + const actualHeaderRequestParams = (client.innerApiCalls.listSectionItems as SinonStub) .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listSpaceEvents with error', async () => { + it('invokes listSectionItems with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpaceEventsRequest() + new protos.google.chat.v1.ListSectionItemsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSectionItemsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.innerApiCalls.listSpaceEvents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSpaceEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.listSpaceEvents as SinonStub) + client.innerApiCalls.listSectionItems = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSectionItems(request), expectedError); + const actualRequest = (client.innerApiCalls.listSectionItems as SinonStub) .getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSpaceEvents as SinonStub) + const actualHeaderRequestParams = (client.innerApiCalls.listSectionItems as SinonStub) .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listSpaceEventsStream without error', async () => { + it('invokes listSectionItemsStream without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpaceEventsRequest() + new protos.google.chat.v1.ListSectionItemsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSectionItemsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), ]; - client.descriptors.page.listSpaceEvents.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSpaceEventsStream(request); + client.descriptors.page.listSectionItems.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSectionItemsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.SpaceEvent[] = []; - stream.on('data', (response: protos.google.chat.v1.SpaceEvent) => { + const responses: protos.google.chat.v1.SectionItem[] = []; + stream.on('data', (response: protos.google.chat.v1.SectionItem) => { responses.push(response); }); stream.on('end', () => { @@ -4557,35 +5591,35 @@ describe('v1.ChatServiceClient', () => { }); const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSpaceEvents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpaceEvents, request)); + assert((client.descriptors.page.listSectionItems.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSectionItems, request)); assert( - (client.descriptors.page.listSpaceEvents.createStream as SinonStub) + (client.descriptors.page.listSectionItems.createStream as SinonStub) .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) ); }); - it('invokes listSpaceEventsStream with error', async () => { + it('invokes listSectionItemsStream with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpaceEventsRequest() + new protos.google.chat.v1.ListSectionItemsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSectionItemsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listSpaceEvents.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSpaceEventsStream(request); + client.descriptors.page.listSectionItems.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSectionItemsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.chat.v1.SpaceEvent[] = []; - stream.on('data', (response: protos.google.chat.v1.SpaceEvent) => { + const responses: protos.google.chat.v1.SectionItem[] = []; + stream.on('data', (response: protos.google.chat.v1.SectionItem) => { responses.push(response); }); stream.on('end', () => { @@ -4596,79 +5630,79 @@ describe('v1.ChatServiceClient', () => { }); }); await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSpaceEvents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpaceEvents, request)); + assert((client.descriptors.page.listSectionItems.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSectionItems, request)); assert( - (client.descriptors.page.listSpaceEvents.createStream as SinonStub) + (client.descriptors.page.listSectionItems.createStream as SinonStub) .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) ); }); - it('uses async iteration with listSpaceEvents without error', async () => { + it('uses async iteration with listSectionItems without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpaceEventsRequest() + new protos.google.chat.v1.ListSectionItemsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSectionItemsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedResponse = [ - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), - generateSampleMessage(new protos.google.chat.v1.SpaceEvent()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), + generateSampleMessage(new protos.google.chat.v1.SectionItem()), ]; - client.descriptors.page.listSpaceEvents.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.chat.v1.ISpaceEvent[] = []; - const iterable = client.listSpaceEventsAsync(request); + client.descriptors.page.listSectionItems.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.chat.v1.ISectionItem[] = []; + const iterable = client.listSectionItemsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listSpaceEvents.asyncIterate as SinonStub) + (client.descriptors.page.listSectionItems.asyncIterate as SinonStub) .getCall(0).args[1], request); assert( - (client.descriptors.page.listSpaceEvents.asyncIterate as SinonStub) + (client.descriptors.page.listSectionItems.asyncIterate as SinonStub) .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) ); }); - it('uses async iteration with listSpaceEvents with error', async () => { + it('uses async iteration with listSectionItems with error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); await client.initialize(); const request = generateSampleMessage( - new protos.google.chat.v1.ListSpaceEventsRequest() + new protos.google.chat.v1.ListSectionItemsRequest() ); const defaultValue1 = - getTypeDefaultValue('.google.chat.v1.ListSpaceEventsRequest', ['parent']); + getTypeDefaultValue('.google.chat.v1.ListSectionItemsRequest', ['parent']); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; const expectedError = new Error('expected'); - client.descriptors.page.listSpaceEvents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSpaceEventsAsync(request); + client.descriptors.page.listSectionItems.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSectionItemsAsync(request); await assert.rejects(async () => { - const responses: protos.google.chat.v1.ISpaceEvent[] = []; + const responses: protos.google.chat.v1.ISectionItem[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listSpaceEvents.asyncIterate as SinonStub) + (client.descriptors.page.listSectionItems.asyncIterate as SinonStub) .getCall(0).args[1], request); assert( - (client.descriptors.page.listSpaceEvents.asyncIterate as SinonStub) + (client.descriptors.page.listSectionItems.asyncIterate as SinonStub) .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams ) @@ -4922,6 +5956,90 @@ describe('v1.ChatServiceClient', () => { }); }); + describe('section', async () => { + const fakePath = "/rendered/path/section"; + const expectedParameters = { + user: "userValue", + section: "sectionValue", + }; + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sectionPath', () => { + const result = client.sectionPath("userValue", "sectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromSectionName', () => { + const result = client.matchUserFromSectionName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.sectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSectionFromSectionName', () => { + const result = client.matchSectionFromSectionName(fakePath); + assert.strictEqual(result, "sectionValue"); + assert((client.pathTemplates.sectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sectionItem', async () => { + const fakePath = "/rendered/path/sectionItem"; + const expectedParameters = { + user: "userValue", + section: "sectionValue", + item: "itemValue", + }; + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sectionItemPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sectionItemPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sectionItemPath', () => { + const result = client.sectionItemPath("userValue", "sectionValue", "itemValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sectionItemPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchUserFromSectionItemName', () => { + const result = client.matchUserFromSectionItemName(fakePath); + assert.strictEqual(result, "userValue"); + assert((client.pathTemplates.sectionItemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSectionFromSectionItemName', () => { + const result = client.matchSectionFromSectionItemName(fakePath); + assert.strictEqual(result, "sectionValue"); + assert((client.pathTemplates.sectionItemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchItemFromSectionItemName', () => { + const result = client.matchItemFromSectionItemName(fakePath); + assert.strictEqual(result, "itemValue"); + assert((client.pathTemplates.sectionItemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + describe('space', async () => { const fakePath = "/rendered/path/space"; const expectedParameters = {