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 package gamesconfiguration
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71 )
72
73
74
75 var _ = bytes.NewBuffer
76 var _ = strconv.Itoa
77 var _ = fmt.Sprintf
78 var _ = json.NewDecoder
79 var _ = io.Copy
80 var _ = url.Parse
81 var _ = gensupport.MarshalJSON
82 var _ = googleapi.Version
83 var _ = errors.New
84 var _ = strings.Replace
85 var _ = context.Canceled
86 var _ = internaloption.WithDefaultEndpoint
87 var _ = internal.Version
88
89 const apiId = "gamesConfiguration:v1configuration"
90 const apiName = "gamesConfiguration"
91 const apiVersion = "v1configuration"
92 const basePath = "https://gamesconfiguration.googleapis.com/"
93 const basePathTemplate = "https://gamesconfiguration.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://gamesconfiguration.mtls.googleapis.com/"
95
96
97 const (
98
99 AndroidpublisherScope = "https://www.googleapis.com/auth/androidpublisher"
100 )
101
102
103 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
104 scopesOption := internaloption.WithDefaultScopes(
105 "https://www.googleapis.com/auth/androidpublisher",
106 )
107
108 opts = append([]option.ClientOption{scopesOption}, opts...)
109 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
110 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
111 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
112 opts = append(opts, internaloption.EnableNewAuthLibrary())
113 client, endpoint, err := htransport.NewClient(ctx, opts...)
114 if err != nil {
115 return nil, err
116 }
117 s, err := New(client)
118 if err != nil {
119 return nil, err
120 }
121 if endpoint != "" {
122 s.BasePath = endpoint
123 }
124 return s, nil
125 }
126
127
128
129
130
131
132 func New(client *http.Client) (*Service, error) {
133 if client == nil {
134 return nil, errors.New("client is nil")
135 }
136 s := &Service{client: client, BasePath: basePath}
137 s.AchievementConfigurations = NewAchievementConfigurationsService(s)
138 s.LeaderboardConfigurations = NewLeaderboardConfigurationsService(s)
139 return s, nil
140 }
141
142 type Service struct {
143 client *http.Client
144 BasePath string
145 UserAgent string
146
147 AchievementConfigurations *AchievementConfigurationsService
148
149 LeaderboardConfigurations *LeaderboardConfigurationsService
150 }
151
152 func (s *Service) userAgent() string {
153 if s.UserAgent == "" {
154 return googleapi.UserAgent
155 }
156 return googleapi.UserAgent + " " + s.UserAgent
157 }
158
159 func NewAchievementConfigurationsService(s *Service) *AchievementConfigurationsService {
160 rs := &AchievementConfigurationsService{s: s}
161 return rs
162 }
163
164 type AchievementConfigurationsService struct {
165 s *Service
166 }
167
168 func NewLeaderboardConfigurationsService(s *Service) *LeaderboardConfigurationsService {
169 rs := &LeaderboardConfigurationsService{s: s}
170 return rs
171 }
172
173 type LeaderboardConfigurationsService struct {
174 s *Service
175 }
176
177
178 type AchievementConfiguration struct {
179
180
181
182
183
184
185 AchievementType string `json:"achievementType,omitempty"`
186
187 Draft *AchievementConfigurationDetail `json:"draft,omitempty"`
188
189 Id string `json:"id,omitempty"`
190
191
192
193
194
195
196 InitialState string `json:"initialState,omitempty"`
197
198
199 Kind string `json:"kind,omitempty"`
200
201 Published *AchievementConfigurationDetail `json:"published,omitempty"`
202
203 StepsToUnlock int64 `json:"stepsToUnlock,omitempty"`
204
205 Token string `json:"token,omitempty"`
206
207
208 googleapi.ServerResponse `json:"-"`
209
210
211
212
213
214 ForceSendFields []string `json:"-"`
215
216
217
218
219 NullFields []string `json:"-"`
220 }
221
222 func (s *AchievementConfiguration) MarshalJSON() ([]byte, error) {
223 type NoMethod AchievementConfiguration
224 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
225 }
226
227
228 type AchievementConfigurationDetail struct {
229
230 Description *LocalizedStringBundle `json:"description,omitempty"`
231
232 IconUrl string `json:"iconUrl,omitempty"`
233
234
235 Kind string `json:"kind,omitempty"`
236
237 Name *LocalizedStringBundle `json:"name,omitempty"`
238
239 PointValue int64 `json:"pointValue,omitempty"`
240
241
242 SortRank int64 `json:"sortRank,omitempty"`
243
244
245
246
247
248 ForceSendFields []string `json:"-"`
249
250
251
252
253 NullFields []string `json:"-"`
254 }
255
256 func (s *AchievementConfigurationDetail) MarshalJSON() ([]byte, error) {
257 type NoMethod AchievementConfigurationDetail
258 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
259 }
260
261
262 type AchievementConfigurationListResponse struct {
263
264 Items []*AchievementConfiguration `json:"items,omitempty"`
265
266
267 Kind string `json:"kind,omitempty"`
268
269 NextPageToken string `json:"nextPageToken,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 *AchievementConfigurationListResponse) MarshalJSON() ([]byte, error) {
287 type NoMethod AchievementConfigurationListResponse
288 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
289 }
290
291
292 type GamesNumberAffixConfiguration struct {
293
294
295
296 Few *LocalizedStringBundle `json:"few,omitempty"`
297
298
299 Many *LocalizedStringBundle `json:"many,omitempty"`
300
301
302
303 One *LocalizedStringBundle `json:"one,omitempty"`
304
305
306 Other *LocalizedStringBundle `json:"other,omitempty"`
307
308
309 Two *LocalizedStringBundle `json:"two,omitempty"`
310
311
312 Zero *LocalizedStringBundle `json:"zero,omitempty"`
313
314
315
316
317
318 ForceSendFields []string `json:"-"`
319
320
321
322
323 NullFields []string `json:"-"`
324 }
325
326 func (s *GamesNumberAffixConfiguration) MarshalJSON() ([]byte, error) {
327 type NoMethod GamesNumberAffixConfiguration
328 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
329 }
330
331
332 type GamesNumberFormatConfiguration struct {
333
334 CurrencyCode string `json:"currencyCode,omitempty"`
335
336
337 NumDecimalPlaces int64 `json:"numDecimalPlaces,omitempty"`
338
339
340
341
342
343
344
345
346
347 NumberFormatType string `json:"numberFormatType,omitempty"`
348
349
350 Suffix *GamesNumberAffixConfiguration `json:"suffix,omitempty"`
351
352
353
354
355
356 ForceSendFields []string `json:"-"`
357
358
359
360
361 NullFields []string `json:"-"`
362 }
363
364 func (s *GamesNumberFormatConfiguration) MarshalJSON() ([]byte, error) {
365 type NoMethod GamesNumberFormatConfiguration
366 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
367 }
368
369
370 type LeaderboardConfiguration struct {
371
372 Draft *LeaderboardConfigurationDetail `json:"draft,omitempty"`
373
374 Id string `json:"id,omitempty"`
375
376
377 Kind string `json:"kind,omitempty"`
378
379 Published *LeaderboardConfigurationDetail `json:"published,omitempty"`
380
381 ScoreMax int64 `json:"scoreMax,omitempty,string"`
382
383 ScoreMin int64 `json:"scoreMin,omitempty,string"`
384
385
386
387
388 ScoreOrder string `json:"scoreOrder,omitempty"`
389
390 Token string `json:"token,omitempty"`
391
392
393 googleapi.ServerResponse `json:"-"`
394
395
396
397
398
399 ForceSendFields []string `json:"-"`
400
401
402
403
404 NullFields []string `json:"-"`
405 }
406
407 func (s *LeaderboardConfiguration) MarshalJSON() ([]byte, error) {
408 type NoMethod LeaderboardConfiguration
409 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
410 }
411
412
413 type LeaderboardConfigurationDetail struct {
414
415 IconUrl string `json:"iconUrl,omitempty"`
416
417
418 Kind string `json:"kind,omitempty"`
419
420 Name *LocalizedStringBundle `json:"name,omitempty"`
421
422 ScoreFormat *GamesNumberFormatConfiguration `json:"scoreFormat,omitempty"`
423
424
425 SortRank int64 `json:"sortRank,omitempty"`
426
427
428
429
430
431 ForceSendFields []string `json:"-"`
432
433
434
435
436 NullFields []string `json:"-"`
437 }
438
439 func (s *LeaderboardConfigurationDetail) MarshalJSON() ([]byte, error) {
440 type NoMethod LeaderboardConfigurationDetail
441 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
442 }
443
444
445 type LeaderboardConfigurationListResponse struct {
446
447 Items []*LeaderboardConfiguration `json:"items,omitempty"`
448
449
450 Kind string `json:"kind,omitempty"`
451
452 NextPageToken string `json:"nextPageToken,omitempty"`
453
454
455 googleapi.ServerResponse `json:"-"`
456
457
458
459
460
461 ForceSendFields []string `json:"-"`
462
463
464
465
466 NullFields []string `json:"-"`
467 }
468
469 func (s *LeaderboardConfigurationListResponse) MarshalJSON() ([]byte, error) {
470 type NoMethod LeaderboardConfigurationListResponse
471 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
472 }
473
474
475 type LocalizedString struct {
476
477
478 Kind string `json:"kind,omitempty"`
479
480 Locale string `json:"locale,omitempty"`
481
482 Value string `json:"value,omitempty"`
483
484
485
486
487
488 ForceSendFields []string `json:"-"`
489
490
491
492
493 NullFields []string `json:"-"`
494 }
495
496 func (s *LocalizedString) MarshalJSON() ([]byte, error) {
497 type NoMethod LocalizedString
498 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
499 }
500
501
502 type LocalizedStringBundle struct {
503
504
505 Kind string `json:"kind,omitempty"`
506
507 Translations []*LocalizedString `json:"translations,omitempty"`
508
509
510
511
512
513 ForceSendFields []string `json:"-"`
514
515
516
517
518 NullFields []string `json:"-"`
519 }
520
521 func (s *LocalizedStringBundle) MarshalJSON() ([]byte, error) {
522 type NoMethod LocalizedStringBundle
523 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
524 }
525
526 type AchievementConfigurationsDeleteCall struct {
527 s *Service
528 achievementId string
529 urlParams_ gensupport.URLParams
530 ctx_ context.Context
531 header_ http.Header
532 }
533
534
535
536
537 func (r *AchievementConfigurationsService) Delete(achievementId string) *AchievementConfigurationsDeleteCall {
538 c := &AchievementConfigurationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
539 c.achievementId = achievementId
540 return c
541 }
542
543
544
545
546 func (c *AchievementConfigurationsDeleteCall) Fields(s ...googleapi.Field) *AchievementConfigurationsDeleteCall {
547 c.urlParams_.Set("fields", googleapi.CombineFields(s))
548 return c
549 }
550
551
552 func (c *AchievementConfigurationsDeleteCall) Context(ctx context.Context) *AchievementConfigurationsDeleteCall {
553 c.ctx_ = ctx
554 return c
555 }
556
557
558
559 func (c *AchievementConfigurationsDeleteCall) Header() http.Header {
560 if c.header_ == nil {
561 c.header_ = make(http.Header)
562 }
563 return c.header_
564 }
565
566 func (c *AchievementConfigurationsDeleteCall) doRequest(alt string) (*http.Response, error) {
567 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
568 var body io.Reader = nil
569 c.urlParams_.Set("alt", alt)
570 c.urlParams_.Set("prettyPrint", "false")
571 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/achievements/{achievementId}")
572 urls += "?" + c.urlParams_.Encode()
573 req, err := http.NewRequest("DELETE", urls, body)
574 if err != nil {
575 return nil, err
576 }
577 req.Header = reqHeaders
578 googleapi.Expand(req.URL, map[string]string{
579 "achievementId": c.achievementId,
580 })
581 return gensupport.SendRequest(c.ctx_, c.s.client, req)
582 }
583
584
585 func (c *AchievementConfigurationsDeleteCall) Do(opts ...googleapi.CallOption) error {
586 gensupport.SetOptions(c.urlParams_, opts...)
587 res, err := c.doRequest("json")
588 if err != nil {
589 return err
590 }
591 defer googleapi.CloseBody(res)
592 if err := googleapi.CheckResponse(res); err != nil {
593 return gensupport.WrapError(err)
594 }
595 return nil
596 }
597
598 type AchievementConfigurationsGetCall struct {
599 s *Service
600 achievementId string
601 urlParams_ gensupport.URLParams
602 ifNoneMatch_ string
603 ctx_ context.Context
604 header_ http.Header
605 }
606
607
608
609
610
611 func (r *AchievementConfigurationsService) Get(achievementId string) *AchievementConfigurationsGetCall {
612 c := &AchievementConfigurationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
613 c.achievementId = achievementId
614 return c
615 }
616
617
618
619
620 func (c *AchievementConfigurationsGetCall) Fields(s ...googleapi.Field) *AchievementConfigurationsGetCall {
621 c.urlParams_.Set("fields", googleapi.CombineFields(s))
622 return c
623 }
624
625
626
627
628 func (c *AchievementConfigurationsGetCall) IfNoneMatch(entityTag string) *AchievementConfigurationsGetCall {
629 c.ifNoneMatch_ = entityTag
630 return c
631 }
632
633
634 func (c *AchievementConfigurationsGetCall) Context(ctx context.Context) *AchievementConfigurationsGetCall {
635 c.ctx_ = ctx
636 return c
637 }
638
639
640
641 func (c *AchievementConfigurationsGetCall) Header() http.Header {
642 if c.header_ == nil {
643 c.header_ = make(http.Header)
644 }
645 return c.header_
646 }
647
648 func (c *AchievementConfigurationsGetCall) doRequest(alt string) (*http.Response, error) {
649 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
650 if c.ifNoneMatch_ != "" {
651 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
652 }
653 var body io.Reader = nil
654 c.urlParams_.Set("alt", alt)
655 c.urlParams_.Set("prettyPrint", "false")
656 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/achievements/{achievementId}")
657 urls += "?" + c.urlParams_.Encode()
658 req, err := http.NewRequest("GET", urls, body)
659 if err != nil {
660 return nil, err
661 }
662 req.Header = reqHeaders
663 googleapi.Expand(req.URL, map[string]string{
664 "achievementId": c.achievementId,
665 })
666 return gensupport.SendRequest(c.ctx_, c.s.client, req)
667 }
668
669
670
671
672
673
674
675 func (c *AchievementConfigurationsGetCall) Do(opts ...googleapi.CallOption) (*AchievementConfiguration, error) {
676 gensupport.SetOptions(c.urlParams_, opts...)
677 res, err := c.doRequest("json")
678 if res != nil && res.StatusCode == http.StatusNotModified {
679 if res.Body != nil {
680 res.Body.Close()
681 }
682 return nil, gensupport.WrapError(&googleapi.Error{
683 Code: res.StatusCode,
684 Header: res.Header,
685 })
686 }
687 if err != nil {
688 return nil, err
689 }
690 defer googleapi.CloseBody(res)
691 if err := googleapi.CheckResponse(res); err != nil {
692 return nil, gensupport.WrapError(err)
693 }
694 ret := &AchievementConfiguration{
695 ServerResponse: googleapi.ServerResponse{
696 Header: res.Header,
697 HTTPStatusCode: res.StatusCode,
698 },
699 }
700 target := &ret
701 if err := gensupport.DecodeResponse(target, res); err != nil {
702 return nil, err
703 }
704 return ret, nil
705 }
706
707 type AchievementConfigurationsInsertCall struct {
708 s *Service
709 applicationId string
710 achievementconfiguration *AchievementConfiguration
711 urlParams_ gensupport.URLParams
712 ctx_ context.Context
713 header_ http.Header
714 }
715
716
717
718
719 func (r *AchievementConfigurationsService) Insert(applicationId string, achievementconfiguration *AchievementConfiguration) *AchievementConfigurationsInsertCall {
720 c := &AchievementConfigurationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
721 c.applicationId = applicationId
722 c.achievementconfiguration = achievementconfiguration
723 return c
724 }
725
726
727
728
729 func (c *AchievementConfigurationsInsertCall) Fields(s ...googleapi.Field) *AchievementConfigurationsInsertCall {
730 c.urlParams_.Set("fields", googleapi.CombineFields(s))
731 return c
732 }
733
734
735 func (c *AchievementConfigurationsInsertCall) Context(ctx context.Context) *AchievementConfigurationsInsertCall {
736 c.ctx_ = ctx
737 return c
738 }
739
740
741
742 func (c *AchievementConfigurationsInsertCall) Header() http.Header {
743 if c.header_ == nil {
744 c.header_ = make(http.Header)
745 }
746 return c.header_
747 }
748
749 func (c *AchievementConfigurationsInsertCall) doRequest(alt string) (*http.Response, error) {
750 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
751 var body io.Reader = nil
752 body, err := googleapi.WithoutDataWrapper.JSONReader(c.achievementconfiguration)
753 if err != nil {
754 return nil, err
755 }
756 c.urlParams_.Set("alt", alt)
757 c.urlParams_.Set("prettyPrint", "false")
758 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/applications/{applicationId}/achievements")
759 urls += "?" + c.urlParams_.Encode()
760 req, err := http.NewRequest("POST", urls, body)
761 if err != nil {
762 return nil, err
763 }
764 req.Header = reqHeaders
765 googleapi.Expand(req.URL, map[string]string{
766 "applicationId": c.applicationId,
767 })
768 return gensupport.SendRequest(c.ctx_, c.s.client, req)
769 }
770
771
772
773
774
775
776
777 func (c *AchievementConfigurationsInsertCall) Do(opts ...googleapi.CallOption) (*AchievementConfiguration, error) {
778 gensupport.SetOptions(c.urlParams_, opts...)
779 res, err := c.doRequest("json")
780 if res != nil && res.StatusCode == http.StatusNotModified {
781 if res.Body != nil {
782 res.Body.Close()
783 }
784 return nil, gensupport.WrapError(&googleapi.Error{
785 Code: res.StatusCode,
786 Header: res.Header,
787 })
788 }
789 if err != nil {
790 return nil, err
791 }
792 defer googleapi.CloseBody(res)
793 if err := googleapi.CheckResponse(res); err != nil {
794 return nil, gensupport.WrapError(err)
795 }
796 ret := &AchievementConfiguration{
797 ServerResponse: googleapi.ServerResponse{
798 Header: res.Header,
799 HTTPStatusCode: res.StatusCode,
800 },
801 }
802 target := &ret
803 if err := gensupport.DecodeResponse(target, res); err != nil {
804 return nil, err
805 }
806 return ret, nil
807 }
808
809 type AchievementConfigurationsListCall struct {
810 s *Service
811 applicationId string
812 urlParams_ gensupport.URLParams
813 ifNoneMatch_ string
814 ctx_ context.Context
815 header_ http.Header
816 }
817
818
819
820
821 func (r *AchievementConfigurationsService) List(applicationId string) *AchievementConfigurationsListCall {
822 c := &AchievementConfigurationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
823 c.applicationId = applicationId
824 return c
825 }
826
827
828
829
830
831 func (c *AchievementConfigurationsListCall) MaxResults(maxResults int64) *AchievementConfigurationsListCall {
832 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
833 return c
834 }
835
836
837
838 func (c *AchievementConfigurationsListCall) PageToken(pageToken string) *AchievementConfigurationsListCall {
839 c.urlParams_.Set("pageToken", pageToken)
840 return c
841 }
842
843
844
845
846 func (c *AchievementConfigurationsListCall) Fields(s ...googleapi.Field) *AchievementConfigurationsListCall {
847 c.urlParams_.Set("fields", googleapi.CombineFields(s))
848 return c
849 }
850
851
852
853
854 func (c *AchievementConfigurationsListCall) IfNoneMatch(entityTag string) *AchievementConfigurationsListCall {
855 c.ifNoneMatch_ = entityTag
856 return c
857 }
858
859
860 func (c *AchievementConfigurationsListCall) Context(ctx context.Context) *AchievementConfigurationsListCall {
861 c.ctx_ = ctx
862 return c
863 }
864
865
866
867 func (c *AchievementConfigurationsListCall) Header() http.Header {
868 if c.header_ == nil {
869 c.header_ = make(http.Header)
870 }
871 return c.header_
872 }
873
874 func (c *AchievementConfigurationsListCall) doRequest(alt string) (*http.Response, error) {
875 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
876 if c.ifNoneMatch_ != "" {
877 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
878 }
879 var body io.Reader = nil
880 c.urlParams_.Set("alt", alt)
881 c.urlParams_.Set("prettyPrint", "false")
882 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/applications/{applicationId}/achievements")
883 urls += "?" + c.urlParams_.Encode()
884 req, err := http.NewRequest("GET", urls, body)
885 if err != nil {
886 return nil, err
887 }
888 req.Header = reqHeaders
889 googleapi.Expand(req.URL, map[string]string{
890 "applicationId": c.applicationId,
891 })
892 return gensupport.SendRequest(c.ctx_, c.s.client, req)
893 }
894
895
896
897
898
899
900
901 func (c *AchievementConfigurationsListCall) Do(opts ...googleapi.CallOption) (*AchievementConfigurationListResponse, error) {
902 gensupport.SetOptions(c.urlParams_, opts...)
903 res, err := c.doRequest("json")
904 if res != nil && res.StatusCode == http.StatusNotModified {
905 if res.Body != nil {
906 res.Body.Close()
907 }
908 return nil, gensupport.WrapError(&googleapi.Error{
909 Code: res.StatusCode,
910 Header: res.Header,
911 })
912 }
913 if err != nil {
914 return nil, err
915 }
916 defer googleapi.CloseBody(res)
917 if err := googleapi.CheckResponse(res); err != nil {
918 return nil, gensupport.WrapError(err)
919 }
920 ret := &AchievementConfigurationListResponse{
921 ServerResponse: googleapi.ServerResponse{
922 Header: res.Header,
923 HTTPStatusCode: res.StatusCode,
924 },
925 }
926 target := &ret
927 if err := gensupport.DecodeResponse(target, res); err != nil {
928 return nil, err
929 }
930 return ret, nil
931 }
932
933
934
935
936 func (c *AchievementConfigurationsListCall) Pages(ctx context.Context, f func(*AchievementConfigurationListResponse) error) error {
937 c.ctx_ = ctx
938 defer c.PageToken(c.urlParams_.Get("pageToken"))
939 for {
940 x, err := c.Do()
941 if err != nil {
942 return err
943 }
944 if err := f(x); err != nil {
945 return err
946 }
947 if x.NextPageToken == "" {
948 return nil
949 }
950 c.PageToken(x.NextPageToken)
951 }
952 }
953
954 type AchievementConfigurationsUpdateCall struct {
955 s *Service
956 achievementId string
957 achievementconfiguration *AchievementConfiguration
958 urlParams_ gensupport.URLParams
959 ctx_ context.Context
960 header_ http.Header
961 }
962
963
964
965
966
967 func (r *AchievementConfigurationsService) Update(achievementId string, achievementconfiguration *AchievementConfiguration) *AchievementConfigurationsUpdateCall {
968 c := &AchievementConfigurationsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
969 c.achievementId = achievementId
970 c.achievementconfiguration = achievementconfiguration
971 return c
972 }
973
974
975
976
977 func (c *AchievementConfigurationsUpdateCall) Fields(s ...googleapi.Field) *AchievementConfigurationsUpdateCall {
978 c.urlParams_.Set("fields", googleapi.CombineFields(s))
979 return c
980 }
981
982
983 func (c *AchievementConfigurationsUpdateCall) Context(ctx context.Context) *AchievementConfigurationsUpdateCall {
984 c.ctx_ = ctx
985 return c
986 }
987
988
989
990 func (c *AchievementConfigurationsUpdateCall) Header() http.Header {
991 if c.header_ == nil {
992 c.header_ = make(http.Header)
993 }
994 return c.header_
995 }
996
997 func (c *AchievementConfigurationsUpdateCall) doRequest(alt string) (*http.Response, error) {
998 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
999 var body io.Reader = nil
1000 body, err := googleapi.WithoutDataWrapper.JSONReader(c.achievementconfiguration)
1001 if err != nil {
1002 return nil, err
1003 }
1004 c.urlParams_.Set("alt", alt)
1005 c.urlParams_.Set("prettyPrint", "false")
1006 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/achievements/{achievementId}")
1007 urls += "?" + c.urlParams_.Encode()
1008 req, err := http.NewRequest("PUT", urls, body)
1009 if err != nil {
1010 return nil, err
1011 }
1012 req.Header = reqHeaders
1013 googleapi.Expand(req.URL, map[string]string{
1014 "achievementId": c.achievementId,
1015 })
1016 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1017 }
1018
1019
1020
1021
1022
1023
1024
1025 func (c *AchievementConfigurationsUpdateCall) Do(opts ...googleapi.CallOption) (*AchievementConfiguration, error) {
1026 gensupport.SetOptions(c.urlParams_, opts...)
1027 res, err := c.doRequest("json")
1028 if res != nil && res.StatusCode == http.StatusNotModified {
1029 if res.Body != nil {
1030 res.Body.Close()
1031 }
1032 return nil, gensupport.WrapError(&googleapi.Error{
1033 Code: res.StatusCode,
1034 Header: res.Header,
1035 })
1036 }
1037 if err != nil {
1038 return nil, err
1039 }
1040 defer googleapi.CloseBody(res)
1041 if err := googleapi.CheckResponse(res); err != nil {
1042 return nil, gensupport.WrapError(err)
1043 }
1044 ret := &AchievementConfiguration{
1045 ServerResponse: googleapi.ServerResponse{
1046 Header: res.Header,
1047 HTTPStatusCode: res.StatusCode,
1048 },
1049 }
1050 target := &ret
1051 if err := gensupport.DecodeResponse(target, res); err != nil {
1052 return nil, err
1053 }
1054 return ret, nil
1055 }
1056
1057 type LeaderboardConfigurationsDeleteCall struct {
1058 s *Service
1059 leaderboardId string
1060 urlParams_ gensupport.URLParams
1061 ctx_ context.Context
1062 header_ http.Header
1063 }
1064
1065
1066
1067
1068 func (r *LeaderboardConfigurationsService) Delete(leaderboardId string) *LeaderboardConfigurationsDeleteCall {
1069 c := &LeaderboardConfigurationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1070 c.leaderboardId = leaderboardId
1071 return c
1072 }
1073
1074
1075
1076
1077 func (c *LeaderboardConfigurationsDeleteCall) Fields(s ...googleapi.Field) *LeaderboardConfigurationsDeleteCall {
1078 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1079 return c
1080 }
1081
1082
1083 func (c *LeaderboardConfigurationsDeleteCall) Context(ctx context.Context) *LeaderboardConfigurationsDeleteCall {
1084 c.ctx_ = ctx
1085 return c
1086 }
1087
1088
1089
1090 func (c *LeaderboardConfigurationsDeleteCall) Header() http.Header {
1091 if c.header_ == nil {
1092 c.header_ = make(http.Header)
1093 }
1094 return c.header_
1095 }
1096
1097 func (c *LeaderboardConfigurationsDeleteCall) doRequest(alt string) (*http.Response, error) {
1098 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1099 var body io.Reader = nil
1100 c.urlParams_.Set("alt", alt)
1101 c.urlParams_.Set("prettyPrint", "false")
1102 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/leaderboards/{leaderboardId}")
1103 urls += "?" + c.urlParams_.Encode()
1104 req, err := http.NewRequest("DELETE", urls, body)
1105 if err != nil {
1106 return nil, err
1107 }
1108 req.Header = reqHeaders
1109 googleapi.Expand(req.URL, map[string]string{
1110 "leaderboardId": c.leaderboardId,
1111 })
1112 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1113 }
1114
1115
1116 func (c *LeaderboardConfigurationsDeleteCall) Do(opts ...googleapi.CallOption) error {
1117 gensupport.SetOptions(c.urlParams_, opts...)
1118 res, err := c.doRequest("json")
1119 if err != nil {
1120 return err
1121 }
1122 defer googleapi.CloseBody(res)
1123 if err := googleapi.CheckResponse(res); err != nil {
1124 return gensupport.WrapError(err)
1125 }
1126 return nil
1127 }
1128
1129 type LeaderboardConfigurationsGetCall struct {
1130 s *Service
1131 leaderboardId string
1132 urlParams_ gensupport.URLParams
1133 ifNoneMatch_ string
1134 ctx_ context.Context
1135 header_ http.Header
1136 }
1137
1138
1139
1140
1141
1142 func (r *LeaderboardConfigurationsService) Get(leaderboardId string) *LeaderboardConfigurationsGetCall {
1143 c := &LeaderboardConfigurationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1144 c.leaderboardId = leaderboardId
1145 return c
1146 }
1147
1148
1149
1150
1151 func (c *LeaderboardConfigurationsGetCall) Fields(s ...googleapi.Field) *LeaderboardConfigurationsGetCall {
1152 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1153 return c
1154 }
1155
1156
1157
1158
1159 func (c *LeaderboardConfigurationsGetCall) IfNoneMatch(entityTag string) *LeaderboardConfigurationsGetCall {
1160 c.ifNoneMatch_ = entityTag
1161 return c
1162 }
1163
1164
1165 func (c *LeaderboardConfigurationsGetCall) Context(ctx context.Context) *LeaderboardConfigurationsGetCall {
1166 c.ctx_ = ctx
1167 return c
1168 }
1169
1170
1171
1172 func (c *LeaderboardConfigurationsGetCall) Header() http.Header {
1173 if c.header_ == nil {
1174 c.header_ = make(http.Header)
1175 }
1176 return c.header_
1177 }
1178
1179 func (c *LeaderboardConfigurationsGetCall) doRequest(alt string) (*http.Response, error) {
1180 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1181 if c.ifNoneMatch_ != "" {
1182 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1183 }
1184 var body io.Reader = nil
1185 c.urlParams_.Set("alt", alt)
1186 c.urlParams_.Set("prettyPrint", "false")
1187 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/leaderboards/{leaderboardId}")
1188 urls += "?" + c.urlParams_.Encode()
1189 req, err := http.NewRequest("GET", urls, body)
1190 if err != nil {
1191 return nil, err
1192 }
1193 req.Header = reqHeaders
1194 googleapi.Expand(req.URL, map[string]string{
1195 "leaderboardId": c.leaderboardId,
1196 })
1197 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1198 }
1199
1200
1201
1202
1203
1204
1205
1206 func (c *LeaderboardConfigurationsGetCall) Do(opts ...googleapi.CallOption) (*LeaderboardConfiguration, error) {
1207 gensupport.SetOptions(c.urlParams_, opts...)
1208 res, err := c.doRequest("json")
1209 if res != nil && res.StatusCode == http.StatusNotModified {
1210 if res.Body != nil {
1211 res.Body.Close()
1212 }
1213 return nil, gensupport.WrapError(&googleapi.Error{
1214 Code: res.StatusCode,
1215 Header: res.Header,
1216 })
1217 }
1218 if err != nil {
1219 return nil, err
1220 }
1221 defer googleapi.CloseBody(res)
1222 if err := googleapi.CheckResponse(res); err != nil {
1223 return nil, gensupport.WrapError(err)
1224 }
1225 ret := &LeaderboardConfiguration{
1226 ServerResponse: googleapi.ServerResponse{
1227 Header: res.Header,
1228 HTTPStatusCode: res.StatusCode,
1229 },
1230 }
1231 target := &ret
1232 if err := gensupport.DecodeResponse(target, res); err != nil {
1233 return nil, err
1234 }
1235 return ret, nil
1236 }
1237
1238 type LeaderboardConfigurationsInsertCall struct {
1239 s *Service
1240 applicationId string
1241 leaderboardconfiguration *LeaderboardConfiguration
1242 urlParams_ gensupport.URLParams
1243 ctx_ context.Context
1244 header_ http.Header
1245 }
1246
1247
1248
1249
1250 func (r *LeaderboardConfigurationsService) Insert(applicationId string, leaderboardconfiguration *LeaderboardConfiguration) *LeaderboardConfigurationsInsertCall {
1251 c := &LeaderboardConfigurationsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1252 c.applicationId = applicationId
1253 c.leaderboardconfiguration = leaderboardconfiguration
1254 return c
1255 }
1256
1257
1258
1259
1260 func (c *LeaderboardConfigurationsInsertCall) Fields(s ...googleapi.Field) *LeaderboardConfigurationsInsertCall {
1261 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1262 return c
1263 }
1264
1265
1266 func (c *LeaderboardConfigurationsInsertCall) Context(ctx context.Context) *LeaderboardConfigurationsInsertCall {
1267 c.ctx_ = ctx
1268 return c
1269 }
1270
1271
1272
1273 func (c *LeaderboardConfigurationsInsertCall) Header() http.Header {
1274 if c.header_ == nil {
1275 c.header_ = make(http.Header)
1276 }
1277 return c.header_
1278 }
1279
1280 func (c *LeaderboardConfigurationsInsertCall) doRequest(alt string) (*http.Response, error) {
1281 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1282 var body io.Reader = nil
1283 body, err := googleapi.WithoutDataWrapper.JSONReader(c.leaderboardconfiguration)
1284 if err != nil {
1285 return nil, err
1286 }
1287 c.urlParams_.Set("alt", alt)
1288 c.urlParams_.Set("prettyPrint", "false")
1289 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/applications/{applicationId}/leaderboards")
1290 urls += "?" + c.urlParams_.Encode()
1291 req, err := http.NewRequest("POST", urls, body)
1292 if err != nil {
1293 return nil, err
1294 }
1295 req.Header = reqHeaders
1296 googleapi.Expand(req.URL, map[string]string{
1297 "applicationId": c.applicationId,
1298 })
1299 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1300 }
1301
1302
1303
1304
1305
1306
1307
1308 func (c *LeaderboardConfigurationsInsertCall) Do(opts ...googleapi.CallOption) (*LeaderboardConfiguration, error) {
1309 gensupport.SetOptions(c.urlParams_, opts...)
1310 res, err := c.doRequest("json")
1311 if res != nil && res.StatusCode == http.StatusNotModified {
1312 if res.Body != nil {
1313 res.Body.Close()
1314 }
1315 return nil, gensupport.WrapError(&googleapi.Error{
1316 Code: res.StatusCode,
1317 Header: res.Header,
1318 })
1319 }
1320 if err != nil {
1321 return nil, err
1322 }
1323 defer googleapi.CloseBody(res)
1324 if err := googleapi.CheckResponse(res); err != nil {
1325 return nil, gensupport.WrapError(err)
1326 }
1327 ret := &LeaderboardConfiguration{
1328 ServerResponse: googleapi.ServerResponse{
1329 Header: res.Header,
1330 HTTPStatusCode: res.StatusCode,
1331 },
1332 }
1333 target := &ret
1334 if err := gensupport.DecodeResponse(target, res); err != nil {
1335 return nil, err
1336 }
1337 return ret, nil
1338 }
1339
1340 type LeaderboardConfigurationsListCall struct {
1341 s *Service
1342 applicationId string
1343 urlParams_ gensupport.URLParams
1344 ifNoneMatch_ string
1345 ctx_ context.Context
1346 header_ http.Header
1347 }
1348
1349
1350
1351
1352 func (r *LeaderboardConfigurationsService) List(applicationId string) *LeaderboardConfigurationsListCall {
1353 c := &LeaderboardConfigurationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1354 c.applicationId = applicationId
1355 return c
1356 }
1357
1358
1359
1360
1361
1362 func (c *LeaderboardConfigurationsListCall) MaxResults(maxResults int64) *LeaderboardConfigurationsListCall {
1363 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1364 return c
1365 }
1366
1367
1368
1369 func (c *LeaderboardConfigurationsListCall) PageToken(pageToken string) *LeaderboardConfigurationsListCall {
1370 c.urlParams_.Set("pageToken", pageToken)
1371 return c
1372 }
1373
1374
1375
1376
1377 func (c *LeaderboardConfigurationsListCall) Fields(s ...googleapi.Field) *LeaderboardConfigurationsListCall {
1378 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1379 return c
1380 }
1381
1382
1383
1384
1385 func (c *LeaderboardConfigurationsListCall) IfNoneMatch(entityTag string) *LeaderboardConfigurationsListCall {
1386 c.ifNoneMatch_ = entityTag
1387 return c
1388 }
1389
1390
1391 func (c *LeaderboardConfigurationsListCall) Context(ctx context.Context) *LeaderboardConfigurationsListCall {
1392 c.ctx_ = ctx
1393 return c
1394 }
1395
1396
1397
1398 func (c *LeaderboardConfigurationsListCall) Header() http.Header {
1399 if c.header_ == nil {
1400 c.header_ = make(http.Header)
1401 }
1402 return c.header_
1403 }
1404
1405 func (c *LeaderboardConfigurationsListCall) doRequest(alt string) (*http.Response, error) {
1406 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1407 if c.ifNoneMatch_ != "" {
1408 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1409 }
1410 var body io.Reader = nil
1411 c.urlParams_.Set("alt", alt)
1412 c.urlParams_.Set("prettyPrint", "false")
1413 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/applications/{applicationId}/leaderboards")
1414 urls += "?" + c.urlParams_.Encode()
1415 req, err := http.NewRequest("GET", urls, body)
1416 if err != nil {
1417 return nil, err
1418 }
1419 req.Header = reqHeaders
1420 googleapi.Expand(req.URL, map[string]string{
1421 "applicationId": c.applicationId,
1422 })
1423 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1424 }
1425
1426
1427
1428
1429
1430
1431
1432 func (c *LeaderboardConfigurationsListCall) Do(opts ...googleapi.CallOption) (*LeaderboardConfigurationListResponse, error) {
1433 gensupport.SetOptions(c.urlParams_, opts...)
1434 res, err := c.doRequest("json")
1435 if res != nil && res.StatusCode == http.StatusNotModified {
1436 if res.Body != nil {
1437 res.Body.Close()
1438 }
1439 return nil, gensupport.WrapError(&googleapi.Error{
1440 Code: res.StatusCode,
1441 Header: res.Header,
1442 })
1443 }
1444 if err != nil {
1445 return nil, err
1446 }
1447 defer googleapi.CloseBody(res)
1448 if err := googleapi.CheckResponse(res); err != nil {
1449 return nil, gensupport.WrapError(err)
1450 }
1451 ret := &LeaderboardConfigurationListResponse{
1452 ServerResponse: googleapi.ServerResponse{
1453 Header: res.Header,
1454 HTTPStatusCode: res.StatusCode,
1455 },
1456 }
1457 target := &ret
1458 if err := gensupport.DecodeResponse(target, res); err != nil {
1459 return nil, err
1460 }
1461 return ret, nil
1462 }
1463
1464
1465
1466
1467 func (c *LeaderboardConfigurationsListCall) Pages(ctx context.Context, f func(*LeaderboardConfigurationListResponse) error) error {
1468 c.ctx_ = ctx
1469 defer c.PageToken(c.urlParams_.Get("pageToken"))
1470 for {
1471 x, err := c.Do()
1472 if err != nil {
1473 return err
1474 }
1475 if err := f(x); err != nil {
1476 return err
1477 }
1478 if x.NextPageToken == "" {
1479 return nil
1480 }
1481 c.PageToken(x.NextPageToken)
1482 }
1483 }
1484
1485 type LeaderboardConfigurationsUpdateCall struct {
1486 s *Service
1487 leaderboardId string
1488 leaderboardconfiguration *LeaderboardConfiguration
1489 urlParams_ gensupport.URLParams
1490 ctx_ context.Context
1491 header_ http.Header
1492 }
1493
1494
1495
1496
1497
1498 func (r *LeaderboardConfigurationsService) Update(leaderboardId string, leaderboardconfiguration *LeaderboardConfiguration) *LeaderboardConfigurationsUpdateCall {
1499 c := &LeaderboardConfigurationsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1500 c.leaderboardId = leaderboardId
1501 c.leaderboardconfiguration = leaderboardconfiguration
1502 return c
1503 }
1504
1505
1506
1507
1508 func (c *LeaderboardConfigurationsUpdateCall) Fields(s ...googleapi.Field) *LeaderboardConfigurationsUpdateCall {
1509 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1510 return c
1511 }
1512
1513
1514 func (c *LeaderboardConfigurationsUpdateCall) Context(ctx context.Context) *LeaderboardConfigurationsUpdateCall {
1515 c.ctx_ = ctx
1516 return c
1517 }
1518
1519
1520
1521 func (c *LeaderboardConfigurationsUpdateCall) Header() http.Header {
1522 if c.header_ == nil {
1523 c.header_ = make(http.Header)
1524 }
1525 return c.header_
1526 }
1527
1528 func (c *LeaderboardConfigurationsUpdateCall) doRequest(alt string) (*http.Response, error) {
1529 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1530 var body io.Reader = nil
1531 body, err := googleapi.WithoutDataWrapper.JSONReader(c.leaderboardconfiguration)
1532 if err != nil {
1533 return nil, err
1534 }
1535 c.urlParams_.Set("alt", alt)
1536 c.urlParams_.Set("prettyPrint", "false")
1537 urls := googleapi.ResolveRelative(c.s.BasePath, "games/v1configuration/leaderboards/{leaderboardId}")
1538 urls += "?" + c.urlParams_.Encode()
1539 req, err := http.NewRequest("PUT", urls, body)
1540 if err != nil {
1541 return nil, err
1542 }
1543 req.Header = reqHeaders
1544 googleapi.Expand(req.URL, map[string]string{
1545 "leaderboardId": c.leaderboardId,
1546 })
1547 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1548 }
1549
1550
1551
1552
1553
1554
1555
1556 func (c *LeaderboardConfigurationsUpdateCall) Do(opts ...googleapi.CallOption) (*LeaderboardConfiguration, error) {
1557 gensupport.SetOptions(c.urlParams_, opts...)
1558 res, err := c.doRequest("json")
1559 if res != nil && res.StatusCode == http.StatusNotModified {
1560 if res.Body != nil {
1561 res.Body.Close()
1562 }
1563 return nil, gensupport.WrapError(&googleapi.Error{
1564 Code: res.StatusCode,
1565 Header: res.Header,
1566 })
1567 }
1568 if err != nil {
1569 return nil, err
1570 }
1571 defer googleapi.CloseBody(res)
1572 if err := googleapi.CheckResponse(res); err != nil {
1573 return nil, gensupport.WrapError(err)
1574 }
1575 ret := &LeaderboardConfiguration{
1576 ServerResponse: googleapi.ServerResponse{
1577 Header: res.Header,
1578 HTTPStatusCode: res.StatusCode,
1579 },
1580 }
1581 target := &ret
1582 if err := gensupport.DecodeResponse(target, res); err != nil {
1583 return nil, err
1584 }
1585 return ret, nil
1586 }
1587
View as plain text