@google-apps/chat 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -189,6 +189,7 @@ class ChatServiceClient {
189
189
  this.descriptors.page = {
190
190
  listMessages: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'messages'),
191
191
  listMemberships: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'memberships'),
192
+ searchMessages: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'),
192
193
  listSpaces: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
193
194
  searchSpaces: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
194
195
  findGroupChats: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
@@ -239,6 +240,7 @@ class ChatServiceClient {
239
240
  'getMessage',
240
241
  'updateMessage',
241
242
  'deleteMessage',
243
+ 'searchMessages',
242
244
  'getAttachment',
243
245
  'uploadAttachment',
244
246
  'listSpaces',
@@ -2538,6 +2540,437 @@ class ChatServiceClient {
2538
2540
  this._log.info('listMemberships iterate %j', request);
2539
2541
  return this.descriptors.page.listMemberships.asyncIterate(this.innerApiCalls['listMemberships'], request, callSettings);
2540
2542
  }
2543
+ searchMessages(request, optionsOrCallback, callback) {
2544
+ request = request || {};
2545
+ let options;
2546
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2547
+ callback = optionsOrCallback;
2548
+ options = {};
2549
+ }
2550
+ else {
2551
+ options = optionsOrCallback;
2552
+ }
2553
+ options = options || {};
2554
+ options.otherArgs = options.otherArgs || {};
2555
+ options.otherArgs.headers = options.otherArgs.headers || {};
2556
+ options.otherArgs.headers['x-goog-request-params'] =
2557
+ this._gaxModule.routingHeader.fromParams({
2558
+ parent: request.parent ?? '',
2559
+ });
2560
+ this.initialize().catch((err) => {
2561
+ throw err;
2562
+ });
2563
+ const wrappedCallback = callback
2564
+ ? (error, values, nextPageRequest, rawResponse) => {
2565
+ this._log.info('searchMessages values %j', values);
2566
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
2567
+ }
2568
+ : undefined;
2569
+ this._log.info('searchMessages request %j', request);
2570
+ return this.innerApiCalls
2571
+ .searchMessages(request, options, wrappedCallback)
2572
+ ?.then(([response, input, output]) => {
2573
+ this._log.info('searchMessages values %j', response);
2574
+ return [response, input, output];
2575
+ });
2576
+ }
2577
+ /**
2578
+ * Equivalent to `searchMessages`, but returns a NodeJS Stream object.
2579
+ * @param {Object} request
2580
+ * The request object that will be sent.
2581
+ * @param {string} request.parent
2582
+ * Required. The resource name of the space to search within.
2583
+ *
2584
+ * To search across all spaces the user has access to, set this field to
2585
+ * `spaces/-`. Using any other value for `parent` results in an
2586
+ * `INVALID_ARGUMENT` error.
2587
+ *
2588
+ * To limit the search to one or more spaces, use `space.name` or
2589
+ * `space.display_name` in the `filter`.
2590
+ * @param {string} request.filter
2591
+ * Required. A search query.
2592
+ *
2593
+ * The query can specify one or more search keywords, which are used to filter
2594
+ * the results,
2595
+ *
2596
+ * You can also filter the results using the following message fields:
2597
+ *
2598
+ * - `create_time`: Accepts a timestamp in
2599
+ * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the
2600
+ * supported comparison operators are: `<` and `>=`.
2601
+ * - `sender.name`: The resource name of the sender (`users/{user}`). Only
2602
+ * supports `=`. You can use the e-mail as an alias for `{user}`. For
2603
+ * example, `users/example@gmail.com`, where `example@gmail.com` is the
2604
+ * e-mail of the Google Chat user.
2605
+ * - `space.name`: The resource name of the space where the message is posted.
2606
+ * (`spaces/{space}`). Only supports `=`. If this filter is not set, the
2607
+ * search is performed across all direct messages and spaces the user has
2608
+ * access to as a space member.
2609
+ * - `space.display_name`: Supports the operator `:` (has) and filters spaces
2610
+ * based on a partial match of their display name. Results are limited to
2611
+ * the top five space matches. For example, `space.display_name:Project`
2612
+ * searches for messages in the top five spaces that contain the word
2613
+ * "Project" in their display names.
2614
+ * - `attachment`: Supports the operator `:*` (has any) to check for the
2615
+ * presence of attachments. If `attachment:*` is specified, only messages
2616
+ * that have at least one attachment are returned.
2617
+ * - `annotations.user_mentions.user.name`: The resource name of the mentioned
2618
+ * user (`users/{user}`). Only supports `:` (has). For example:
2619
+ * `annotations.user_mentions.user.name:"users/1234567890"` returns only
2620
+ * messages that contain a mention to the specified user. Alternatively, the
2621
+ * alias `me` can be used to filter for messages that mention the caller
2622
+ * user, for example: `annotations.user_mentions.user.name:users/me`. You
2623
+ * can also use the e-mail as an alias for `{user}`, for example,
2624
+ * `users/example@gmail.com`.
2625
+ *
2626
+ * For advanced filtering, the following functions are also available:
2627
+ *
2628
+ * - `has_link()`: Returns only messages that have at least one hyperlink in
2629
+ * the message text.
2630
+ * - `is_unread()`: Filters out messages that have been read by the calling
2631
+ * user.
2632
+ *
2633
+ * Using the `space.display_name` filter requires that the calling credentials
2634
+ * include one of the following [authorization
2635
+ * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
2636
+ *
2637
+ * - `https://www.googleapis.com/auth/chat.spaces.readonly`
2638
+ * - `https://www.googleapis.com/auth/chat.spaces`
2639
+ *
2640
+ * Using the `is_unread()` filter requires that the calling credentials
2641
+ * include one of the following [authorization
2642
+ * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
2643
+ *
2644
+ * - `https://www.googleapis.com/auth/chat.users.readstate.readonly`
2645
+ * - `https://www.googleapis.com/auth/chat.users.readstate`
2646
+ *
2647
+ *
2648
+ * Across different fields, only `AND` operators are supported. A valid
2649
+ * example is `sender.name = "users/1234567890" AND is_unread()`. The word
2650
+ * `AND` is optional and is implied if omitted. For example, `sender.name =
2651
+ * "users/1234567890" is_unread()` is valid and is equivalent to the previous
2652
+ * example. An invalid example is `sender.name = "users/1234567890" OR
2653
+ * is_unread()` because `OR` is not supported between different fields.
2654
+ *
2655
+ * Among the same field:
2656
+ *
2657
+ * - `create_time` supports only `AND`, and can only be used to represent
2658
+ * an interval, such as `create_time >= "2022-01-01T00:00:00+00:00" AND
2659
+ * create_time < "2023-01-01T00:00:00+00:00"`.
2660
+ * - `sender.name` supports only the `OR` operator, for example:
2661
+ * `sender.name = "users/1234567890" OR sender.name = "users/0987654321"`.
2662
+ * - `space.name` supports only the `OR` operator, for example:
2663
+ * `space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI"`.
2664
+ * - `space.display_name` supports the operators `AND` and `OR`, but not a
2665
+ * mix of both. For example:
2666
+ * `space.display_name:Project AND space.display_name:Tasks` returns
2667
+ * messages that are in spaces with display names containing both `Project`
2668
+ * and `Tasks`, whereas
2669
+ * `space.display_name:Project OR space.display_name:Tasks` returns messages
2670
+ * that are in spaces with display names containing either `Project` or
2671
+ * `Tasks` or both.
2672
+ * - `annotations.user_mentions.user.name` supports the operators `AND` and
2673
+ * `OR`, but not a mix of both. For example:
2674
+ * `annotations.user_mentions.user.name:"users/1234567890" AND
2675
+ * annotations.user_mentions.user.name:"users/0987654321"` returns only
2676
+ * messages that mentions both users, whereas
2677
+ * `annotations.user_mentions.user.name:"users/1234567890" OR
2678
+ * annotations.user_mentions.user.name:"users/0987654321"` returns messages
2679
+ * that mention either user or both.
2680
+ *
2681
+ * Parentheses are required to disambiguate operator precedence when combining
2682
+ * `AND` and `OR` operators in the same query. For example:
2683
+ * `(sender.name="users/me" OR sender.name="users/123456") AND is_unread()`.
2684
+ * Otherwise, parentheses are optional.
2685
+ *
2686
+ * The following example queries are valid:
2687
+ *
2688
+ * ```
2689
+ * "Pending reports" AND create_time >= "2023-01-01T00:00:00Z"
2690
+ *
2691
+ * sender.name = "users/example@gmail.com"
2692
+ *
2693
+ * annotations.user_mentions.user.name:"users/0987654321"
2694
+ *
2695
+ * attachment:* AND space.name = "spaces/ABCDEFGH"
2696
+ *
2697
+ * tasks AND is_unread() AND sender.name = "users/1234567890"
2698
+ *
2699
+ * "things to do" "urgent"
2700
+ *
2701
+ * (sender.name = "users/1234567890")
2702
+ * AND (create_time < "2023-05-01T00:00:00Z")
2703
+ *
2704
+ * tasks AND space.name = "spaces/ABCDEFGH" AND has_link()
2705
+ *
2706
+ * "project one" is_unread()
2707
+ *
2708
+ * space.display_name:Project tasks
2709
+ * ```
2710
+ *
2711
+ * The maximum query length is 1,000 characters.
2712
+ *
2713
+ * Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
2714
+ * error.
2715
+ * @param {number} [request.pageSize]
2716
+ * Optional. The maximum number of results to return. The service may return
2717
+ * fewer than this value.
2718
+ *
2719
+ * If unspecified, at most 25 are returned.
2720
+ *
2721
+ * The maximum value is 100. If you use a value more than 100, it's
2722
+ * automatically changed to 100.
2723
+ * @param {string} [request.pageToken]
2724
+ * Optional. A token, received from the previous search messages call. Provide
2725
+ * this parameter to retrieve the subsequent page.
2726
+ *
2727
+ * When paginating, all other parameters provided should match the call that
2728
+ * provided the page token. Passing different values to the other parameters
2729
+ * might lead to unexpected results.
2730
+ * @param {string} [request.orderBy]
2731
+ * Optional. How the results list is ordered.
2732
+ *
2733
+ * Supported attributes to order by are:
2734
+ *
2735
+ * - `create_time`: Sorts the results by the time of the message creation.
2736
+ * Default value.
2737
+ * - `relevance`: Sorts the results by relevance.
2738
+ * [Developer Preview](https://developers.google.com/workspace/preview).
2739
+ *
2740
+ * The default ordering is `create_time desc`. Only a single order per query
2741
+ * (`create_time` or `relevance`) is supported. Only descending order (`desc`)
2742
+ * is supported, and it must be specified after the order attribute.
2743
+ * @param {google.chat.v1.SearchMessagesRequest.SearchMessagesView} [request.view]
2744
+ * Optional. Specifies what kind of search results view to return. The default
2745
+ * is `SEARCH_MESSAGES_VIEW_BASIC`.
2746
+ * @param {object} [options]
2747
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2748
+ * @returns {Stream}
2749
+ * An object stream which emits an object representing {@link protos.google.chat.v1.SearchMessageResult|SearchMessageResult} on 'data' event.
2750
+ * The client library will perform auto-pagination by default: it will call the API as many
2751
+ * times as needed. Note that it can affect your quota.
2752
+ * We recommend using `searchMessagesAsync()`
2753
+ * method described below for async iteration which you can stop as needed.
2754
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2755
+ * for more details and examples.
2756
+ */
2757
+ searchMessagesStream(request, options) {
2758
+ request = request || {};
2759
+ options = options || {};
2760
+ options.otherArgs = options.otherArgs || {};
2761
+ options.otherArgs.headers = options.otherArgs.headers || {};
2762
+ options.otherArgs.headers['x-goog-request-params'] =
2763
+ this._gaxModule.routingHeader.fromParams({
2764
+ parent: request.parent ?? '',
2765
+ });
2766
+ const defaultCallSettings = this._defaults['searchMessages'];
2767
+ const callSettings = defaultCallSettings.merge(options);
2768
+ this.initialize().catch((err) => {
2769
+ throw err;
2770
+ });
2771
+ this._log.info('searchMessages stream %j', request);
2772
+ return this.descriptors.page.searchMessages.createStream(this.innerApiCalls.searchMessages, request, callSettings);
2773
+ }
2774
+ /**
2775
+ * Equivalent to `searchMessages`, but returns an iterable object.
2776
+ *
2777
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
2778
+ * @param {Object} request
2779
+ * The request object that will be sent.
2780
+ * @param {string} request.parent
2781
+ * Required. The resource name of the space to search within.
2782
+ *
2783
+ * To search across all spaces the user has access to, set this field to
2784
+ * `spaces/-`. Using any other value for `parent` results in an
2785
+ * `INVALID_ARGUMENT` error.
2786
+ *
2787
+ * To limit the search to one or more spaces, use `space.name` or
2788
+ * `space.display_name` in the `filter`.
2789
+ * @param {string} request.filter
2790
+ * Required. A search query.
2791
+ *
2792
+ * The query can specify one or more search keywords, which are used to filter
2793
+ * the results,
2794
+ *
2795
+ * You can also filter the results using the following message fields:
2796
+ *
2797
+ * - `create_time`: Accepts a timestamp in
2798
+ * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the
2799
+ * supported comparison operators are: `<` and `>=`.
2800
+ * - `sender.name`: The resource name of the sender (`users/{user}`). Only
2801
+ * supports `=`. You can use the e-mail as an alias for `{user}`. For
2802
+ * example, `users/example@gmail.com`, where `example@gmail.com` is the
2803
+ * e-mail of the Google Chat user.
2804
+ * - `space.name`: The resource name of the space where the message is posted.
2805
+ * (`spaces/{space}`). Only supports `=`. If this filter is not set, the
2806
+ * search is performed across all direct messages and spaces the user has
2807
+ * access to as a space member.
2808
+ * - `space.display_name`: Supports the operator `:` (has) and filters spaces
2809
+ * based on a partial match of their display name. Results are limited to
2810
+ * the top five space matches. For example, `space.display_name:Project`
2811
+ * searches for messages in the top five spaces that contain the word
2812
+ * "Project" in their display names.
2813
+ * - `attachment`: Supports the operator `:*` (has any) to check for the
2814
+ * presence of attachments. If `attachment:*` is specified, only messages
2815
+ * that have at least one attachment are returned.
2816
+ * - `annotations.user_mentions.user.name`: The resource name of the mentioned
2817
+ * user (`users/{user}`). Only supports `:` (has). For example:
2818
+ * `annotations.user_mentions.user.name:"users/1234567890"` returns only
2819
+ * messages that contain a mention to the specified user. Alternatively, the
2820
+ * alias `me` can be used to filter for messages that mention the caller
2821
+ * user, for example: `annotations.user_mentions.user.name:users/me`. You
2822
+ * can also use the e-mail as an alias for `{user}`, for example,
2823
+ * `users/example@gmail.com`.
2824
+ *
2825
+ * For advanced filtering, the following functions are also available:
2826
+ *
2827
+ * - `has_link()`: Returns only messages that have at least one hyperlink in
2828
+ * the message text.
2829
+ * - `is_unread()`: Filters out messages that have been read by the calling
2830
+ * user.
2831
+ *
2832
+ * Using the `space.display_name` filter requires that the calling credentials
2833
+ * include one of the following [authorization
2834
+ * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
2835
+ *
2836
+ * - `https://www.googleapis.com/auth/chat.spaces.readonly`
2837
+ * - `https://www.googleapis.com/auth/chat.spaces`
2838
+ *
2839
+ * Using the `is_unread()` filter requires that the calling credentials
2840
+ * include one of the following [authorization
2841
+ * scopes](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes):
2842
+ *
2843
+ * - `https://www.googleapis.com/auth/chat.users.readstate.readonly`
2844
+ * - `https://www.googleapis.com/auth/chat.users.readstate`
2845
+ *
2846
+ *
2847
+ * Across different fields, only `AND` operators are supported. A valid
2848
+ * example is `sender.name = "users/1234567890" AND is_unread()`. The word
2849
+ * `AND` is optional and is implied if omitted. For example, `sender.name =
2850
+ * "users/1234567890" is_unread()` is valid and is equivalent to the previous
2851
+ * example. An invalid example is `sender.name = "users/1234567890" OR
2852
+ * is_unread()` because `OR` is not supported between different fields.
2853
+ *
2854
+ * Among the same field:
2855
+ *
2856
+ * - `create_time` supports only `AND`, and can only be used to represent
2857
+ * an interval, such as `create_time >= "2022-01-01T00:00:00+00:00" AND
2858
+ * create_time < "2023-01-01T00:00:00+00:00"`.
2859
+ * - `sender.name` supports only the `OR` operator, for example:
2860
+ * `sender.name = "users/1234567890" OR sender.name = "users/0987654321"`.
2861
+ * - `space.name` supports only the `OR` operator, for example:
2862
+ * `space.name = "spaces/ABCDEFGH" OR space.name = "spaces/QWERTYUI"`.
2863
+ * - `space.display_name` supports the operators `AND` and `OR`, but not a
2864
+ * mix of both. For example:
2865
+ * `space.display_name:Project AND space.display_name:Tasks` returns
2866
+ * messages that are in spaces with display names containing both `Project`
2867
+ * and `Tasks`, whereas
2868
+ * `space.display_name:Project OR space.display_name:Tasks` returns messages
2869
+ * that are in spaces with display names containing either `Project` or
2870
+ * `Tasks` or both.
2871
+ * - `annotations.user_mentions.user.name` supports the operators `AND` and
2872
+ * `OR`, but not a mix of both. For example:
2873
+ * `annotations.user_mentions.user.name:"users/1234567890" AND
2874
+ * annotations.user_mentions.user.name:"users/0987654321"` returns only
2875
+ * messages that mentions both users, whereas
2876
+ * `annotations.user_mentions.user.name:"users/1234567890" OR
2877
+ * annotations.user_mentions.user.name:"users/0987654321"` returns messages
2878
+ * that mention either user or both.
2879
+ *
2880
+ * Parentheses are required to disambiguate operator precedence when combining
2881
+ * `AND` and `OR` operators in the same query. For example:
2882
+ * `(sender.name="users/me" OR sender.name="users/123456") AND is_unread()`.
2883
+ * Otherwise, parentheses are optional.
2884
+ *
2885
+ * The following example queries are valid:
2886
+ *
2887
+ * ```
2888
+ * "Pending reports" AND create_time >= "2023-01-01T00:00:00Z"
2889
+ *
2890
+ * sender.name = "users/example@gmail.com"
2891
+ *
2892
+ * annotations.user_mentions.user.name:"users/0987654321"
2893
+ *
2894
+ * attachment:* AND space.name = "spaces/ABCDEFGH"
2895
+ *
2896
+ * tasks AND is_unread() AND sender.name = "users/1234567890"
2897
+ *
2898
+ * "things to do" "urgent"
2899
+ *
2900
+ * (sender.name = "users/1234567890")
2901
+ * AND (create_time < "2023-05-01T00:00:00Z")
2902
+ *
2903
+ * tasks AND space.name = "spaces/ABCDEFGH" AND has_link()
2904
+ *
2905
+ * "project one" is_unread()
2906
+ *
2907
+ * space.display_name:Project tasks
2908
+ * ```
2909
+ *
2910
+ * The maximum query length is 1,000 characters.
2911
+ *
2912
+ * Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
2913
+ * error.
2914
+ * @param {number} [request.pageSize]
2915
+ * Optional. The maximum number of results to return. The service may return
2916
+ * fewer than this value.
2917
+ *
2918
+ * If unspecified, at most 25 are returned.
2919
+ *
2920
+ * The maximum value is 100. If you use a value more than 100, it's
2921
+ * automatically changed to 100.
2922
+ * @param {string} [request.pageToken]
2923
+ * Optional. A token, received from the previous search messages call. Provide
2924
+ * this parameter to retrieve the subsequent page.
2925
+ *
2926
+ * When paginating, all other parameters provided should match the call that
2927
+ * provided the page token. Passing different values to the other parameters
2928
+ * might lead to unexpected results.
2929
+ * @param {string} [request.orderBy]
2930
+ * Optional. How the results list is ordered.
2931
+ *
2932
+ * Supported attributes to order by are:
2933
+ *
2934
+ * - `create_time`: Sorts the results by the time of the message creation.
2935
+ * Default value.
2936
+ * - `relevance`: Sorts the results by relevance.
2937
+ * [Developer Preview](https://developers.google.com/workspace/preview).
2938
+ *
2939
+ * The default ordering is `create_time desc`. Only a single order per query
2940
+ * (`create_time` or `relevance`) is supported. Only descending order (`desc`)
2941
+ * is supported, and it must be specified after the order attribute.
2942
+ * @param {google.chat.v1.SearchMessagesRequest.SearchMessagesView} [request.view]
2943
+ * Optional. Specifies what kind of search results view to return. The default
2944
+ * is `SEARCH_MESSAGES_VIEW_BASIC`.
2945
+ * @param {object} [options]
2946
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2947
+ * @returns {Object}
2948
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
2949
+ * When you iterate the returned iterable, each element will be an object representing
2950
+ * {@link protos.google.chat.v1.SearchMessageResult|SearchMessageResult}. The API will be called under the hood as needed, once per the page,
2951
+ * so you can stop the iteration when you don't need more results.
2952
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2953
+ * for more details and examples.
2954
+ * @example <caption>include:samples/generated/v1/chat_service.search_messages.js</caption>
2955
+ * region_tag:chat_v1_generated_ChatService_SearchMessages_async
2956
+ */
2957
+ searchMessagesAsync(request, options) {
2958
+ request = request || {};
2959
+ options = options || {};
2960
+ options.otherArgs = options.otherArgs || {};
2961
+ options.otherArgs.headers = options.otherArgs.headers || {};
2962
+ options.otherArgs.headers['x-goog-request-params'] =
2963
+ this._gaxModule.routingHeader.fromParams({
2964
+ parent: request.parent ?? '',
2965
+ });
2966
+ const defaultCallSettings = this._defaults['searchMessages'];
2967
+ const callSettings = defaultCallSettings.merge(options);
2968
+ this.initialize().catch((err) => {
2969
+ throw err;
2970
+ });
2971
+ this._log.info('searchMessages iterate %j', request);
2972
+ return this.descriptors.page.searchMessages.asyncIterate(this.innerApiCalls['searchMessages'], request, callSettings);
2973
+ }
2541
2974
  listSpaces(request, optionsOrCallback, callback) {
2542
2975
  request = request || {};
2543
2976
  let options;
@@ -2744,9 +3177,6 @@ class ChatServiceClient {
2744
3177
  * Requires either the `chat.admin.spaces.readonly` or `chat.admin.spaces`
2745
3178
  * [OAuth 2.0
2746
3179
  * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
2747
- *
2748
- * This method currently only supports admin access, thus only `true` is
2749
- * accepted for this field.
2750
3180
  * @param {number} request.pageSize
2751
3181
  * The maximum number of spaces to return. The service may return fewer than
2752
3182
  * this value.
@@ -2765,7 +3195,8 @@ class ChatServiceClient {
2765
3195
  * @param {string} request.query
2766
3196
  * Required. A search query.
2767
3197
  *
2768
- * You can search by using the following parameters:
3198
+ * You can search by using the following parameters when `useAdminAccess`
3199
+ * is set to `true`:
2769
3200
  *
2770
3201
  * - `create_time`
2771
3202
  * - `customer`
@@ -2775,18 +3206,27 @@ class ChatServiceClient {
2775
3206
  * - `space_history_state`
2776
3207
  * - `space_type`
2777
3208
  *
3209
+ * When `useAdminAccess` is set to `false`:
3210
+ *
3211
+ * - `display_name`
3212
+ * - `external_user_allowed`
3213
+ * - `space_type`
3214
+ *
2778
3215
  * `create_time` and `last_active_time` accept a timestamp in
2779
3216
  * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the supported
2780
3217
  * comparison operators are: `=`, `<`, `>`, `<=`, `>=`.
2781
3218
  *
2782
- * `customer` is required and is used to indicate which customer
2783
- * to fetch spaces from. `customers/my_customer` is the only supported value.
3219
+ * `customer` is required when `useAdminAccess` is set to `true`, and is
3220
+ * used to indicate which customer to fetch spaces from.
3221
+ * `customers/my_customer` is the only supported value.
2784
3222
  *
2785
3223
  * `display_name` only accepts the `HAS` (`:`) operator. The text to
2786
3224
  * match is first tokenized into tokens and each token is prefix-matched
2787
3225
  * case-insensitively and independently as a substring anywhere in the space's
2788
3226
  * `display_name`. For example, `Fun Eve` matches `Fun event` or `The
2789
- * evening was fun`, but not `notFun event` or `even`.
3227
+ * evening was fun`, but not `notFun event` or `even`. When `useAdminAccess`
3228
+ * is set to `false`, `display_name` is required to retrieve meaningful
3229
+ * results. Otherwise, the default behavior is to return an empty response.
2790
3230
  *
2791
3231
  * `external_user_allowed` accepts either `true` or `false`.
2792
3232
  *
@@ -2809,7 +3249,8 @@ class ChatServiceClient {
2809
3249
  * < "2022-01-01T00:00:00+00:00" AND last_active_time >
2810
3250
  * "2023-01-01T00:00:00+00:00"`.
2811
3251
  *
2812
- * The following example queries are valid:
3252
+ * The following example queries are valid when `useAdminAccess` is set to
3253
+ * `true`:
2813
3254
  *
2814
3255
  * ```
2815
3256
  * customer = "customers/my_customer" AND space_type = "SPACE"
@@ -2831,6 +3272,21 @@ class ChatServiceClient {
2831
3272
  * "2020-01-01T00:00:00+00:00") AND (external_user_allowed = "true") AND
2832
3273
  * (space_history_state = "HISTORY_ON" OR space_history_state = "HISTORY_OFF")
2833
3274
  * ```
3275
+ *
3276
+ * The following example queries are valid when `useAdminAccess` is set to
3277
+ * `false`:
3278
+ *
3279
+ * ```
3280
+ * display_name:"Hello World" AND space_type = "SPACE"
3281
+ *
3282
+ * (display_name:"Hello" OR display_name:"Fun") AND space_type = "SPACE"
3283
+ *
3284
+ * (external_user_allowed = "true" AND space_type = "SPACE") // Returns an
3285
+ * empty response.
3286
+ *
3287
+ * (external_user_allowed = "true" AND display_name:"Hello" AND space_type =
3288
+ * "SPACE")
3289
+ * ```
2834
3290
  * @param {string} [request.orderBy]
2835
3291
  * Optional. How the list of spaces is ordered.
2836
3292
  *
@@ -2842,13 +3298,17 @@ class ChatServiceClient {
2842
3298
  * any topic of this space.
2843
3299
  * - `create_time` — Denotes the time of the space creation.
2844
3300
  *
3301
+ * When `useAdminAccess` is `false`, only `create_time` and `relevance` are
3302
+ * supported for ordering. Only `DESC` is supported for these fields in
3303
+ * non-admin searches.
3304
+ *
2845
3305
  * Valid ordering operation values are:
2846
3306
  *
2847
3307
  * - `ASC` for ascending. Default value.
2848
3308
  *
2849
3309
  * - `DESC` for descending.
2850
3310
  *
2851
- * The supported syntax are:
3311
+ * The supported syntax are when `useAdminAccess` is set to `true`:
2852
3312
  *
2853
3313
  * - `membership_count.joined_direct_human_user_count DESC`
2854
3314
  * - `membership_count.joined_direct_human_user_count ASC`
@@ -2856,6 +3316,11 @@ class ChatServiceClient {
2856
3316
  * - `last_active_time ASC`
2857
3317
  * - `create_time DESC`
2858
3318
  * - `create_time ASC`
3319
+ *
3320
+ * When `useAdminAccess` is set to `false`:
3321
+ *
3322
+ * - `create_time DESC`
3323
+ * - `relevance DESC`
2859
3324
  * @param {object} [options]
2860
3325
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2861
3326
  * @returns {Stream}
@@ -2897,9 +3362,6 @@ class ChatServiceClient {
2897
3362
  * Requires either the `chat.admin.spaces.readonly` or `chat.admin.spaces`
2898
3363
  * [OAuth 2.0
2899
3364
  * scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes).
2900
- *
2901
- * This method currently only supports admin access, thus only `true` is
2902
- * accepted for this field.
2903
3365
  * @param {number} request.pageSize
2904
3366
  * The maximum number of spaces to return. The service may return fewer than
2905
3367
  * this value.
@@ -2918,7 +3380,8 @@ class ChatServiceClient {
2918
3380
  * @param {string} request.query
2919
3381
  * Required. A search query.
2920
3382
  *
2921
- * You can search by using the following parameters:
3383
+ * You can search by using the following parameters when `useAdminAccess`
3384
+ * is set to `true`:
2922
3385
  *
2923
3386
  * - `create_time`
2924
3387
  * - `customer`
@@ -2928,18 +3391,27 @@ class ChatServiceClient {
2928
3391
  * - `space_history_state`
2929
3392
  * - `space_type`
2930
3393
  *
3394
+ * When `useAdminAccess` is set to `false`:
3395
+ *
3396
+ * - `display_name`
3397
+ * - `external_user_allowed`
3398
+ * - `space_type`
3399
+ *
2931
3400
  * `create_time` and `last_active_time` accept a timestamp in
2932
3401
  * [RFC-3339](https://www.rfc-editor.org/rfc/rfc3339) format and the supported
2933
3402
  * comparison operators are: `=`, `<`, `>`, `<=`, `>=`.
2934
3403
  *
2935
- * `customer` is required and is used to indicate which customer
2936
- * to fetch spaces from. `customers/my_customer` is the only supported value.
3404
+ * `customer` is required when `useAdminAccess` is set to `true`, and is
3405
+ * used to indicate which customer to fetch spaces from.
3406
+ * `customers/my_customer` is the only supported value.
2937
3407
  *
2938
3408
  * `display_name` only accepts the `HAS` (`:`) operator. The text to
2939
3409
  * match is first tokenized into tokens and each token is prefix-matched
2940
3410
  * case-insensitively and independently as a substring anywhere in the space's
2941
3411
  * `display_name`. For example, `Fun Eve` matches `Fun event` or `The
2942
- * evening was fun`, but not `notFun event` or `even`.
3412
+ * evening was fun`, but not `notFun event` or `even`. When `useAdminAccess`
3413
+ * is set to `false`, `display_name` is required to retrieve meaningful
3414
+ * results. Otherwise, the default behavior is to return an empty response.
2943
3415
  *
2944
3416
  * `external_user_allowed` accepts either `true` or `false`.
2945
3417
  *
@@ -2962,7 +3434,8 @@ class ChatServiceClient {
2962
3434
  * < "2022-01-01T00:00:00+00:00" AND last_active_time >
2963
3435
  * "2023-01-01T00:00:00+00:00"`.
2964
3436
  *
2965
- * The following example queries are valid:
3437
+ * The following example queries are valid when `useAdminAccess` is set to
3438
+ * `true`:
2966
3439
  *
2967
3440
  * ```
2968
3441
  * customer = "customers/my_customer" AND space_type = "SPACE"
@@ -2984,6 +3457,21 @@ class ChatServiceClient {
2984
3457
  * "2020-01-01T00:00:00+00:00") AND (external_user_allowed = "true") AND
2985
3458
  * (space_history_state = "HISTORY_ON" OR space_history_state = "HISTORY_OFF")
2986
3459
  * ```
3460
+ *
3461
+ * The following example queries are valid when `useAdminAccess` is set to
3462
+ * `false`:
3463
+ *
3464
+ * ```
3465
+ * display_name:"Hello World" AND space_type = "SPACE"
3466
+ *
3467
+ * (display_name:"Hello" OR display_name:"Fun") AND space_type = "SPACE"
3468
+ *
3469
+ * (external_user_allowed = "true" AND space_type = "SPACE") // Returns an
3470
+ * empty response.
3471
+ *
3472
+ * (external_user_allowed = "true" AND display_name:"Hello" AND space_type =
3473
+ * "SPACE")
3474
+ * ```
2987
3475
  * @param {string} [request.orderBy]
2988
3476
  * Optional. How the list of spaces is ordered.
2989
3477
  *
@@ -2995,13 +3483,17 @@ class ChatServiceClient {
2995
3483
  * any topic of this space.
2996
3484
  * - `create_time` — Denotes the time of the space creation.
2997
3485
  *
3486
+ * When `useAdminAccess` is `false`, only `create_time` and `relevance` are
3487
+ * supported for ordering. Only `DESC` is supported for these fields in
3488
+ * non-admin searches.
3489
+ *
2998
3490
  * Valid ordering operation values are:
2999
3491
  *
3000
3492
  * - `ASC` for ascending. Default value.
3001
3493
  *
3002
3494
  * - `DESC` for descending.
3003
3495
  *
3004
- * The supported syntax are:
3496
+ * The supported syntax are when `useAdminAccess` is set to `true`:
3005
3497
  *
3006
3498
  * - `membership_count.joined_direct_human_user_count DESC`
3007
3499
  * - `membership_count.joined_direct_human_user_count ASC`
@@ -3009,6 +3501,11 @@ class ChatServiceClient {
3009
3501
  * - `last_active_time ASC`
3010
3502
  * - `create_time DESC`
3011
3503
  * - `create_time ASC`
3504
+ *
3505
+ * When `useAdminAccess` is set to `false`:
3506
+ *
3507
+ * - `create_time DESC`
3508
+ * - `relevance DESC`
3012
3509
  * @param {object} [options]
3013
3510
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3014
3511
  * @returns {Object}