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 package workspaceevents
57
58 import (
59 "bytes"
60 "context"
61 "encoding/json"
62 "errors"
63 "fmt"
64 "io"
65 "net/http"
66 "net/url"
67 "strconv"
68 "strings"
69
70 googleapi "google.golang.org/api/googleapi"
71 internal "google.golang.org/api/internal"
72 gensupport "google.golang.org/api/internal/gensupport"
73 option "google.golang.org/api/option"
74 internaloption "google.golang.org/api/option/internaloption"
75 htransport "google.golang.org/api/transport/http"
76 )
77
78
79
80 var _ = bytes.NewBuffer
81 var _ = strconv.Itoa
82 var _ = fmt.Sprintf
83 var _ = json.NewDecoder
84 var _ = io.Copy
85 var _ = url.Parse
86 var _ = gensupport.MarshalJSON
87 var _ = googleapi.Version
88 var _ = errors.New
89 var _ = strings.Replace
90 var _ = context.Canceled
91 var _ = internaloption.WithDefaultEndpoint
92 var _ = internal.Version
93
94 const apiId = "workspaceevents:v1"
95 const apiName = "workspaceevents"
96 const apiVersion = "v1"
97 const basePath = "https://workspaceevents.googleapis.com/"
98 const basePathTemplate = "https://workspaceevents.UNIVERSE_DOMAIN/"
99 const mtlsBasePath = "https://workspaceevents.mtls.googleapis.com/"
100
101
102 const (
103
104 ChatBotScope = "https://www.googleapis.com/auth/chat.bot"
105
106
107 ChatMembershipsScope = "https://www.googleapis.com/auth/chat.memberships"
108
109
110 ChatMembershipsReadonlyScope = "https://www.googleapis.com/auth/chat.memberships.readonly"
111
112
113
114 ChatMessagesScope = "https://www.googleapis.com/auth/chat.messages"
115
116
117 ChatMessagesReactionsScope = "https://www.googleapis.com/auth/chat.messages.reactions"
118
119
120 ChatMessagesReactionsReadonlyScope = "https://www.googleapis.com/auth/chat.messages.reactions.readonly"
121
122
123 ChatMessagesReadonlyScope = "https://www.googleapis.com/auth/chat.messages.readonly"
124
125
126
127 ChatSpacesScope = "https://www.googleapis.com/auth/chat.spaces"
128
129
130 ChatSpacesReadonlyScope = "https://www.googleapis.com/auth/chat.spaces.readonly"
131
132
133
134 MeetingsSpaceCreatedScope = "https://www.googleapis.com/auth/meetings.space.created"
135
136
137 MeetingsSpaceReadonlyScope = "https://www.googleapis.com/auth/meetings.space.readonly"
138 )
139
140
141 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
142 scopesOption := internaloption.WithDefaultScopes(
143 "https://www.googleapis.com/auth/chat.bot",
144 "https://www.googleapis.com/auth/chat.memberships",
145 "https://www.googleapis.com/auth/chat.memberships.readonly",
146 "https://www.googleapis.com/auth/chat.messages",
147 "https://www.googleapis.com/auth/chat.messages.reactions",
148 "https://www.googleapis.com/auth/chat.messages.reactions.readonly",
149 "https://www.googleapis.com/auth/chat.messages.readonly",
150 "https://www.googleapis.com/auth/chat.spaces",
151 "https://www.googleapis.com/auth/chat.spaces.readonly",
152 "https://www.googleapis.com/auth/meetings.space.created",
153 "https://www.googleapis.com/auth/meetings.space.readonly",
154 )
155
156 opts = append([]option.ClientOption{scopesOption}, opts...)
157 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
158 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
159 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
160 opts = append(opts, internaloption.EnableNewAuthLibrary())
161 client, endpoint, err := htransport.NewClient(ctx, opts...)
162 if err != nil {
163 return nil, err
164 }
165 s, err := New(client)
166 if err != nil {
167 return nil, err
168 }
169 if endpoint != "" {
170 s.BasePath = endpoint
171 }
172 return s, nil
173 }
174
175
176
177
178
179
180 func New(client *http.Client) (*Service, error) {
181 if client == nil {
182 return nil, errors.New("client is nil")
183 }
184 s := &Service{client: client, BasePath: basePath}
185 s.Operations = NewOperationsService(s)
186 s.Subscriptions = NewSubscriptionsService(s)
187 return s, nil
188 }
189
190 type Service struct {
191 client *http.Client
192 BasePath string
193 UserAgent string
194
195 Operations *OperationsService
196
197 Subscriptions *SubscriptionsService
198 }
199
200 func (s *Service) userAgent() string {
201 if s.UserAgent == "" {
202 return googleapi.UserAgent
203 }
204 return googleapi.UserAgent + " " + s.UserAgent
205 }
206
207 func NewOperationsService(s *Service) *OperationsService {
208 rs := &OperationsService{s: s}
209 return rs
210 }
211
212 type OperationsService struct {
213 s *Service
214 }
215
216 func NewSubscriptionsService(s *Service) *SubscriptionsService {
217 rs := &SubscriptionsService{s: s}
218 return rs
219 }
220
221 type SubscriptionsService struct {
222 s *Service
223 }
224
225
226
227 type ListSubscriptionsResponse struct {
228
229
230 NextPageToken string `json:"nextPageToken,omitempty"`
231
232 Subscriptions []*Subscription `json:"subscriptions,omitempty"`
233
234
235 googleapi.ServerResponse `json:"-"`
236
237
238
239
240
241 ForceSendFields []string `json:"-"`
242
243
244
245
246 NullFields []string `json:"-"`
247 }
248
249 func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) {
250 type NoMethod ListSubscriptionsResponse
251 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
252 }
253
254
255 type NotificationEndpoint struct {
256
257
258
259
260
261
262
263 PubsubTopic string `json:"pubsubTopic,omitempty"`
264
265
266
267
268
269 ForceSendFields []string `json:"-"`
270
271
272
273
274 NullFields []string `json:"-"`
275 }
276
277 func (s *NotificationEndpoint) MarshalJSON() ([]byte, error) {
278 type NoMethod NotificationEndpoint
279 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
280 }
281
282
283
284 type Operation struct {
285
286
287
288 Done bool `json:"done,omitempty"`
289
290 Error *Status `json:"error,omitempty"`
291
292
293
294
295 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
296
297
298
299 Name string `json:"name,omitempty"`
300
301
302
303
304
305
306
307 Response googleapi.RawMessage `json:"response,omitempty"`
308
309
310 googleapi.ServerResponse `json:"-"`
311
312
313
314
315
316 ForceSendFields []string `json:"-"`
317
318
319
320
321 NullFields []string `json:"-"`
322 }
323
324 func (s *Operation) MarshalJSON() ([]byte, error) {
325 type NoMethod Operation
326 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
327 }
328
329
330
331 type PayloadOptions struct {
332
333
334
335
336
337
338 FieldMask string `json:"fieldMask,omitempty"`
339
340
341
342
343
344
345 IncludeResource bool `json:"includeResource,omitempty"`
346
347
348
349
350
351 ForceSendFields []string `json:"-"`
352
353
354
355
356 NullFields []string `json:"-"`
357 }
358
359 func (s *PayloadOptions) MarshalJSON() ([]byte, error) {
360 type NoMethod PayloadOptions
361 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
362 }
363
364
365
366 type ReactivateSubscriptionRequest struct {
367 }
368
369
370
371
372
373
374
375 type Status struct {
376
377 Code int64 `json:"code,omitempty"`
378
379
380 Details []googleapi.RawMessage `json:"details,omitempty"`
381
382
383
384 Message string `json:"message,omitempty"`
385
386
387
388
389
390 ForceSendFields []string `json:"-"`
391
392
393
394
395 NullFields []string `json:"-"`
396 }
397
398 func (s *Status) MarshalJSON() ([]byte, error) {
399 type NoMethod Status
400 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
401 }
402
403
404
405
406
407
408 type Subscription struct {
409
410
411
412
413
414 Authority string `json:"authority,omitempty"`
415
416 CreateTime string `json:"createTime,omitempty"`
417
418
419
420 Etag string `json:"etag,omitempty"`
421
422
423
424
425
426
427
428
429
430
431
432 EventTypes []string `json:"eventTypes,omitempty"`
433
434
435 ExpireTime string `json:"expireTime,omitempty"`
436
437
438 Name string `json:"name,omitempty"`
439
440
441 NotificationEndpoint *NotificationEndpoint `json:"notificationEndpoint,omitempty"`
442
443
444 PayloadOptions *PayloadOptions `json:"payloadOptions,omitempty"`
445
446
447 Reconciling bool `json:"reconciling,omitempty"`
448
449
450
451
452
453
454
455
456
457
458
459 State string `json:"state,omitempty"`
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 SuspensionReason string `json:"suspensionReason,omitempty"`
485
486
487
488
489
490
491
492
493 TargetResource string `json:"targetResource,omitempty"`
494
495
496 Ttl string `json:"ttl,omitempty"`
497
498 Uid string `json:"uid,omitempty"`
499
500 UpdateTime string `json:"updateTime,omitempty"`
501
502
503 googleapi.ServerResponse `json:"-"`
504
505
506
507
508
509 ForceSendFields []string `json:"-"`
510
511
512
513
514 NullFields []string `json:"-"`
515 }
516
517 func (s *Subscription) MarshalJSON() ([]byte, error) {
518 type NoMethod Subscription
519 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
520 }
521
522 type OperationsGetCall struct {
523 s *Service
524 name string
525 urlParams_ gensupport.URLParams
526 ifNoneMatch_ string
527 ctx_ context.Context
528 header_ http.Header
529 }
530
531
532
533
534
535
536 func (r *OperationsService) Get(name string) *OperationsGetCall {
537 c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
538 c.name = name
539 return c
540 }
541
542
543
544
545 func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
546 c.urlParams_.Set("fields", googleapi.CombineFields(s))
547 return c
548 }
549
550
551
552
553 func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
554 c.ifNoneMatch_ = entityTag
555 return c
556 }
557
558
559 func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
560 c.ctx_ = ctx
561 return c
562 }
563
564
565
566 func (c *OperationsGetCall) Header() http.Header {
567 if c.header_ == nil {
568 c.header_ = make(http.Header)
569 }
570 return c.header_
571 }
572
573 func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
574 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
575 if c.ifNoneMatch_ != "" {
576 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
577 }
578 var body io.Reader = nil
579 c.urlParams_.Set("alt", alt)
580 c.urlParams_.Set("prettyPrint", "false")
581 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
582 urls += "?" + c.urlParams_.Encode()
583 req, err := http.NewRequest("GET", urls, body)
584 if err != nil {
585 return nil, err
586 }
587 req.Header = reqHeaders
588 googleapi.Expand(req.URL, map[string]string{
589 "name": c.name,
590 })
591 return gensupport.SendRequest(c.ctx_, c.s.client, req)
592 }
593
594
595
596
597
598
599 func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
600 gensupport.SetOptions(c.urlParams_, opts...)
601 res, err := c.doRequest("json")
602 if res != nil && res.StatusCode == http.StatusNotModified {
603 if res.Body != nil {
604 res.Body.Close()
605 }
606 return nil, gensupport.WrapError(&googleapi.Error{
607 Code: res.StatusCode,
608 Header: res.Header,
609 })
610 }
611 if err != nil {
612 return nil, err
613 }
614 defer googleapi.CloseBody(res)
615 if err := googleapi.CheckResponse(res); err != nil {
616 return nil, gensupport.WrapError(err)
617 }
618 ret := &Operation{
619 ServerResponse: googleapi.ServerResponse{
620 Header: res.Header,
621 HTTPStatusCode: res.StatusCode,
622 },
623 }
624 target := &ret
625 if err := gensupport.DecodeResponse(target, res); err != nil {
626 return nil, err
627 }
628 return ret, nil
629 }
630
631 type SubscriptionsCreateCall struct {
632 s *Service
633 subscription *Subscription
634 urlParams_ gensupport.URLParams
635 ctx_ context.Context
636 header_ http.Header
637 }
638
639
640
641
642
643 func (r *SubscriptionsService) Create(subscription *Subscription) *SubscriptionsCreateCall {
644 c := &SubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
645 c.subscription = subscription
646 return c
647 }
648
649
650
651 func (c *SubscriptionsCreateCall) ValidateOnly(validateOnly bool) *SubscriptionsCreateCall {
652 c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
653 return c
654 }
655
656
657
658
659 func (c *SubscriptionsCreateCall) Fields(s ...googleapi.Field) *SubscriptionsCreateCall {
660 c.urlParams_.Set("fields", googleapi.CombineFields(s))
661 return c
662 }
663
664
665 func (c *SubscriptionsCreateCall) Context(ctx context.Context) *SubscriptionsCreateCall {
666 c.ctx_ = ctx
667 return c
668 }
669
670
671
672 func (c *SubscriptionsCreateCall) Header() http.Header {
673 if c.header_ == nil {
674 c.header_ = make(http.Header)
675 }
676 return c.header_
677 }
678
679 func (c *SubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
680 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
681 var body io.Reader = nil
682 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
683 if err != nil {
684 return nil, err
685 }
686 c.urlParams_.Set("alt", alt)
687 c.urlParams_.Set("prettyPrint", "false")
688 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/subscriptions")
689 urls += "?" + c.urlParams_.Encode()
690 req, err := http.NewRequest("POST", urls, body)
691 if err != nil {
692 return nil, err
693 }
694 req.Header = reqHeaders
695 return gensupport.SendRequest(c.ctx_, c.s.client, req)
696 }
697
698
699
700
701
702
703 func (c *SubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
704 gensupport.SetOptions(c.urlParams_, opts...)
705 res, err := c.doRequest("json")
706 if res != nil && res.StatusCode == http.StatusNotModified {
707 if res.Body != nil {
708 res.Body.Close()
709 }
710 return nil, gensupport.WrapError(&googleapi.Error{
711 Code: res.StatusCode,
712 Header: res.Header,
713 })
714 }
715 if err != nil {
716 return nil, err
717 }
718 defer googleapi.CloseBody(res)
719 if err := googleapi.CheckResponse(res); err != nil {
720 return nil, gensupport.WrapError(err)
721 }
722 ret := &Operation{
723 ServerResponse: googleapi.ServerResponse{
724 Header: res.Header,
725 HTTPStatusCode: res.StatusCode,
726 },
727 }
728 target := &ret
729 if err := gensupport.DecodeResponse(target, res); err != nil {
730 return nil, err
731 }
732 return ret, nil
733 }
734
735 type SubscriptionsDeleteCall struct {
736 s *Service
737 name string
738 urlParams_ gensupport.URLParams
739 ctx_ context.Context
740 header_ http.Header
741 }
742
743
744
745
746
747
748
749
750 func (r *SubscriptionsService) Delete(name string) *SubscriptionsDeleteCall {
751 c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
752 c.name = name
753 return c
754 }
755
756
757
758
759 func (c *SubscriptionsDeleteCall) AllowMissing(allowMissing bool) *SubscriptionsDeleteCall {
760 c.urlParams_.Set("allowMissing", fmt.Sprint(allowMissing))
761 return c
762 }
763
764
765
766
767 func (c *SubscriptionsDeleteCall) Etag(etag string) *SubscriptionsDeleteCall {
768 c.urlParams_.Set("etag", etag)
769 return c
770 }
771
772
773
774 func (c *SubscriptionsDeleteCall) ValidateOnly(validateOnly bool) *SubscriptionsDeleteCall {
775 c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
776 return c
777 }
778
779
780
781
782 func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
783 c.urlParams_.Set("fields", googleapi.CombineFields(s))
784 return c
785 }
786
787
788 func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
789 c.ctx_ = ctx
790 return c
791 }
792
793
794
795 func (c *SubscriptionsDeleteCall) Header() http.Header {
796 if c.header_ == nil {
797 c.header_ = make(http.Header)
798 }
799 return c.header_
800 }
801
802 func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
803 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
804 var body io.Reader = nil
805 c.urlParams_.Set("alt", alt)
806 c.urlParams_.Set("prettyPrint", "false")
807 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
808 urls += "?" + c.urlParams_.Encode()
809 req, err := http.NewRequest("DELETE", urls, body)
810 if err != nil {
811 return nil, err
812 }
813 req.Header = reqHeaders
814 googleapi.Expand(req.URL, map[string]string{
815 "name": c.name,
816 })
817 return gensupport.SendRequest(c.ctx_, c.s.client, req)
818 }
819
820
821
822
823
824
825 func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
826 gensupport.SetOptions(c.urlParams_, opts...)
827 res, err := c.doRequest("json")
828 if res != nil && res.StatusCode == http.StatusNotModified {
829 if res.Body != nil {
830 res.Body.Close()
831 }
832 return nil, gensupport.WrapError(&googleapi.Error{
833 Code: res.StatusCode,
834 Header: res.Header,
835 })
836 }
837 if err != nil {
838 return nil, err
839 }
840 defer googleapi.CloseBody(res)
841 if err := googleapi.CheckResponse(res); err != nil {
842 return nil, gensupport.WrapError(err)
843 }
844 ret := &Operation{
845 ServerResponse: googleapi.ServerResponse{
846 Header: res.Header,
847 HTTPStatusCode: res.StatusCode,
848 },
849 }
850 target := &ret
851 if err := gensupport.DecodeResponse(target, res); err != nil {
852 return nil, err
853 }
854 return ret, nil
855 }
856
857 type SubscriptionsGetCall struct {
858 s *Service
859 name string
860 urlParams_ gensupport.URLParams
861 ifNoneMatch_ string
862 ctx_ context.Context
863 header_ http.Header
864 }
865
866
867
868
869
870
871
872
873 func (r *SubscriptionsService) Get(name string) *SubscriptionsGetCall {
874 c := &SubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
875 c.name = name
876 return c
877 }
878
879
880
881
882 func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
883 c.urlParams_.Set("fields", googleapi.CombineFields(s))
884 return c
885 }
886
887
888
889
890 func (c *SubscriptionsGetCall) IfNoneMatch(entityTag string) *SubscriptionsGetCall {
891 c.ifNoneMatch_ = entityTag
892 return c
893 }
894
895
896 func (c *SubscriptionsGetCall) Context(ctx context.Context) *SubscriptionsGetCall {
897 c.ctx_ = ctx
898 return c
899 }
900
901
902
903 func (c *SubscriptionsGetCall) Header() http.Header {
904 if c.header_ == nil {
905 c.header_ = make(http.Header)
906 }
907 return c.header_
908 }
909
910 func (c *SubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
911 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
912 if c.ifNoneMatch_ != "" {
913 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
914 }
915 var body io.Reader = nil
916 c.urlParams_.Set("alt", alt)
917 c.urlParams_.Set("prettyPrint", "false")
918 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
919 urls += "?" + c.urlParams_.Encode()
920 req, err := http.NewRequest("GET", urls, body)
921 if err != nil {
922 return nil, err
923 }
924 req.Header = reqHeaders
925 googleapi.Expand(req.URL, map[string]string{
926 "name": c.name,
927 })
928 return gensupport.SendRequest(c.ctx_, c.s.client, req)
929 }
930
931
932
933
934
935
936 func (c *SubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
937 gensupport.SetOptions(c.urlParams_, opts...)
938 res, err := c.doRequest("json")
939 if res != nil && res.StatusCode == http.StatusNotModified {
940 if res.Body != nil {
941 res.Body.Close()
942 }
943 return nil, gensupport.WrapError(&googleapi.Error{
944 Code: res.StatusCode,
945 Header: res.Header,
946 })
947 }
948 if err != nil {
949 return nil, err
950 }
951 defer googleapi.CloseBody(res)
952 if err := googleapi.CheckResponse(res); err != nil {
953 return nil, gensupport.WrapError(err)
954 }
955 ret := &Subscription{
956 ServerResponse: googleapi.ServerResponse{
957 Header: res.Header,
958 HTTPStatusCode: res.StatusCode,
959 },
960 }
961 target := &ret
962 if err := gensupport.DecodeResponse(target, res); err != nil {
963 return nil, err
964 }
965 return ret, nil
966 }
967
968 type SubscriptionsListCall struct {
969 s *Service
970 urlParams_ gensupport.URLParams
971 ifNoneMatch_ string
972 ctx_ context.Context
973 header_ http.Header
974 }
975
976
977
978
979
980 func (r *SubscriptionsService) List() *SubscriptionsListCall {
981 c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
982 return c
983 }
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000 func (c *SubscriptionsListCall) Filter(filter string) *SubscriptionsListCall {
1001 c.urlParams_.Set("filter", filter)
1002 return c
1003 }
1004
1005
1006
1007
1008
1009
1010 func (c *SubscriptionsListCall) PageSize(pageSize int64) *SubscriptionsListCall {
1011 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1012 return c
1013 }
1014
1015
1016
1017
1018
1019
1020 func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
1021 c.urlParams_.Set("pageToken", pageToken)
1022 return c
1023 }
1024
1025
1026
1027
1028 func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
1029 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1030 return c
1031 }
1032
1033
1034
1035
1036 func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
1037 c.ifNoneMatch_ = entityTag
1038 return c
1039 }
1040
1041
1042 func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
1043 c.ctx_ = ctx
1044 return c
1045 }
1046
1047
1048
1049 func (c *SubscriptionsListCall) Header() http.Header {
1050 if c.header_ == nil {
1051 c.header_ = make(http.Header)
1052 }
1053 return c.header_
1054 }
1055
1056 func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
1057 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1058 if c.ifNoneMatch_ != "" {
1059 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1060 }
1061 var body io.Reader = nil
1062 c.urlParams_.Set("alt", alt)
1063 c.urlParams_.Set("prettyPrint", "false")
1064 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/subscriptions")
1065 urls += "?" + c.urlParams_.Encode()
1066 req, err := http.NewRequest("GET", urls, body)
1067 if err != nil {
1068 return nil, err
1069 }
1070 req.Header = reqHeaders
1071 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1072 }
1073
1074
1075
1076
1077
1078
1079
1080 func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) {
1081 gensupport.SetOptions(c.urlParams_, opts...)
1082 res, err := c.doRequest("json")
1083 if res != nil && res.StatusCode == http.StatusNotModified {
1084 if res.Body != nil {
1085 res.Body.Close()
1086 }
1087 return nil, gensupport.WrapError(&googleapi.Error{
1088 Code: res.StatusCode,
1089 Header: res.Header,
1090 })
1091 }
1092 if err != nil {
1093 return nil, err
1094 }
1095 defer googleapi.CloseBody(res)
1096 if err := googleapi.CheckResponse(res); err != nil {
1097 return nil, gensupport.WrapError(err)
1098 }
1099 ret := &ListSubscriptionsResponse{
1100 ServerResponse: googleapi.ServerResponse{
1101 Header: res.Header,
1102 HTTPStatusCode: res.StatusCode,
1103 },
1104 }
1105 target := &ret
1106 if err := gensupport.DecodeResponse(target, res); err != nil {
1107 return nil, err
1108 }
1109 return ret, nil
1110 }
1111
1112
1113
1114
1115 func (c *SubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error {
1116 c.ctx_ = ctx
1117 defer c.PageToken(c.urlParams_.Get("pageToken"))
1118 for {
1119 x, err := c.Do()
1120 if err != nil {
1121 return err
1122 }
1123 if err := f(x); err != nil {
1124 return err
1125 }
1126 if x.NextPageToken == "" {
1127 return nil
1128 }
1129 c.PageToken(x.NextPageToken)
1130 }
1131 }
1132
1133 type SubscriptionsPatchCall struct {
1134 s *Service
1135 name string
1136 subscription *Subscription
1137 urlParams_ gensupport.URLParams
1138 ctx_ context.Context
1139 header_ http.Header
1140 }
1141
1142
1143
1144
1145
1146
1147
1148
1149 func (r *SubscriptionsService) Patch(name string, subscription *Subscription) *SubscriptionsPatchCall {
1150 c := &SubscriptionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1151 c.name = name
1152 c.subscription = subscription
1153 return c
1154 }
1155
1156
1157
1158
1159
1160
1161
1162 func (c *SubscriptionsPatchCall) UpdateMask(updateMask string) *SubscriptionsPatchCall {
1163 c.urlParams_.Set("updateMask", updateMask)
1164 return c
1165 }
1166
1167
1168
1169 func (c *SubscriptionsPatchCall) ValidateOnly(validateOnly bool) *SubscriptionsPatchCall {
1170 c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
1171 return c
1172 }
1173
1174
1175
1176
1177 func (c *SubscriptionsPatchCall) Fields(s ...googleapi.Field) *SubscriptionsPatchCall {
1178 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1179 return c
1180 }
1181
1182
1183 func (c *SubscriptionsPatchCall) Context(ctx context.Context) *SubscriptionsPatchCall {
1184 c.ctx_ = ctx
1185 return c
1186 }
1187
1188
1189
1190 func (c *SubscriptionsPatchCall) Header() http.Header {
1191 if c.header_ == nil {
1192 c.header_ = make(http.Header)
1193 }
1194 return c.header_
1195 }
1196
1197 func (c *SubscriptionsPatchCall) doRequest(alt string) (*http.Response, error) {
1198 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1199 var body io.Reader = nil
1200 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
1201 if err != nil {
1202 return nil, err
1203 }
1204 c.urlParams_.Set("alt", alt)
1205 c.urlParams_.Set("prettyPrint", "false")
1206 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1207 urls += "?" + c.urlParams_.Encode()
1208 req, err := http.NewRequest("PATCH", urls, body)
1209 if err != nil {
1210 return nil, err
1211 }
1212 req.Header = reqHeaders
1213 googleapi.Expand(req.URL, map[string]string{
1214 "name": c.name,
1215 })
1216 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1217 }
1218
1219
1220
1221
1222
1223
1224 func (c *SubscriptionsPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1225 gensupport.SetOptions(c.urlParams_, opts...)
1226 res, err := c.doRequest("json")
1227 if res != nil && res.StatusCode == http.StatusNotModified {
1228 if res.Body != nil {
1229 res.Body.Close()
1230 }
1231 return nil, gensupport.WrapError(&googleapi.Error{
1232 Code: res.StatusCode,
1233 Header: res.Header,
1234 })
1235 }
1236 if err != nil {
1237 return nil, err
1238 }
1239 defer googleapi.CloseBody(res)
1240 if err := googleapi.CheckResponse(res); err != nil {
1241 return nil, gensupport.WrapError(err)
1242 }
1243 ret := &Operation{
1244 ServerResponse: googleapi.ServerResponse{
1245 Header: res.Header,
1246 HTTPStatusCode: res.StatusCode,
1247 },
1248 }
1249 target := &ret
1250 if err := gensupport.DecodeResponse(target, res); err != nil {
1251 return nil, err
1252 }
1253 return ret, nil
1254 }
1255
1256 type SubscriptionsReactivateCall struct {
1257 s *Service
1258 name string
1259 reactivatesubscriptionrequest *ReactivateSubscriptionRequest
1260 urlParams_ gensupport.URLParams
1261 ctx_ context.Context
1262 header_ http.Header
1263 }
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275 func (r *SubscriptionsService) Reactivate(name string, reactivatesubscriptionrequest *ReactivateSubscriptionRequest) *SubscriptionsReactivateCall {
1276 c := &SubscriptionsReactivateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1277 c.name = name
1278 c.reactivatesubscriptionrequest = reactivatesubscriptionrequest
1279 return c
1280 }
1281
1282
1283
1284
1285 func (c *SubscriptionsReactivateCall) Fields(s ...googleapi.Field) *SubscriptionsReactivateCall {
1286 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1287 return c
1288 }
1289
1290
1291 func (c *SubscriptionsReactivateCall) Context(ctx context.Context) *SubscriptionsReactivateCall {
1292 c.ctx_ = ctx
1293 return c
1294 }
1295
1296
1297
1298 func (c *SubscriptionsReactivateCall) Header() http.Header {
1299 if c.header_ == nil {
1300 c.header_ = make(http.Header)
1301 }
1302 return c.header_
1303 }
1304
1305 func (c *SubscriptionsReactivateCall) doRequest(alt string) (*http.Response, error) {
1306 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1307 var body io.Reader = nil
1308 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reactivatesubscriptionrequest)
1309 if err != nil {
1310 return nil, err
1311 }
1312 c.urlParams_.Set("alt", alt)
1313 c.urlParams_.Set("prettyPrint", "false")
1314 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:reactivate")
1315 urls += "?" + c.urlParams_.Encode()
1316 req, err := http.NewRequest("POST", urls, body)
1317 if err != nil {
1318 return nil, err
1319 }
1320 req.Header = reqHeaders
1321 googleapi.Expand(req.URL, map[string]string{
1322 "name": c.name,
1323 })
1324 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1325 }
1326
1327
1328
1329
1330
1331
1332 func (c *SubscriptionsReactivateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1333 gensupport.SetOptions(c.urlParams_, opts...)
1334 res, err := c.doRequest("json")
1335 if res != nil && res.StatusCode == http.StatusNotModified {
1336 if res.Body != nil {
1337 res.Body.Close()
1338 }
1339 return nil, gensupport.WrapError(&googleapi.Error{
1340 Code: res.StatusCode,
1341 Header: res.Header,
1342 })
1343 }
1344 if err != nil {
1345 return nil, err
1346 }
1347 defer googleapi.CloseBody(res)
1348 if err := googleapi.CheckResponse(res); err != nil {
1349 return nil, gensupport.WrapError(err)
1350 }
1351 ret := &Operation{
1352 ServerResponse: googleapi.ServerResponse{
1353 Header: res.Header,
1354 HTTPStatusCode: res.StatusCode,
1355 },
1356 }
1357 target := &ret
1358 if err := gensupport.DecodeResponse(target, res); err != nil {
1359 return nil, err
1360 }
1361 return ret, nil
1362 }
1363
View as plain text