diff --git a/packages/google-chat/README.md b/packages/google-chat/README.md index 4124902409b..438af105f2d 100644 --- a/packages/google-chat/README.md +++ b/packages/google-chat/README.md @@ -148,6 +148,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Chat_service.list_reactions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_reactions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-chat/samples/generated/v1/chat_service.list_reactions.js,packages/google-chat/samples/README.md) | | Chat_service.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) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-chat/samples/generated/v1/chat_service.list_space_events.js,packages/google-chat/samples/README.md) | | Chat_service.list_spaces | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.list_spaces.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-chat/samples/generated/v1/chat_service.list_spaces.js,packages/google-chat/samples/README.md) | +| Chat_service.search_spaces | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.search_spaces.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-chat/samples/generated/v1/chat_service.search_spaces.js,packages/google-chat/samples/README.md) | | Chat_service.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) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-chat/samples/generated/v1/chat_service.set_up_space.js,packages/google-chat/samples/README.md) | | Chat_service.update_membership | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.update_membership.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-chat/samples/generated/v1/chat_service.update_membership.js,packages/google-chat/samples/README.md) | | Chat_service.update_message | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.update_message.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-chat/samples/generated/v1/chat_service.update_message.js,packages/google-chat/samples/README.md) | 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 01f080ee30c..c019c328ea7 100644 --- a/packages/google-chat/protos/google/chat/v1/chat_service.proto +++ b/packages/google-chat/protos/google/chat/v1/chat_service.proto @@ -269,6 +269,18 @@ service ChatService { option (google.api.method_signature) = ""; } + // Returns a list of spaces in a Google Workspace organization based on an + // administrator's search. Requires [user + // authentication with administrator + // privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). + // In the request, set `use_admin_access` to `true`. + rpc SearchSpaces(SearchSpacesRequest) returns (SearchSpacesResponse) { + option (google.api.http) = { + get: "/v1/spaces:search" + }; + option (google.api.method_signature) = ""; + } + // Returns details about a space. For an example, see // [Get details about a // space](https://developers.google.com/workspace/chat/get-spaces). diff --git a/packages/google-chat/protos/google/chat/v1/membership.proto b/packages/google-chat/protos/google/chat/v1/membership.proto index 1441df09b61..5222a49b0be 100644 --- a/packages/google-chat/protos/google/chat/v1/membership.proto +++ b/packages/google-chat/protos/google/chat/v1/membership.proto @@ -156,6 +156,21 @@ message CreateMembershipRequest { // membership relation for itself, it must use the `chat.memberships.app` // scope, set `user.type` to `BOT`, and set `user.name` to `users/app`. Membership membership = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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 the `chat.admin.memberships` [OAuth 2.0 + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + // + // Creating app memberships or creating memberships for users outside the + // administrator's Google Workspace organization isn't supported using admin + // access. + bool use_admin_access = 5; } // Request message for updating a membership. @@ -172,6 +187,17 @@ message UpdateMembershipRequest { // - `role` google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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 the `chat.admin.memberships` [OAuth 2.0 + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + bool use_admin_access = 3; } // Request message for listing memberships. @@ -215,8 +241,8 @@ message ListMembershipsRequest { // // To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. // - // To filter by type, set `member.type` to `HUMAN` or `BOT`. Developer - // Preview: You can also filter for `member.type` using the `!=` operator. + // 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. @@ -263,6 +289,20 @@ message ListMembershipsRequest { // Currently requires [user // authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). bool show_invited = 7 [(google.api.field_behavior) = 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. + bool use_admin_access = 8; } // Response to list memberships of the space. @@ -295,6 +335,20 @@ message GetMembershipRequest { (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "chat.googleapis.com/Membership" } ]; + + // 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 the `chat.admin.memberships` or `chat.admin.memberships.readonly` + // [OAuth 2.0 + // scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + // + // Getting app memberships in a space isn't supported when using admin access. + bool use_admin_access = 3; } // Request to delete a membership in a space. @@ -317,4 +371,17 @@ message DeleteMembershipRequest { (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "chat.googleapis.com/Membership" } ]; + + // 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 the `chat.admin.memberships` [OAuth 2.0 + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + // + // Deleting app memberships in a space isn't supported using admin access. + bool use_admin_access = 2; } diff --git a/packages/google-chat/protos/google/chat/v1/space.proto b/packages/google-chat/protos/google/chat/v1/space.proto index 6bc022a90ab..3796f82fbe3 100644 --- a/packages/google-chat/protos/google/chat/v1/space.proto +++ b/packages/google-chat/protos/google/chat/v1/space.proto @@ -103,6 +103,16 @@ message Space { string guidelines = 2; } + // Represents the count of memberships of a space, grouped into categories. + message MembershipCount { + // Count of human users that have directly joined the space, not counting + // users joined by having membership in a joined group. + int32 joined_direct_human_user_count = 4; + + // Count of all groups that have directly joined the space. + int32 joined_group_count = 5; + } + // Represents the [access // setting](https://support.google.com/chat/answer/11971020) of the space. message AccessSettings { @@ -218,6 +228,10 @@ message Space { (google.api.field_behavior) = OPTIONAL ]; + // Output only. Timestamp of the last message in the space. + google.protobuf.Timestamp last_active_time = 18 + [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. For direct message (DM) spaces with a Chat app, whether the // space was created by a Google Workspace administrator. Administrators can // install and set up a direct message with a Chat app on behalf of users in @@ -226,6 +240,12 @@ message Space { // To support admin install, your Chat app must feature direct messaging. bool admin_installed = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The count of joined memberships grouped by member type. + // Populated when the `space_type` is `SPACE`, `DIRECT_MESSAGE` or + // `GROUP_CHAT`. + MembershipCount membership_count = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + // Optional. Specifies the [access // setting](https://support.google.com/chat/answer/11971020) of the space. // Only populated when the `space_type` is `SPACE`. @@ -318,6 +338,17 @@ message GetSpaceRequest { (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "chat.googleapis.com/Space" } ]; + + // 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 the `chat.admin.spaces` or `chat.admin.spaces.readonly` [OAuth 2.0 + // scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + bool use_admin_access = 2; } // A request to get direct message space based on the user resource. @@ -397,6 +428,165 @@ message UpdateSpaceRequest { // (Warning: mutually exclusive with all other non-permission settings field // paths). `permission_settings` is not supported with admin access. google.protobuf.FieldMask update_mask = 2; + + // 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 the `chat.admin.spaces` [OAuth 2.0 + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + // + // Some `FieldMask` values are not supported using admin access. For details, + // see the description of `update_mask`. + bool use_admin_access = 3; +} + +// Request to search for a list of spaces based on a query. +message SearchSpacesRequest { + // 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. + bool use_admin_access = 1; + + // 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. + int32 page_size = 2; + + // 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. + string page_token = 3; + + // 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") + // ``` + string query = 4 [(google.api.field_behavior) = REQUIRED]; + + // 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` + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response with a list of spaces corresponding to the search spaces request. +message SearchSpacesResponse { + // A page of the requested spaces. + repeated Space spaces = 1; + + // A token that can be used to retrieve the next page. If this field is empty, + // there are no subsequent pages. + string next_page_token = 2; + + // The total number of spaces that match the query, across all pages. If the + // result is over 10,000 spaces, this value is an estimate. + int32 total_size = 3; } // Request for deleting a space. @@ -408,6 +598,17 @@ message DeleteSpaceRequest { (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "chat.googleapis.com/Space" } ]; + + // 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 the `chat.admin.delete` [OAuth 2.0 + // scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + bool use_admin_access = 2; } // Request message for completing the import process for a space. diff --git a/packages/google-chat/protos/protos.d.ts b/packages/google-chat/protos/protos.d.ts index 57b29a23d72..a02a3ce0692 100644 --- a/packages/google-chat/protos/protos.d.ts +++ b/packages/google-chat/protos/protos.d.ts @@ -11453,6 +11453,20 @@ export namespace google { */ public listSpaces(request: google.chat.v1.IListSpacesRequest): Promise; + /** + * Calls SearchSpaces. + * @param request SearchSpacesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchSpacesResponse + */ + public searchSpaces(request: google.chat.v1.ISearchSpacesRequest, callback: google.chat.v1.ChatService.SearchSpacesCallback): void; + + /** + * Calls SearchSpaces. + * @param request SearchSpacesRequest message or plain object + * @returns Promise + */ + public searchSpaces(request: google.chat.v1.ISearchSpacesRequest): Promise; + /** * Calls GetSpace. * @param request GetSpaceRequest message or plain object @@ -11778,6 +11792,13 @@ export namespace google { */ type ListSpacesCallback = (error: (Error|null), response?: google.chat.v1.ListSpacesResponse) => void; + /** + * Callback as used by {@link google.chat.v1.ChatService|searchSpaces}. + * @param error Error, if any + * @param [response] SearchSpacesResponse + */ + type SearchSpacesCallback = (error: (Error|null), response?: google.chat.v1.SearchSpacesResponse) => void; + /** * Callback as used by {@link google.chat.v1.ChatService|getSpace}. * @param error Error, if any @@ -12067,6 +12088,9 @@ export namespace google { /** CreateMembershipRequest membership */ membership?: (google.chat.v1.IMembership|null); + + /** CreateMembershipRequest useAdminAccess */ + useAdminAccess?: (boolean|null); } /** Represents a CreateMembershipRequest. */ @@ -12084,6 +12108,9 @@ export namespace google { /** CreateMembershipRequest membership. */ public membership?: (google.chat.v1.IMembership|null); + /** CreateMembershipRequest useAdminAccess. */ + public useAdminAccess: boolean; + /** * Creates a new CreateMembershipRequest instance using the specified properties. * @param [properties] Properties to set @@ -12170,6 +12197,9 @@ export namespace google { /** UpdateMembershipRequest updateMask */ updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateMembershipRequest useAdminAccess */ + useAdminAccess?: (boolean|null); } /** Represents an UpdateMembershipRequest. */ @@ -12187,6 +12217,9 @@ export namespace google { /** UpdateMembershipRequest updateMask. */ public updateMask?: (google.protobuf.IFieldMask|null); + /** UpdateMembershipRequest useAdminAccess. */ + public useAdminAccess: boolean; + /** * Creates a new UpdateMembershipRequest instance using the specified properties. * @param [properties] Properties to set @@ -12285,6 +12318,9 @@ export namespace google { /** ListMembershipsRequest showInvited */ showInvited?: (boolean|null); + + /** ListMembershipsRequest useAdminAccess */ + useAdminAccess?: (boolean|null); } /** Represents a ListMembershipsRequest. */ @@ -12314,6 +12350,9 @@ export namespace google { /** ListMembershipsRequest showInvited. */ public showInvited: boolean; + /** ListMembershipsRequest useAdminAccess. */ + public useAdminAccess: boolean; + /** * Creates a new ListMembershipsRequest instance using the specified properties. * @param [properties] Properties to set @@ -12500,6 +12539,9 @@ export namespace google { /** GetMembershipRequest name */ name?: (string|null); + + /** GetMembershipRequest useAdminAccess */ + useAdminAccess?: (boolean|null); } /** Represents a GetMembershipRequest. */ @@ -12514,6 +12556,9 @@ export namespace google { /** GetMembershipRequest name. */ public name: string; + /** GetMembershipRequest useAdminAccess. */ + public useAdminAccess: boolean; + /** * Creates a new GetMembershipRequest instance using the specified properties. * @param [properties] Properties to set @@ -12597,6 +12642,9 @@ export namespace google { /** DeleteMembershipRequest name */ name?: (string|null); + + /** DeleteMembershipRequest useAdminAccess */ + useAdminAccess?: (boolean|null); } /** Represents a DeleteMembershipRequest. */ @@ -12611,6 +12659,9 @@ export namespace google { /** DeleteMembershipRequest name. */ public name: string; + /** DeleteMembershipRequest useAdminAccess. */ + public useAdminAccess: boolean; + /** * Creates a new DeleteMembershipRequest instance using the specified properties. * @param [properties] Properties to set @@ -17719,9 +17770,15 @@ export namespace google { /** Space createTime */ createTime?: (google.protobuf.ITimestamp|null); + /** Space lastActiveTime */ + lastActiveTime?: (google.protobuf.ITimestamp|null); + /** Space adminInstalled */ adminInstalled?: (boolean|null); + /** Space membershipCount */ + membershipCount?: (google.chat.v1.Space.IMembershipCount|null); + /** Space accessSettings */ accessSettings?: (google.chat.v1.Space.IAccessSettings|null); @@ -17774,9 +17831,15 @@ export namespace google { /** Space createTime. */ public createTime?: (google.protobuf.ITimestamp|null); + /** Space lastActiveTime. */ + public lastActiveTime?: (google.protobuf.ITimestamp|null); + /** Space adminInstalled. */ public adminInstalled: boolean; + /** Space membershipCount. */ + public membershipCount?: (google.chat.v1.Space.IMembershipCount|null); + /** Space accessSettings. */ public accessSettings?: (google.chat.v1.Space.IAccessSettings|null); @@ -17989,6 +18052,109 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a MembershipCount. */ + interface IMembershipCount { + + /** MembershipCount joinedDirectHumanUserCount */ + joinedDirectHumanUserCount?: (number|null); + + /** MembershipCount joinedGroupCount */ + joinedGroupCount?: (number|null); + } + + /** Represents a MembershipCount. */ + class MembershipCount implements IMembershipCount { + + /** + * Constructs a new MembershipCount. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.Space.IMembershipCount); + + /** MembershipCount joinedDirectHumanUserCount. */ + public joinedDirectHumanUserCount: number; + + /** MembershipCount joinedGroupCount. */ + public joinedGroupCount: number; + + /** + * Creates a new MembershipCount instance using the specified properties. + * @param [properties] Properties to set + * @returns MembershipCount instance + */ + public static create(properties?: google.chat.v1.Space.IMembershipCount): google.chat.v1.Space.MembershipCount; + + /** + * Encodes the specified MembershipCount message. Does not implicitly {@link google.chat.v1.Space.MembershipCount.verify|verify} messages. + * @param message MembershipCount message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.Space.IMembershipCount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MembershipCount message, length delimited. Does not implicitly {@link google.chat.v1.Space.MembershipCount.verify|verify} messages. + * @param message MembershipCount message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.Space.IMembershipCount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MembershipCount message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MembershipCount + * @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.Space.MembershipCount; + + /** + * Decodes a MembershipCount message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MembershipCount + * @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.Space.MembershipCount; + + /** + * Verifies a MembershipCount 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 MembershipCount message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MembershipCount + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.Space.MembershipCount; + + /** + * Creates a plain object from a MembershipCount message. Also converts values to other types if specified. + * @param message MembershipCount + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.Space.MembershipCount, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MembershipCount to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MembershipCount + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of an AccessSettings. */ interface IAccessSettings { @@ -18423,6 +18589,9 @@ export namespace google { /** GetSpaceRequest name */ name?: (string|null); + + /** GetSpaceRequest useAdminAccess */ + useAdminAccess?: (boolean|null); } /** Represents a GetSpaceRequest. */ @@ -18437,6 +18606,9 @@ export namespace google { /** GetSpaceRequest name. */ public name: string; + /** GetSpaceRequest useAdminAccess. */ + public useAdminAccess: boolean; + /** * Creates a new GetSpaceRequest instance using the specified properties. * @param [properties] Properties to set @@ -18620,6 +18792,9 @@ export namespace google { /** UpdateSpaceRequest updateMask */ updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateSpaceRequest useAdminAccess */ + useAdminAccess?: (boolean|null); } /** Represents an UpdateSpaceRequest. */ @@ -18637,6 +18812,9 @@ export namespace google { /** UpdateSpaceRequest updateMask. */ public updateMask?: (google.protobuf.IFieldMask|null); + /** UpdateSpaceRequest useAdminAccess. */ + public useAdminAccess: boolean; + /** * Creates a new UpdateSpaceRequest instance using the specified properties. * @param [properties] Properties to set @@ -18715,11 +18893,244 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a SearchSpacesRequest. */ + interface ISearchSpacesRequest { + + /** SearchSpacesRequest useAdminAccess */ + useAdminAccess?: (boolean|null); + + /** SearchSpacesRequest pageSize */ + pageSize?: (number|null); + + /** SearchSpacesRequest pageToken */ + pageToken?: (string|null); + + /** SearchSpacesRequest query */ + query?: (string|null); + + /** SearchSpacesRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a SearchSpacesRequest. */ + class SearchSpacesRequest implements ISearchSpacesRequest { + + /** + * Constructs a new SearchSpacesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.ISearchSpacesRequest); + + /** SearchSpacesRequest useAdminAccess. */ + public useAdminAccess: boolean; + + /** SearchSpacesRequest pageSize. */ + public pageSize: number; + + /** SearchSpacesRequest pageToken. */ + public pageToken: string; + + /** SearchSpacesRequest query. */ + public query: string; + + /** SearchSpacesRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new SearchSpacesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchSpacesRequest instance + */ + public static create(properties?: google.chat.v1.ISearchSpacesRequest): google.chat.v1.SearchSpacesRequest; + + /** + * Encodes the specified SearchSpacesRequest message. Does not implicitly {@link google.chat.v1.SearchSpacesRequest.verify|verify} messages. + * @param message SearchSpacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.ISearchSpacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchSpacesRequest message, length delimited. Does not implicitly {@link google.chat.v1.SearchSpacesRequest.verify|verify} messages. + * @param message SearchSpacesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.ISearchSpacesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchSpacesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchSpacesRequest + * @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.SearchSpacesRequest; + + /** + * Decodes a SearchSpacesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchSpacesRequest + * @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.SearchSpacesRequest; + + /** + * Verifies a SearchSpacesRequest 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 SearchSpacesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchSpacesRequest + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.SearchSpacesRequest; + + /** + * Creates a plain object from a SearchSpacesRequest message. Also converts values to other types if specified. + * @param message SearchSpacesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.SearchSpacesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchSpacesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchSpacesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchSpacesResponse. */ + interface ISearchSpacesResponse { + + /** SearchSpacesResponse spaces */ + spaces?: (google.chat.v1.ISpace[]|null); + + /** SearchSpacesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** SearchSpacesResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a SearchSpacesResponse. */ + class SearchSpacesResponse implements ISearchSpacesResponse { + + /** + * Constructs a new SearchSpacesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.chat.v1.ISearchSpacesResponse); + + /** SearchSpacesResponse spaces. */ + public spaces: google.chat.v1.ISpace[]; + + /** SearchSpacesResponse nextPageToken. */ + public nextPageToken: string; + + /** SearchSpacesResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new SearchSpacesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchSpacesResponse instance + */ + public static create(properties?: google.chat.v1.ISearchSpacesResponse): google.chat.v1.SearchSpacesResponse; + + /** + * Encodes the specified SearchSpacesResponse message. Does not implicitly {@link google.chat.v1.SearchSpacesResponse.verify|verify} messages. + * @param message SearchSpacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.chat.v1.ISearchSpacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchSpacesResponse message, length delimited. Does not implicitly {@link google.chat.v1.SearchSpacesResponse.verify|verify} messages. + * @param message SearchSpacesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.chat.v1.ISearchSpacesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchSpacesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchSpacesResponse + * @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.SearchSpacesResponse; + + /** + * Decodes a SearchSpacesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchSpacesResponse + * @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.SearchSpacesResponse; + + /** + * Verifies a SearchSpacesResponse 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 SearchSpacesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchSpacesResponse + */ + public static fromObject(object: { [k: string]: any }): google.chat.v1.SearchSpacesResponse; + + /** + * Creates a plain object from a SearchSpacesResponse message. Also converts values to other types if specified. + * @param message SearchSpacesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.chat.v1.SearchSpacesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchSpacesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchSpacesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a DeleteSpaceRequest. */ interface IDeleteSpaceRequest { /** DeleteSpaceRequest name */ name?: (string|null); + + /** DeleteSpaceRequest useAdminAccess */ + useAdminAccess?: (boolean|null); } /** Represents a DeleteSpaceRequest. */ @@ -18734,6 +19145,9 @@ export namespace google { /** DeleteSpaceRequest name. */ public name: string; + /** DeleteSpaceRequest useAdminAccess. */ + public useAdminAccess: boolean; + /** * Creates a new DeleteSpaceRequest instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-chat/protos/protos.js b/packages/google-chat/protos/protos.js index e790ba866b1..f3a5f3c9a86 100644 --- a/packages/google-chat/protos/protos.js +++ b/packages/google-chat/protos/protos.js @@ -30557,6 +30557,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.chat.v1.ChatService|searchSpaces}. + * @memberof google.chat.v1.ChatService + * @typedef SearchSpacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.chat.v1.SearchSpacesResponse} [response] SearchSpacesResponse + */ + + /** + * Calls SearchSpaces. + * @function searchSpaces + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.ISearchSpacesRequest} request SearchSpacesRequest message or plain object + * @param {google.chat.v1.ChatService.SearchSpacesCallback} callback Node-style callback called with the error, if any, and SearchSpacesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ChatService.prototype.searchSpaces = function searchSpaces(request, callback) { + return this.rpcCall(searchSpaces, $root.google.chat.v1.SearchSpacesRequest, $root.google.chat.v1.SearchSpacesResponse, request, callback); + }, "name", { value: "SearchSpaces" }); + + /** + * Calls SearchSpaces. + * @function searchSpaces + * @memberof google.chat.v1.ChatService + * @instance + * @param {google.chat.v1.ISearchSpacesRequest} request SearchSpacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.chat.v1.ChatService|getSpace}. * @memberof google.chat.v1.ChatService @@ -31638,6 +31671,7 @@ * @interface ICreateMembershipRequest * @property {string|null} [parent] CreateMembershipRequest parent * @property {google.chat.v1.IMembership|null} [membership] CreateMembershipRequest membership + * @property {boolean|null} [useAdminAccess] CreateMembershipRequest useAdminAccess */ /** @@ -31671,6 +31705,14 @@ */ CreateMembershipRequest.prototype.membership = null; + /** + * CreateMembershipRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.CreateMembershipRequest + * @instance + */ + CreateMembershipRequest.prototype.useAdminAccess = false; + /** * Creates a new CreateMembershipRequest instance using the specified properties. * @function create @@ -31699,6 +31741,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); if (message.membership != null && Object.hasOwnProperty.call(message, "membership")) $root.google.chat.v1.Membership.encode(message.membership, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.useAdminAccess); return writer; }; @@ -31741,6 +31785,10 @@ message.membership = $root.google.chat.v1.Membership.decode(reader, reader.uint32()); break; } + case 5: { + message.useAdminAccess = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -31784,6 +31832,9 @@ if (error) return "membership." + error; } + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean expected"; return null; }; @@ -31806,6 +31857,8 @@ throw TypeError(".google.chat.v1.CreateMembershipRequest.membership: object expected"); message.membership = $root.google.chat.v1.Membership.fromObject(object.membership); } + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); return message; }; @@ -31825,11 +31878,14 @@ if (options.defaults) { object.parent = ""; object.membership = null; + object.useAdminAccess = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; if (message.membership != null && message.hasOwnProperty("membership")) object.membership = $root.google.chat.v1.Membership.toObject(message.membership, options); + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; return object; }; @@ -31870,6 +31926,7 @@ * @interface IUpdateMembershipRequest * @property {google.chat.v1.IMembership|null} [membership] UpdateMembershipRequest membership * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateMembershipRequest updateMask + * @property {boolean|null} [useAdminAccess] UpdateMembershipRequest useAdminAccess */ /** @@ -31903,6 +31960,14 @@ */ UpdateMembershipRequest.prototype.updateMask = null; + /** + * UpdateMembershipRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.UpdateMembershipRequest + * @instance + */ + UpdateMembershipRequest.prototype.useAdminAccess = false; + /** * Creates a new UpdateMembershipRequest instance using the specified properties. * @function create @@ -31931,6 +31996,8 @@ $root.google.chat.v1.Membership.encode(message.membership, 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(); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.useAdminAccess); return writer; }; @@ -31973,6 +32040,10 @@ message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; } + case 3: { + message.useAdminAccess = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -32018,6 +32089,9 @@ if (error) return "updateMask." + error; } + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean expected"; return null; }; @@ -32043,6 +32117,8 @@ throw TypeError(".google.chat.v1.UpdateMembershipRequest.updateMask: object expected"); message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); return message; }; @@ -32062,11 +32138,14 @@ if (options.defaults) { object.membership = null; object.updateMask = null; + object.useAdminAccess = false; } if (message.membership != null && message.hasOwnProperty("membership")) object.membership = $root.google.chat.v1.Membership.toObject(message.membership, options); if (message.updateMask != null && message.hasOwnProperty("updateMask")) object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; return object; }; @@ -32111,6 +32190,7 @@ * @property {string|null} [filter] ListMembershipsRequest filter * @property {boolean|null} [showGroups] ListMembershipsRequest showGroups * @property {boolean|null} [showInvited] ListMembershipsRequest showInvited + * @property {boolean|null} [useAdminAccess] ListMembershipsRequest useAdminAccess */ /** @@ -32176,6 +32256,14 @@ */ ListMembershipsRequest.prototype.showInvited = false; + /** + * ListMembershipsRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.ListMembershipsRequest + * @instance + */ + ListMembershipsRequest.prototype.useAdminAccess = false; + /** * Creates a new ListMembershipsRequest instance using the specified properties. * @function create @@ -32212,6 +32300,8 @@ writer.uint32(/* id 6, wireType 0 =*/48).bool(message.showGroups); if (message.showInvited != null && Object.hasOwnProperty.call(message, "showInvited")) writer.uint32(/* id 7, wireType 0 =*/56).bool(message.showInvited); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.useAdminAccess); return writer; }; @@ -32270,6 +32360,10 @@ message.showInvited = reader.bool(); break; } + case 8: { + message.useAdminAccess = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -32323,6 +32417,9 @@ if (message.showInvited != null && message.hasOwnProperty("showInvited")) if (typeof message.showInvited !== "boolean") return "showInvited: boolean expected"; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean expected"; return null; }; @@ -32350,6 +32447,8 @@ message.showGroups = Boolean(object.showGroups); if (object.showInvited != null) message.showInvited = Boolean(object.showInvited); + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); return message; }; @@ -32373,6 +32472,7 @@ object.filter = ""; object.showGroups = false; object.showInvited = false; + object.useAdminAccess = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -32386,6 +32486,8 @@ object.showGroups = message.showGroups; if (message.showInvited != null && message.hasOwnProperty("showInvited")) object.showInvited = message.showInvited; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; return object; }; @@ -32673,6 +32775,7 @@ * @memberof google.chat.v1 * @interface IGetMembershipRequest * @property {string|null} [name] GetMembershipRequest name + * @property {boolean|null} [useAdminAccess] GetMembershipRequest useAdminAccess */ /** @@ -32698,6 +32801,14 @@ */ GetMembershipRequest.prototype.name = ""; + /** + * GetMembershipRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.GetMembershipRequest + * @instance + */ + GetMembershipRequest.prototype.useAdminAccess = false; + /** * Creates a new GetMembershipRequest instance using the specified properties. * @function create @@ -32724,6 +32835,8 @@ writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.useAdminAccess); return writer; }; @@ -32762,6 +32875,10 @@ message.name = reader.string(); break; } + case 3: { + message.useAdminAccess = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -32800,6 +32917,9 @@ if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean expected"; return null; }; @@ -32817,6 +32937,8 @@ var message = new $root.google.chat.v1.GetMembershipRequest(); if (object.name != null) message.name = String(object.name); + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); return message; }; @@ -32833,10 +32955,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.useAdminAccess = false; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; return object; }; @@ -32876,6 +33002,7 @@ * @memberof google.chat.v1 * @interface IDeleteMembershipRequest * @property {string|null} [name] DeleteMembershipRequest name + * @property {boolean|null} [useAdminAccess] DeleteMembershipRequest useAdminAccess */ /** @@ -32901,6 +33028,14 @@ */ DeleteMembershipRequest.prototype.name = ""; + /** + * DeleteMembershipRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.DeleteMembershipRequest + * @instance + */ + DeleteMembershipRequest.prototype.useAdminAccess = false; + /** * Creates a new DeleteMembershipRequest instance using the specified properties. * @function create @@ -32927,6 +33062,8 @@ writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.useAdminAccess); return writer; }; @@ -32965,6 +33102,10 @@ message.name = reader.string(); break; } + case 2: { + message.useAdminAccess = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -33003,6 +33144,9 @@ if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean expected"; return null; }; @@ -33020,6 +33164,8 @@ var message = new $root.google.chat.v1.DeleteMembershipRequest(); if (object.name != null) message.name = String(object.name); + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); return message; }; @@ -33036,10 +33182,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.useAdminAccess = false; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; return object; }; @@ -45572,7 +45722,9 @@ * @property {google.chat.v1.HistoryState|null} [spaceHistoryState] Space spaceHistoryState * @property {boolean|null} [importMode] Space importMode * @property {google.protobuf.ITimestamp|null} [createTime] Space createTime + * @property {google.protobuf.ITimestamp|null} [lastActiveTime] Space lastActiveTime * @property {boolean|null} [adminInstalled] Space adminInstalled + * @property {google.chat.v1.Space.IMembershipCount|null} [membershipCount] Space membershipCount * @property {google.chat.v1.Space.IAccessSettings|null} [accessSettings] Space accessSettings * @property {string|null} [spaceUri] Space spaceUri */ @@ -45688,6 +45840,14 @@ */ Space.prototype.createTime = null; + /** + * Space lastActiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} lastActiveTime + * @memberof google.chat.v1.Space + * @instance + */ + Space.prototype.lastActiveTime = null; + /** * Space adminInstalled. * @member {boolean} adminInstalled @@ -45696,6 +45856,14 @@ */ Space.prototype.adminInstalled = false; + /** + * Space membershipCount. + * @member {google.chat.v1.Space.IMembershipCount|null|undefined} membershipCount + * @memberof google.chat.v1.Space + * @instance + */ + Space.prototype.membershipCount = null; + /** * Space accessSettings. * @member {google.chat.v1.Space.IAccessSettings|null|undefined} accessSettings @@ -45760,8 +45928,12 @@ writer.uint32(/* id 16, wireType 0 =*/128).bool(message.importMode); if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.lastActiveTime != null && Object.hasOwnProperty.call(message, "lastActiveTime")) + $root.google.protobuf.Timestamp.encode(message.lastActiveTime, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); if (message.adminInstalled != null && Object.hasOwnProperty.call(message, "adminInstalled")) writer.uint32(/* id 19, wireType 0 =*/152).bool(message.adminInstalled); + if (message.membershipCount != null && Object.hasOwnProperty.call(message, "membershipCount")) + $root.google.chat.v1.Space.MembershipCount.encode(message.membershipCount, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.accessSettings != null && Object.hasOwnProperty.call(message, "accessSettings")) $root.google.chat.v1.Space.AccessSettings.encode(message.accessSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); if (message.spaceUri != null && Object.hasOwnProperty.call(message, "spaceUri")) @@ -45848,10 +46020,18 @@ message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } + case 18: { + message.lastActiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } case 19: { message.adminInstalled = reader.bool(); break; } + case 20: { + message.membershipCount = $root.google.chat.v1.Space.MembershipCount.decode(reader, reader.uint32()); + break; + } case 23: { message.accessSettings = $root.google.chat.v1.Space.AccessSettings.decode(reader, reader.uint32()); break; @@ -45961,9 +46141,19 @@ if (error) return "createTime." + error; } + if (message.lastActiveTime != null && message.hasOwnProperty("lastActiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.lastActiveTime); + if (error) + return "lastActiveTime." + error; + } if (message.adminInstalled != null && message.hasOwnProperty("adminInstalled")) if (typeof message.adminInstalled !== "boolean") return "adminInstalled: boolean expected"; + if (message.membershipCount != null && message.hasOwnProperty("membershipCount")) { + var error = $root.google.chat.v1.Space.MembershipCount.verify(message.membershipCount); + if (error) + return "membershipCount." + error; + } if (message.accessSettings != null && message.hasOwnProperty("accessSettings")) { var error = $root.google.chat.v1.Space.AccessSettings.verify(message.accessSettings); if (error) @@ -46097,8 +46287,18 @@ throw TypeError(".google.chat.v1.Space.createTime: object expected"); message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } + if (object.lastActiveTime != null) { + if (typeof object.lastActiveTime !== "object") + throw TypeError(".google.chat.v1.Space.lastActiveTime: object expected"); + message.lastActiveTime = $root.google.protobuf.Timestamp.fromObject(object.lastActiveTime); + } if (object.adminInstalled != null) message.adminInstalled = Boolean(object.adminInstalled); + if (object.membershipCount != null) { + if (typeof object.membershipCount !== "object") + throw TypeError(".google.chat.v1.Space.membershipCount: object expected"); + message.membershipCount = $root.google.chat.v1.Space.MembershipCount.fromObject(object.membershipCount); + } if (object.accessSettings != null) { if (typeof object.accessSettings !== "object") throw TypeError(".google.chat.v1.Space.accessSettings: object expected"); @@ -46135,7 +46335,9 @@ object.spaceHistoryState = options.enums === String ? "HISTORY_STATE_UNSPECIFIED" : 0; object.importMode = false; object.createTime = null; + object.lastActiveTime = null; object.adminInstalled = false; + object.membershipCount = null; object.accessSettings = null; object.spaceUri = ""; } @@ -46163,8 +46365,12 @@ object.importMode = message.importMode; if (message.createTime != null && message.hasOwnProperty("createTime")) object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.lastActiveTime != null && message.hasOwnProperty("lastActiveTime")) + object.lastActiveTime = $root.google.protobuf.Timestamp.toObject(message.lastActiveTime, options); if (message.adminInstalled != null && message.hasOwnProperty("adminInstalled")) object.adminInstalled = message.adminInstalled; + if (message.membershipCount != null && message.hasOwnProperty("membershipCount")) + object.membershipCount = $root.google.chat.v1.Space.MembershipCount.toObject(message.membershipCount, options); if (message.accessSettings != null && message.hasOwnProperty("accessSettings")) object.accessSettings = $root.google.chat.v1.Space.AccessSettings.toObject(message.accessSettings, options); if (message.spaceUri != null && message.hasOwnProperty("spaceUri")) @@ -46477,6 +46683,233 @@ return SpaceDetails; })(); + Space.MembershipCount = (function() { + + /** + * Properties of a MembershipCount. + * @memberof google.chat.v1.Space + * @interface IMembershipCount + * @property {number|null} [joinedDirectHumanUserCount] MembershipCount joinedDirectHumanUserCount + * @property {number|null} [joinedGroupCount] MembershipCount joinedGroupCount + */ + + /** + * Constructs a new MembershipCount. + * @memberof google.chat.v1.Space + * @classdesc Represents a MembershipCount. + * @implements IMembershipCount + * @constructor + * @param {google.chat.v1.Space.IMembershipCount=} [properties] Properties to set + */ + function MembershipCount(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]]; + } + + /** + * MembershipCount joinedDirectHumanUserCount. + * @member {number} joinedDirectHumanUserCount + * @memberof google.chat.v1.Space.MembershipCount + * @instance + */ + MembershipCount.prototype.joinedDirectHumanUserCount = 0; + + /** + * MembershipCount joinedGroupCount. + * @member {number} joinedGroupCount + * @memberof google.chat.v1.Space.MembershipCount + * @instance + */ + MembershipCount.prototype.joinedGroupCount = 0; + + /** + * Creates a new MembershipCount instance using the specified properties. + * @function create + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {google.chat.v1.Space.IMembershipCount=} [properties] Properties to set + * @returns {google.chat.v1.Space.MembershipCount} MembershipCount instance + */ + MembershipCount.create = function create(properties) { + return new MembershipCount(properties); + }; + + /** + * Encodes the specified MembershipCount message. Does not implicitly {@link google.chat.v1.Space.MembershipCount.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {google.chat.v1.Space.IMembershipCount} message MembershipCount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MembershipCount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.joinedDirectHumanUserCount != null && Object.hasOwnProperty.call(message, "joinedDirectHumanUserCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.joinedDirectHumanUserCount); + if (message.joinedGroupCount != null && Object.hasOwnProperty.call(message, "joinedGroupCount")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.joinedGroupCount); + return writer; + }; + + /** + * Encodes the specified MembershipCount message, length delimited. Does not implicitly {@link google.chat.v1.Space.MembershipCount.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {google.chat.v1.Space.IMembershipCount} message MembershipCount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MembershipCount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MembershipCount message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.Space.MembershipCount} MembershipCount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MembershipCount.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.Space.MembershipCount(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.joinedDirectHumanUserCount = reader.int32(); + break; + } + case 5: { + message.joinedGroupCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MembershipCount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.Space.MembershipCount} MembershipCount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MembershipCount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MembershipCount message. + * @function verify + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MembershipCount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.joinedDirectHumanUserCount != null && message.hasOwnProperty("joinedDirectHumanUserCount")) + if (!$util.isInteger(message.joinedDirectHumanUserCount)) + return "joinedDirectHumanUserCount: integer expected"; + if (message.joinedGroupCount != null && message.hasOwnProperty("joinedGroupCount")) + if (!$util.isInteger(message.joinedGroupCount)) + return "joinedGroupCount: integer expected"; + return null; + }; + + /** + * Creates a MembershipCount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.Space.MembershipCount} MembershipCount + */ + MembershipCount.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.Space.MembershipCount) + return object; + var message = new $root.google.chat.v1.Space.MembershipCount(); + if (object.joinedDirectHumanUserCount != null) + message.joinedDirectHumanUserCount = object.joinedDirectHumanUserCount | 0; + if (object.joinedGroupCount != null) + message.joinedGroupCount = object.joinedGroupCount | 0; + return message; + }; + + /** + * Creates a plain object from a MembershipCount message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {google.chat.v1.Space.MembershipCount} message MembershipCount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MembershipCount.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.joinedDirectHumanUserCount = 0; + object.joinedGroupCount = 0; + } + if (message.joinedDirectHumanUserCount != null && message.hasOwnProperty("joinedDirectHumanUserCount")) + object.joinedDirectHumanUserCount = message.joinedDirectHumanUserCount; + if (message.joinedGroupCount != null && message.hasOwnProperty("joinedGroupCount")) + object.joinedGroupCount = message.joinedGroupCount; + return object; + }; + + /** + * Converts this MembershipCount to JSON. + * @function toJSON + * @memberof google.chat.v1.Space.MembershipCount + * @instance + * @returns {Object.} JSON object + */ + MembershipCount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MembershipCount + * @function getTypeUrl + * @memberof google.chat.v1.Space.MembershipCount + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MembershipCount.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.Space.MembershipCount"; + }; + + return MembershipCount; + })(); + Space.AccessSettings = (function() { /** @@ -47484,6 +47917,7 @@ * @memberof google.chat.v1 * @interface IGetSpaceRequest * @property {string|null} [name] GetSpaceRequest name + * @property {boolean|null} [useAdminAccess] GetSpaceRequest useAdminAccess */ /** @@ -47509,6 +47943,14 @@ */ GetSpaceRequest.prototype.name = ""; + /** + * GetSpaceRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.GetSpaceRequest + * @instance + */ + GetSpaceRequest.prototype.useAdminAccess = false; + /** * Creates a new GetSpaceRequest instance using the specified properties. * @function create @@ -47535,6 +47977,8 @@ writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.useAdminAccess); return writer; }; @@ -47573,6 +48017,10 @@ message.name = reader.string(); break; } + case 2: { + message.useAdminAccess = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -47611,6 +48059,9 @@ if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean expected"; return null; }; @@ -47628,6 +48079,8 @@ var message = new $root.google.chat.v1.GetSpaceRequest(); if (object.name != null) message.name = String(object.name); + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); return message; }; @@ -47644,10 +48097,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.useAdminAccess = false; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; return object; }; @@ -47891,6 +48348,7 @@ * @interface IUpdateSpaceRequest * @property {google.chat.v1.ISpace|null} [space] UpdateSpaceRequest space * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSpaceRequest updateMask + * @property {boolean|null} [useAdminAccess] UpdateSpaceRequest useAdminAccess */ /** @@ -47924,6 +48382,14 @@ */ UpdateSpaceRequest.prototype.updateMask = null; + /** + * UpdateSpaceRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.UpdateSpaceRequest + * @instance + */ + UpdateSpaceRequest.prototype.useAdminAccess = false; + /** * Creates a new UpdateSpaceRequest instance using the specified properties. * @function create @@ -47952,6 +48418,8 @@ $root.google.chat.v1.Space.encode(message.space, 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(); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.useAdminAccess); return writer; }; @@ -47994,6 +48462,10 @@ message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; } + case 3: { + message.useAdminAccess = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -48039,6 +48511,9 @@ if (error) return "updateMask." + error; } + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean expected"; return null; }; @@ -48064,6 +48539,8 @@ throw TypeError(".google.chat.v1.UpdateSpaceRequest.updateMask: object expected"); message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); return message; }; @@ -48083,11 +48560,14 @@ if (options.defaults) { object.space = null; object.updateMask = null; + object.useAdminAccess = false; } if (message.space != null && message.hasOwnProperty("space")) object.space = $root.google.chat.v1.Space.toObject(message.space, options); if (message.updateMask != null && message.hasOwnProperty("updateMask")) object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; return object; }; @@ -48120,20 +48600,589 @@ return UpdateSpaceRequest; })(); - v1.DeleteSpaceRequest = (function() { + v1.SearchSpacesRequest = (function() { /** - * Properties of a DeleteSpaceRequest. + * Properties of a SearchSpacesRequest. * @memberof google.chat.v1 - * @interface IDeleteSpaceRequest - * @property {string|null} [name] DeleteSpaceRequest name + * @interface ISearchSpacesRequest + * @property {boolean|null} [useAdminAccess] SearchSpacesRequest useAdminAccess + * @property {number|null} [pageSize] SearchSpacesRequest pageSize + * @property {string|null} [pageToken] SearchSpacesRequest pageToken + * @property {string|null} [query] SearchSpacesRequest query + * @property {string|null} [orderBy] SearchSpacesRequest orderBy */ /** - * Constructs a new DeleteSpaceRequest. + * Constructs a new SearchSpacesRequest. * @memberof google.chat.v1 - * @classdesc Represents a DeleteSpaceRequest. - * @implements IDeleteSpaceRequest + * @classdesc Represents a SearchSpacesRequest. + * @implements ISearchSpacesRequest + * @constructor + * @param {google.chat.v1.ISearchSpacesRequest=} [properties] Properties to set + */ + function SearchSpacesRequest(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]]; + } + + /** + * SearchSpacesRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.SearchSpacesRequest + * @instance + */ + SearchSpacesRequest.prototype.useAdminAccess = false; + + /** + * SearchSpacesRequest pageSize. + * @member {number} pageSize + * @memberof google.chat.v1.SearchSpacesRequest + * @instance + */ + SearchSpacesRequest.prototype.pageSize = 0; + + /** + * SearchSpacesRequest pageToken. + * @member {string} pageToken + * @memberof google.chat.v1.SearchSpacesRequest + * @instance + */ + SearchSpacesRequest.prototype.pageToken = ""; + + /** + * SearchSpacesRequest query. + * @member {string} query + * @memberof google.chat.v1.SearchSpacesRequest + * @instance + */ + SearchSpacesRequest.prototype.query = ""; + + /** + * SearchSpacesRequest orderBy. + * @member {string} orderBy + * @memberof google.chat.v1.SearchSpacesRequest + * @instance + */ + SearchSpacesRequest.prototype.orderBy = ""; + + /** + * Creates a new SearchSpacesRequest instance using the specified properties. + * @function create + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {google.chat.v1.ISearchSpacesRequest=} [properties] Properties to set + * @returns {google.chat.v1.SearchSpacesRequest} SearchSpacesRequest instance + */ + SearchSpacesRequest.create = function create(properties) { + return new SearchSpacesRequest(properties); + }; + + /** + * Encodes the specified SearchSpacesRequest message. Does not implicitly {@link google.chat.v1.SearchSpacesRequest.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {google.chat.v1.ISearchSpacesRequest} message SearchSpacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchSpacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.useAdminAccess); + 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.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.query); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified SearchSpacesRequest message, length delimited. Does not implicitly {@link google.chat.v1.SearchSpacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {google.chat.v1.ISearchSpacesRequest} message SearchSpacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchSpacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchSpacesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.SearchSpacesRequest} SearchSpacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchSpacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.SearchSpacesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.useAdminAccess = reader.bool(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.query = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchSpacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.SearchSpacesRequest} SearchSpacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchSpacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchSpacesRequest message. + * @function verify + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchSpacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean 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.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a SearchSpacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.SearchSpacesRequest} SearchSpacesRequest + */ + SearchSpacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.SearchSpacesRequest) + return object; + var message = new $root.google.chat.v1.SearchSpacesRequest(); + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.query != null) + message.query = String(object.query); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a SearchSpacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {google.chat.v1.SearchSpacesRequest} message SearchSpacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchSpacesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.useAdminAccess = false; + object.pageSize = 0; + object.pageToken = ""; + object.query = ""; + object.orderBy = ""; + } + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this SearchSpacesRequest to JSON. + * @function toJSON + * @memberof google.chat.v1.SearchSpacesRequest + * @instance + * @returns {Object.} JSON object + */ + SearchSpacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchSpacesRequest + * @function getTypeUrl + * @memberof google.chat.v1.SearchSpacesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchSpacesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.SearchSpacesRequest"; + }; + + return SearchSpacesRequest; + })(); + + v1.SearchSpacesResponse = (function() { + + /** + * Properties of a SearchSpacesResponse. + * @memberof google.chat.v1 + * @interface ISearchSpacesResponse + * @property {Array.|null} [spaces] SearchSpacesResponse spaces + * @property {string|null} [nextPageToken] SearchSpacesResponse nextPageToken + * @property {number|null} [totalSize] SearchSpacesResponse totalSize + */ + + /** + * Constructs a new SearchSpacesResponse. + * @memberof google.chat.v1 + * @classdesc Represents a SearchSpacesResponse. + * @implements ISearchSpacesResponse + * @constructor + * @param {google.chat.v1.ISearchSpacesResponse=} [properties] Properties to set + */ + function SearchSpacesResponse(properties) { + this.spaces = []; + 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]]; + } + + /** + * SearchSpacesResponse spaces. + * @member {Array.} spaces + * @memberof google.chat.v1.SearchSpacesResponse + * @instance + */ + SearchSpacesResponse.prototype.spaces = $util.emptyArray; + + /** + * SearchSpacesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.chat.v1.SearchSpacesResponse + * @instance + */ + SearchSpacesResponse.prototype.nextPageToken = ""; + + /** + * SearchSpacesResponse totalSize. + * @member {number} totalSize + * @memberof google.chat.v1.SearchSpacesResponse + * @instance + */ + SearchSpacesResponse.prototype.totalSize = 0; + + /** + * Creates a new SearchSpacesResponse instance using the specified properties. + * @function create + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {google.chat.v1.ISearchSpacesResponse=} [properties] Properties to set + * @returns {google.chat.v1.SearchSpacesResponse} SearchSpacesResponse instance + */ + SearchSpacesResponse.create = function create(properties) { + return new SearchSpacesResponse(properties); + }; + + /** + * Encodes the specified SearchSpacesResponse message. Does not implicitly {@link google.chat.v1.SearchSpacesResponse.verify|verify} messages. + * @function encode + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {google.chat.v1.ISearchSpacesResponse} message SearchSpacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchSpacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.spaces != null && message.spaces.length) + for (var i = 0; i < message.spaces.length; ++i) + $root.google.chat.v1.Space.encode(message.spaces[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); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + return writer; + }; + + /** + * Encodes the specified SearchSpacesResponse message, length delimited. Does not implicitly {@link google.chat.v1.SearchSpacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {google.chat.v1.ISearchSpacesResponse} message SearchSpacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchSpacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchSpacesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.chat.v1.SearchSpacesResponse} SearchSpacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchSpacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.chat.v1.SearchSpacesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.spaces && message.spaces.length)) + message.spaces = []; + message.spaces.push($root.google.chat.v1.Space.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + message.totalSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchSpacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.chat.v1.SearchSpacesResponse} SearchSpacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchSpacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchSpacesResponse message. + * @function verify + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchSpacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.spaces != null && message.hasOwnProperty("spaces")) { + if (!Array.isArray(message.spaces)) + return "spaces: array expected"; + for (var i = 0; i < message.spaces.length; ++i) { + var error = $root.google.chat.v1.Space.verify(message.spaces[i]); + if (error) + return "spaces." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + return null; + }; + + /** + * Creates a SearchSpacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.chat.v1.SearchSpacesResponse} SearchSpacesResponse + */ + SearchSpacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.chat.v1.SearchSpacesResponse) + return object; + var message = new $root.google.chat.v1.SearchSpacesResponse(); + if (object.spaces) { + if (!Array.isArray(object.spaces)) + throw TypeError(".google.chat.v1.SearchSpacesResponse.spaces: array expected"); + message.spaces = []; + for (var i = 0; i < object.spaces.length; ++i) { + if (typeof object.spaces[i] !== "object") + throw TypeError(".google.chat.v1.SearchSpacesResponse.spaces: object expected"); + message.spaces[i] = $root.google.chat.v1.Space.fromObject(object.spaces[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + return message; + }; + + /** + * Creates a plain object from a SearchSpacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {google.chat.v1.SearchSpacesResponse} message SearchSpacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchSpacesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.spaces = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.spaces && message.spaces.length) { + object.spaces = []; + for (var j = 0; j < message.spaces.length; ++j) + object.spaces[j] = $root.google.chat.v1.Space.toObject(message.spaces[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + return object; + }; + + /** + * Converts this SearchSpacesResponse to JSON. + * @function toJSON + * @memberof google.chat.v1.SearchSpacesResponse + * @instance + * @returns {Object.} JSON object + */ + SearchSpacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchSpacesResponse + * @function getTypeUrl + * @memberof google.chat.v1.SearchSpacesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchSpacesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.chat.v1.SearchSpacesResponse"; + }; + + return SearchSpacesResponse; + })(); + + v1.DeleteSpaceRequest = (function() { + + /** + * Properties of a DeleteSpaceRequest. + * @memberof google.chat.v1 + * @interface IDeleteSpaceRequest + * @property {string|null} [name] DeleteSpaceRequest name + * @property {boolean|null} [useAdminAccess] DeleteSpaceRequest useAdminAccess + */ + + /** + * Constructs a new DeleteSpaceRequest. + * @memberof google.chat.v1 + * @classdesc Represents a DeleteSpaceRequest. + * @implements IDeleteSpaceRequest * @constructor * @param {google.chat.v1.IDeleteSpaceRequest=} [properties] Properties to set */ @@ -48152,6 +49201,14 @@ */ DeleteSpaceRequest.prototype.name = ""; + /** + * DeleteSpaceRequest useAdminAccess. + * @member {boolean} useAdminAccess + * @memberof google.chat.v1.DeleteSpaceRequest + * @instance + */ + DeleteSpaceRequest.prototype.useAdminAccess = false; + /** * Creates a new DeleteSpaceRequest instance using the specified properties. * @function create @@ -48178,6 +49235,8 @@ writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.useAdminAccess != null && Object.hasOwnProperty.call(message, "useAdminAccess")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.useAdminAccess); return writer; }; @@ -48216,6 +49275,10 @@ message.name = reader.string(); break; } + case 2: { + message.useAdminAccess = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -48254,6 +49317,9 @@ if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + if (typeof message.useAdminAccess !== "boolean") + return "useAdminAccess: boolean expected"; return null; }; @@ -48271,6 +49337,8 @@ var message = new $root.google.chat.v1.DeleteSpaceRequest(); if (object.name != null) message.name = String(object.name); + if (object.useAdminAccess != null) + message.useAdminAccess = Boolean(object.useAdminAccess); return message; }; @@ -48287,10 +49355,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.useAdminAccess = false; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.useAdminAccess != null && message.hasOwnProperty("useAdminAccess")) + object.useAdminAccess = message.useAdminAccess; return object; }; diff --git a/packages/google-chat/protos/protos.json b/packages/google-chat/protos/protos.json index 3d898cd610b..e29597e023b 100644 --- a/packages/google-chat/protos/protos.json +++ b/packages/google-chat/protos/protos.json @@ -2976,6 +2976,24 @@ } ] }, + "SearchSpaces": { + "requestType": "SearchSpacesRequest", + "responseType": "SearchSpacesResponse", + "options": { + "(google.api.http).get": "/v1/spaces:search", + "(google.api.method_signature)": "" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/spaces:search" + } + }, + { + "(google.api.method_signature)": "" + } + ] + }, "GetSpace": { "requestType": "GetSpaceRequest", "responseType": "Space", @@ -3398,6 +3416,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "useAdminAccess": { + "type": "bool", + "id": 5 } } }, @@ -3416,6 +3438,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "useAdminAccess": { + "type": "bool", + "id": 3 } } }, @@ -3463,6 +3489,10 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "useAdminAccess": { + "type": "bool", + "id": 8 } } }, @@ -3491,6 +3521,10 @@ "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).type": "chat.googleapis.com/Membership" } + }, + "useAdminAccess": { + "type": "bool", + "id": 3 } } }, @@ -3503,6 +3537,10 @@ "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).type": "chat.googleapis.com/Membership" } + }, + "useAdminAccess": { + "type": "bool", + "id": 2 } } }, @@ -4636,6 +4674,13 @@ "(google.api.field_behavior)": "OPTIONAL" } }, + "lastActiveTime": { + "type": "google.protobuf.Timestamp", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, "adminInstalled": { "type": "bool", "id": 19, @@ -4643,6 +4688,13 @@ "(google.api.field_behavior)": "OUTPUT_ONLY" } }, + "membershipCount": { + "type": "MembershipCount", + "id": 20, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, "accessSettings": { "type": "AccessSettings", "id": 23, @@ -4694,6 +4746,18 @@ } } }, + "MembershipCount": { + "fields": { + "joinedDirectHumanUserCount": { + "type": "int32", + "id": 4 + }, + "joinedGroupCount": { + "type": "int32", + "id": 5 + } + } + }, "AccessSettings": { "fields": { "accessState": { @@ -4788,6 +4852,10 @@ "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).type": "chat.googleapis.com/Space" } + }, + "useAdminAccess": { + "type": "bool", + "id": 2 } } }, @@ -4814,6 +4882,57 @@ "updateMask": { "type": "google.protobuf.FieldMask", "id": 2 + }, + "useAdminAccess": { + "type": "bool", + "id": 3 + } + } + }, + "SearchSpacesRequest": { + "fields": { + "useAdminAccess": { + "type": "bool", + "id": 1 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "query": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "orderBy": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SearchSpacesResponse": { + "fields": { + "spaces": { + "rule": "repeated", + "type": "Space", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 } } }, @@ -4826,6 +4945,10 @@ "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).type": "chat.googleapis.com/Space" } + }, + "useAdminAccess": { + "type": "bool", + "id": 2 } } }, diff --git a/packages/google-chat/samples/README.md b/packages/google-chat/samples/README.md index 1fc9f5de54e..d1c340e2284 100644 --- a/packages/google-chat/samples/README.md +++ b/packages/google-chat/samples/README.md @@ -34,6 +34,7 @@ * [Chat_service.list_reactions](#chat_service.list_reactions) * [Chat_service.list_space_events](#chat_service.list_space_events) * [Chat_service.list_spaces](#chat_service.list_spaces) + * [Chat_service.search_spaces](#chat_service.search_spaces) * [Chat_service.set_up_space](#chat_service.set_up_space) * [Chat_service.update_membership](#chat_service.update_membership) * [Chat_service.update_message](#chat_service.update_message) @@ -431,6 +432,23 @@ __Usage:__ +### Chat_service.search_spaces + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.search_spaces.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-chat/samples/generated/v1/chat_service.search_spaces.js,samples/README.md) + +__Usage:__ + + +`node packages/google-chat/samples/generated/v1/chat_service.search_spaces.js` + + +----- + + + + ### Chat_service.set_up_space View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-chat/samples/generated/v1/chat_service.set_up_space.js). diff --git a/packages/google-chat/samples/generated/v1/chat_service.create_membership.js b/packages/google-chat/samples/generated/v1/chat_service.create_membership.js index 3a4059bf015..3931cf503f9 100644 --- a/packages/google-chat/samples/generated/v1/chat_service.create_membership.js +++ b/packages/google-chat/samples/generated/v1/chat_service.create_membership.js @@ -53,6 +53,19 @@ function main(parent, membership) { * scope, set `user.type` to `BOT`, and set `user.name` to `users/app`. */ // const membership = {} + /** + * 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 the `chat.admin.memberships` OAuth 2.0 + * scope (https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * Creating app memberships or creating memberships for users outside the + * administrator's Google Workspace organization isn't supported using admin + * access. + */ + // const useAdminAccess = true // Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1; diff --git a/packages/google-chat/samples/generated/v1/chat_service.delete_membership.js b/packages/google-chat/samples/generated/v1/chat_service.delete_membership.js index 0f10a6a7f79..0fe2f98d69d 100644 --- a/packages/google-chat/samples/generated/v1/chat_service.delete_membership.js +++ b/packages/google-chat/samples/generated/v1/chat_service.delete_membership.js @@ -42,6 +42,17 @@ function main(name) { * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. */ // const name = 'abc123' + /** + * 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 the `chat.admin.memberships` OAuth 2.0 + * scope (https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * Deleting app memberships in a space isn't supported using admin access. + */ + // const useAdminAccess = true // Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1; diff --git a/packages/google-chat/samples/generated/v1/chat_service.delete_space.js b/packages/google-chat/samples/generated/v1/chat_service.delete_space.js index 37b2f5fa560..bc74b47be03 100644 --- a/packages/google-chat/samples/generated/v1/chat_service.delete_space.js +++ b/packages/google-chat/samples/generated/v1/chat_service.delete_space.js @@ -33,6 +33,16 @@ function main(name) { * Format: `spaces/{space}` */ // const name = 'abc123' + /** + * 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 the `chat.admin.delete` OAuth 2.0 + * scope (https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + */ + // const useAdminAccess = true // Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1; diff --git a/packages/google-chat/samples/generated/v1/chat_service.get_membership.js b/packages/google-chat/samples/generated/v1/chat_service.get_membership.js index 4a049ade044..21260f3fe4b 100644 --- a/packages/google-chat/samples/generated/v1/chat_service.get_membership.js +++ b/packages/google-chat/samples/generated/v1/chat_service.get_membership.js @@ -41,6 +41,18 @@ function main(name) { * email of the Google Chat user. */ // const name = 'abc123' + /** + * 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 the `chat.admin.memberships` or `chat.admin.memberships.readonly` + * OAuth 2.0 + * scopes (https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * Getting app memberships in a space isn't supported when using admin access. + */ + // const useAdminAccess = true // Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1; diff --git a/packages/google-chat/samples/generated/v1/chat_service.get_space.js b/packages/google-chat/samples/generated/v1/chat_service.get_space.js index a9c882af8f7..0c5aff0f7d3 100644 --- a/packages/google-chat/samples/generated/v1/chat_service.get_space.js +++ b/packages/google-chat/samples/generated/v1/chat_service.get_space.js @@ -33,6 +33,16 @@ function main(name) { * Format: `spaces/{space}` */ // const name = 'abc123' + /** + * 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 the `chat.admin.spaces` or `chat.admin.spaces.readonly` OAuth 2.0 + * scopes (https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + */ + // const useAdminAccess = true // Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1; diff --git a/packages/google-chat/samples/generated/v1/chat_service.list_memberships.js b/packages/google-chat/samples/generated/v1/chat_service.list_memberships.js index 39667b2983a..5f15a3fc803 100644 --- a/packages/google-chat/samples/generated/v1/chat_service.list_memberships.js +++ b/packages/google-chat/samples/generated/v1/chat_service.list_memberships.js @@ -58,8 +58,8 @@ function main(parent) { * 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`. Developer - * Preview: You can also filter for `member.type` using the `!=` operator. + * 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 @@ -100,6 +100,18 @@ function main(parent) { * authentication (https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). */ // const showInvited = true + /** + * 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. + */ + // const useAdminAccess = true // Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1; diff --git a/packages/google-chat/samples/generated/v1/chat_service.search_spaces.js b/packages/google-chat/samples/generated/v1/chat_service.search_spaces.js new file mode 100644 index 00000000000..b97443763fc --- /dev/null +++ b/packages/google-chat/samples/generated/v1/chat_service.search_spaces.js @@ -0,0 +1,163 @@ +// Copyright 2024 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(query) { + // [START chat_v1_generated_ChatService_SearchSpaces_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. + */ + /** + * 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. + */ + // const useAdminAccess = true + /** + * 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. + */ + // const pageSize = 1234 + /** + * 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. + */ + // const pageToken = 'abc123' + /** + * 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") + * ``` + */ + // const query = 'abc123' + /** + * 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` + */ + // const orderBy = 'abc123' + + // Imports the Chat library + const {ChatServiceClient} = require('@google-apps/chat').v1; + + // Instantiates a client + const chatClient = new ChatServiceClient(); + + async function callSearchSpaces() { + // Construct request + const request = { + query, + }; + + // Run request + const iterable = chatClient.searchSpacesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchSpaces(); + // [END chat_v1_generated_ChatService_SearchSpaces_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_membership.js b/packages/google-chat/samples/generated/v1/chat_service.update_membership.js index 6c4d6dc7fa1..3369de25380 100644 --- a/packages/google-chat/samples/generated/v1/chat_service.update_membership.js +++ b/packages/google-chat/samples/generated/v1/chat_service.update_membership.js @@ -40,6 +40,16 @@ function main(membership, updateMask) { * - `role` */ // const updateMask = {} + /** + * 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 the `chat.admin.memberships` OAuth 2.0 + * scope (https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + */ + // const useAdminAccess = true // Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1; diff --git a/packages/google-chat/samples/generated/v1/chat_service.update_space.js b/packages/google-chat/samples/generated/v1/chat_service.update_space.js index a04e266f0c2..40e381e12de 100644 --- a/packages/google-chat/samples/generated/v1/chat_service.update_space.js +++ b/packages/google-chat/samples/generated/v1/chat_service.update_space.js @@ -81,6 +81,18 @@ function main(space) { * paths). `permission_settings` is not supported with admin access. */ // const updateMask = {} + /** + * 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 the `chat.admin.spaces` OAuth 2.0 + * scope (https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * Some `FieldMask` values are not supported using admin access. For details, + * see the description of `update_mask`. + */ + // const useAdminAccess = true // Imports the Chat library const {ChatServiceClient} = require('@google-apps/chat').v1; 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 9e892e81d33..dd3283d4510 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 @@ -142,7 +142,7 @@ "segments": [ { "start": 25, - "end": 123, + "end": 135, "type": "FULL" } ], @@ -174,6 +174,10 @@ { "name": "show_invited", "type": "TYPE_BOOL" + }, + { + "name": "use_admin_access", + "type": "TYPE_BOOL" } ], "resultType": ".google.chat.v1.ListMembershipsResponse", @@ -202,7 +206,7 @@ "segments": [ { "start": 25, - "end": 62, + "end": 74, "type": "FULL" } ], @@ -214,6 +218,10 @@ { "name": "name", "type": "TYPE_STRING" + }, + { + "name": "use_admin_access", + "type": "TYPE_BOOL" } ], "resultType": ".google.chat.v1.Membership", @@ -495,6 +503,62 @@ } } }, + { + "regionTag": "chat_v1_generated_ChatService_SearchSpaces_async", + "title": "ChatService searchSpaces Sample", + "origin": "API_DEFINITION", + "description": " Returns a list of spaces in a Google Workspace organization based on an administrator's search. Requires [user authentication with administrator privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). In the request, set `use_admin_access` to `true`.", + "canonical": true, + "file": "chat_service.search_spaces.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 155, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchSpaces", + "fullName": "google.chat.v1.ChatService.SearchSpaces", + "async": true, + "parameters": [ + { + "name": "use_admin_access", + "type": "TYPE_BOOL" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.chat.v1.SearchSpacesResponse", + "client": { + "shortName": "ChatServiceClient", + "fullName": "google.chat.v1.ChatServiceClient" + }, + "method": { + "shortName": "SearchSpaces", + "fullName": "google.chat.v1.ChatService.SearchSpaces", + "service": { + "shortName": "ChatService", + "fullName": "google.chat.v1.ChatService" + } + } + } + }, { "regionTag": "chat_v1_generated_ChatService_GetSpace_async", "title": "ChatService getSpace Sample", @@ -506,7 +570,7 @@ "segments": [ { "start": 25, - "end": 54, + "end": 64, "type": "FULL" } ], @@ -518,6 +582,10 @@ { "name": "name", "type": "TYPE_STRING" + }, + { + "name": "use_admin_access", + "type": "TYPE_BOOL" } ], "resultType": ".google.chat.v1.Space", @@ -638,7 +706,7 @@ "segments": [ { "start": 25, - "end": 102, + "end": 114, "type": "FULL" } ], @@ -654,6 +722,10 @@ { "name": "update_mask", "type": ".google.protobuf.FieldMask" + }, + { + "name": "use_admin_access", + "type": "TYPE_BOOL" } ], "resultType": ".google.chat.v1.Space", @@ -682,7 +754,7 @@ "segments": [ { "start": 25, - "end": 54, + "end": 64, "type": "FULL" } ], @@ -694,6 +766,10 @@ { "name": "name", "type": "TYPE_STRING" + }, + { + "name": "use_admin_access", + "type": "TYPE_BOOL" } ], "resultType": ".google.protobuf.Empty", @@ -802,7 +878,7 @@ "segments": [ { "start": 25, - "end": 75, + "end": 88, "type": "FULL" } ], @@ -818,6 +894,10 @@ { "name": "membership", "type": ".google.chat.v1.Membership" + }, + { + "name": "use_admin_access", + "type": "TYPE_BOOL" } ], "resultType": ".google.chat.v1.Membership", @@ -846,7 +926,7 @@ "segments": [ { "start": 25, - "end": 62, + "end": 72, "type": "FULL" } ], @@ -862,6 +942,10 @@ { "name": "update_mask", "type": ".google.protobuf.FieldMask" + }, + { + "name": "use_admin_access", + "type": "TYPE_BOOL" } ], "resultType": ".google.chat.v1.Membership", @@ -890,7 +974,7 @@ "segments": [ { "start": 25, - "end": 63, + "end": 74, "type": "FULL" } ], @@ -902,6 +986,10 @@ { "name": "name", "type": "TYPE_STRING" + }, + { + "name": "use_admin_access", + "type": "TYPE_BOOL" } ], "resultType": ".google.chat.v1.Membership", diff --git a/packages/google-chat/src/v1/chat_service_client.ts b/packages/google-chat/src/v1/chat_service_client.ts index ee520b7c7d0..8420ca357c2 100644 --- a/packages/google-chat/src/v1/chat_service_client.ts +++ b/packages/google-chat/src/v1/chat_service_client.ts @@ -249,6 +249,11 @@ export class ChatServiceClient { 'nextPageToken', 'spaces' ), + searchSpaces: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'spaces' + ), listReactions: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', @@ -321,6 +326,7 @@ export class ChatServiceClient { 'getAttachment', 'uploadAttachment', 'listSpaces', + 'searchSpaces', 'getSpace', 'createSpace', 'setUpSpace', @@ -633,6 +639,19 @@ export class ChatServiceClient { * you can use the user's email as an alias for `{member}`. For example, * `spaces/{space}/members/example@gmail.com` where `example@gmail.com` is the * email of the Google Chat user. + * @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 the `chat.admin.memberships` or `chat.admin.memberships.readonly` + * [OAuth 2.0 + * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * + * Getting 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. @@ -1240,6 +1259,16 @@ export class ChatServiceClient { * Required. Resource name of the space, in the form `spaces/{space}`. * * Format: `spaces/{space}` + * @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 the `chat.admin.spaces` or `chat.admin.spaces.readonly` [OAuth 2.0 + * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). * @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. @@ -1675,6 +1704,19 @@ export class ChatServiceClient { * `permission_settings.reply_messages` * (Warning: mutually exclusive with all other non-permission settings field * paths). `permission_settings` is not supported with admin access. + * @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 the `chat.admin.spaces` [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * + * Some `FieldMask` values are not supported using admin access. For details, + * see the description of `update_mask`. * @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. @@ -1766,6 +1808,16 @@ export class ChatServiceClient { * Required. Resource name of the space to delete. * * Format: `spaces/{space}` + * @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 the `chat.admin.delete` [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). * @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. @@ -2098,6 +2150,20 @@ export class ChatServiceClient { * `users/user@example.com` or `users/123456789`. When a Chat app creates a * membership relation for itself, it must use the `chat.memberships.app` * scope, set `user.type` to `BOT`, and set `user.name` to `users/app`. + * @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 the `chat.admin.memberships` [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * + * Creating app memberships or creating memberships for users outside the + * administrator's Google Workspace organization isn't supported 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. @@ -2192,6 +2258,16 @@ export class ChatServiceClient { * Currently supported field paths: * * - `role` + * @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 the `chat.admin.memberships` [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). * @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. @@ -2292,6 +2368,18 @@ export class ChatServiceClient { * and `spaces/{space}/members/app` format. * * Format: `spaces/{space}/members/{member}` or `spaces/{space}/members/app`. + * @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 the `chat.admin.memberships` [OAuth 2.0 + * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). + * + * Deleting app memberships in a space isn't supported 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. @@ -3409,8 +3497,8 @@ export class ChatServiceClient { * * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. * - * To filter by type, set `member.type` to `HUMAN` or `BOT`. Developer - * Preview: You can also filter for `member.type` using the `!=` operator. + * 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. @@ -3454,6 +3542,19 @@ export class ChatServiceClient { * * Currently requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * @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.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. @@ -3569,8 +3670,8 @@ export class ChatServiceClient { * * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. * - * To filter by type, set `member.type` to `HUMAN` or `BOT`. Developer - * Preview: You can also filter for `member.type` using the `!=` operator. + * 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. @@ -3614,6 +3715,19 @@ export class ChatServiceClient { * * Currently requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * @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.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} @@ -3685,8 +3799,8 @@ export class ChatServiceClient { * * To filter by role, set `role` to `ROLE_MEMBER` or `ROLE_MANAGER`. * - * To filter by type, set `member.type` to `HUMAN` or `BOT`. Developer - * Preview: You can also filter for `member.type` using the `!=` operator. + * 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. @@ -3730,6 +3844,19 @@ export class ChatServiceClient { * * Currently requires [user * authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). + * @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.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} @@ -4037,6 +4164,527 @@ export class ChatServiceClient { callSettings ) as AsyncIterable; } + /** + * Returns a list of spaces in a Google Workspace organization based on an + * administrator's search. Requires [user + * authentication with administrator + * privileges](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user#admin-privileges). + * In the request, set `use_admin_access` to `true`. + * + * @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 {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 `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. + */ + searchSpaces( + request?: protos.google.chat.v1.ISearchSpacesRequest, + options?: CallOptions + ): 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 || {}; + this.initialize(); + return this.innerApiCalls.searchSpaces(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, 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(); + return this.descriptors.page.searchSpaces.createStream( + this.innerApiCalls.searchSpaces as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `searchSpaces`, 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 {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 {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(); + 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 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 1f38421e687..86bbee997a4 100644 --- a/packages/google-chat/src/v1/chat_service_client_config.json +++ b/packages/google-chat/src/v1/chat_service_client_config.json @@ -82,6 +82,11 @@ "retry_codes_name": "unavailable", "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" }, + "SearchSpaces": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, "GetSpace": { "timeout_millis": 30000, "retry_codes_name": "unavailable", diff --git a/packages/google-chat/src/v1/gapic_metadata.json b/packages/google-chat/src/v1/gapic_metadata.json index 5f4dbe23cd8..b4b2079f5b7 100644 --- a/packages/google-chat/src/v1/gapic_metadata.json +++ b/packages/google-chat/src/v1/gapic_metadata.json @@ -146,6 +146,13 @@ "listSpacesAsync" ] }, + "SearchSpaces": { + "methods": [ + "searchSpaces", + "searchSpacesStream", + "searchSpacesAsync" + ] + }, "ListReactions": { "methods": [ "listReactions", @@ -301,6 +308,13 @@ "listSpacesAsync" ] }, + "SearchSpaces": { + "methods": [ + "searchSpaces", + "searchSpacesStream", + "searchSpacesAsync" + ] + }, "ListReactions": { "methods": [ "listReactions", diff --git a/packages/google-chat/test/gapic_chat_service_v1.ts b/packages/google-chat/test/gapic_chat_service_v1.ts index 8c403d5cb15..6eb5715fcb0 100644 --- a/packages/google-chat/test/gapic_chat_service_v1.ts +++ b/packages/google-chat/test/gapic_chat_service_v1.ts @@ -3965,6 +3965,209 @@ describe('v1.ChatServiceClient', () => { }); }); + describe('searchSpaces', () => { + it('invokes searchSpaces without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + 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.searchSpaces = stubSimpleCall(expectedResponse); + const [response] = await client.searchSpaces(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchSpaces without error using callback', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + 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.searchSpaces = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchSpaces( + request, + ( + err?: Error | null, + result?: protos.google.chat.v1.ISpace[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes searchSpaces with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.SearchSpacesRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchSpaces = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.searchSpaces(request), expectedError); + }); + + it('invokes searchSpacesStream without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + 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.descriptors.page.searchSpaces.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchSpacesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.chat.v1.Space[] = []; + stream.on('data', (response: protos.google.chat.v1.Space) => { + 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.searchSpaces.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchSpaces, request) + ); + }); + + it('invokes searchSpacesStream with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.SearchSpacesRequest() + ); + const expectedError = new Error('expected'); + 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.Space[] = []; + stream.on('data', (response: protos.google.chat.v1.Space) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.searchSpaces.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchSpaces, request) + ); + }); + + it('uses async iteration with searchSpaces without error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + 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.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.searchSpaces.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + + it('uses async iteration with searchSpaces with error', async () => { + const client = new chatserviceModule.v1.ChatServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.chat.v1.SearchSpacesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.searchSpaces.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchSpacesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.chat.v1.ISpace[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.searchSpaces.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + describe('listReactions', () => { it('invokes listReactions without error', async () => { const client = new chatserviceModule.v1.ChatServiceClient({