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 package appstate
39
40 import (
41 "bytes"
42 "context"
43 "encoding/json"
44 "errors"
45 "fmt"
46 "io"
47 "net/http"
48 "net/url"
49 "strconv"
50 "strings"
51
52 googleapi "google.golang.org/api/googleapi"
53 gensupport "google.golang.org/api/internal/gensupport"
54 option "google.golang.org/api/option"
55 htransport "google.golang.org/api/transport/http"
56 )
57
58
59
60 var _ = bytes.NewBuffer
61 var _ = strconv.Itoa
62 var _ = fmt.Sprintf
63 var _ = json.NewDecoder
64 var _ = io.Copy
65 var _ = url.Parse
66 var _ = gensupport.MarshalJSON
67 var _ = googleapi.Version
68 var _ = errors.New
69 var _ = strings.Replace
70 var _ = context.Canceled
71
72 const apiId = "appstate:v1"
73 const apiName = "appstate"
74 const apiVersion = "v1"
75 const basePath = "https://www.googleapis.com/appstate/v1/"
76
77
78 const (
79
80 AppstateScope = "https://www.googleapis.com/auth/appstate"
81 )
82
83
84 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
85 scopesOption := option.WithScopes(
86 "https://www.googleapis.com/auth/appstate",
87 )
88
89 opts = append([]option.ClientOption{scopesOption}, opts...)
90 client, endpoint, err := htransport.NewClient(ctx, opts...)
91 if err != nil {
92 return nil, err
93 }
94 s, err := New(client)
95 if err != nil {
96 return nil, err
97 }
98 if endpoint != "" {
99 s.BasePath = endpoint
100 }
101 return s, nil
102 }
103
104
105
106
107
108
109 func New(client *http.Client) (*Service, error) {
110 if client == nil {
111 return nil, errors.New("client is nil")
112 }
113 s := &Service{client: client, BasePath: basePath}
114 s.States = NewStatesService(s)
115 return s, nil
116 }
117
118 type Service struct {
119 client *http.Client
120 BasePath string
121 UserAgent string
122
123 States *StatesService
124 }
125
126 func (s *Service) userAgent() string {
127 if s.UserAgent == "" {
128 return googleapi.UserAgent
129 }
130 return googleapi.UserAgent + " " + s.UserAgent
131 }
132
133 func NewStatesService(s *Service) *StatesService {
134 rs := &StatesService{s: s}
135 return rs
136 }
137
138 type StatesService struct {
139 s *Service
140 }
141
142
143 type GetResponse struct {
144
145 CurrentStateVersion string `json:"currentStateVersion,omitempty"`
146
147
148 Data string `json:"data,omitempty"`
149
150
151
152 Kind string `json:"kind,omitempty"`
153
154
155 StateKey int64 `json:"stateKey,omitempty"`
156
157
158
159 googleapi.ServerResponse `json:"-"`
160
161
162
163
164
165
166
167 ForceSendFields []string `json:"-"`
168
169
170
171
172
173
174
175
176 NullFields []string `json:"-"`
177 }
178
179 func (s *GetResponse) MarshalJSON() ([]byte, error) {
180 type NoMethod GetResponse
181 raw := NoMethod(*s)
182 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
183 }
184
185
186
187 type ListResponse struct {
188
189 Items []*GetResponse `json:"items,omitempty"`
190
191
192
193 Kind string `json:"kind,omitempty"`
194
195
196 MaximumKeyCount int64 `json:"maximumKeyCount,omitempty"`
197
198
199
200 googleapi.ServerResponse `json:"-"`
201
202
203
204
205
206
207
208 ForceSendFields []string `json:"-"`
209
210
211
212
213
214
215
216 NullFields []string `json:"-"`
217 }
218
219 func (s *ListResponse) MarshalJSON() ([]byte, error) {
220 type NoMethod ListResponse
221 raw := NoMethod(*s)
222 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
223 }
224
225
226
227 type UpdateRequest struct {
228
229
230 Data string `json:"data,omitempty"`
231
232
233
234 Kind string `json:"kind,omitempty"`
235
236
237
238
239
240
241
242 ForceSendFields []string `json:"-"`
243
244
245
246
247
248
249
250 NullFields []string `json:"-"`
251 }
252
253 func (s *UpdateRequest) MarshalJSON() ([]byte, error) {
254 type NoMethod UpdateRequest
255 raw := NoMethod(*s)
256 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
257 }
258
259
260 type WriteResult struct {
261
262
263 CurrentStateVersion string `json:"currentStateVersion,omitempty"`
264
265
266
267 Kind string `json:"kind,omitempty"`
268
269
270 StateKey int64 `json:"stateKey,omitempty"`
271
272
273
274 googleapi.ServerResponse `json:"-"`
275
276
277
278
279
280
281
282 ForceSendFields []string `json:"-"`
283
284
285
286
287
288
289
290
291 NullFields []string `json:"-"`
292 }
293
294 func (s *WriteResult) MarshalJSON() ([]byte, error) {
295 type NoMethod WriteResult
296 raw := NoMethod(*s)
297 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
298 }
299
300
301
302 type StatesClearCall struct {
303 s *Service
304 stateKey int64
305 urlParams_ gensupport.URLParams
306 ctx_ context.Context
307 header_ http.Header
308 }
309
310
311
312
313 func (r *StatesService) Clear(stateKey int64) *StatesClearCall {
314 c := &StatesClearCall{s: r.s, urlParams_: make(gensupport.URLParams)}
315 c.stateKey = stateKey
316 return c
317 }
318
319
320
321
322 func (c *StatesClearCall) CurrentDataVersion(currentDataVersion string) *StatesClearCall {
323 c.urlParams_.Set("currentDataVersion", currentDataVersion)
324 return c
325 }
326
327
328
329
330 func (c *StatesClearCall) Fields(s ...googleapi.Field) *StatesClearCall {
331 c.urlParams_.Set("fields", googleapi.CombineFields(s))
332 return c
333 }
334
335
336
337
338 func (c *StatesClearCall) Context(ctx context.Context) *StatesClearCall {
339 c.ctx_ = ctx
340 return c
341 }
342
343
344
345 func (c *StatesClearCall) Header() http.Header {
346 if c.header_ == nil {
347 c.header_ = make(http.Header)
348 }
349 return c.header_
350 }
351
352 func (c *StatesClearCall) doRequest(alt string) (*http.Response, error) {
353 reqHeaders := make(http.Header)
354 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
355 for k, v := range c.header_ {
356 reqHeaders[k] = v
357 }
358 reqHeaders.Set("User-Agent", c.s.userAgent())
359 var body io.Reader = nil
360 c.urlParams_.Set("alt", alt)
361 c.urlParams_.Set("prettyPrint", "false")
362 urls := googleapi.ResolveRelative(c.s.BasePath, "states/{stateKey}/clear")
363 urls += "?" + c.urlParams_.Encode()
364 req, err := http.NewRequest("POST", urls, body)
365 if err != nil {
366 return nil, err
367 }
368 req.Header = reqHeaders
369 googleapi.Expand(req.URL, map[string]string{
370 "stateKey": strconv.FormatInt(c.stateKey, 10),
371 })
372 return gensupport.SendRequest(c.ctx_, c.s.client, req)
373 }
374
375
376
377
378
379
380
381
382 func (c *StatesClearCall) Do(opts ...googleapi.CallOption) (*WriteResult, error) {
383 gensupport.SetOptions(c.urlParams_, opts...)
384 res, err := c.doRequest("json")
385 if res != nil && res.StatusCode == http.StatusNotModified {
386 if res.Body != nil {
387 res.Body.Close()
388 }
389 return nil, &googleapi.Error{
390 Code: res.StatusCode,
391 Header: res.Header,
392 }
393 }
394 if err != nil {
395 return nil, err
396 }
397 defer googleapi.CloseBody(res)
398 if err := googleapi.CheckResponse(res); err != nil {
399 return nil, err
400 }
401 ret := &WriteResult{
402 ServerResponse: googleapi.ServerResponse{
403 Header: res.Header,
404 HTTPStatusCode: res.StatusCode,
405 },
406 }
407 target := &ret
408 if err := gensupport.DecodeResponse(target, res); err != nil {
409 return nil, err
410 }
411 return ret, nil
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444 }
445
446
447
448 type StatesDeleteCall struct {
449 s *Service
450 stateKey int64
451 urlParams_ gensupport.URLParams
452 ctx_ context.Context
453 header_ http.Header
454 }
455
456
457
458
459
460
461
462 func (r *StatesService) Delete(stateKey int64) *StatesDeleteCall {
463 c := &StatesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
464 c.stateKey = stateKey
465 return c
466 }
467
468
469
470
471 func (c *StatesDeleteCall) Fields(s ...googleapi.Field) *StatesDeleteCall {
472 c.urlParams_.Set("fields", googleapi.CombineFields(s))
473 return c
474 }
475
476
477
478
479 func (c *StatesDeleteCall) Context(ctx context.Context) *StatesDeleteCall {
480 c.ctx_ = ctx
481 return c
482 }
483
484
485
486 func (c *StatesDeleteCall) Header() http.Header {
487 if c.header_ == nil {
488 c.header_ = make(http.Header)
489 }
490 return c.header_
491 }
492
493 func (c *StatesDeleteCall) doRequest(alt string) (*http.Response, error) {
494 reqHeaders := make(http.Header)
495 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
496 for k, v := range c.header_ {
497 reqHeaders[k] = v
498 }
499 reqHeaders.Set("User-Agent", c.s.userAgent())
500 var body io.Reader = nil
501 c.urlParams_.Set("alt", alt)
502 c.urlParams_.Set("prettyPrint", "false")
503 urls := googleapi.ResolveRelative(c.s.BasePath, "states/{stateKey}")
504 urls += "?" + c.urlParams_.Encode()
505 req, err := http.NewRequest("DELETE", urls, body)
506 if err != nil {
507 return nil, err
508 }
509 req.Header = reqHeaders
510 googleapi.Expand(req.URL, map[string]string{
511 "stateKey": strconv.FormatInt(c.stateKey, 10),
512 })
513 return gensupport.SendRequest(c.ctx_, c.s.client, req)
514 }
515
516
517 func (c *StatesDeleteCall) Do(opts ...googleapi.CallOption) error {
518 gensupport.SetOptions(c.urlParams_, opts...)
519 res, err := c.doRequest("json")
520 if err != nil {
521 return err
522 }
523 defer googleapi.CloseBody(res)
524 if err := googleapi.CheckResponse(res); err != nil {
525 return err
526 }
527 return nil
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552 }
553
554
555
556 type StatesGetCall struct {
557 s *Service
558 stateKey int64
559 urlParams_ gensupport.URLParams
560 ifNoneMatch_ string
561 ctx_ context.Context
562 header_ http.Header
563 }
564
565
566
567 func (r *StatesService) Get(stateKey int64) *StatesGetCall {
568 c := &StatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
569 c.stateKey = stateKey
570 return c
571 }
572
573
574
575
576 func (c *StatesGetCall) Fields(s ...googleapi.Field) *StatesGetCall {
577 c.urlParams_.Set("fields", googleapi.CombineFields(s))
578 return c
579 }
580
581
582
583
584
585
586 func (c *StatesGetCall) IfNoneMatch(entityTag string) *StatesGetCall {
587 c.ifNoneMatch_ = entityTag
588 return c
589 }
590
591
592
593
594 func (c *StatesGetCall) Context(ctx context.Context) *StatesGetCall {
595 c.ctx_ = ctx
596 return c
597 }
598
599
600
601 func (c *StatesGetCall) Header() http.Header {
602 if c.header_ == nil {
603 c.header_ = make(http.Header)
604 }
605 return c.header_
606 }
607
608 func (c *StatesGetCall) doRequest(alt string) (*http.Response, error) {
609 reqHeaders := make(http.Header)
610 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
611 for k, v := range c.header_ {
612 reqHeaders[k] = v
613 }
614 reqHeaders.Set("User-Agent", c.s.userAgent())
615 if c.ifNoneMatch_ != "" {
616 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
617 }
618 var body io.Reader = nil
619 c.urlParams_.Set("alt", alt)
620 c.urlParams_.Set("prettyPrint", "false")
621 urls := googleapi.ResolveRelative(c.s.BasePath, "states/{stateKey}")
622 urls += "?" + c.urlParams_.Encode()
623 req, err := http.NewRequest("GET", urls, body)
624 if err != nil {
625 return nil, err
626 }
627 req.Header = reqHeaders
628 googleapi.Expand(req.URL, map[string]string{
629 "stateKey": strconv.FormatInt(c.stateKey, 10),
630 })
631 return gensupport.SendRequest(c.ctx_, c.s.client, req)
632 }
633
634
635
636
637
638
639
640
641 func (c *StatesGetCall) Do(opts ...googleapi.CallOption) (*GetResponse, error) {
642 gensupport.SetOptions(c.urlParams_, opts...)
643 res, err := c.doRequest("json")
644 if res != nil && res.StatusCode == http.StatusNotModified {
645 if res.Body != nil {
646 res.Body.Close()
647 }
648 return nil, &googleapi.Error{
649 Code: res.StatusCode,
650 Header: res.Header,
651 }
652 }
653 if err != nil {
654 return nil, err
655 }
656 defer googleapi.CloseBody(res)
657 if err := googleapi.CheckResponse(res); err != nil {
658 return nil, err
659 }
660 ret := &GetResponse{
661 ServerResponse: googleapi.ServerResponse{
662 Header: res.Header,
663 HTTPStatusCode: res.StatusCode,
664 },
665 }
666 target := &ret
667 if err := gensupport.DecodeResponse(target, res); err != nil {
668 return nil, err
669 }
670 return ret, nil
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698 }
699
700
701
702 type StatesListCall struct {
703 s *Service
704 urlParams_ gensupport.URLParams
705 ifNoneMatch_ string
706 ctx_ context.Context
707 header_ http.Header
708 }
709
710
711 func (r *StatesService) List() *StatesListCall {
712 c := &StatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
713 return c
714 }
715
716
717
718 func (c *StatesListCall) IncludeData(includeData bool) *StatesListCall {
719 c.urlParams_.Set("includeData", fmt.Sprint(includeData))
720 return c
721 }
722
723
724
725
726 func (c *StatesListCall) Fields(s ...googleapi.Field) *StatesListCall {
727 c.urlParams_.Set("fields", googleapi.CombineFields(s))
728 return c
729 }
730
731
732
733
734
735
736 func (c *StatesListCall) IfNoneMatch(entityTag string) *StatesListCall {
737 c.ifNoneMatch_ = entityTag
738 return c
739 }
740
741
742
743
744 func (c *StatesListCall) Context(ctx context.Context) *StatesListCall {
745 c.ctx_ = ctx
746 return c
747 }
748
749
750
751 func (c *StatesListCall) Header() http.Header {
752 if c.header_ == nil {
753 c.header_ = make(http.Header)
754 }
755 return c.header_
756 }
757
758 func (c *StatesListCall) doRequest(alt string) (*http.Response, error) {
759 reqHeaders := make(http.Header)
760 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
761 for k, v := range c.header_ {
762 reqHeaders[k] = v
763 }
764 reqHeaders.Set("User-Agent", c.s.userAgent())
765 if c.ifNoneMatch_ != "" {
766 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
767 }
768 var body io.Reader = nil
769 c.urlParams_.Set("alt", alt)
770 c.urlParams_.Set("prettyPrint", "false")
771 urls := googleapi.ResolveRelative(c.s.BasePath, "states")
772 urls += "?" + c.urlParams_.Encode()
773 req, err := http.NewRequest("GET", urls, body)
774 if err != nil {
775 return nil, err
776 }
777 req.Header = reqHeaders
778 return gensupport.SendRequest(c.ctx_, c.s.client, req)
779 }
780
781
782
783
784
785
786
787
788 func (c *StatesListCall) Do(opts ...googleapi.CallOption) (*ListResponse, error) {
789 gensupport.SetOptions(c.urlParams_, opts...)
790 res, err := c.doRequest("json")
791 if res != nil && res.StatusCode == http.StatusNotModified {
792 if res.Body != nil {
793 res.Body.Close()
794 }
795 return nil, &googleapi.Error{
796 Code: res.StatusCode,
797 Header: res.Header,
798 }
799 }
800 if err != nil {
801 return nil, err
802 }
803 defer googleapi.CloseBody(res)
804 if err := googleapi.CheckResponse(res); err != nil {
805 return nil, err
806 }
807 ret := &ListResponse{
808 ServerResponse: googleapi.ServerResponse{
809 Header: res.Header,
810 HTTPStatusCode: res.StatusCode,
811 },
812 }
813 target := &ret
814 if err := gensupport.DecodeResponse(target, res); err != nil {
815 return nil, err
816 }
817 return ret, nil
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839 }
840
841
842
843 type StatesUpdateCall struct {
844 s *Service
845 stateKey int64
846 updaterequest *UpdateRequest
847 urlParams_ gensupport.URLParams
848 ctx_ context.Context
849 header_ http.Header
850 }
851
852
853
854
855
856 func (r *StatesService) Update(stateKey int64, updaterequest *UpdateRequest) *StatesUpdateCall {
857 c := &StatesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
858 c.stateKey = stateKey
859 c.updaterequest = updaterequest
860 return c
861 }
862
863
864
865
866
867
868
869 func (c *StatesUpdateCall) CurrentStateVersion(currentStateVersion string) *StatesUpdateCall {
870 c.urlParams_.Set("currentStateVersion", currentStateVersion)
871 return c
872 }
873
874
875
876
877 func (c *StatesUpdateCall) Fields(s ...googleapi.Field) *StatesUpdateCall {
878 c.urlParams_.Set("fields", googleapi.CombineFields(s))
879 return c
880 }
881
882
883
884
885 func (c *StatesUpdateCall) Context(ctx context.Context) *StatesUpdateCall {
886 c.ctx_ = ctx
887 return c
888 }
889
890
891
892 func (c *StatesUpdateCall) Header() http.Header {
893 if c.header_ == nil {
894 c.header_ = make(http.Header)
895 }
896 return c.header_
897 }
898
899 func (c *StatesUpdateCall) doRequest(alt string) (*http.Response, error) {
900 reqHeaders := make(http.Header)
901 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
902 for k, v := range c.header_ {
903 reqHeaders[k] = v
904 }
905 reqHeaders.Set("User-Agent", c.s.userAgent())
906 var body io.Reader = nil
907 body, err := googleapi.WithoutDataWrapper.JSONReader(c.updaterequest)
908 if err != nil {
909 return nil, err
910 }
911 reqHeaders.Set("Content-Type", "application/json")
912 c.urlParams_.Set("alt", alt)
913 c.urlParams_.Set("prettyPrint", "false")
914 urls := googleapi.ResolveRelative(c.s.BasePath, "states/{stateKey}")
915 urls += "?" + c.urlParams_.Encode()
916 req, err := http.NewRequest("PUT", urls, body)
917 if err != nil {
918 return nil, err
919 }
920 req.Header = reqHeaders
921 googleapi.Expand(req.URL, map[string]string{
922 "stateKey": strconv.FormatInt(c.stateKey, 10),
923 })
924 return gensupport.SendRequest(c.ctx_, c.s.client, req)
925 }
926
927
928
929
930
931
932
933
934 func (c *StatesUpdateCall) Do(opts ...googleapi.CallOption) (*WriteResult, error) {
935 gensupport.SetOptions(c.urlParams_, opts...)
936 res, err := c.doRequest("json")
937 if res != nil && res.StatusCode == http.StatusNotModified {
938 if res.Body != nil {
939 res.Body.Close()
940 }
941 return nil, &googleapi.Error{
942 Code: res.StatusCode,
943 Header: res.Header,
944 }
945 }
946 if err != nil {
947 return nil, err
948 }
949 defer googleapi.CloseBody(res)
950 if err := googleapi.CheckResponse(res); err != nil {
951 return nil, err
952 }
953 ret := &WriteResult{
954 ServerResponse: googleapi.ServerResponse{
955 Header: res.Header,
956 HTTPStatusCode: res.StatusCode,
957 },
958 }
959 target := &ret
960 if err := gensupport.DecodeResponse(target, res); err != nil {
961 return nil, err
962 }
963 return ret, nil
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999 }
1000
View as plain text