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 package pubsub
59
60 import (
61 "bytes"
62 "context"
63 "encoding/json"
64 "errors"
65 "fmt"
66 "io"
67 "net/http"
68 "net/url"
69 "strconv"
70 "strings"
71
72 googleapi "google.golang.org/api/googleapi"
73 internal "google.golang.org/api/internal"
74 gensupport "google.golang.org/api/internal/gensupport"
75 option "google.golang.org/api/option"
76 internaloption "google.golang.org/api/option/internaloption"
77 htransport "google.golang.org/api/transport/http"
78 )
79
80
81
82 var _ = bytes.NewBuffer
83 var _ = strconv.Itoa
84 var _ = fmt.Sprintf
85 var _ = json.NewDecoder
86 var _ = io.Copy
87 var _ = url.Parse
88 var _ = gensupport.MarshalJSON
89 var _ = googleapi.Version
90 var _ = errors.New
91 var _ = strings.Replace
92 var _ = context.Canceled
93 var _ = internaloption.WithDefaultEndpoint
94 var _ = internal.Version
95
96 const apiId = "pubsub:v1beta1a"
97 const apiName = "pubsub"
98 const apiVersion = "v1beta1a"
99 const basePath = "https://pubsub.googleapis.com/"
100 const basePathTemplate = "https://pubsub.UNIVERSE_DOMAIN/"
101 const mtlsBasePath = "https://pubsub.mtls.googleapis.com/"
102
103
104 const (
105
106
107 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
108
109
110 PubsubScope = "https://www.googleapis.com/auth/pubsub"
111 )
112
113
114 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
115 scopesOption := internaloption.WithDefaultScopes(
116 "https://www.googleapis.com/auth/cloud-platform",
117 "https://www.googleapis.com/auth/pubsub",
118 )
119
120 opts = append([]option.ClientOption{scopesOption}, opts...)
121 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
122 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
123 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
124 opts = append(opts, internaloption.EnableNewAuthLibrary())
125 client, endpoint, err := htransport.NewClient(ctx, opts...)
126 if err != nil {
127 return nil, err
128 }
129 s, err := New(client)
130 if err != nil {
131 return nil, err
132 }
133 if endpoint != "" {
134 s.BasePath = endpoint
135 }
136 return s, nil
137 }
138
139
140
141
142
143
144 func New(client *http.Client) (*Service, error) {
145 if client == nil {
146 return nil, errors.New("client is nil")
147 }
148 s := &Service{client: client, BasePath: basePath}
149 s.Subscriptions = NewSubscriptionsService(s)
150 s.Topics = NewTopicsService(s)
151 return s, nil
152 }
153
154 type Service struct {
155 client *http.Client
156 BasePath string
157 UserAgent string
158
159 Subscriptions *SubscriptionsService
160
161 Topics *TopicsService
162 }
163
164 func (s *Service) userAgent() string {
165 if s.UserAgent == "" {
166 return googleapi.UserAgent
167 }
168 return googleapi.UserAgent + " " + s.UserAgent
169 }
170
171 func NewSubscriptionsService(s *Service) *SubscriptionsService {
172 rs := &SubscriptionsService{s: s}
173 return rs
174 }
175
176 type SubscriptionsService struct {
177 s *Service
178 }
179
180 func NewTopicsService(s *Service) *TopicsService {
181 rs := &TopicsService{s: s}
182 return rs
183 }
184
185 type TopicsService struct {
186 s *Service
187 }
188
189
190 type AcknowledgeRequest struct {
191
192
193 AckId []string `json:"ackId,omitempty"`
194
195 Subscription string `json:"subscription,omitempty"`
196
197
198
199
200
201 ForceSendFields []string `json:"-"`
202
203
204
205
206 NullFields []string `json:"-"`
207 }
208
209 func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) {
210 type NoMethod AcknowledgeRequest
211 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
212 }
213
214
215
216
217
218
219
220
221 type Empty struct {
222
223 googleapi.ServerResponse `json:"-"`
224 }
225
226
227 type Label struct {
228
229
230
231
232
233
234
235
236
237
238
239 Key string `json:"key,omitempty"`
240
241 NumValue int64 `json:"numValue,omitempty,string"`
242
243 StrValue string `json:"strValue,omitempty"`
244
245
246
247
248
249 ForceSendFields []string `json:"-"`
250
251
252
253
254 NullFields []string `json:"-"`
255 }
256
257 func (s *Label) MarshalJSON() ([]byte, error) {
258 type NoMethod Label
259 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
260 }
261
262
263 type ListSubscriptionsResponse struct {
264
265
266
267 NextPageToken string `json:"nextPageToken,omitempty"`
268
269 Subscription []*Subscription `json:"subscription,omitempty"`
270
271
272 googleapi.ServerResponse `json:"-"`
273
274
275
276
277
278 ForceSendFields []string `json:"-"`
279
280
281
282
283 NullFields []string `json:"-"`
284 }
285
286 func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) {
287 type NoMethod ListSubscriptionsResponse
288 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
289 }
290
291
292 type ListTopicsResponse struct {
293
294
295
296 NextPageToken string `json:"nextPageToken,omitempty"`
297
298 Topic []*Topic `json:"topic,omitempty"`
299
300
301 googleapi.ServerResponse `json:"-"`
302
303
304
305
306
307 ForceSendFields []string `json:"-"`
308
309
310
311
312 NullFields []string `json:"-"`
313 }
314
315 func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) {
316 type NoMethod ListTopicsResponse
317 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
318 }
319
320
321 type ModifyAckDeadlineRequest struct {
322
323
324
325
326
327 AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
328
329
330 AckId string `json:"ackId,omitempty"`
331
332
333 AckIds []string `json:"ackIds,omitempty"`
334
335
336 Subscription string `json:"subscription,omitempty"`
337
338
339
340
341
342 ForceSendFields []string `json:"-"`
343
344
345
346
347 NullFields []string `json:"-"`
348 }
349
350 func (s *ModifyAckDeadlineRequest) MarshalJSON() ([]byte, error) {
351 type NoMethod ModifyAckDeadlineRequest
352 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
353 }
354
355
356 type ModifyPushConfigRequest struct {
357
358
359 PushConfig *PushConfig `json:"pushConfig,omitempty"`
360
361 Subscription string `json:"subscription,omitempty"`
362
363
364
365
366
367 ForceSendFields []string `json:"-"`
368
369
370
371
372 NullFields []string `json:"-"`
373 }
374
375 func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) {
376 type NoMethod ModifyPushConfigRequest
377 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
378 }
379
380
381 type PublishBatchRequest struct {
382
383 Messages []*PubsubMessage `json:"messages,omitempty"`
384
385 Topic string `json:"topic,omitempty"`
386
387
388
389
390
391 ForceSendFields []string `json:"-"`
392
393
394
395
396 NullFields []string `json:"-"`
397 }
398
399 func (s *PublishBatchRequest) MarshalJSON() ([]byte, error) {
400 type NoMethod PublishBatchRequest
401 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
402 }
403
404
405 type PublishBatchResponse struct {
406
407
408
409 MessageIds []string `json:"messageIds,omitempty"`
410
411
412 googleapi.ServerResponse `json:"-"`
413
414
415
416
417
418 ForceSendFields []string `json:"-"`
419
420
421
422
423 NullFields []string `json:"-"`
424 }
425
426 func (s *PublishBatchResponse) MarshalJSON() ([]byte, error) {
427 type NoMethod PublishBatchResponse
428 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
429 }
430
431
432 type PublishRequest struct {
433
434 Message *PubsubMessage `json:"message,omitempty"`
435
436 Topic string `json:"topic,omitempty"`
437
438
439
440
441
442 ForceSendFields []string `json:"-"`
443
444
445
446
447 NullFields []string `json:"-"`
448 }
449
450 func (s *PublishRequest) MarshalJSON() ([]byte, error) {
451 type NoMethod PublishRequest
452 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
453 }
454
455
456 type PubsubEvent struct {
457
458
459
460 Deleted bool `json:"deleted,omitempty"`
461
462 Message *PubsubMessage `json:"message,omitempty"`
463
464 Subscription string `json:"subscription,omitempty"`
465
466 Truncated bool `json:"truncated,omitempty"`
467
468
469
470
471
472 ForceSendFields []string `json:"-"`
473
474
475
476
477 NullFields []string `json:"-"`
478 }
479
480 func (s *PubsubEvent) MarshalJSON() ([]byte, error) {
481 type NoMethod PubsubEvent
482 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
483 }
484
485
486 type PubsubMessage struct {
487
488 Data string `json:"data,omitempty"`
489
490
491 Label []*Label `json:"label,omitempty"`
492
493
494
495
496 MessageId string `json:"messageId,omitempty"`
497
498
499 PublishTime int64 `json:"publishTime,omitempty,string"`
500
501
502
503
504
505 ForceSendFields []string `json:"-"`
506
507
508
509
510 NullFields []string `json:"-"`
511 }
512
513 func (s *PubsubMessage) MarshalJSON() ([]byte, error) {
514 type NoMethod PubsubMessage
515 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
516 }
517
518
519 type PullBatchRequest struct {
520
521
522 MaxEvents int64 `json:"maxEvents,omitempty"`
523
524
525
526
527
528 ReturnImmediately bool `json:"returnImmediately,omitempty"`
529
530 Subscription string `json:"subscription,omitempty"`
531
532
533
534
535
536 ForceSendFields []string `json:"-"`
537
538
539
540
541 NullFields []string `json:"-"`
542 }
543
544 func (s *PullBatchRequest) MarshalJSON() ([]byte, error) {
545 type NoMethod PullBatchRequest
546 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
547 }
548
549
550 type PullBatchResponse struct {
551
552
553
554
555 PullResponses []*PullResponse `json:"pullResponses,omitempty"`
556
557
558 googleapi.ServerResponse `json:"-"`
559
560
561
562
563
564 ForceSendFields []string `json:"-"`
565
566
567
568
569 NullFields []string `json:"-"`
570 }
571
572 func (s *PullBatchResponse) MarshalJSON() ([]byte, error) {
573 type NoMethod PullBatchResponse
574 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
575 }
576
577
578 type PullRequest struct {
579
580
581
582
583
584 ReturnImmediately bool `json:"returnImmediately,omitempty"`
585
586 Subscription string `json:"subscription,omitempty"`
587
588
589
590
591
592 ForceSendFields []string `json:"-"`
593
594
595
596
597 NullFields []string `json:"-"`
598 }
599
600 func (s *PullRequest) MarshalJSON() ([]byte, error) {
601 type NoMethod PullRequest
602 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
603 }
604
605
606
607 type PullResponse struct {
608
609 AckId string `json:"ackId,omitempty"`
610
611 PubsubEvent *PubsubEvent `json:"pubsubEvent,omitempty"`
612
613
614 googleapi.ServerResponse `json:"-"`
615
616
617
618
619
620 ForceSendFields []string `json:"-"`
621
622
623
624
625 NullFields []string `json:"-"`
626 }
627
628 func (s *PullResponse) MarshalJSON() ([]byte, error) {
629 type NoMethod PullResponse
630 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
631 }
632
633
634 type PushConfig struct {
635
636
637
638 PushEndpoint string `json:"pushEndpoint,omitempty"`
639
640
641
642
643
644 ForceSendFields []string `json:"-"`
645
646
647
648
649 NullFields []string `json:"-"`
650 }
651
652 func (s *PushConfig) MarshalJSON() ([]byte, error) {
653 type NoMethod PushConfig
654 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
655 }
656
657
658 type Subscription struct {
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673 AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
674
675 Name string `json:"name,omitempty"`
676
677
678 PushConfig *PushConfig `json:"pushConfig,omitempty"`
679
680
681 Topic string `json:"topic,omitempty"`
682
683
684 googleapi.ServerResponse `json:"-"`
685
686
687
688
689
690 ForceSendFields []string `json:"-"`
691
692
693
694
695 NullFields []string `json:"-"`
696 }
697
698 func (s *Subscription) MarshalJSON() ([]byte, error) {
699 type NoMethod Subscription
700 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
701 }
702
703
704 type Topic struct {
705
706 Name string `json:"name,omitempty"`
707
708
709 googleapi.ServerResponse `json:"-"`
710
711
712
713
714
715 ForceSendFields []string `json:"-"`
716
717
718
719
720 NullFields []string `json:"-"`
721 }
722
723 func (s *Topic) MarshalJSON() ([]byte, error) {
724 type NoMethod Topic
725 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
726 }
727
728 type SubscriptionsAcknowledgeCall struct {
729 s *Service
730 acknowledgerequest *AcknowledgeRequest
731 urlParams_ gensupport.URLParams
732 ctx_ context.Context
733 header_ http.Header
734 }
735
736
737
738
739
740
741 func (r *SubscriptionsService) Acknowledge(acknowledgerequest *AcknowledgeRequest) *SubscriptionsAcknowledgeCall {
742 c := &SubscriptionsAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
743 c.acknowledgerequest = acknowledgerequest
744 return c
745 }
746
747
748
749
750 func (c *SubscriptionsAcknowledgeCall) Fields(s ...googleapi.Field) *SubscriptionsAcknowledgeCall {
751 c.urlParams_.Set("fields", googleapi.CombineFields(s))
752 return c
753 }
754
755
756 func (c *SubscriptionsAcknowledgeCall) Context(ctx context.Context) *SubscriptionsAcknowledgeCall {
757 c.ctx_ = ctx
758 return c
759 }
760
761
762
763 func (c *SubscriptionsAcknowledgeCall) Header() http.Header {
764 if c.header_ == nil {
765 c.header_ = make(http.Header)
766 }
767 return c.header_
768 }
769
770 func (c *SubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
771 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
772 var body io.Reader = nil
773 body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest)
774 if err != nil {
775 return nil, err
776 }
777 c.urlParams_.Set("alt", alt)
778 c.urlParams_.Set("prettyPrint", "false")
779 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/acknowledge")
780 urls += "?" + c.urlParams_.Encode()
781 req, err := http.NewRequest("POST", urls, body)
782 if err != nil {
783 return nil, err
784 }
785 req.Header = reqHeaders
786 return gensupport.SendRequest(c.ctx_, c.s.client, req)
787 }
788
789
790
791
792
793
794 func (c *SubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
795 gensupport.SetOptions(c.urlParams_, opts...)
796 res, err := c.doRequest("json")
797 if res != nil && res.StatusCode == http.StatusNotModified {
798 if res.Body != nil {
799 res.Body.Close()
800 }
801 return nil, gensupport.WrapError(&googleapi.Error{
802 Code: res.StatusCode,
803 Header: res.Header,
804 })
805 }
806 if err != nil {
807 return nil, err
808 }
809 defer googleapi.CloseBody(res)
810 if err := googleapi.CheckResponse(res); err != nil {
811 return nil, gensupport.WrapError(err)
812 }
813 ret := &Empty{
814 ServerResponse: googleapi.ServerResponse{
815 Header: res.Header,
816 HTTPStatusCode: res.StatusCode,
817 },
818 }
819 target := &ret
820 if err := gensupport.DecodeResponse(target, res); err != nil {
821 return nil, err
822 }
823 return ret, nil
824 }
825
826 type SubscriptionsCreateCall struct {
827 s *Service
828 subscription *Subscription
829 urlParams_ gensupport.URLParams
830 ctx_ context.Context
831 header_ http.Header
832 }
833
834
835
836
837
838
839 func (r *SubscriptionsService) Create(subscription *Subscription) *SubscriptionsCreateCall {
840 c := &SubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
841 c.subscription = subscription
842 return c
843 }
844
845
846
847
848 func (c *SubscriptionsCreateCall) Fields(s ...googleapi.Field) *SubscriptionsCreateCall {
849 c.urlParams_.Set("fields", googleapi.CombineFields(s))
850 return c
851 }
852
853
854 func (c *SubscriptionsCreateCall) Context(ctx context.Context) *SubscriptionsCreateCall {
855 c.ctx_ = ctx
856 return c
857 }
858
859
860
861 func (c *SubscriptionsCreateCall) Header() http.Header {
862 if c.header_ == nil {
863 c.header_ = make(http.Header)
864 }
865 return c.header_
866 }
867
868 func (c *SubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
869 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
870 var body io.Reader = nil
871 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
872 if err != nil {
873 return nil, err
874 }
875 c.urlParams_.Set("alt", alt)
876 c.urlParams_.Set("prettyPrint", "false")
877 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions")
878 urls += "?" + c.urlParams_.Encode()
879 req, err := http.NewRequest("POST", urls, body)
880 if err != nil {
881 return nil, err
882 }
883 req.Header = reqHeaders
884 return gensupport.SendRequest(c.ctx_, c.s.client, req)
885 }
886
887
888
889
890
891
892 func (c *SubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
893 gensupport.SetOptions(c.urlParams_, opts...)
894 res, err := c.doRequest("json")
895 if res != nil && res.StatusCode == http.StatusNotModified {
896 if res.Body != nil {
897 res.Body.Close()
898 }
899 return nil, gensupport.WrapError(&googleapi.Error{
900 Code: res.StatusCode,
901 Header: res.Header,
902 })
903 }
904 if err != nil {
905 return nil, err
906 }
907 defer googleapi.CloseBody(res)
908 if err := googleapi.CheckResponse(res); err != nil {
909 return nil, gensupport.WrapError(err)
910 }
911 ret := &Subscription{
912 ServerResponse: googleapi.ServerResponse{
913 Header: res.Header,
914 HTTPStatusCode: res.StatusCode,
915 },
916 }
917 target := &ret
918 if err := gensupport.DecodeResponse(target, res); err != nil {
919 return nil, err
920 }
921 return ret, nil
922 }
923
924 type SubscriptionsDeleteCall struct {
925 s *Service
926 subscription string
927 urlParams_ gensupport.URLParams
928 ctx_ context.Context
929 header_ http.Header
930 }
931
932
933
934
935
936
937 func (r *SubscriptionsService) Delete(subscription string) *SubscriptionsDeleteCall {
938 c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
939 c.subscription = subscription
940 return c
941 }
942
943
944
945
946 func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
947 c.urlParams_.Set("fields", googleapi.CombineFields(s))
948 return c
949 }
950
951
952 func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
953 c.ctx_ = ctx
954 return c
955 }
956
957
958
959 func (c *SubscriptionsDeleteCall) Header() http.Header {
960 if c.header_ == nil {
961 c.header_ = make(http.Header)
962 }
963 return c.header_
964 }
965
966 func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
967 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
968 var body io.Reader = nil
969 c.urlParams_.Set("alt", alt)
970 c.urlParams_.Set("prettyPrint", "false")
971 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/{+subscription}")
972 urls += "?" + c.urlParams_.Encode()
973 req, err := http.NewRequest("DELETE", urls, body)
974 if err != nil {
975 return nil, err
976 }
977 req.Header = reqHeaders
978 googleapi.Expand(req.URL, map[string]string{
979 "subscription": c.subscription,
980 })
981 return gensupport.SendRequest(c.ctx_, c.s.client, req)
982 }
983
984
985
986
987
988
989 func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
990 gensupport.SetOptions(c.urlParams_, opts...)
991 res, err := c.doRequest("json")
992 if res != nil && res.StatusCode == http.StatusNotModified {
993 if res.Body != nil {
994 res.Body.Close()
995 }
996 return nil, gensupport.WrapError(&googleapi.Error{
997 Code: res.StatusCode,
998 Header: res.Header,
999 })
1000 }
1001 if err != nil {
1002 return nil, err
1003 }
1004 defer googleapi.CloseBody(res)
1005 if err := googleapi.CheckResponse(res); err != nil {
1006 return nil, gensupport.WrapError(err)
1007 }
1008 ret := &Empty{
1009 ServerResponse: googleapi.ServerResponse{
1010 Header: res.Header,
1011 HTTPStatusCode: res.StatusCode,
1012 },
1013 }
1014 target := &ret
1015 if err := gensupport.DecodeResponse(target, res); err != nil {
1016 return nil, err
1017 }
1018 return ret, nil
1019 }
1020
1021 type SubscriptionsGetCall struct {
1022 s *Service
1023 subscription string
1024 urlParams_ gensupport.URLParams
1025 ifNoneMatch_ string
1026 ctx_ context.Context
1027 header_ http.Header
1028 }
1029
1030
1031
1032
1033 func (r *SubscriptionsService) Get(subscription string) *SubscriptionsGetCall {
1034 c := &SubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1035 c.subscription = subscription
1036 return c
1037 }
1038
1039
1040
1041
1042 func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
1043 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1044 return c
1045 }
1046
1047
1048
1049
1050 func (c *SubscriptionsGetCall) IfNoneMatch(entityTag string) *SubscriptionsGetCall {
1051 c.ifNoneMatch_ = entityTag
1052 return c
1053 }
1054
1055
1056 func (c *SubscriptionsGetCall) Context(ctx context.Context) *SubscriptionsGetCall {
1057 c.ctx_ = ctx
1058 return c
1059 }
1060
1061
1062
1063 func (c *SubscriptionsGetCall) Header() http.Header {
1064 if c.header_ == nil {
1065 c.header_ = make(http.Header)
1066 }
1067 return c.header_
1068 }
1069
1070 func (c *SubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
1071 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1072 if c.ifNoneMatch_ != "" {
1073 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1074 }
1075 var body io.Reader = nil
1076 c.urlParams_.Set("alt", alt)
1077 c.urlParams_.Set("prettyPrint", "false")
1078 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/{+subscription}")
1079 urls += "?" + c.urlParams_.Encode()
1080 req, err := http.NewRequest("GET", urls, body)
1081 if err != nil {
1082 return nil, err
1083 }
1084 req.Header = reqHeaders
1085 googleapi.Expand(req.URL, map[string]string{
1086 "subscription": c.subscription,
1087 })
1088 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1089 }
1090
1091
1092
1093
1094
1095
1096 func (c *SubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1097 gensupport.SetOptions(c.urlParams_, opts...)
1098 res, err := c.doRequest("json")
1099 if res != nil && res.StatusCode == http.StatusNotModified {
1100 if res.Body != nil {
1101 res.Body.Close()
1102 }
1103 return nil, gensupport.WrapError(&googleapi.Error{
1104 Code: res.StatusCode,
1105 Header: res.Header,
1106 })
1107 }
1108 if err != nil {
1109 return nil, err
1110 }
1111 defer googleapi.CloseBody(res)
1112 if err := googleapi.CheckResponse(res); err != nil {
1113 return nil, gensupport.WrapError(err)
1114 }
1115 ret := &Subscription{
1116 ServerResponse: googleapi.ServerResponse{
1117 Header: res.Header,
1118 HTTPStatusCode: res.StatusCode,
1119 },
1120 }
1121 target := &ret
1122 if err := gensupport.DecodeResponse(target, res); err != nil {
1123 return nil, err
1124 }
1125 return ret, nil
1126 }
1127
1128 type SubscriptionsListCall struct {
1129 s *Service
1130 urlParams_ gensupport.URLParams
1131 ifNoneMatch_ string
1132 ctx_ context.Context
1133 header_ http.Header
1134 }
1135
1136
1137 func (r *SubscriptionsService) List() *SubscriptionsListCall {
1138 c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1139 return c
1140 }
1141
1142
1143
1144 func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
1145 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1146 return c
1147 }
1148
1149
1150
1151 func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
1152 c.urlParams_.Set("pageToken", pageToken)
1153 return c
1154 }
1155
1156
1157 func (c *SubscriptionsListCall) Query(query string) *SubscriptionsListCall {
1158 c.urlParams_.Set("query", query)
1159 return c
1160 }
1161
1162
1163
1164
1165 func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
1166 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1167 return c
1168 }
1169
1170
1171
1172
1173 func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
1174 c.ifNoneMatch_ = entityTag
1175 return c
1176 }
1177
1178
1179 func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
1180 c.ctx_ = ctx
1181 return c
1182 }
1183
1184
1185
1186 func (c *SubscriptionsListCall) Header() http.Header {
1187 if c.header_ == nil {
1188 c.header_ = make(http.Header)
1189 }
1190 return c.header_
1191 }
1192
1193 func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
1194 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1195 if c.ifNoneMatch_ != "" {
1196 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1197 }
1198 var body io.Reader = nil
1199 c.urlParams_.Set("alt", alt)
1200 c.urlParams_.Set("prettyPrint", "false")
1201 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions")
1202 urls += "?" + c.urlParams_.Encode()
1203 req, err := http.NewRequest("GET", urls, body)
1204 if err != nil {
1205 return nil, err
1206 }
1207 req.Header = reqHeaders
1208 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1209 }
1210
1211
1212
1213
1214
1215
1216
1217 func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) {
1218 gensupport.SetOptions(c.urlParams_, opts...)
1219 res, err := c.doRequest("json")
1220 if res != nil && res.StatusCode == http.StatusNotModified {
1221 if res.Body != nil {
1222 res.Body.Close()
1223 }
1224 return nil, gensupport.WrapError(&googleapi.Error{
1225 Code: res.StatusCode,
1226 Header: res.Header,
1227 })
1228 }
1229 if err != nil {
1230 return nil, err
1231 }
1232 defer googleapi.CloseBody(res)
1233 if err := googleapi.CheckResponse(res); err != nil {
1234 return nil, gensupport.WrapError(err)
1235 }
1236 ret := &ListSubscriptionsResponse{
1237 ServerResponse: googleapi.ServerResponse{
1238 Header: res.Header,
1239 HTTPStatusCode: res.StatusCode,
1240 },
1241 }
1242 target := &ret
1243 if err := gensupport.DecodeResponse(target, res); err != nil {
1244 return nil, err
1245 }
1246 return ret, nil
1247 }
1248
1249
1250
1251
1252 func (c *SubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error {
1253 c.ctx_ = ctx
1254 defer c.PageToken(c.urlParams_.Get("pageToken"))
1255 for {
1256 x, err := c.Do()
1257 if err != nil {
1258 return err
1259 }
1260 if err := f(x); err != nil {
1261 return err
1262 }
1263 if x.NextPageToken == "" {
1264 return nil
1265 }
1266 c.PageToken(x.NextPageToken)
1267 }
1268 }
1269
1270 type SubscriptionsModifyAckDeadlineCall struct {
1271 s *Service
1272 modifyackdeadlinerequest *ModifyAckDeadlineRequest
1273 urlParams_ gensupport.URLParams
1274 ctx_ context.Context
1275 header_ http.Header
1276 }
1277
1278
1279
1280 func (r *SubscriptionsService) ModifyAckDeadline(modifyackdeadlinerequest *ModifyAckDeadlineRequest) *SubscriptionsModifyAckDeadlineCall {
1281 c := &SubscriptionsModifyAckDeadlineCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1282 c.modifyackdeadlinerequest = modifyackdeadlinerequest
1283 return c
1284 }
1285
1286
1287
1288
1289 func (c *SubscriptionsModifyAckDeadlineCall) Fields(s ...googleapi.Field) *SubscriptionsModifyAckDeadlineCall {
1290 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1291 return c
1292 }
1293
1294
1295 func (c *SubscriptionsModifyAckDeadlineCall) Context(ctx context.Context) *SubscriptionsModifyAckDeadlineCall {
1296 c.ctx_ = ctx
1297 return c
1298 }
1299
1300
1301
1302 func (c *SubscriptionsModifyAckDeadlineCall) Header() http.Header {
1303 if c.header_ == nil {
1304 c.header_ = make(http.Header)
1305 }
1306 return c.header_
1307 }
1308
1309 func (c *SubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) {
1310 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1311 var body io.Reader = nil
1312 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest)
1313 if err != nil {
1314 return nil, err
1315 }
1316 c.urlParams_.Set("alt", alt)
1317 c.urlParams_.Set("prettyPrint", "false")
1318 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/modifyAckDeadline")
1319 urls += "?" + c.urlParams_.Encode()
1320 req, err := http.NewRequest("POST", urls, body)
1321 if err != nil {
1322 return nil, err
1323 }
1324 req.Header = reqHeaders
1325 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1326 }
1327
1328
1329
1330
1331
1332
1333 func (c *SubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1334 gensupport.SetOptions(c.urlParams_, opts...)
1335 res, err := c.doRequest("json")
1336 if res != nil && res.StatusCode == http.StatusNotModified {
1337 if res.Body != nil {
1338 res.Body.Close()
1339 }
1340 return nil, gensupport.WrapError(&googleapi.Error{
1341 Code: res.StatusCode,
1342 Header: res.Header,
1343 })
1344 }
1345 if err != nil {
1346 return nil, err
1347 }
1348 defer googleapi.CloseBody(res)
1349 if err := googleapi.CheckResponse(res); err != nil {
1350 return nil, gensupport.WrapError(err)
1351 }
1352 ret := &Empty{
1353 ServerResponse: googleapi.ServerResponse{
1354 Header: res.Header,
1355 HTTPStatusCode: res.StatusCode,
1356 },
1357 }
1358 target := &ret
1359 if err := gensupport.DecodeResponse(target, res); err != nil {
1360 return nil, err
1361 }
1362 return ret, nil
1363 }
1364
1365 type SubscriptionsModifyPushConfigCall struct {
1366 s *Service
1367 modifypushconfigrequest *ModifyPushConfigRequest
1368 urlParams_ gensupport.URLParams
1369 ctx_ context.Context
1370 header_ http.Header
1371 }
1372
1373
1374
1375
1376
1377
1378 func (r *SubscriptionsService) ModifyPushConfig(modifypushconfigrequest *ModifyPushConfigRequest) *SubscriptionsModifyPushConfigCall {
1379 c := &SubscriptionsModifyPushConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1380 c.modifypushconfigrequest = modifypushconfigrequest
1381 return c
1382 }
1383
1384
1385
1386
1387 func (c *SubscriptionsModifyPushConfigCall) Fields(s ...googleapi.Field) *SubscriptionsModifyPushConfigCall {
1388 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1389 return c
1390 }
1391
1392
1393 func (c *SubscriptionsModifyPushConfigCall) Context(ctx context.Context) *SubscriptionsModifyPushConfigCall {
1394 c.ctx_ = ctx
1395 return c
1396 }
1397
1398
1399
1400 func (c *SubscriptionsModifyPushConfigCall) Header() http.Header {
1401 if c.header_ == nil {
1402 c.header_ = make(http.Header)
1403 }
1404 return c.header_
1405 }
1406
1407 func (c *SubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) {
1408 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1409 var body io.Reader = nil
1410 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest)
1411 if err != nil {
1412 return nil, err
1413 }
1414 c.urlParams_.Set("alt", alt)
1415 c.urlParams_.Set("prettyPrint", "false")
1416 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/modifyPushConfig")
1417 urls += "?" + c.urlParams_.Encode()
1418 req, err := http.NewRequest("POST", urls, body)
1419 if err != nil {
1420 return nil, err
1421 }
1422 req.Header = reqHeaders
1423 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1424 }
1425
1426
1427
1428
1429
1430
1431 func (c *SubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1432 gensupport.SetOptions(c.urlParams_, opts...)
1433 res, err := c.doRequest("json")
1434 if res != nil && res.StatusCode == http.StatusNotModified {
1435 if res.Body != nil {
1436 res.Body.Close()
1437 }
1438 return nil, gensupport.WrapError(&googleapi.Error{
1439 Code: res.StatusCode,
1440 Header: res.Header,
1441 })
1442 }
1443 if err != nil {
1444 return nil, err
1445 }
1446 defer googleapi.CloseBody(res)
1447 if err := googleapi.CheckResponse(res); err != nil {
1448 return nil, gensupport.WrapError(err)
1449 }
1450 ret := &Empty{
1451 ServerResponse: googleapi.ServerResponse{
1452 Header: res.Header,
1453 HTTPStatusCode: res.StatusCode,
1454 },
1455 }
1456 target := &ret
1457 if err := gensupport.DecodeResponse(target, res); err != nil {
1458 return nil, err
1459 }
1460 return ret, nil
1461 }
1462
1463 type SubscriptionsPullCall struct {
1464 s *Service
1465 pullrequest *PullRequest
1466 urlParams_ gensupport.URLParams
1467 ctx_ context.Context
1468 header_ http.Header
1469 }
1470
1471
1472
1473
1474
1475
1476 func (r *SubscriptionsService) Pull(pullrequest *PullRequest) *SubscriptionsPullCall {
1477 c := &SubscriptionsPullCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1478 c.pullrequest = pullrequest
1479 return c
1480 }
1481
1482
1483
1484
1485 func (c *SubscriptionsPullCall) Fields(s ...googleapi.Field) *SubscriptionsPullCall {
1486 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1487 return c
1488 }
1489
1490
1491 func (c *SubscriptionsPullCall) Context(ctx context.Context) *SubscriptionsPullCall {
1492 c.ctx_ = ctx
1493 return c
1494 }
1495
1496
1497
1498 func (c *SubscriptionsPullCall) Header() http.Header {
1499 if c.header_ == nil {
1500 c.header_ = make(http.Header)
1501 }
1502 return c.header_
1503 }
1504
1505 func (c *SubscriptionsPullCall) doRequest(alt string) (*http.Response, error) {
1506 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1507 var body io.Reader = nil
1508 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest)
1509 if err != nil {
1510 return nil, err
1511 }
1512 c.urlParams_.Set("alt", alt)
1513 c.urlParams_.Set("prettyPrint", "false")
1514 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/pull")
1515 urls += "?" + c.urlParams_.Encode()
1516 req, err := http.NewRequest("POST", urls, body)
1517 if err != nil {
1518 return nil, err
1519 }
1520 req.Header = reqHeaders
1521 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1522 }
1523
1524
1525
1526
1527
1528
1529 func (c *SubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullResponse, error) {
1530 gensupport.SetOptions(c.urlParams_, opts...)
1531 res, err := c.doRequest("json")
1532 if res != nil && res.StatusCode == http.StatusNotModified {
1533 if res.Body != nil {
1534 res.Body.Close()
1535 }
1536 return nil, gensupport.WrapError(&googleapi.Error{
1537 Code: res.StatusCode,
1538 Header: res.Header,
1539 })
1540 }
1541 if err != nil {
1542 return nil, err
1543 }
1544 defer googleapi.CloseBody(res)
1545 if err := googleapi.CheckResponse(res); err != nil {
1546 return nil, gensupport.WrapError(err)
1547 }
1548 ret := &PullResponse{
1549 ServerResponse: googleapi.ServerResponse{
1550 Header: res.Header,
1551 HTTPStatusCode: res.StatusCode,
1552 },
1553 }
1554 target := &ret
1555 if err := gensupport.DecodeResponse(target, res); err != nil {
1556 return nil, err
1557 }
1558 return ret, nil
1559 }
1560
1561 type SubscriptionsPullBatchCall struct {
1562 s *Service
1563 pullbatchrequest *PullBatchRequest
1564 urlParams_ gensupport.URLParams
1565 ctx_ context.Context
1566 header_ http.Header
1567 }
1568
1569
1570
1571
1572
1573 func (r *SubscriptionsService) PullBatch(pullbatchrequest *PullBatchRequest) *SubscriptionsPullBatchCall {
1574 c := &SubscriptionsPullBatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1575 c.pullbatchrequest = pullbatchrequest
1576 return c
1577 }
1578
1579
1580
1581
1582 func (c *SubscriptionsPullBatchCall) Fields(s ...googleapi.Field) *SubscriptionsPullBatchCall {
1583 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1584 return c
1585 }
1586
1587
1588 func (c *SubscriptionsPullBatchCall) Context(ctx context.Context) *SubscriptionsPullBatchCall {
1589 c.ctx_ = ctx
1590 return c
1591 }
1592
1593
1594
1595 func (c *SubscriptionsPullBatchCall) Header() http.Header {
1596 if c.header_ == nil {
1597 c.header_ = make(http.Header)
1598 }
1599 return c.header_
1600 }
1601
1602 func (c *SubscriptionsPullBatchCall) doRequest(alt string) (*http.Response, error) {
1603 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1604 var body io.Reader = nil
1605 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullbatchrequest)
1606 if err != nil {
1607 return nil, err
1608 }
1609 c.urlParams_.Set("alt", alt)
1610 c.urlParams_.Set("prettyPrint", "false")
1611 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/subscriptions/pullBatch")
1612 urls += "?" + c.urlParams_.Encode()
1613 req, err := http.NewRequest("POST", urls, body)
1614 if err != nil {
1615 return nil, err
1616 }
1617 req.Header = reqHeaders
1618 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1619 }
1620
1621
1622
1623
1624
1625
1626
1627 func (c *SubscriptionsPullBatchCall) Do(opts ...googleapi.CallOption) (*PullBatchResponse, error) {
1628 gensupport.SetOptions(c.urlParams_, opts...)
1629 res, err := c.doRequest("json")
1630 if res != nil && res.StatusCode == http.StatusNotModified {
1631 if res.Body != nil {
1632 res.Body.Close()
1633 }
1634 return nil, gensupport.WrapError(&googleapi.Error{
1635 Code: res.StatusCode,
1636 Header: res.Header,
1637 })
1638 }
1639 if err != nil {
1640 return nil, err
1641 }
1642 defer googleapi.CloseBody(res)
1643 if err := googleapi.CheckResponse(res); err != nil {
1644 return nil, gensupport.WrapError(err)
1645 }
1646 ret := &PullBatchResponse{
1647 ServerResponse: googleapi.ServerResponse{
1648 Header: res.Header,
1649 HTTPStatusCode: res.StatusCode,
1650 },
1651 }
1652 target := &ret
1653 if err := gensupport.DecodeResponse(target, res); err != nil {
1654 return nil, err
1655 }
1656 return ret, nil
1657 }
1658
1659 type TopicsCreateCall struct {
1660 s *Service
1661 topic *Topic
1662 urlParams_ gensupport.URLParams
1663 ctx_ context.Context
1664 header_ http.Header
1665 }
1666
1667
1668 func (r *TopicsService) Create(topic *Topic) *TopicsCreateCall {
1669 c := &TopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1670 c.topic = topic
1671 return c
1672 }
1673
1674
1675
1676
1677 func (c *TopicsCreateCall) Fields(s ...googleapi.Field) *TopicsCreateCall {
1678 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1679 return c
1680 }
1681
1682
1683 func (c *TopicsCreateCall) Context(ctx context.Context) *TopicsCreateCall {
1684 c.ctx_ = ctx
1685 return c
1686 }
1687
1688
1689
1690 func (c *TopicsCreateCall) Header() http.Header {
1691 if c.header_ == nil {
1692 c.header_ = make(http.Header)
1693 }
1694 return c.header_
1695 }
1696
1697 func (c *TopicsCreateCall) doRequest(alt string) (*http.Response, error) {
1698 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1699 var body io.Reader = nil
1700 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic)
1701 if err != nil {
1702 return nil, err
1703 }
1704 c.urlParams_.Set("alt", alt)
1705 c.urlParams_.Set("prettyPrint", "false")
1706 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics")
1707 urls += "?" + c.urlParams_.Encode()
1708 req, err := http.NewRequest("POST", urls, body)
1709 if err != nil {
1710 return nil, err
1711 }
1712 req.Header = reqHeaders
1713 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1714 }
1715
1716
1717
1718
1719
1720
1721 func (c *TopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
1722 gensupport.SetOptions(c.urlParams_, opts...)
1723 res, err := c.doRequest("json")
1724 if res != nil && res.StatusCode == http.StatusNotModified {
1725 if res.Body != nil {
1726 res.Body.Close()
1727 }
1728 return nil, gensupport.WrapError(&googleapi.Error{
1729 Code: res.StatusCode,
1730 Header: res.Header,
1731 })
1732 }
1733 if err != nil {
1734 return nil, err
1735 }
1736 defer googleapi.CloseBody(res)
1737 if err := googleapi.CheckResponse(res); err != nil {
1738 return nil, gensupport.WrapError(err)
1739 }
1740 ret := &Topic{
1741 ServerResponse: googleapi.ServerResponse{
1742 Header: res.Header,
1743 HTTPStatusCode: res.StatusCode,
1744 },
1745 }
1746 target := &ret
1747 if err := gensupport.DecodeResponse(target, res); err != nil {
1748 return nil, err
1749 }
1750 return ret, nil
1751 }
1752
1753 type TopicsDeleteCall struct {
1754 s *Service
1755 topic string
1756 urlParams_ gensupport.URLParams
1757 ctx_ context.Context
1758 header_ http.Header
1759 }
1760
1761
1762
1763
1764
1765
1766 func (r *TopicsService) Delete(topic string) *TopicsDeleteCall {
1767 c := &TopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1768 c.topic = topic
1769 return c
1770 }
1771
1772
1773
1774
1775 func (c *TopicsDeleteCall) Fields(s ...googleapi.Field) *TopicsDeleteCall {
1776 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1777 return c
1778 }
1779
1780
1781 func (c *TopicsDeleteCall) Context(ctx context.Context) *TopicsDeleteCall {
1782 c.ctx_ = ctx
1783 return c
1784 }
1785
1786
1787
1788 func (c *TopicsDeleteCall) Header() http.Header {
1789 if c.header_ == nil {
1790 c.header_ = make(http.Header)
1791 }
1792 return c.header_
1793 }
1794
1795 func (c *TopicsDeleteCall) doRequest(alt string) (*http.Response, error) {
1796 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1797 var body io.Reader = nil
1798 c.urlParams_.Set("alt", alt)
1799 c.urlParams_.Set("prettyPrint", "false")
1800 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics/{+topic}")
1801 urls += "?" + c.urlParams_.Encode()
1802 req, err := http.NewRequest("DELETE", urls, body)
1803 if err != nil {
1804 return nil, err
1805 }
1806 req.Header = reqHeaders
1807 googleapi.Expand(req.URL, map[string]string{
1808 "topic": c.topic,
1809 })
1810 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1811 }
1812
1813
1814
1815
1816
1817
1818 func (c *TopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1819 gensupport.SetOptions(c.urlParams_, opts...)
1820 res, err := c.doRequest("json")
1821 if res != nil && res.StatusCode == http.StatusNotModified {
1822 if res.Body != nil {
1823 res.Body.Close()
1824 }
1825 return nil, gensupport.WrapError(&googleapi.Error{
1826 Code: res.StatusCode,
1827 Header: res.Header,
1828 })
1829 }
1830 if err != nil {
1831 return nil, err
1832 }
1833 defer googleapi.CloseBody(res)
1834 if err := googleapi.CheckResponse(res); err != nil {
1835 return nil, gensupport.WrapError(err)
1836 }
1837 ret := &Empty{
1838 ServerResponse: googleapi.ServerResponse{
1839 Header: res.Header,
1840 HTTPStatusCode: res.StatusCode,
1841 },
1842 }
1843 target := &ret
1844 if err := gensupport.DecodeResponse(target, res); err != nil {
1845 return nil, err
1846 }
1847 return ret, nil
1848 }
1849
1850 type TopicsGetCall struct {
1851 s *Service
1852 topic string
1853 urlParams_ gensupport.URLParams
1854 ifNoneMatch_ string
1855 ctx_ context.Context
1856 header_ http.Header
1857 }
1858
1859
1860
1861
1862
1863
1864 func (r *TopicsService) Get(topic string) *TopicsGetCall {
1865 c := &TopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1866 c.topic = topic
1867 return c
1868 }
1869
1870
1871
1872
1873 func (c *TopicsGetCall) Fields(s ...googleapi.Field) *TopicsGetCall {
1874 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1875 return c
1876 }
1877
1878
1879
1880
1881 func (c *TopicsGetCall) IfNoneMatch(entityTag string) *TopicsGetCall {
1882 c.ifNoneMatch_ = entityTag
1883 return c
1884 }
1885
1886
1887 func (c *TopicsGetCall) Context(ctx context.Context) *TopicsGetCall {
1888 c.ctx_ = ctx
1889 return c
1890 }
1891
1892
1893
1894 func (c *TopicsGetCall) Header() http.Header {
1895 if c.header_ == nil {
1896 c.header_ = make(http.Header)
1897 }
1898 return c.header_
1899 }
1900
1901 func (c *TopicsGetCall) doRequest(alt string) (*http.Response, error) {
1902 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1903 if c.ifNoneMatch_ != "" {
1904 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1905 }
1906 var body io.Reader = nil
1907 c.urlParams_.Set("alt", alt)
1908 c.urlParams_.Set("prettyPrint", "false")
1909 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics/{+topic}")
1910 urls += "?" + c.urlParams_.Encode()
1911 req, err := http.NewRequest("GET", urls, body)
1912 if err != nil {
1913 return nil, err
1914 }
1915 req.Header = reqHeaders
1916 googleapi.Expand(req.URL, map[string]string{
1917 "topic": c.topic,
1918 })
1919 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1920 }
1921
1922
1923
1924
1925
1926
1927 func (c *TopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
1928 gensupport.SetOptions(c.urlParams_, opts...)
1929 res, err := c.doRequest("json")
1930 if res != nil && res.StatusCode == http.StatusNotModified {
1931 if res.Body != nil {
1932 res.Body.Close()
1933 }
1934 return nil, gensupport.WrapError(&googleapi.Error{
1935 Code: res.StatusCode,
1936 Header: res.Header,
1937 })
1938 }
1939 if err != nil {
1940 return nil, err
1941 }
1942 defer googleapi.CloseBody(res)
1943 if err := googleapi.CheckResponse(res); err != nil {
1944 return nil, gensupport.WrapError(err)
1945 }
1946 ret := &Topic{
1947 ServerResponse: googleapi.ServerResponse{
1948 Header: res.Header,
1949 HTTPStatusCode: res.StatusCode,
1950 },
1951 }
1952 target := &ret
1953 if err := gensupport.DecodeResponse(target, res); err != nil {
1954 return nil, err
1955 }
1956 return ret, nil
1957 }
1958
1959 type TopicsListCall struct {
1960 s *Service
1961 urlParams_ gensupport.URLParams
1962 ifNoneMatch_ string
1963 ctx_ context.Context
1964 header_ http.Header
1965 }
1966
1967
1968 func (r *TopicsService) List() *TopicsListCall {
1969 c := &TopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1970 return c
1971 }
1972
1973
1974
1975 func (c *TopicsListCall) MaxResults(maxResults int64) *TopicsListCall {
1976 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1977 return c
1978 }
1979
1980
1981
1982 func (c *TopicsListCall) PageToken(pageToken string) *TopicsListCall {
1983 c.urlParams_.Set("pageToken", pageToken)
1984 return c
1985 }
1986
1987
1988 func (c *TopicsListCall) Query(query string) *TopicsListCall {
1989 c.urlParams_.Set("query", query)
1990 return c
1991 }
1992
1993
1994
1995
1996 func (c *TopicsListCall) Fields(s ...googleapi.Field) *TopicsListCall {
1997 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1998 return c
1999 }
2000
2001
2002
2003
2004 func (c *TopicsListCall) IfNoneMatch(entityTag string) *TopicsListCall {
2005 c.ifNoneMatch_ = entityTag
2006 return c
2007 }
2008
2009
2010 func (c *TopicsListCall) Context(ctx context.Context) *TopicsListCall {
2011 c.ctx_ = ctx
2012 return c
2013 }
2014
2015
2016
2017 func (c *TopicsListCall) Header() http.Header {
2018 if c.header_ == nil {
2019 c.header_ = make(http.Header)
2020 }
2021 return c.header_
2022 }
2023
2024 func (c *TopicsListCall) doRequest(alt string) (*http.Response, error) {
2025 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2026 if c.ifNoneMatch_ != "" {
2027 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2028 }
2029 var body io.Reader = nil
2030 c.urlParams_.Set("alt", alt)
2031 c.urlParams_.Set("prettyPrint", "false")
2032 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics")
2033 urls += "?" + c.urlParams_.Encode()
2034 req, err := http.NewRequest("GET", urls, body)
2035 if err != nil {
2036 return nil, err
2037 }
2038 req.Header = reqHeaders
2039 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2040 }
2041
2042
2043
2044
2045
2046
2047
2048 func (c *TopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) {
2049 gensupport.SetOptions(c.urlParams_, opts...)
2050 res, err := c.doRequest("json")
2051 if res != nil && res.StatusCode == http.StatusNotModified {
2052 if res.Body != nil {
2053 res.Body.Close()
2054 }
2055 return nil, gensupport.WrapError(&googleapi.Error{
2056 Code: res.StatusCode,
2057 Header: res.Header,
2058 })
2059 }
2060 if err != nil {
2061 return nil, err
2062 }
2063 defer googleapi.CloseBody(res)
2064 if err := googleapi.CheckResponse(res); err != nil {
2065 return nil, gensupport.WrapError(err)
2066 }
2067 ret := &ListTopicsResponse{
2068 ServerResponse: googleapi.ServerResponse{
2069 Header: res.Header,
2070 HTTPStatusCode: res.StatusCode,
2071 },
2072 }
2073 target := &ret
2074 if err := gensupport.DecodeResponse(target, res); err != nil {
2075 return nil, err
2076 }
2077 return ret, nil
2078 }
2079
2080
2081
2082
2083 func (c *TopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error {
2084 c.ctx_ = ctx
2085 defer c.PageToken(c.urlParams_.Get("pageToken"))
2086 for {
2087 x, err := c.Do()
2088 if err != nil {
2089 return err
2090 }
2091 if err := f(x); err != nil {
2092 return err
2093 }
2094 if x.NextPageToken == "" {
2095 return nil
2096 }
2097 c.PageToken(x.NextPageToken)
2098 }
2099 }
2100
2101 type TopicsPublishCall struct {
2102 s *Service
2103 publishrequest *PublishRequest
2104 urlParams_ gensupport.URLParams
2105 ctx_ context.Context
2106 header_ http.Header
2107 }
2108
2109
2110
2111 func (r *TopicsService) Publish(publishrequest *PublishRequest) *TopicsPublishCall {
2112 c := &TopicsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2113 c.publishrequest = publishrequest
2114 return c
2115 }
2116
2117
2118
2119
2120 func (c *TopicsPublishCall) Fields(s ...googleapi.Field) *TopicsPublishCall {
2121 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2122 return c
2123 }
2124
2125
2126 func (c *TopicsPublishCall) Context(ctx context.Context) *TopicsPublishCall {
2127 c.ctx_ = ctx
2128 return c
2129 }
2130
2131
2132
2133 func (c *TopicsPublishCall) Header() http.Header {
2134 if c.header_ == nil {
2135 c.header_ = make(http.Header)
2136 }
2137 return c.header_
2138 }
2139
2140 func (c *TopicsPublishCall) doRequest(alt string) (*http.Response, error) {
2141 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2142 var body io.Reader = nil
2143 body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest)
2144 if err != nil {
2145 return nil, err
2146 }
2147 c.urlParams_.Set("alt", alt)
2148 c.urlParams_.Set("prettyPrint", "false")
2149 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics/publish")
2150 urls += "?" + c.urlParams_.Encode()
2151 req, err := http.NewRequest("POST", urls, body)
2152 if err != nil {
2153 return nil, err
2154 }
2155 req.Header = reqHeaders
2156 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2157 }
2158
2159
2160
2161
2162
2163
2164 func (c *TopicsPublishCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2165 gensupport.SetOptions(c.urlParams_, opts...)
2166 res, err := c.doRequest("json")
2167 if res != nil && res.StatusCode == http.StatusNotModified {
2168 if res.Body != nil {
2169 res.Body.Close()
2170 }
2171 return nil, gensupport.WrapError(&googleapi.Error{
2172 Code: res.StatusCode,
2173 Header: res.Header,
2174 })
2175 }
2176 if err != nil {
2177 return nil, err
2178 }
2179 defer googleapi.CloseBody(res)
2180 if err := googleapi.CheckResponse(res); err != nil {
2181 return nil, gensupport.WrapError(err)
2182 }
2183 ret := &Empty{
2184 ServerResponse: googleapi.ServerResponse{
2185 Header: res.Header,
2186 HTTPStatusCode: res.StatusCode,
2187 },
2188 }
2189 target := &ret
2190 if err := gensupport.DecodeResponse(target, res); err != nil {
2191 return nil, err
2192 }
2193 return ret, nil
2194 }
2195
2196 type TopicsPublishBatchCall struct {
2197 s *Service
2198 publishbatchrequest *PublishBatchRequest
2199 urlParams_ gensupport.URLParams
2200 ctx_ context.Context
2201 header_ http.Header
2202 }
2203
2204
2205
2206 func (r *TopicsService) PublishBatch(publishbatchrequest *PublishBatchRequest) *TopicsPublishBatchCall {
2207 c := &TopicsPublishBatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2208 c.publishbatchrequest = publishbatchrequest
2209 return c
2210 }
2211
2212
2213
2214
2215 func (c *TopicsPublishBatchCall) Fields(s ...googleapi.Field) *TopicsPublishBatchCall {
2216 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2217 return c
2218 }
2219
2220
2221 func (c *TopicsPublishBatchCall) Context(ctx context.Context) *TopicsPublishBatchCall {
2222 c.ctx_ = ctx
2223 return c
2224 }
2225
2226
2227
2228 func (c *TopicsPublishBatchCall) Header() http.Header {
2229 if c.header_ == nil {
2230 c.header_ = make(http.Header)
2231 }
2232 return c.header_
2233 }
2234
2235 func (c *TopicsPublishBatchCall) doRequest(alt string) (*http.Response, error) {
2236 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2237 var body io.Reader = nil
2238 body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishbatchrequest)
2239 if err != nil {
2240 return nil, err
2241 }
2242 c.urlParams_.Set("alt", alt)
2243 c.urlParams_.Set("prettyPrint", "false")
2244 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1a/topics/publishBatch")
2245 urls += "?" + c.urlParams_.Encode()
2246 req, err := http.NewRequest("POST", urls, body)
2247 if err != nil {
2248 return nil, err
2249 }
2250 req.Header = reqHeaders
2251 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2252 }
2253
2254
2255
2256
2257
2258
2259
2260 func (c *TopicsPublishBatchCall) Do(opts ...googleapi.CallOption) (*PublishBatchResponse, error) {
2261 gensupport.SetOptions(c.urlParams_, opts...)
2262 res, err := c.doRequest("json")
2263 if res != nil && res.StatusCode == http.StatusNotModified {
2264 if res.Body != nil {
2265 res.Body.Close()
2266 }
2267 return nil, gensupport.WrapError(&googleapi.Error{
2268 Code: res.StatusCode,
2269 Header: res.Header,
2270 })
2271 }
2272 if err != nil {
2273 return nil, err
2274 }
2275 defer googleapi.CloseBody(res)
2276 if err := googleapi.CheckResponse(res); err != nil {
2277 return nil, gensupport.WrapError(err)
2278 }
2279 ret := &PublishBatchResponse{
2280 ServerResponse: googleapi.ServerResponse{
2281 Header: res.Header,
2282 HTTPStatusCode: res.StatusCode,
2283 },
2284 }
2285 target := &ret
2286 if err := gensupport.DecodeResponse(target, res); err != nil {
2287 return nil, err
2288 }
2289 return ret, nil
2290 }
2291
View as plain text