-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
ChatServiceClient.java
4213 lines (4066 loc) · 207 KB
/
ChatServiceClient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* 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.
*/
package com.google.chat.v1;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.chat.v1.stub.ChatServiceStub;
import com.google.chat.v1.stub.ChatServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Enables developers to build Chat apps and integrations on Google Chat
* Platform.
*
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* SpaceName parent = SpaceName.of("[SPACE]");
* Message message = Message.newBuilder().build();
* String messageId = "messageId-1440013438";
* Message response = chatServiceClient.createMessage(parent, message, messageId);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the ChatServiceClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
* <table>
* <caption>Methods</caption>
* <tr>
* <th>Method</th>
* <th>Description</th>
* <th>Method Variants</th>
* </tr>
* <tr>
* <td><p> CreateMessage</td>
* <td><p> Creates a message in a Google Chat space. For an example, see [Send a message](https://developers.google.com/workspace/chat/create-messages).
* <p> Calling this method requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and supports the following authentication types:
* <p> - For text messages, user authentication or app authentication are supported. - For card messages, only app authentication is supported. (Only Chat apps can create card messages.)</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> createMessage(CreateMessageRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> createMessage(SpaceName parent, Message message, String messageId)
* <li><p> createMessage(String parent, Message message, String messageId)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> createMessageCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> ListMessages</td>
* <td><p> Lists messages in a space that the caller is a member of, including messages from blocked members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> listMessages(ListMessagesRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> listMessages(SpaceName parent)
* <li><p> listMessages(String parent)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> listMessagesPagedCallable()
* <li><p> listMessagesCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> ListMemberships</td>
* <td><p> Lists memberships in a space. For an example, see [List users and Google Chat apps in a space](https://developers.google.com/workspace/chat/list-members). Listing memberships with [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) lists memberships in spaces that the Chat app has access to, but excludes Chat app memberships, including its own. Listing memberships with [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) lists memberships in spaces that the authenticated user has access to.
* <p> Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> listMemberships(ListMembershipsRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> listMemberships(SpaceName parent)
* <li><p> listMemberships(String parent)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> listMembershipsPagedCallable()
* <li><p> listMembershipsCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> GetMembership</td>
* <td><p> Returns details about a membership. For an example, see [Get details about a user's or Google Chat app's membership](https://developers.google.com/workspace/chat/get-members).
* <p> Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> getMembership(GetMembershipRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> getMembership(MembershipName name)
* <li><p> getMembership(String name)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> getMembershipCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> GetMessage</td>
* <td><p> Returns details about a message. For an example, see [Get details about a message](https://developers.google.com/workspace/chat/get-messages).
* <p> Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
* <p> Note: Might return a message from a blocked member or space.</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> getMessage(GetMessageRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> getMessage(MessageName name)
* <li><p> getMessage(String name)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> getMessageCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> UpdateMessage</td>
* <td><p> Updates a message. There's a difference between the `patch` and `update` methods. The `patch` method uses a `patch` request while the `update` method uses a `put` request. We recommend using the `patch` method. For an example, see [Update a message](https://developers.google.com/workspace/chat/update-messages).
* <p> Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). When using app authentication, requests can only update messages created by the calling Chat app.</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> updateMessage(UpdateMessageRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> updateMessage(Message message, FieldMask updateMask)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> updateMessageCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> DeleteMessage</td>
* <td><p> Deletes a message. For an example, see [Delete a message](https://developers.google.com/workspace/chat/delete-messages).
* <p> Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user). When using app authentication, requests can only delete messages created by the calling Chat app.</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> deleteMessage(DeleteMessageRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> deleteMessage(MessageName name)
* <li><p> deleteMessage(String name)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> deleteMessageCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> GetAttachment</td>
* <td><p> Gets the metadata of a message attachment. The attachment data is fetched using the [media API](https://developers.google.com/workspace/chat/api/reference/rest/v1/media/download). For an example, see [Get metadata about a message attachment](https://developers.google.com/workspace/chat/get-media-attachments). Requires [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> getAttachment(GetAttachmentRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> getAttachment(AttachmentName name)
* <li><p> getAttachment(String name)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> getAttachmentCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> UploadAttachment</td>
* <td><p> Uploads an attachment. For an example, see [Upload media as a file attachment](https://developers.google.com/workspace/chat/upload-media-attachments). Requires user [authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
* <p> You can upload attachments up to 200 MB. Certain file types aren't supported. For details, see [File types blocked by Google Chat](https://support.google.com/chat/answer/7651457?&co=GENIE.Platform%3DDesktop#File%20types%20blocked%20in%20Google%20Chat).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> uploadAttachment(UploadAttachmentRequest request)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> uploadAttachmentCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> ListSpaces</td>
* <td><p> Lists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see [List spaces](https://developers.google.com/workspace/chat/list-spaces).
* <p> Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
* <p> Lists spaces visible to the caller or authenticated user. Group chats and DMs aren't listed until the first message is sent.</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> listSpaces(ListSpacesRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> listSpaces()
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> listSpacesPagedCallable()
* <li><p> listSpacesCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> GetSpace</td>
* <td><p> Returns details about a space. For an example, see [Get details about a space](https://developers.google.com/workspace/chat/get-spaces).
* <p> Requires [authentication](https://developers.google.com/workspace/chat/authenticate-authorize). Supports [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) and [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> getSpace(GetSpaceRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> getSpace(SpaceName name)
* <li><p> getSpace(String name)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> getSpaceCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> CreateSpace</td>
* <td><p> Creates a named space. Spaces grouped by topics aren't supported. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces).
* <p> If you receive the error message `ALREADY_EXISTS` when creating a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name.
* <p> Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> createSpace(CreateSpaceRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> createSpace(Space space)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> createSpaceCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> SetUpSpace</td>
* <td><p> Creates a space and adds specified users to it. The calling user is automatically added to the space, and shouldn't be specified as a membership in the request. For an example, see [Set up a space with initial members](https://developers.google.com/workspace/chat/set-up-spaces).
* <p> To specify the human members to add, add memberships with the appropriate `member.name` in the `SetUpSpaceRequest`. To add a human user, use `users/{user}`, where `{user}` can be the email address for the user. For users in the same Workspace organization `{user}` can also be the `id` for the person from the People API, or the `id` for the user in the Directory API. For example, if the People API Person profile ID for `user{@literal @}example.com` is `123456789`, you can add the user to the space by setting the `membership.member.name` to `users/user{@literal @}example.com` or `users/123456789`.
* <p> For a space or group chat, if the caller blocks or is blocked by some members, then those members aren't added to the created space.
* <p> To create a direct message (DM) between the calling user and another human user, specify exactly one membership to represent the human user. If one user blocks the other, the request fails and the DM isn't created.
* <p> To create a DM between the calling user and the calling app, set `Space.singleUserBotDm` to `true` and don't specify any memberships. You can only use this method to set up a DM with the calling app. To add the calling app as a member of a space or an existing DM between two human users, see [Invite or add a user or app to a space](https://developers.google.com/workspace/chat/create-members).
* <p> If a DM already exists between two users, even when one user blocks the other at the time a request is made, then the existing DM is returned.
* <p> Spaces with threaded replies aren't supported. If you receive the error message `ALREADY_EXISTS` when setting up a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name.
* <p> Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> setUpSpace(SetUpSpaceRequest request)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> setUpSpaceCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> UpdateSpace</td>
* <td><p> Updates a space. For an example, see [Update a space](https://developers.google.com/workspace/chat/update-spaces).
* <p> If you're updating the `displayName` field and receive the error message `ALREADY_EXISTS`, try a different display name.. An existing space within the Google Workspace organization might already use this display name.
* <p> Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> updateSpace(UpdateSpaceRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> updateSpace(Space space, FieldMask updateMask)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> updateSpaceCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> DeleteSpace</td>
* <td><p> Deletes a named space. Always performs a cascading delete, which means that the space's child resources—like messages posted in the space and memberships in the space—are also deleted. For an example, see [Delete a space](https://developers.google.com/workspace/chat/delete-spaces). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) from a user who has permission to delete the space.</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> deleteSpace(DeleteSpaceRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> deleteSpace(SpaceName name)
* <li><p> deleteSpace(String name)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> deleteSpaceCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> CompleteImportSpace</td>
* <td><p> Completes the [import process](https://developers.google.com/workspace/chat/import-data) for the specified space and makes it visible to users. Requires app authentication and domain-wide delegation. For more information, see [Authorize Google Chat apps to import data](https://developers.google.com/workspace/chat/authorize-import).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> completeImportSpace(CompleteImportSpaceRequest request)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> completeImportSpaceCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> FindDirectMessage</td>
* <td><p> Returns the existing direct message with the specified user. If no direct message space is found, returns a `404 NOT_FOUND` error. For an example, see [Find a direct message](/chat/api/guides/v1/spaces/find-direct-message).
* <p> With [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user), returns the direct message space between the specified user and the authenticated user.
* <p> With [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app), returns the direct message space between the specified user and the calling Chat app.
* <p> Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) or [app authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> findDirectMessage(FindDirectMessageRequest request)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> findDirectMessageCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> CreateMembership</td>
* <td><p> Creates a human membership or app membership for the calling app. Creating memberships for other apps isn't supported. For an example, see [Invite or add a user or a Google Chat app to a space](https://developers.google.com/workspace/chat/create-members). When creating a membership, if the specified member has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified space. Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
* <p> To specify the member to add, set the `membership.member.name` in the `CreateMembershipRequest`:
* <p> - To add the calling app to a space or a direct message between two human users, use `users/app`. Unable to add other apps to the space.
* <p> - To add a human user, use `users/{user}`, where `{user}` can be the email address for the user. For users in the same Workspace organization `{user}` can also be the `id` for the person from the People API, or the `id` for the user in the Directory API. For example, if the People API Person profile ID for `user{@literal @}example.com` is `123456789`, you can add the user to the space by setting the `membership.member.name` to `users/user{@literal @}example.com` or `users/123456789`.</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> createMembership(CreateMembershipRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> createMembership(SpaceName parent, Membership membership)
* <li><p> createMembership(String parent, Membership membership)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> createMembershipCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> UpdateMembership</td>
* <td><p> Updates a membership. Requires [user authentication](https://developers.google.com/chat/api/guides/auth/users).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> updateMembership(UpdateMembershipRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> updateMembership(Membership membership, FieldMask updateMask)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> updateMembershipCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> DeleteMembership</td>
* <td><p> Deletes a membership. For an example, see [Remove a user or a Google Chat app from a space](https://developers.google.com/workspace/chat/delete-members).
* <p> Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> deleteMembership(DeleteMembershipRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> deleteMembership(MembershipName name)
* <li><p> deleteMembership(String name)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> deleteMembershipCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> CreateReaction</td>
* <td><p> Creates a reaction and adds it to a message. Only unicode emojis are supported. For an example, see [Add a reaction to a message](https://developers.google.com/workspace/chat/create-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> createReaction(CreateReactionRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> createReaction(MessageName parent, Reaction reaction)
* <li><p> createReaction(String parent, Reaction reaction)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> createReactionCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> ListReactions</td>
* <td><p> Lists reactions to a message. For an example, see [List reactions for a message](https://developers.google.com/workspace/chat/list-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> listReactions(ListReactionsRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> listReactions(MessageName parent)
* <li><p> listReactions(String parent)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> listReactionsPagedCallable()
* <li><p> listReactionsCallable()
* </ul>
* </td>
* </tr>
* <tr>
* <td><p> DeleteReaction</td>
* <td><p> Deletes a reaction to a message. Only unicode emojis are supported. For an example, see [Delete a reaction](https://developers.google.com/workspace/chat/delete-reactions). Requires [user authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).</td>
* <td>
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
* <ul>
* <li><p> deleteReaction(DeleteReactionRequest request)
* </ul>
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
* <ul>
* <li><p> deleteReaction(ReactionName name)
* <li><p> deleteReaction(String name)
* </ul>
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
* <ul>
* <li><p> deleteReactionCallable()
* </ul>
* </td>
* </tr>
* </table>
*
* <p>See the individual methods for example code.
*
* <p>Many parameters require resource names to be formatted in a particular way. To assist with
* these names, this class includes a format method for each type of name, and additionally a parse
* method to extract the individual identifiers contained within names that are returned.
*
* <p>This class can be customized by passing in a custom instance of ChatServiceSettings to
* create(). For example:
*
* <p>To customize credentials:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* ChatServiceSettings chatServiceSettings =
* ChatServiceSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* ChatServiceClient chatServiceClient = ChatServiceClient.create(chatServiceSettings);
* }</pre>
*
* <p>To customize the endpoint:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* ChatServiceSettings chatServiceSettings =
* ChatServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
* ChatServiceClient chatServiceClient = ChatServiceClient.create(chatServiceSettings);
* }</pre>
*
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* ChatServiceSettings chatServiceSettings = ChatServiceSettings.newHttpJsonBuilder().build();
* ChatServiceClient chatServiceClient = ChatServiceClient.create(chatServiceSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class ChatServiceClient implements BackgroundResource {
private final ChatServiceSettings settings;
private final ChatServiceStub stub;
/** Constructs an instance of ChatServiceClient with default settings. */
public static final ChatServiceClient create() throws IOException {
return create(ChatServiceSettings.newBuilder().build());
}
/**
* Constructs an instance of ChatServiceClient, using the given settings. The channels are created
* based on the settings passed in, or defaults for any settings that are not set.
*/
public static final ChatServiceClient create(ChatServiceSettings settings) throws IOException {
return new ChatServiceClient(settings);
}
/**
* Constructs an instance of ChatServiceClient, using the given stub for making calls. This is for
* advanced usage - prefer using create(ChatServiceSettings).
*/
public static final ChatServiceClient create(ChatServiceStub stub) {
return new ChatServiceClient(stub);
}
/**
* Constructs an instance of ChatServiceClient, using the given settings. This is protected so
* that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected ChatServiceClient(ChatServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((ChatServiceStubSettings) settings.getStubSettings()).createStub();
}
protected ChatServiceClient(ChatServiceStub stub) {
this.settings = null;
this.stub = stub;
}
public final ChatServiceSettings getSettings() {
return settings;
}
public ChatServiceStub getStub() {
return stub;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a message in a Google Chat space. For an example, see [Send a
* message](https://developers.google.com/workspace/chat/create-messages).
*
* <p>Calling this method requires
* [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and
* supports the following authentication types:
*
* <p>- For text messages, user authentication or app authentication are supported. - For card
* messages, only app authentication is supported. (Only Chat apps can create card messages.)
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* SpaceName parent = SpaceName.of("[SPACE]");
* Message message = Message.newBuilder().build();
* String messageId = "messageId-1440013438";
* Message response = chatServiceClient.createMessage(parent, message, messageId);
* }
* }</pre>
*
* @param parent Required. The resource name of the space in which to create a message.
* <p>Format: `spaces/{space}`
* @param message Required. Message body.
* @param messageId Optional. A custom ID for a message. Lets Chat apps get, update, or delete a
* message without needing to store the system-assigned ID in the message's resource name
* (represented in the message `name` field).
* <p>The value for this field must meet the following requirements:
* <ul>
* <li>Begins with `client-`. For example, `client-custom-name` is a valid custom ID, but
* `custom-name` is not.
* <li>Contains up to 63 characters and only lowercase letters, numbers, and hyphens.
* <li>Is unique within a space. A Chat app can't use the same custom ID for different
* messages.
* </ul>
* <p>For details, see [Name a
* message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Message createMessage(SpaceName parent, Message message, String messageId) {
CreateMessageRequest request =
CreateMessageRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setMessage(message)
.setMessageId(messageId)
.build();
return createMessage(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a message in a Google Chat space. For an example, see [Send a
* message](https://developers.google.com/workspace/chat/create-messages).
*
* <p>Calling this method requires
* [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and
* supports the following authentication types:
*
* <p>- For text messages, user authentication or app authentication are supported. - For card
* messages, only app authentication is supported. (Only Chat apps can create card messages.)
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* String parent = SpaceName.of("[SPACE]").toString();
* Message message = Message.newBuilder().build();
* String messageId = "messageId-1440013438";
* Message response = chatServiceClient.createMessage(parent, message, messageId);
* }
* }</pre>
*
* @param parent Required. The resource name of the space in which to create a message.
* <p>Format: `spaces/{space}`
* @param message Required. Message body.
* @param messageId Optional. A custom ID for a message. Lets Chat apps get, update, or delete a
* message without needing to store the system-assigned ID in the message's resource name
* (represented in the message `name` field).
* <p>The value for this field must meet the following requirements:
* <ul>
* <li>Begins with `client-`. For example, `client-custom-name` is a valid custom ID, but
* `custom-name` is not.
* <li>Contains up to 63 characters and only lowercase letters, numbers, and hyphens.
* <li>Is unique within a space. A Chat app can't use the same custom ID for different
* messages.
* </ul>
* <p>For details, see [Name a
* message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Message createMessage(String parent, Message message, String messageId) {
CreateMessageRequest request =
CreateMessageRequest.newBuilder()
.setParent(parent)
.setMessage(message)
.setMessageId(messageId)
.build();
return createMessage(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a message in a Google Chat space. For an example, see [Send a
* message](https://developers.google.com/workspace/chat/create-messages).
*
* <p>Calling this method requires
* [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and
* supports the following authentication types:
*
* <p>- For text messages, user authentication or app authentication are supported. - For card
* messages, only app authentication is supported. (Only Chat apps can create card messages.)
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* CreateMessageRequest request =
* CreateMessageRequest.newBuilder()
* .setParent(SpaceName.of("[SPACE]").toString())
* .setMessage(Message.newBuilder().build())
* .setThreadKey("threadKey-1562254347")
* .setRequestId("requestId693933066")
* .setMessageId("messageId-1440013438")
* .build();
* Message response = chatServiceClient.createMessage(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Message createMessage(CreateMessageRequest request) {
return createMessageCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a message in a Google Chat space. For an example, see [Send a
* message](https://developers.google.com/workspace/chat/create-messages).
*
* <p>Calling this method requires
* [authentication](https://developers.google.com/workspace/chat/authenticate-authorize) and
* supports the following authentication types:
*
* <p>- For text messages, user authentication or app authentication are supported. - For card
* messages, only app authentication is supported. (Only Chat apps can create card messages.)
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* CreateMessageRequest request =
* CreateMessageRequest.newBuilder()
* .setParent(SpaceName.of("[SPACE]").toString())
* .setMessage(Message.newBuilder().build())
* .setThreadKey("threadKey-1562254347")
* .setRequestId("requestId693933066")
* .setMessageId("messageId-1440013438")
* .build();
* ApiFuture<Message> future = chatServiceClient.createMessageCallable().futureCall(request);
* // Do something.
* Message response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CreateMessageRequest, Message> createMessageCallable() {
return stub.createMessageCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists messages in a space that the caller is a member of, including messages from blocked
* members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list).
* Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* SpaceName parent = SpaceName.of("[SPACE]");
* for (Message element : chatServiceClient.listMessages(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. The resource name of the space to list messages from.
* <p>Format: `spaces/{space}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListMessagesPagedResponse listMessages(SpaceName parent) {
ListMessagesRequest request =
ListMessagesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listMessages(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists messages in a space that the caller is a member of, including messages from blocked
* members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list).
* Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* String parent = SpaceName.of("[SPACE]").toString();
* for (Message element : chatServiceClient.listMessages(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. The resource name of the space to list messages from.
* <p>Format: `spaces/{space}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListMessagesPagedResponse listMessages(String parent) {
ListMessagesRequest request = ListMessagesRequest.newBuilder().setParent(parent).build();
return listMessages(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists messages in a space that the caller is a member of, including messages from blocked
* members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list).
* Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* ListMessagesRequest request =
* ListMessagesRequest.newBuilder()
* .setParent(SpaceName.of("[SPACE]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .setShowDeleted(true)
* .build();
* for (Message element : chatServiceClient.listMessages(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListMessagesPagedResponse listMessages(ListMessagesRequest request) {
return listMessagesPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists messages in a space that the caller is a member of, including messages from blocked
* members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list).
* Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* ListMessagesRequest request =
* ListMessagesRequest.newBuilder()
* .setParent(SpaceName.of("[SPACE]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .setShowDeleted(true)
* .build();
* ApiFuture<Message> future = chatServiceClient.listMessagesPagedCallable().futureCall(request);
* // Do something.
* for (Message element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListMessagesRequest, ListMessagesPagedResponse>
listMessagesPagedCallable() {
return stub.listMessagesPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists messages in a space that the caller is a member of, including messages from blocked
* members and spaces. For an example, see [List messages](/chat/api/guides/v1/messages/list).
* Requires [user
* authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user).
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (ChatServiceClient chatServiceClient = ChatServiceClient.create()) {
* ListMessagesRequest request =
* ListMessagesRequest.newBuilder()
* .setParent(SpaceName.of("[SPACE]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setFilter("filter-1274492040")
* .setOrderBy("orderBy-1207110587")
* .setShowDeleted(true)
* .build();
* while (true) {
* ListMessagesResponse response = chatServiceClient.listMessagesCallable().call(request);
* for (Message element : response.getMessagesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListMessagesRequest, ListMessagesResponse> listMessagesCallable() {
return stub.listMessagesCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists memberships in a space. For an example, see [List users and Google Chat apps in a
* space](https://developers.google.com/workspace/chat/list-members). Listing memberships with
* [app