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 reseller
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 = "reseller:v1"
95 const apiName = "reseller"
96 const apiVersion = "v1"
97 const basePath = "https://reseller.googleapis.com/"
98 const basePathTemplate = "https://reseller.UNIVERSE_DOMAIN/"
99 const mtlsBasePath = "https://reseller.mtls.googleapis.com/"
100
101
102 const (
103
104 AppsOrderScope = "https://www.googleapis.com/auth/apps.order"
105
106
107 AppsOrderReadonlyScope = "https://www.googleapis.com/auth/apps.order.readonly"
108 )
109
110
111 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
112 scopesOption := internaloption.WithDefaultScopes(
113 "https://www.googleapis.com/auth/apps.order",
114 "https://www.googleapis.com/auth/apps.order.readonly",
115 )
116
117 opts = append([]option.ClientOption{scopesOption}, opts...)
118 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
119 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
120 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
121 opts = append(opts, internaloption.EnableNewAuthLibrary())
122 client, endpoint, err := htransport.NewClient(ctx, opts...)
123 if err != nil {
124 return nil, err
125 }
126 s, err := New(client)
127 if err != nil {
128 return nil, err
129 }
130 if endpoint != "" {
131 s.BasePath = endpoint
132 }
133 return s, nil
134 }
135
136
137
138
139
140
141 func New(client *http.Client) (*Service, error) {
142 if client == nil {
143 return nil, errors.New("client is nil")
144 }
145 s := &Service{client: client, BasePath: basePath}
146 s.Customers = NewCustomersService(s)
147 s.Resellernotify = NewResellernotifyService(s)
148 s.Subscriptions = NewSubscriptionsService(s)
149 return s, nil
150 }
151
152 type Service struct {
153 client *http.Client
154 BasePath string
155 UserAgent string
156
157 Customers *CustomersService
158
159 Resellernotify *ResellernotifyService
160
161 Subscriptions *SubscriptionsService
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 NewCustomersService(s *Service) *CustomersService {
172 rs := &CustomersService{s: s}
173 return rs
174 }
175
176 type CustomersService struct {
177 s *Service
178 }
179
180 func NewResellernotifyService(s *Service) *ResellernotifyService {
181 rs := &ResellernotifyService{s: s}
182 return rs
183 }
184
185 type ResellernotifyService struct {
186 s *Service
187 }
188
189 func NewSubscriptionsService(s *Service) *SubscriptionsService {
190 rs := &SubscriptionsService{s: s}
191 return rs
192 }
193
194 type SubscriptionsService struct {
195 s *Service
196 }
197
198
199 type Address struct {
200
201
202 AddressLine1 string `json:"addressLine1,omitempty"`
203
204 AddressLine2 string `json:"addressLine2,omitempty"`
205
206 AddressLine3 string `json:"addressLine3,omitempty"`
207
208 ContactName string `json:"contactName,omitempty"`
209
210
211
212 CountryCode string `json:"countryCode,omitempty"`
213
214
215 Kind string `json:"kind,omitempty"`
216
217 Locality string `json:"locality,omitempty"`
218
219 OrganizationName string `json:"organizationName,omitempty"`
220
221
222 PostalCode string `json:"postalCode,omitempty"`
223
224 Region string `json:"region,omitempty"`
225
226
227
228
229
230 ForceSendFields []string `json:"-"`
231
232
233
234
235 NullFields []string `json:"-"`
236 }
237
238 func (s *Address) MarshalJSON() ([]byte, error) {
239 type NoMethod Address
240 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
241 }
242
243
244 type ChangePlanRequest struct {
245
246
247
248
249
250
251
252
253 DealCode string `json:"dealCode,omitempty"`
254
255
256 Kind string `json:"kind,omitempty"`
257
258
259
260
261
262
263
264 PlanName string `json:"planName,omitempty"`
265
266
267
268
269 PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
270
271
272 Seats *Seats `json:"seats,omitempty"`
273
274
275
276
277
278 ForceSendFields []string `json:"-"`
279
280
281
282
283 NullFields []string `json:"-"`
284 }
285
286 func (s *ChangePlanRequest) MarshalJSON() ([]byte, error) {
287 type NoMethod ChangePlanRequest
288 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
289 }
290
291
292
293
294
295 type Customer struct {
296
297
298
299
300
301
302 AlternateEmail string `json:"alternateEmail,omitempty"`
303
304
305
306 CustomerDomain string `json:"customerDomain,omitempty"`
307
308
309 CustomerDomainVerified bool `json:"customerDomainVerified,omitempty"`
310
311
312
313 CustomerId string `json:"customerId,omitempty"`
314
315
316
317
318
319
320
321
322
323 CustomerType string `json:"customerType,omitempty"`
324
325 Kind string `json:"kind,omitempty"`
326
327
328
329
330
331 PhoneNumber string `json:"phoneNumber,omitempty"`
332
333
334 PostalAddress *Address `json:"postalAddress,omitempty"`
335
336
337 PrimaryAdmin *PrimaryAdmin `json:"primaryAdmin,omitempty"`
338
339
340
341 ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
342
343
344 googleapi.ServerResponse `json:"-"`
345
346
347
348
349
350 ForceSendFields []string `json:"-"`
351
352
353
354
355 NullFields []string `json:"-"`
356 }
357
358 func (s *Customer) MarshalJSON() ([]byte, error) {
359 type NoMethod Customer
360 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
361 }
362
363
364 type PrimaryAdmin struct {
365
366
367
368
369
370 PrimaryEmail string `json:"primaryEmail,omitempty"`
371
372
373
374
375
376 ForceSendFields []string `json:"-"`
377
378
379
380
381 NullFields []string `json:"-"`
382 }
383
384 func (s *PrimaryAdmin) MarshalJSON() ([]byte, error) {
385 type NoMethod PrimaryAdmin
386 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
387 }
388
389
390 type RenewalSettings struct {
391
392
393 Kind string `json:"kind,omitempty"`
394
395
396
397 RenewalType string `json:"renewalType,omitempty"`
398
399
400
401
402
403 ForceSendFields []string `json:"-"`
404
405
406
407
408 NullFields []string `json:"-"`
409 }
410
411 func (s *RenewalSettings) MarshalJSON() ([]byte, error) {
412 type NoMethod RenewalSettings
413 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
414 }
415
416
417
418 type ResellernotifyGetwatchdetailsResponse struct {
419
420 ServiceAccountEmailAddresses []string `json:"serviceAccountEmailAddresses,omitempty"`
421
422 TopicName string `json:"topicName,omitempty"`
423
424
425 googleapi.ServerResponse `json:"-"`
426
427
428
429
430
431 ForceSendFields []string `json:"-"`
432
433
434
435
436 NullFields []string `json:"-"`
437 }
438
439 func (s *ResellernotifyGetwatchdetailsResponse) MarshalJSON() ([]byte, error) {
440 type NoMethod ResellernotifyGetwatchdetailsResponse
441 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
442 }
443
444
445 type ResellernotifyResource struct {
446
447 TopicName string `json:"topicName,omitempty"`
448
449
450 googleapi.ServerResponse `json:"-"`
451
452
453
454
455
456 ForceSendFields []string `json:"-"`
457
458
459
460
461 NullFields []string `json:"-"`
462 }
463
464 func (s *ResellernotifyResource) MarshalJSON() ([]byte, error) {
465 type NoMethod ResellernotifyResource
466 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
467 }
468
469
470 type Seats struct {
471
472
473 Kind string `json:"kind,omitempty"`
474
475
476
477
478
479 LicensedNumberOfSeats int64 `json:"licensedNumberOfSeats,omitempty"`
480
481
482
483
484
485
486 MaximumNumberOfSeats int64 `json:"maximumNumberOfSeats,omitempty"`
487
488
489
490
491
492
493
494
495 NumberOfSeats int64 `json:"numberOfSeats,omitempty"`
496
497
498
499
500
501 ForceSendFields []string `json:"-"`
502
503
504
505
506 NullFields []string `json:"-"`
507 }
508
509 func (s *Seats) MarshalJSON() ([]byte, error) {
510 type NoMethod Seats
511 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
512 }
513
514
515 type Subscription struct {
516
517
518 BillingMethod string `json:"billingMethod,omitempty"`
519
520
521
522 CreationTime int64 `json:"creationTime,omitempty,string"`
523
524 CustomerDomain string `json:"customerDomain,omitempty"`
525
526
527
528 CustomerId string `json:"customerId,omitempty"`
529
530
531
532
533 DealCode string `json:"dealCode,omitempty"`
534
535
536 Kind string `json:"kind,omitempty"`
537
538
539
540
541 Plan *SubscriptionPlan `json:"plan,omitempty"`
542
543
544
545
546 PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
547
548
549 RenewalSettings *RenewalSettings `json:"renewalSettings,omitempty"`
550
551
552
553
554 ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
555
556
557 Seats *Seats `json:"seats,omitempty"`
558
559
560
561 SkuId string `json:"skuId,omitempty"`
562
563
564
565
566 SkuName string `json:"skuName,omitempty"`
567
568 Status string `json:"status,omitempty"`
569
570
571
572
573
574 SubscriptionId string `json:"subscriptionId,omitempty"`
575
576
577
578
579
580
581
582
583
584
585
586 SuspensionReasons []string `json:"suspensionReasons,omitempty"`
587
588
589
590 TransferInfo *SubscriptionTransferInfo `json:"transferInfo,omitempty"`
591
592
593 TrialSettings *SubscriptionTrialSettings `json:"trialSettings,omitempty"`
594
595
596 googleapi.ServerResponse `json:"-"`
597
598
599
600
601
602 ForceSendFields []string `json:"-"`
603
604
605
606
607 NullFields []string `json:"-"`
608 }
609
610 func (s *Subscription) MarshalJSON() ([]byte, error) {
611 type NoMethod Subscription
612 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
613 }
614
615
616
617
618
619 type SubscriptionPlan struct {
620
621
622
623
624 CommitmentInterval *SubscriptionPlanCommitmentInterval `json:"commitmentInterval,omitempty"`
625
626
627
628
629 IsCommitmentPlan bool `json:"isCommitmentPlan,omitempty"`
630
631
632
633
634
635
636
637
638
639
640
641
642
643 PlanName string `json:"planName,omitempty"`
644
645
646
647
648
649 ForceSendFields []string `json:"-"`
650
651
652
653
654 NullFields []string `json:"-"`
655 }
656
657 func (s *SubscriptionPlan) MarshalJSON() ([]byte, error) {
658 type NoMethod SubscriptionPlan
659 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
660 }
661
662
663
664
665
666 type SubscriptionPlanCommitmentInterval struct {
667
668
669 EndTime int64 `json:"endTime,omitempty,string"`
670
671
672 StartTime int64 `json:"startTime,omitempty,string"`
673
674
675
676
677
678 ForceSendFields []string `json:"-"`
679
680
681
682
683 NullFields []string `json:"-"`
684 }
685
686 func (s *SubscriptionPlanCommitmentInterval) MarshalJSON() ([]byte, error) {
687 type NoMethod SubscriptionPlanCommitmentInterval
688 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
689 }
690
691
692
693
694 type SubscriptionTransferInfo struct {
695
696
697
698
699 CurrentLegacySkuId string `json:"currentLegacySkuId,omitempty"`
700
701
702
703
704 MinimumTransferableSeats int64 `json:"minimumTransferableSeats,omitempty"`
705
706
707 TransferabilityExpirationTime int64 `json:"transferabilityExpirationTime,omitempty,string"`
708
709
710
711
712
713 ForceSendFields []string `json:"-"`
714
715
716
717
718 NullFields []string `json:"-"`
719 }
720
721 func (s *SubscriptionTransferInfo) MarshalJSON() ([]byte, error) {
722 type NoMethod SubscriptionTransferInfo
723 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
724 }
725
726
727
728
729 type SubscriptionTrialSettings struct {
730
731
732
733 IsInTrial bool `json:"isInTrial,omitempty"`
734
735
736 TrialEndTime int64 `json:"trialEndTime,omitempty,string"`
737
738
739
740
741
742 ForceSendFields []string `json:"-"`
743
744
745
746
747 NullFields []string `json:"-"`
748 }
749
750 func (s *SubscriptionTrialSettings) MarshalJSON() ([]byte, error) {
751 type NoMethod SubscriptionTrialSettings
752 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
753 }
754
755
756
757
758
759 type Subscriptions struct {
760
761
762 Kind string `json:"kind,omitempty"`
763
764
765
766 NextPageToken string `json:"nextPageToken,omitempty"`
767
768 Subscriptions []*Subscription `json:"subscriptions,omitempty"`
769
770
771 googleapi.ServerResponse `json:"-"`
772
773
774
775
776
777 ForceSendFields []string `json:"-"`
778
779
780
781
782 NullFields []string `json:"-"`
783 }
784
785 func (s *Subscriptions) MarshalJSON() ([]byte, error) {
786 type NoMethod Subscriptions
787 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
788 }
789
790 type CustomersGetCall struct {
791 s *Service
792 customerId string
793 urlParams_ gensupport.URLParams
794 ifNoneMatch_ string
795 ctx_ context.Context
796 header_ http.Header
797 }
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812 func (r *CustomersService) Get(customerId string) *CustomersGetCall {
813 c := &CustomersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
814 c.customerId = customerId
815 return c
816 }
817
818
819
820
821 func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
822 c.urlParams_.Set("fields", googleapi.CombineFields(s))
823 return c
824 }
825
826
827
828
829 func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {
830 c.ifNoneMatch_ = entityTag
831 return c
832 }
833
834
835 func (c *CustomersGetCall) Context(ctx context.Context) *CustomersGetCall {
836 c.ctx_ = ctx
837 return c
838 }
839
840
841
842 func (c *CustomersGetCall) Header() http.Header {
843 if c.header_ == nil {
844 c.header_ = make(http.Header)
845 }
846 return c.header_
847 }
848
849 func (c *CustomersGetCall) doRequest(alt string) (*http.Response, error) {
850 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
851 if c.ifNoneMatch_ != "" {
852 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
853 }
854 var body io.Reader = nil
855 c.urlParams_.Set("alt", alt)
856 c.urlParams_.Set("prettyPrint", "false")
857 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
858 urls += "?" + c.urlParams_.Encode()
859 req, err := http.NewRequest("GET", urls, body)
860 if err != nil {
861 return nil, err
862 }
863 req.Header = reqHeaders
864 googleapi.Expand(req.URL, map[string]string{
865 "customerId": c.customerId,
866 })
867 return gensupport.SendRequest(c.ctx_, c.s.client, req)
868 }
869
870
871
872
873
874
875 func (c *CustomersGetCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
876 gensupport.SetOptions(c.urlParams_, opts...)
877 res, err := c.doRequest("json")
878 if res != nil && res.StatusCode == http.StatusNotModified {
879 if res.Body != nil {
880 res.Body.Close()
881 }
882 return nil, gensupport.WrapError(&googleapi.Error{
883 Code: res.StatusCode,
884 Header: res.Header,
885 })
886 }
887 if err != nil {
888 return nil, err
889 }
890 defer googleapi.CloseBody(res)
891 if err := googleapi.CheckResponse(res); err != nil {
892 return nil, gensupport.WrapError(err)
893 }
894 ret := &Customer{
895 ServerResponse: googleapi.ServerResponse{
896 Header: res.Header,
897 HTTPStatusCode: res.StatusCode,
898 },
899 }
900 target := &ret
901 if err := gensupport.DecodeResponse(target, res); err != nil {
902 return nil, err
903 }
904 return ret, nil
905 }
906
907 type CustomersInsertCall struct {
908 s *Service
909 customer *Customer
910 urlParams_ gensupport.URLParams
911 ctx_ context.Context
912 header_ http.Header
913 }
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931 func (r *CustomersService) Insert(customer *Customer) *CustomersInsertCall {
932 c := &CustomersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
933 c.customer = customer
934 return c
935 }
936
937
938
939
940
941
942
943 func (c *CustomersInsertCall) CustomerAuthToken(customerAuthToken string) *CustomersInsertCall {
944 c.urlParams_.Set("customerAuthToken", customerAuthToken)
945 return c
946 }
947
948
949
950
951 func (c *CustomersInsertCall) Fields(s ...googleapi.Field) *CustomersInsertCall {
952 c.urlParams_.Set("fields", googleapi.CombineFields(s))
953 return c
954 }
955
956
957 func (c *CustomersInsertCall) Context(ctx context.Context) *CustomersInsertCall {
958 c.ctx_ = ctx
959 return c
960 }
961
962
963
964 func (c *CustomersInsertCall) Header() http.Header {
965 if c.header_ == nil {
966 c.header_ = make(http.Header)
967 }
968 return c.header_
969 }
970
971 func (c *CustomersInsertCall) doRequest(alt string) (*http.Response, error) {
972 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
973 var body io.Reader = nil
974 body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
975 if err != nil {
976 return nil, err
977 }
978 c.urlParams_.Set("alt", alt)
979 c.urlParams_.Set("prettyPrint", "false")
980 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers")
981 urls += "?" + c.urlParams_.Encode()
982 req, err := http.NewRequest("POST", urls, body)
983 if err != nil {
984 return nil, err
985 }
986 req.Header = reqHeaders
987 return gensupport.SendRequest(c.ctx_, c.s.client, req)
988 }
989
990
991
992
993
994
995 func (c *CustomersInsertCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
996 gensupport.SetOptions(c.urlParams_, opts...)
997 res, err := c.doRequest("json")
998 if res != nil && res.StatusCode == http.StatusNotModified {
999 if res.Body != nil {
1000 res.Body.Close()
1001 }
1002 return nil, gensupport.WrapError(&googleapi.Error{
1003 Code: res.StatusCode,
1004 Header: res.Header,
1005 })
1006 }
1007 if err != nil {
1008 return nil, err
1009 }
1010 defer googleapi.CloseBody(res)
1011 if err := googleapi.CheckResponse(res); err != nil {
1012 return nil, gensupport.WrapError(err)
1013 }
1014 ret := &Customer{
1015 ServerResponse: googleapi.ServerResponse{
1016 Header: res.Header,
1017 HTTPStatusCode: res.StatusCode,
1018 },
1019 }
1020 target := &ret
1021 if err := gensupport.DecodeResponse(target, res); err != nil {
1022 return nil, err
1023 }
1024 return ret, nil
1025 }
1026
1027 type CustomersPatchCall struct {
1028 s *Service
1029 customerId string
1030 customer *Customer
1031 urlParams_ gensupport.URLParams
1032 ctx_ context.Context
1033 header_ http.Header
1034 }
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048 func (r *CustomersService) Patch(customerId string, customer *Customer) *CustomersPatchCall {
1049 c := &CustomersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1050 c.customerId = customerId
1051 c.customer = customer
1052 return c
1053 }
1054
1055
1056
1057
1058 func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
1059 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1060 return c
1061 }
1062
1063
1064 func (c *CustomersPatchCall) Context(ctx context.Context) *CustomersPatchCall {
1065 c.ctx_ = ctx
1066 return c
1067 }
1068
1069
1070
1071 func (c *CustomersPatchCall) Header() http.Header {
1072 if c.header_ == nil {
1073 c.header_ = make(http.Header)
1074 }
1075 return c.header_
1076 }
1077
1078 func (c *CustomersPatchCall) doRequest(alt string) (*http.Response, error) {
1079 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1080 var body io.Reader = nil
1081 body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
1082 if err != nil {
1083 return nil, err
1084 }
1085 c.urlParams_.Set("alt", alt)
1086 c.urlParams_.Set("prettyPrint", "false")
1087 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
1088 urls += "?" + c.urlParams_.Encode()
1089 req, err := http.NewRequest("PATCH", urls, body)
1090 if err != nil {
1091 return nil, err
1092 }
1093 req.Header = reqHeaders
1094 googleapi.Expand(req.URL, map[string]string{
1095 "customerId": c.customerId,
1096 })
1097 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1098 }
1099
1100
1101
1102
1103
1104
1105 func (c *CustomersPatchCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
1106 gensupport.SetOptions(c.urlParams_, opts...)
1107 res, err := c.doRequest("json")
1108 if res != nil && res.StatusCode == http.StatusNotModified {
1109 if res.Body != nil {
1110 res.Body.Close()
1111 }
1112 return nil, gensupport.WrapError(&googleapi.Error{
1113 Code: res.StatusCode,
1114 Header: res.Header,
1115 })
1116 }
1117 if err != nil {
1118 return nil, err
1119 }
1120 defer googleapi.CloseBody(res)
1121 if err := googleapi.CheckResponse(res); err != nil {
1122 return nil, gensupport.WrapError(err)
1123 }
1124 ret := &Customer{
1125 ServerResponse: googleapi.ServerResponse{
1126 Header: res.Header,
1127 HTTPStatusCode: res.StatusCode,
1128 },
1129 }
1130 target := &ret
1131 if err := gensupport.DecodeResponse(target, res); err != nil {
1132 return nil, err
1133 }
1134 return ret, nil
1135 }
1136
1137 type CustomersUpdateCall struct {
1138 s *Service
1139 customerId string
1140 customer *Customer
1141 urlParams_ gensupport.URLParams
1142 ctx_ context.Context
1143 header_ http.Header
1144 }
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158 func (r *CustomersService) Update(customerId string, customer *Customer) *CustomersUpdateCall {
1159 c := &CustomersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1160 c.customerId = customerId
1161 c.customer = customer
1162 return c
1163 }
1164
1165
1166
1167
1168 func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
1169 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1170 return c
1171 }
1172
1173
1174 func (c *CustomersUpdateCall) Context(ctx context.Context) *CustomersUpdateCall {
1175 c.ctx_ = ctx
1176 return c
1177 }
1178
1179
1180
1181 func (c *CustomersUpdateCall) Header() http.Header {
1182 if c.header_ == nil {
1183 c.header_ = make(http.Header)
1184 }
1185 return c.header_
1186 }
1187
1188 func (c *CustomersUpdateCall) doRequest(alt string) (*http.Response, error) {
1189 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1190 var body io.Reader = nil
1191 body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
1192 if err != nil {
1193 return nil, err
1194 }
1195 c.urlParams_.Set("alt", alt)
1196 c.urlParams_.Set("prettyPrint", "false")
1197 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}")
1198 urls += "?" + c.urlParams_.Encode()
1199 req, err := http.NewRequest("PUT", urls, body)
1200 if err != nil {
1201 return nil, err
1202 }
1203 req.Header = reqHeaders
1204 googleapi.Expand(req.URL, map[string]string{
1205 "customerId": c.customerId,
1206 })
1207 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1208 }
1209
1210
1211
1212
1213
1214
1215 func (c *CustomersUpdateCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
1216 gensupport.SetOptions(c.urlParams_, opts...)
1217 res, err := c.doRequest("json")
1218 if res != nil && res.StatusCode == http.StatusNotModified {
1219 if res.Body != nil {
1220 res.Body.Close()
1221 }
1222 return nil, gensupport.WrapError(&googleapi.Error{
1223 Code: res.StatusCode,
1224 Header: res.Header,
1225 })
1226 }
1227 if err != nil {
1228 return nil, err
1229 }
1230 defer googleapi.CloseBody(res)
1231 if err := googleapi.CheckResponse(res); err != nil {
1232 return nil, gensupport.WrapError(err)
1233 }
1234 ret := &Customer{
1235 ServerResponse: googleapi.ServerResponse{
1236 Header: res.Header,
1237 HTTPStatusCode: res.StatusCode,
1238 },
1239 }
1240 target := &ret
1241 if err := gensupport.DecodeResponse(target, res); err != nil {
1242 return nil, err
1243 }
1244 return ret, nil
1245 }
1246
1247 type ResellernotifyGetwatchdetailsCall struct {
1248 s *Service
1249 urlParams_ gensupport.URLParams
1250 ifNoneMatch_ string
1251 ctx_ context.Context
1252 header_ http.Header
1253 }
1254
1255
1256
1257 func (r *ResellernotifyService) Getwatchdetails() *ResellernotifyGetwatchdetailsCall {
1258 c := &ResellernotifyGetwatchdetailsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1259 return c
1260 }
1261
1262
1263
1264
1265 func (c *ResellernotifyGetwatchdetailsCall) Fields(s ...googleapi.Field) *ResellernotifyGetwatchdetailsCall {
1266 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1267 return c
1268 }
1269
1270
1271
1272
1273 func (c *ResellernotifyGetwatchdetailsCall) IfNoneMatch(entityTag string) *ResellernotifyGetwatchdetailsCall {
1274 c.ifNoneMatch_ = entityTag
1275 return c
1276 }
1277
1278
1279 func (c *ResellernotifyGetwatchdetailsCall) Context(ctx context.Context) *ResellernotifyGetwatchdetailsCall {
1280 c.ctx_ = ctx
1281 return c
1282 }
1283
1284
1285
1286 func (c *ResellernotifyGetwatchdetailsCall) Header() http.Header {
1287 if c.header_ == nil {
1288 c.header_ = make(http.Header)
1289 }
1290 return c.header_
1291 }
1292
1293 func (c *ResellernotifyGetwatchdetailsCall) doRequest(alt string) (*http.Response, error) {
1294 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1295 if c.ifNoneMatch_ != "" {
1296 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1297 }
1298 var body io.Reader = nil
1299 c.urlParams_.Set("alt", alt)
1300 c.urlParams_.Set("prettyPrint", "false")
1301 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/getwatchdetails")
1302 urls += "?" + c.urlParams_.Encode()
1303 req, err := http.NewRequest("GET", urls, body)
1304 if err != nil {
1305 return nil, err
1306 }
1307 req.Header = reqHeaders
1308 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1309 }
1310
1311
1312
1313
1314
1315
1316
1317 func (c *ResellernotifyGetwatchdetailsCall) Do(opts ...googleapi.CallOption) (*ResellernotifyGetwatchdetailsResponse, error) {
1318 gensupport.SetOptions(c.urlParams_, opts...)
1319 res, err := c.doRequest("json")
1320 if res != nil && res.StatusCode == http.StatusNotModified {
1321 if res.Body != nil {
1322 res.Body.Close()
1323 }
1324 return nil, gensupport.WrapError(&googleapi.Error{
1325 Code: res.StatusCode,
1326 Header: res.Header,
1327 })
1328 }
1329 if err != nil {
1330 return nil, err
1331 }
1332 defer googleapi.CloseBody(res)
1333 if err := googleapi.CheckResponse(res); err != nil {
1334 return nil, gensupport.WrapError(err)
1335 }
1336 ret := &ResellernotifyGetwatchdetailsResponse{
1337 ServerResponse: googleapi.ServerResponse{
1338 Header: res.Header,
1339 HTTPStatusCode: res.StatusCode,
1340 },
1341 }
1342 target := &ret
1343 if err := gensupport.DecodeResponse(target, res); err != nil {
1344 return nil, err
1345 }
1346 return ret, nil
1347 }
1348
1349 type ResellernotifyRegisterCall struct {
1350 s *Service
1351 urlParams_ gensupport.URLParams
1352 ctx_ context.Context
1353 header_ http.Header
1354 }
1355
1356
1357 func (r *ResellernotifyService) Register() *ResellernotifyRegisterCall {
1358 c := &ResellernotifyRegisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1359 return c
1360 }
1361
1362
1363
1364
1365 func (c *ResellernotifyRegisterCall) ServiceAccountEmailAddress(serviceAccountEmailAddress string) *ResellernotifyRegisterCall {
1366 c.urlParams_.Set("serviceAccountEmailAddress", serviceAccountEmailAddress)
1367 return c
1368 }
1369
1370
1371
1372
1373 func (c *ResellernotifyRegisterCall) Fields(s ...googleapi.Field) *ResellernotifyRegisterCall {
1374 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1375 return c
1376 }
1377
1378
1379 func (c *ResellernotifyRegisterCall) Context(ctx context.Context) *ResellernotifyRegisterCall {
1380 c.ctx_ = ctx
1381 return c
1382 }
1383
1384
1385
1386 func (c *ResellernotifyRegisterCall) Header() http.Header {
1387 if c.header_ == nil {
1388 c.header_ = make(http.Header)
1389 }
1390 return c.header_
1391 }
1392
1393 func (c *ResellernotifyRegisterCall) doRequest(alt string) (*http.Response, error) {
1394 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1395 var body io.Reader = nil
1396 c.urlParams_.Set("alt", alt)
1397 c.urlParams_.Set("prettyPrint", "false")
1398 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/register")
1399 urls += "?" + c.urlParams_.Encode()
1400 req, err := http.NewRequest("POST", urls, body)
1401 if err != nil {
1402 return nil, err
1403 }
1404 req.Header = reqHeaders
1405 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1406 }
1407
1408
1409
1410
1411
1412
1413
1414 func (c *ResellernotifyRegisterCall) Do(opts ...googleapi.CallOption) (*ResellernotifyResource, error) {
1415 gensupport.SetOptions(c.urlParams_, opts...)
1416 res, err := c.doRequest("json")
1417 if res != nil && res.StatusCode == http.StatusNotModified {
1418 if res.Body != nil {
1419 res.Body.Close()
1420 }
1421 return nil, gensupport.WrapError(&googleapi.Error{
1422 Code: res.StatusCode,
1423 Header: res.Header,
1424 })
1425 }
1426 if err != nil {
1427 return nil, err
1428 }
1429 defer googleapi.CloseBody(res)
1430 if err := googleapi.CheckResponse(res); err != nil {
1431 return nil, gensupport.WrapError(err)
1432 }
1433 ret := &ResellernotifyResource{
1434 ServerResponse: googleapi.ServerResponse{
1435 Header: res.Header,
1436 HTTPStatusCode: res.StatusCode,
1437 },
1438 }
1439 target := &ret
1440 if err := gensupport.DecodeResponse(target, res); err != nil {
1441 return nil, err
1442 }
1443 return ret, nil
1444 }
1445
1446 type ResellernotifyUnregisterCall struct {
1447 s *Service
1448 urlParams_ gensupport.URLParams
1449 ctx_ context.Context
1450 header_ http.Header
1451 }
1452
1453
1454 func (r *ResellernotifyService) Unregister() *ResellernotifyUnregisterCall {
1455 c := &ResellernotifyUnregisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1456 return c
1457 }
1458
1459
1460
1461
1462 func (c *ResellernotifyUnregisterCall) ServiceAccountEmailAddress(serviceAccountEmailAddress string) *ResellernotifyUnregisterCall {
1463 c.urlParams_.Set("serviceAccountEmailAddress", serviceAccountEmailAddress)
1464 return c
1465 }
1466
1467
1468
1469
1470 func (c *ResellernotifyUnregisterCall) Fields(s ...googleapi.Field) *ResellernotifyUnregisterCall {
1471 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1472 return c
1473 }
1474
1475
1476 func (c *ResellernotifyUnregisterCall) Context(ctx context.Context) *ResellernotifyUnregisterCall {
1477 c.ctx_ = ctx
1478 return c
1479 }
1480
1481
1482
1483 func (c *ResellernotifyUnregisterCall) Header() http.Header {
1484 if c.header_ == nil {
1485 c.header_ = make(http.Header)
1486 }
1487 return c.header_
1488 }
1489
1490 func (c *ResellernotifyUnregisterCall) doRequest(alt string) (*http.Response, error) {
1491 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1492 var body io.Reader = nil
1493 c.urlParams_.Set("alt", alt)
1494 c.urlParams_.Set("prettyPrint", "false")
1495 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/resellernotify/unregister")
1496 urls += "?" + c.urlParams_.Encode()
1497 req, err := http.NewRequest("POST", urls, body)
1498 if err != nil {
1499 return nil, err
1500 }
1501 req.Header = reqHeaders
1502 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1503 }
1504
1505
1506
1507
1508
1509
1510
1511 func (c *ResellernotifyUnregisterCall) Do(opts ...googleapi.CallOption) (*ResellernotifyResource, error) {
1512 gensupport.SetOptions(c.urlParams_, opts...)
1513 res, err := c.doRequest("json")
1514 if res != nil && res.StatusCode == http.StatusNotModified {
1515 if res.Body != nil {
1516 res.Body.Close()
1517 }
1518 return nil, gensupport.WrapError(&googleapi.Error{
1519 Code: res.StatusCode,
1520 Header: res.Header,
1521 })
1522 }
1523 if err != nil {
1524 return nil, err
1525 }
1526 defer googleapi.CloseBody(res)
1527 if err := googleapi.CheckResponse(res); err != nil {
1528 return nil, gensupport.WrapError(err)
1529 }
1530 ret := &ResellernotifyResource{
1531 ServerResponse: googleapi.ServerResponse{
1532 Header: res.Header,
1533 HTTPStatusCode: res.StatusCode,
1534 },
1535 }
1536 target := &ret
1537 if err := gensupport.DecodeResponse(target, res); err != nil {
1538 return nil, err
1539 }
1540 return ret, nil
1541 }
1542
1543 type SubscriptionsActivateCall struct {
1544 s *Service
1545 customerId string
1546 subscriptionId string
1547 urlParams_ gensupport.URLParams
1548 ctx_ context.Context
1549 header_ http.Header
1550 }
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568 func (r *SubscriptionsService) Activate(customerId string, subscriptionId string) *SubscriptionsActivateCall {
1569 c := &SubscriptionsActivateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1570 c.customerId = customerId
1571 c.subscriptionId = subscriptionId
1572 return c
1573 }
1574
1575
1576
1577
1578 func (c *SubscriptionsActivateCall) Fields(s ...googleapi.Field) *SubscriptionsActivateCall {
1579 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1580 return c
1581 }
1582
1583
1584 func (c *SubscriptionsActivateCall) Context(ctx context.Context) *SubscriptionsActivateCall {
1585 c.ctx_ = ctx
1586 return c
1587 }
1588
1589
1590
1591 func (c *SubscriptionsActivateCall) Header() http.Header {
1592 if c.header_ == nil {
1593 c.header_ = make(http.Header)
1594 }
1595 return c.header_
1596 }
1597
1598 func (c *SubscriptionsActivateCall) doRequest(alt string) (*http.Response, error) {
1599 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1600 var body io.Reader = nil
1601 c.urlParams_.Set("alt", alt)
1602 c.urlParams_.Set("prettyPrint", "false")
1603 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/activate")
1604 urls += "?" + c.urlParams_.Encode()
1605 req, err := http.NewRequest("POST", urls, body)
1606 if err != nil {
1607 return nil, err
1608 }
1609 req.Header = reqHeaders
1610 googleapi.Expand(req.URL, map[string]string{
1611 "customerId": c.customerId,
1612 "subscriptionId": c.subscriptionId,
1613 })
1614 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1615 }
1616
1617
1618
1619
1620
1621
1622 func (c *SubscriptionsActivateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1623 gensupport.SetOptions(c.urlParams_, opts...)
1624 res, err := c.doRequest("json")
1625 if res != nil && res.StatusCode == http.StatusNotModified {
1626 if res.Body != nil {
1627 res.Body.Close()
1628 }
1629 return nil, gensupport.WrapError(&googleapi.Error{
1630 Code: res.StatusCode,
1631 Header: res.Header,
1632 })
1633 }
1634 if err != nil {
1635 return nil, err
1636 }
1637 defer googleapi.CloseBody(res)
1638 if err := googleapi.CheckResponse(res); err != nil {
1639 return nil, gensupport.WrapError(err)
1640 }
1641 ret := &Subscription{
1642 ServerResponse: googleapi.ServerResponse{
1643 Header: res.Header,
1644 HTTPStatusCode: res.StatusCode,
1645 },
1646 }
1647 target := &ret
1648 if err := gensupport.DecodeResponse(target, res); err != nil {
1649 return nil, err
1650 }
1651 return ret, nil
1652 }
1653
1654 type SubscriptionsChangePlanCall struct {
1655 s *Service
1656 customerId string
1657 subscriptionId string
1658 changeplanrequest *ChangePlanRequest
1659 urlParams_ gensupport.URLParams
1660 ctx_ context.Context
1661 header_ http.Header
1662 }
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683 func (r *SubscriptionsService) ChangePlan(customerId string, subscriptionId string, changeplanrequest *ChangePlanRequest) *SubscriptionsChangePlanCall {
1684 c := &SubscriptionsChangePlanCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1685 c.customerId = customerId
1686 c.subscriptionId = subscriptionId
1687 c.changeplanrequest = changeplanrequest
1688 return c
1689 }
1690
1691
1692
1693
1694 func (c *SubscriptionsChangePlanCall) Fields(s ...googleapi.Field) *SubscriptionsChangePlanCall {
1695 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1696 return c
1697 }
1698
1699
1700 func (c *SubscriptionsChangePlanCall) Context(ctx context.Context) *SubscriptionsChangePlanCall {
1701 c.ctx_ = ctx
1702 return c
1703 }
1704
1705
1706
1707 func (c *SubscriptionsChangePlanCall) Header() http.Header {
1708 if c.header_ == nil {
1709 c.header_ = make(http.Header)
1710 }
1711 return c.header_
1712 }
1713
1714 func (c *SubscriptionsChangePlanCall) doRequest(alt string) (*http.Response, error) {
1715 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1716 var body io.Reader = nil
1717 body, err := googleapi.WithoutDataWrapper.JSONReader(c.changeplanrequest)
1718 if err != nil {
1719 return nil, err
1720 }
1721 c.urlParams_.Set("alt", alt)
1722 c.urlParams_.Set("prettyPrint", "false")
1723 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changePlan")
1724 urls += "?" + c.urlParams_.Encode()
1725 req, err := http.NewRequest("POST", urls, body)
1726 if err != nil {
1727 return nil, err
1728 }
1729 req.Header = reqHeaders
1730 googleapi.Expand(req.URL, map[string]string{
1731 "customerId": c.customerId,
1732 "subscriptionId": c.subscriptionId,
1733 })
1734 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1735 }
1736
1737
1738
1739
1740
1741
1742 func (c *SubscriptionsChangePlanCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1743 gensupport.SetOptions(c.urlParams_, opts...)
1744 res, err := c.doRequest("json")
1745 if res != nil && res.StatusCode == http.StatusNotModified {
1746 if res.Body != nil {
1747 res.Body.Close()
1748 }
1749 return nil, gensupport.WrapError(&googleapi.Error{
1750 Code: res.StatusCode,
1751 Header: res.Header,
1752 })
1753 }
1754 if err != nil {
1755 return nil, err
1756 }
1757 defer googleapi.CloseBody(res)
1758 if err := googleapi.CheckResponse(res); err != nil {
1759 return nil, gensupport.WrapError(err)
1760 }
1761 ret := &Subscription{
1762 ServerResponse: googleapi.ServerResponse{
1763 Header: res.Header,
1764 HTTPStatusCode: res.StatusCode,
1765 },
1766 }
1767 target := &ret
1768 if err := gensupport.DecodeResponse(target, res); err != nil {
1769 return nil, err
1770 }
1771 return ret, nil
1772 }
1773
1774 type SubscriptionsChangeRenewalSettingsCall struct {
1775 s *Service
1776 customerId string
1777 subscriptionId string
1778 renewalsettings *RenewalSettings
1779 urlParams_ gensupport.URLParams
1780 ctx_ context.Context
1781 header_ http.Header
1782 }
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800 func (r *SubscriptionsService) ChangeRenewalSettings(customerId string, subscriptionId string, renewalsettings *RenewalSettings) *SubscriptionsChangeRenewalSettingsCall {
1801 c := &SubscriptionsChangeRenewalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1802 c.customerId = customerId
1803 c.subscriptionId = subscriptionId
1804 c.renewalsettings = renewalsettings
1805 return c
1806 }
1807
1808
1809
1810
1811 func (c *SubscriptionsChangeRenewalSettingsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeRenewalSettingsCall {
1812 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1813 return c
1814 }
1815
1816
1817 func (c *SubscriptionsChangeRenewalSettingsCall) Context(ctx context.Context) *SubscriptionsChangeRenewalSettingsCall {
1818 c.ctx_ = ctx
1819 return c
1820 }
1821
1822
1823
1824 func (c *SubscriptionsChangeRenewalSettingsCall) Header() http.Header {
1825 if c.header_ == nil {
1826 c.header_ = make(http.Header)
1827 }
1828 return c.header_
1829 }
1830
1831 func (c *SubscriptionsChangeRenewalSettingsCall) doRequest(alt string) (*http.Response, error) {
1832 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1833 var body io.Reader = nil
1834 body, err := googleapi.WithoutDataWrapper.JSONReader(c.renewalsettings)
1835 if err != nil {
1836 return nil, err
1837 }
1838 c.urlParams_.Set("alt", alt)
1839 c.urlParams_.Set("prettyPrint", "false")
1840 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings")
1841 urls += "?" + c.urlParams_.Encode()
1842 req, err := http.NewRequest("POST", urls, body)
1843 if err != nil {
1844 return nil, err
1845 }
1846 req.Header = reqHeaders
1847 googleapi.Expand(req.URL, map[string]string{
1848 "customerId": c.customerId,
1849 "subscriptionId": c.subscriptionId,
1850 })
1851 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1852 }
1853
1854
1855
1856
1857
1858
1859 func (c *SubscriptionsChangeRenewalSettingsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1860 gensupport.SetOptions(c.urlParams_, opts...)
1861 res, err := c.doRequest("json")
1862 if res != nil && res.StatusCode == http.StatusNotModified {
1863 if res.Body != nil {
1864 res.Body.Close()
1865 }
1866 return nil, gensupport.WrapError(&googleapi.Error{
1867 Code: res.StatusCode,
1868 Header: res.Header,
1869 })
1870 }
1871 if err != nil {
1872 return nil, err
1873 }
1874 defer googleapi.CloseBody(res)
1875 if err := googleapi.CheckResponse(res); err != nil {
1876 return nil, gensupport.WrapError(err)
1877 }
1878 ret := &Subscription{
1879 ServerResponse: googleapi.ServerResponse{
1880 Header: res.Header,
1881 HTTPStatusCode: res.StatusCode,
1882 },
1883 }
1884 target := &ret
1885 if err := gensupport.DecodeResponse(target, res); err != nil {
1886 return nil, err
1887 }
1888 return ret, nil
1889 }
1890
1891 type SubscriptionsChangeSeatsCall struct {
1892 s *Service
1893 customerId string
1894 subscriptionId string
1895 seats *Seats
1896 urlParams_ gensupport.URLParams
1897 ctx_ context.Context
1898 header_ http.Header
1899 }
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918 func (r *SubscriptionsService) ChangeSeats(customerId string, subscriptionId string, seats *Seats) *SubscriptionsChangeSeatsCall {
1919 c := &SubscriptionsChangeSeatsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1920 c.customerId = customerId
1921 c.subscriptionId = subscriptionId
1922 c.seats = seats
1923 return c
1924 }
1925
1926
1927
1928
1929 func (c *SubscriptionsChangeSeatsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeSeatsCall {
1930 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1931 return c
1932 }
1933
1934
1935 func (c *SubscriptionsChangeSeatsCall) Context(ctx context.Context) *SubscriptionsChangeSeatsCall {
1936 c.ctx_ = ctx
1937 return c
1938 }
1939
1940
1941
1942 func (c *SubscriptionsChangeSeatsCall) Header() http.Header {
1943 if c.header_ == nil {
1944 c.header_ = make(http.Header)
1945 }
1946 return c.header_
1947 }
1948
1949 func (c *SubscriptionsChangeSeatsCall) doRequest(alt string) (*http.Response, error) {
1950 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1951 var body io.Reader = nil
1952 body, err := googleapi.WithoutDataWrapper.JSONReader(c.seats)
1953 if err != nil {
1954 return nil, err
1955 }
1956 c.urlParams_.Set("alt", alt)
1957 c.urlParams_.Set("prettyPrint", "false")
1958 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/changeSeats")
1959 urls += "?" + c.urlParams_.Encode()
1960 req, err := http.NewRequest("POST", urls, body)
1961 if err != nil {
1962 return nil, err
1963 }
1964 req.Header = reqHeaders
1965 googleapi.Expand(req.URL, map[string]string{
1966 "customerId": c.customerId,
1967 "subscriptionId": c.subscriptionId,
1968 })
1969 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1970 }
1971
1972
1973
1974
1975
1976
1977 func (c *SubscriptionsChangeSeatsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1978 gensupport.SetOptions(c.urlParams_, opts...)
1979 res, err := c.doRequest("json")
1980 if res != nil && res.StatusCode == http.StatusNotModified {
1981 if res.Body != nil {
1982 res.Body.Close()
1983 }
1984 return nil, gensupport.WrapError(&googleapi.Error{
1985 Code: res.StatusCode,
1986 Header: res.Header,
1987 })
1988 }
1989 if err != nil {
1990 return nil, err
1991 }
1992 defer googleapi.CloseBody(res)
1993 if err := googleapi.CheckResponse(res); err != nil {
1994 return nil, gensupport.WrapError(err)
1995 }
1996 ret := &Subscription{
1997 ServerResponse: googleapi.ServerResponse{
1998 Header: res.Header,
1999 HTTPStatusCode: res.StatusCode,
2000 },
2001 }
2002 target := &ret
2003 if err := gensupport.DecodeResponse(target, res); err != nil {
2004 return nil, err
2005 }
2006 return ret, nil
2007 }
2008
2009 type SubscriptionsDeleteCall struct {
2010 s *Service
2011 customerId string
2012 subscriptionId string
2013 urlParams_ gensupport.URLParams
2014 ctx_ context.Context
2015 header_ http.Header
2016 }
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033 func (r *SubscriptionsService) Delete(customerId string, subscriptionId string, deletionType string) *SubscriptionsDeleteCall {
2034 c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2035 c.customerId = customerId
2036 c.subscriptionId = subscriptionId
2037 c.urlParams_.Set("deletionType", deletionType)
2038 return c
2039 }
2040
2041
2042
2043
2044 func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
2045 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2046 return c
2047 }
2048
2049
2050 func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
2051 c.ctx_ = ctx
2052 return c
2053 }
2054
2055
2056
2057 func (c *SubscriptionsDeleteCall) Header() http.Header {
2058 if c.header_ == nil {
2059 c.header_ = make(http.Header)
2060 }
2061 return c.header_
2062 }
2063
2064 func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
2065 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2066 var body io.Reader = nil
2067 c.urlParams_.Set("alt", alt)
2068 c.urlParams_.Set("prettyPrint", "false")
2069 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}")
2070 urls += "?" + c.urlParams_.Encode()
2071 req, err := http.NewRequest("DELETE", urls, body)
2072 if err != nil {
2073 return nil, err
2074 }
2075 req.Header = reqHeaders
2076 googleapi.Expand(req.URL, map[string]string{
2077 "customerId": c.customerId,
2078 "subscriptionId": c.subscriptionId,
2079 })
2080 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2081 }
2082
2083
2084 func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) error {
2085 gensupport.SetOptions(c.urlParams_, opts...)
2086 res, err := c.doRequest("json")
2087 if err != nil {
2088 return err
2089 }
2090 defer googleapi.CloseBody(res)
2091 if err := googleapi.CheckResponse(res); err != nil {
2092 return gensupport.WrapError(err)
2093 }
2094 return nil
2095 }
2096
2097 type SubscriptionsGetCall struct {
2098 s *Service
2099 customerId string
2100 subscriptionId string
2101 urlParams_ gensupport.URLParams
2102 ifNoneMatch_ string
2103 ctx_ context.Context
2104 header_ http.Header
2105 }
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125 func (r *SubscriptionsService) Get(customerId string, subscriptionId string) *SubscriptionsGetCall {
2126 c := &SubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2127 c.customerId = customerId
2128 c.subscriptionId = subscriptionId
2129 return c
2130 }
2131
2132
2133
2134
2135 func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
2136 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2137 return c
2138 }
2139
2140
2141
2142
2143 func (c *SubscriptionsGetCall) IfNoneMatch(entityTag string) *SubscriptionsGetCall {
2144 c.ifNoneMatch_ = entityTag
2145 return c
2146 }
2147
2148
2149 func (c *SubscriptionsGetCall) Context(ctx context.Context) *SubscriptionsGetCall {
2150 c.ctx_ = ctx
2151 return c
2152 }
2153
2154
2155
2156 func (c *SubscriptionsGetCall) Header() http.Header {
2157 if c.header_ == nil {
2158 c.header_ = make(http.Header)
2159 }
2160 return c.header_
2161 }
2162
2163 func (c *SubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
2164 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2165 if c.ifNoneMatch_ != "" {
2166 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2167 }
2168 var body io.Reader = nil
2169 c.urlParams_.Set("alt", alt)
2170 c.urlParams_.Set("prettyPrint", "false")
2171 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}")
2172 urls += "?" + c.urlParams_.Encode()
2173 req, err := http.NewRequest("GET", urls, body)
2174 if err != nil {
2175 return nil, err
2176 }
2177 req.Header = reqHeaders
2178 googleapi.Expand(req.URL, map[string]string{
2179 "customerId": c.customerId,
2180 "subscriptionId": c.subscriptionId,
2181 })
2182 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2183 }
2184
2185
2186
2187
2188
2189
2190 func (c *SubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2191 gensupport.SetOptions(c.urlParams_, opts...)
2192 res, err := c.doRequest("json")
2193 if res != nil && res.StatusCode == http.StatusNotModified {
2194 if res.Body != nil {
2195 res.Body.Close()
2196 }
2197 return nil, gensupport.WrapError(&googleapi.Error{
2198 Code: res.StatusCode,
2199 Header: res.Header,
2200 })
2201 }
2202 if err != nil {
2203 return nil, err
2204 }
2205 defer googleapi.CloseBody(res)
2206 if err := googleapi.CheckResponse(res); err != nil {
2207 return nil, gensupport.WrapError(err)
2208 }
2209 ret := &Subscription{
2210 ServerResponse: googleapi.ServerResponse{
2211 Header: res.Header,
2212 HTTPStatusCode: res.StatusCode,
2213 },
2214 }
2215 target := &ret
2216 if err := gensupport.DecodeResponse(target, res); err != nil {
2217 return nil, err
2218 }
2219 return ret, nil
2220 }
2221
2222 type SubscriptionsInsertCall struct {
2223 s *Service
2224 customerId string
2225 subscription *Subscription
2226 urlParams_ gensupport.URLParams
2227 ctx_ context.Context
2228 header_ http.Header
2229 }
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252 func (r *SubscriptionsService) Insert(customerId string, subscription *Subscription) *SubscriptionsInsertCall {
2253 c := &SubscriptionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2254 c.customerId = customerId
2255 c.subscription = subscription
2256 return c
2257 }
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274 func (c *SubscriptionsInsertCall) Action(action string) *SubscriptionsInsertCall {
2275 c.urlParams_.Set("action", action)
2276 return c
2277 }
2278
2279
2280
2281
2282
2283
2284
2285 func (c *SubscriptionsInsertCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsInsertCall {
2286 c.urlParams_.Set("customerAuthToken", customerAuthToken)
2287 return c
2288 }
2289
2290
2291
2292
2293
2294
2295
2296 func (c *SubscriptionsInsertCall) SourceSkuId(sourceSkuId string) *SubscriptionsInsertCall {
2297 c.urlParams_.Set("sourceSkuId", sourceSkuId)
2298 return c
2299 }
2300
2301
2302
2303
2304 func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
2305 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2306 return c
2307 }
2308
2309
2310 func (c *SubscriptionsInsertCall) Context(ctx context.Context) *SubscriptionsInsertCall {
2311 c.ctx_ = ctx
2312 return c
2313 }
2314
2315
2316
2317 func (c *SubscriptionsInsertCall) Header() http.Header {
2318 if c.header_ == nil {
2319 c.header_ = make(http.Header)
2320 }
2321 return c.header_
2322 }
2323
2324 func (c *SubscriptionsInsertCall) doRequest(alt string) (*http.Response, error) {
2325 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2326 var body io.Reader = nil
2327 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
2328 if err != nil {
2329 return nil, err
2330 }
2331 c.urlParams_.Set("alt", alt)
2332 c.urlParams_.Set("prettyPrint", "false")
2333 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions")
2334 urls += "?" + c.urlParams_.Encode()
2335 req, err := http.NewRequest("POST", urls, body)
2336 if err != nil {
2337 return nil, err
2338 }
2339 req.Header = reqHeaders
2340 googleapi.Expand(req.URL, map[string]string{
2341 "customerId": c.customerId,
2342 })
2343 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2344 }
2345
2346
2347
2348
2349
2350
2351 func (c *SubscriptionsInsertCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2352 gensupport.SetOptions(c.urlParams_, opts...)
2353 res, err := c.doRequest("json")
2354 if res != nil && res.StatusCode == http.StatusNotModified {
2355 if res.Body != nil {
2356 res.Body.Close()
2357 }
2358 return nil, gensupport.WrapError(&googleapi.Error{
2359 Code: res.StatusCode,
2360 Header: res.Header,
2361 })
2362 }
2363 if err != nil {
2364 return nil, err
2365 }
2366 defer googleapi.CloseBody(res)
2367 if err := googleapi.CheckResponse(res); err != nil {
2368 return nil, gensupport.WrapError(err)
2369 }
2370 ret := &Subscription{
2371 ServerResponse: googleapi.ServerResponse{
2372 Header: res.Header,
2373 HTTPStatusCode: res.StatusCode,
2374 },
2375 }
2376 target := &ret
2377 if err := gensupport.DecodeResponse(target, res); err != nil {
2378 return nil, err
2379 }
2380 return ret, nil
2381 }
2382
2383 type SubscriptionsListCall struct {
2384 s *Service
2385 urlParams_ gensupport.URLParams
2386 ifNoneMatch_ string
2387 ctx_ context.Context
2388 header_ http.Header
2389 }
2390
2391
2392
2393
2394
2395
2396 func (r *SubscriptionsService) List() *SubscriptionsListCall {
2397 c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2398 return c
2399 }
2400
2401
2402
2403
2404
2405
2406
2407 func (c *SubscriptionsListCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsListCall {
2408 c.urlParams_.Set("customerAuthToken", customerAuthToken)
2409 return c
2410 }
2411
2412
2413
2414
2415
2416
2417
2418 func (c *SubscriptionsListCall) CustomerId(customerId string) *SubscriptionsListCall {
2419 c.urlParams_.Set("customerId", customerId)
2420 return c
2421 }
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431 func (c *SubscriptionsListCall) CustomerNamePrefix(customerNamePrefix string) *SubscriptionsListCall {
2432 c.urlParams_.Set("customerNamePrefix", customerNamePrefix)
2433 return c
2434 }
2435
2436
2437
2438
2439 func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
2440 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
2441 return c
2442 }
2443
2444
2445
2446 func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
2447 c.urlParams_.Set("pageToken", pageToken)
2448 return c
2449 }
2450
2451
2452
2453
2454 func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
2455 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2456 return c
2457 }
2458
2459
2460
2461
2462 func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
2463 c.ifNoneMatch_ = entityTag
2464 return c
2465 }
2466
2467
2468 func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
2469 c.ctx_ = ctx
2470 return c
2471 }
2472
2473
2474
2475 func (c *SubscriptionsListCall) Header() http.Header {
2476 if c.header_ == nil {
2477 c.header_ = make(http.Header)
2478 }
2479 return c.header_
2480 }
2481
2482 func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
2483 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2484 if c.ifNoneMatch_ != "" {
2485 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2486 }
2487 var body io.Reader = nil
2488 c.urlParams_.Set("alt", alt)
2489 c.urlParams_.Set("prettyPrint", "false")
2490 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/subscriptions")
2491 urls += "?" + c.urlParams_.Encode()
2492 req, err := http.NewRequest("GET", urls, body)
2493 if err != nil {
2494 return nil, err
2495 }
2496 req.Header = reqHeaders
2497 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2498 }
2499
2500
2501
2502
2503
2504
2505 func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*Subscriptions, error) {
2506 gensupport.SetOptions(c.urlParams_, opts...)
2507 res, err := c.doRequest("json")
2508 if res != nil && res.StatusCode == http.StatusNotModified {
2509 if res.Body != nil {
2510 res.Body.Close()
2511 }
2512 return nil, gensupport.WrapError(&googleapi.Error{
2513 Code: res.StatusCode,
2514 Header: res.Header,
2515 })
2516 }
2517 if err != nil {
2518 return nil, err
2519 }
2520 defer googleapi.CloseBody(res)
2521 if err := googleapi.CheckResponse(res); err != nil {
2522 return nil, gensupport.WrapError(err)
2523 }
2524 ret := &Subscriptions{
2525 ServerResponse: googleapi.ServerResponse{
2526 Header: res.Header,
2527 HTTPStatusCode: res.StatusCode,
2528 },
2529 }
2530 target := &ret
2531 if err := gensupport.DecodeResponse(target, res); err != nil {
2532 return nil, err
2533 }
2534 return ret, nil
2535 }
2536
2537
2538
2539
2540 func (c *SubscriptionsListCall) Pages(ctx context.Context, f func(*Subscriptions) error) error {
2541 c.ctx_ = ctx
2542 defer c.PageToken(c.urlParams_.Get("pageToken"))
2543 for {
2544 x, err := c.Do()
2545 if err != nil {
2546 return err
2547 }
2548 if err := f(x); err != nil {
2549 return err
2550 }
2551 if x.NextPageToken == "" {
2552 return nil
2553 }
2554 c.PageToken(x.NextPageToken)
2555 }
2556 }
2557
2558 type SubscriptionsStartPaidServiceCall struct {
2559 s *Service
2560 customerId string
2561 subscriptionId string
2562 urlParams_ gensupport.URLParams
2563 ctx_ context.Context
2564 header_ http.Header
2565 }
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584 func (r *SubscriptionsService) StartPaidService(customerId string, subscriptionId string) *SubscriptionsStartPaidServiceCall {
2585 c := &SubscriptionsStartPaidServiceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2586 c.customerId = customerId
2587 c.subscriptionId = subscriptionId
2588 return c
2589 }
2590
2591
2592
2593
2594 func (c *SubscriptionsStartPaidServiceCall) Fields(s ...googleapi.Field) *SubscriptionsStartPaidServiceCall {
2595 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2596 return c
2597 }
2598
2599
2600 func (c *SubscriptionsStartPaidServiceCall) Context(ctx context.Context) *SubscriptionsStartPaidServiceCall {
2601 c.ctx_ = ctx
2602 return c
2603 }
2604
2605
2606
2607 func (c *SubscriptionsStartPaidServiceCall) Header() http.Header {
2608 if c.header_ == nil {
2609 c.header_ = make(http.Header)
2610 }
2611 return c.header_
2612 }
2613
2614 func (c *SubscriptionsStartPaidServiceCall) doRequest(alt string) (*http.Response, error) {
2615 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2616 var body io.Reader = nil
2617 c.urlParams_.Set("alt", alt)
2618 c.urlParams_.Set("prettyPrint", "false")
2619 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/startPaidService")
2620 urls += "?" + c.urlParams_.Encode()
2621 req, err := http.NewRequest("POST", urls, body)
2622 if err != nil {
2623 return nil, err
2624 }
2625 req.Header = reqHeaders
2626 googleapi.Expand(req.URL, map[string]string{
2627 "customerId": c.customerId,
2628 "subscriptionId": c.subscriptionId,
2629 })
2630 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2631 }
2632
2633
2634
2635
2636
2637
2638 func (c *SubscriptionsStartPaidServiceCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2639 gensupport.SetOptions(c.urlParams_, opts...)
2640 res, err := c.doRequest("json")
2641 if res != nil && res.StatusCode == http.StatusNotModified {
2642 if res.Body != nil {
2643 res.Body.Close()
2644 }
2645 return nil, gensupport.WrapError(&googleapi.Error{
2646 Code: res.StatusCode,
2647 Header: res.Header,
2648 })
2649 }
2650 if err != nil {
2651 return nil, err
2652 }
2653 defer googleapi.CloseBody(res)
2654 if err := googleapi.CheckResponse(res); err != nil {
2655 return nil, gensupport.WrapError(err)
2656 }
2657 ret := &Subscription{
2658 ServerResponse: googleapi.ServerResponse{
2659 Header: res.Header,
2660 HTTPStatusCode: res.StatusCode,
2661 },
2662 }
2663 target := &ret
2664 if err := gensupport.DecodeResponse(target, res); err != nil {
2665 return nil, err
2666 }
2667 return ret, nil
2668 }
2669
2670 type SubscriptionsSuspendCall struct {
2671 s *Service
2672 customerId string
2673 subscriptionId string
2674 urlParams_ gensupport.URLParams
2675 ctx_ context.Context
2676 header_ http.Header
2677 }
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701 func (r *SubscriptionsService) Suspend(customerId string, subscriptionId string) *SubscriptionsSuspendCall {
2702 c := &SubscriptionsSuspendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2703 c.customerId = customerId
2704 c.subscriptionId = subscriptionId
2705 return c
2706 }
2707
2708
2709
2710
2711 func (c *SubscriptionsSuspendCall) Fields(s ...googleapi.Field) *SubscriptionsSuspendCall {
2712 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2713 return c
2714 }
2715
2716
2717 func (c *SubscriptionsSuspendCall) Context(ctx context.Context) *SubscriptionsSuspendCall {
2718 c.ctx_ = ctx
2719 return c
2720 }
2721
2722
2723
2724 func (c *SubscriptionsSuspendCall) Header() http.Header {
2725 if c.header_ == nil {
2726 c.header_ = make(http.Header)
2727 }
2728 return c.header_
2729 }
2730
2731 func (c *SubscriptionsSuspendCall) doRequest(alt string) (*http.Response, error) {
2732 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2733 var body io.Reader = nil
2734 c.urlParams_.Set("alt", alt)
2735 c.urlParams_.Set("prettyPrint", "false")
2736 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}/suspend")
2737 urls += "?" + c.urlParams_.Encode()
2738 req, err := http.NewRequest("POST", urls, body)
2739 if err != nil {
2740 return nil, err
2741 }
2742 req.Header = reqHeaders
2743 googleapi.Expand(req.URL, map[string]string{
2744 "customerId": c.customerId,
2745 "subscriptionId": c.subscriptionId,
2746 })
2747 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2748 }
2749
2750
2751
2752
2753
2754
2755 func (c *SubscriptionsSuspendCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
2756 gensupport.SetOptions(c.urlParams_, opts...)
2757 res, err := c.doRequest("json")
2758 if res != nil && res.StatusCode == http.StatusNotModified {
2759 if res.Body != nil {
2760 res.Body.Close()
2761 }
2762 return nil, gensupport.WrapError(&googleapi.Error{
2763 Code: res.StatusCode,
2764 Header: res.Header,
2765 })
2766 }
2767 if err != nil {
2768 return nil, err
2769 }
2770 defer googleapi.CloseBody(res)
2771 if err := googleapi.CheckResponse(res); err != nil {
2772 return nil, gensupport.WrapError(err)
2773 }
2774 ret := &Subscription{
2775 ServerResponse: googleapi.ServerResponse{
2776 Header: res.Header,
2777 HTTPStatusCode: res.StatusCode,
2778 },
2779 }
2780 target := &ret
2781 if err := gensupport.DecodeResponse(target, res); err != nil {
2782 return nil, err
2783 }
2784 return ret, nil
2785 }
2786
View as plain text