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 package webmasters
43
44 import (
45 "bytes"
46 "context"
47 "encoding/json"
48 "errors"
49 "fmt"
50 "io"
51 "net/http"
52 "net/url"
53 "strconv"
54 "strings"
55
56 googleapi "google.golang.org/api/googleapi"
57 gensupport "google.golang.org/api/internal/gensupport"
58 option "google.golang.org/api/option"
59 internaloption "google.golang.org/api/option/internaloption"
60 htransport "google.golang.org/api/transport/http"
61 )
62
63
64
65 var _ = bytes.NewBuffer
66 var _ = strconv.Itoa
67 var _ = fmt.Sprintf
68 var _ = json.NewDecoder
69 var _ = io.Copy
70 var _ = url.Parse
71 var _ = gensupport.MarshalJSON
72 var _ = googleapi.Version
73 var _ = errors.New
74 var _ = strings.Replace
75 var _ = context.Canceled
76 var _ = internaloption.WithDefaultEndpoint
77
78 const apiId = "webmasters:v3"
79 const apiName = "webmasters"
80 const apiVersion = "v3"
81 const basePath = "https://www.googleapis.com/webmasters/v3/"
82
83
84 const (
85
86 WebmastersScope = "https://www.googleapis.com/auth/webmasters"
87
88
89 WebmastersReadonlyScope = "https://www.googleapis.com/auth/webmasters.readonly"
90 )
91
92
93 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
94 scopesOption := option.WithScopes(
95 "https://www.googleapis.com/auth/webmasters",
96 "https://www.googleapis.com/auth/webmasters.readonly",
97 )
98
99 opts = append([]option.ClientOption{scopesOption}, opts...)
100 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
101 client, endpoint, err := htransport.NewClient(ctx, opts...)
102 if err != nil {
103 return nil, err
104 }
105 s, err := New(client)
106 if err != nil {
107 return nil, err
108 }
109 if endpoint != "" {
110 s.BasePath = endpoint
111 }
112 return s, nil
113 }
114
115
116
117
118
119
120 func New(client *http.Client) (*Service, error) {
121 if client == nil {
122 return nil, errors.New("client is nil")
123 }
124 s := &Service{client: client, BasePath: basePath}
125 s.Searchanalytics = NewSearchanalyticsService(s)
126 s.Sitemaps = NewSitemapsService(s)
127 s.Sites = NewSitesService(s)
128 return s, nil
129 }
130
131 type Service struct {
132 client *http.Client
133 BasePath string
134 UserAgent string
135
136 Searchanalytics *SearchanalyticsService
137
138 Sitemaps *SitemapsService
139
140 Sites *SitesService
141 }
142
143 func (s *Service) userAgent() string {
144 if s.UserAgent == "" {
145 return googleapi.UserAgent
146 }
147 return googleapi.UserAgent + " " + s.UserAgent
148 }
149
150 func NewSearchanalyticsService(s *Service) *SearchanalyticsService {
151 rs := &SearchanalyticsService{s: s}
152 return rs
153 }
154
155 type SearchanalyticsService struct {
156 s *Service
157 }
158
159 func NewSitemapsService(s *Service) *SitemapsService {
160 rs := &SitemapsService{s: s}
161 return rs
162 }
163
164 type SitemapsService struct {
165 s *Service
166 }
167
168 func NewSitesService(s *Service) *SitesService {
169 rs := &SitesService{s: s}
170 return rs
171 }
172
173 type SitesService struct {
174 s *Service
175 }
176
177 type ApiDataRow struct {
178 Clicks float64 `json:"clicks,omitempty"`
179
180 Ctr float64 `json:"ctr,omitempty"`
181
182 Impressions float64 `json:"impressions,omitempty"`
183
184 Keys []string `json:"keys,omitempty"`
185
186 Position float64 `json:"position,omitempty"`
187
188
189
190
191
192
193
194 ForceSendFields []string `json:"-"`
195
196
197
198
199
200
201
202 NullFields []string `json:"-"`
203 }
204
205 func (s *ApiDataRow) MarshalJSON() ([]byte, error) {
206 type NoMethod ApiDataRow
207 raw := NoMethod(*s)
208 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
209 }
210
211 func (s *ApiDataRow) UnmarshalJSON(data []byte) error {
212 type NoMethod ApiDataRow
213 var s1 struct {
214 Clicks gensupport.JSONFloat64 `json:"clicks"`
215 Ctr gensupport.JSONFloat64 `json:"ctr"`
216 Impressions gensupport.JSONFloat64 `json:"impressions"`
217 Position gensupport.JSONFloat64 `json:"position"`
218 *NoMethod
219 }
220 s1.NoMethod = (*NoMethod)(s)
221 if err := json.Unmarshal(data, &s1); err != nil {
222 return err
223 }
224 s.Clicks = float64(s1.Clicks)
225 s.Ctr = float64(s1.Ctr)
226 s.Impressions = float64(s1.Impressions)
227 s.Position = float64(s1.Position)
228 return nil
229 }
230
231 type ApiDimensionFilter struct {
232 Dimension string `json:"dimension,omitempty"`
233
234 Expression string `json:"expression,omitempty"`
235
236 Operator string `json:"operator,omitempty"`
237
238
239
240
241
242
243
244 ForceSendFields []string `json:"-"`
245
246
247
248
249
250
251
252 NullFields []string `json:"-"`
253 }
254
255 func (s *ApiDimensionFilter) MarshalJSON() ([]byte, error) {
256 type NoMethod ApiDimensionFilter
257 raw := NoMethod(*s)
258 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
259 }
260
261 type ApiDimensionFilterGroup struct {
262 Filters []*ApiDimensionFilter `json:"filters,omitempty"`
263
264 GroupType string `json:"groupType,omitempty"`
265
266
267
268
269
270
271
272 ForceSendFields []string `json:"-"`
273
274
275
276
277
278
279
280 NullFields []string `json:"-"`
281 }
282
283 func (s *ApiDimensionFilterGroup) MarshalJSON() ([]byte, error) {
284 type NoMethod ApiDimensionFilterGroup
285 raw := NoMethod(*s)
286 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
287 }
288
289 type SearchAnalyticsQueryRequest struct {
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305 AggregationType string `json:"aggregationType,omitempty"`
306
307
308
309
310 DataState string `json:"dataState,omitempty"`
311
312
313
314
315
316
317 DimensionFilterGroups []*ApiDimensionFilterGroup `json:"dimensionFilterGroups,omitempty"`
318
319
320
321
322
323 Dimensions []string `json:"dimensions,omitempty"`
324
325
326
327
328 EndDate string `json:"endDate,omitempty"`
329
330
331
332 RowLimit int64 `json:"rowLimit,omitempty"`
333
334
335
336 SearchType string `json:"searchType,omitempty"`
337
338
339
340
341 StartDate string `json:"startDate,omitempty"`
342
343
344
345 StartRow int64 `json:"startRow,omitempty"`
346
347
348
349
350
351
352
353 ForceSendFields []string `json:"-"`
354
355
356
357
358
359
360
361
362 NullFields []string `json:"-"`
363 }
364
365 func (s *SearchAnalyticsQueryRequest) MarshalJSON() ([]byte, error) {
366 type NoMethod SearchAnalyticsQueryRequest
367 raw := NoMethod(*s)
368 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
369 }
370
371
372
373
374
375 type SearchAnalyticsQueryResponse struct {
376
377 ResponseAggregationType string `json:"responseAggregationType,omitempty"`
378
379
380
381 Rows []*ApiDataRow `json:"rows,omitempty"`
382
383
384
385 googleapi.ServerResponse `json:"-"`
386
387
388
389
390
391
392
393
394 ForceSendFields []string `json:"-"`
395
396
397
398
399
400
401
402
403 NullFields []string `json:"-"`
404 }
405
406 func (s *SearchAnalyticsQueryResponse) MarshalJSON() ([]byte, error) {
407 type NoMethod SearchAnalyticsQueryResponse
408 raw := NoMethod(*s)
409 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
410 }
411
412
413 type SitemapsListResponse struct {
414
415
416 Sitemap []*WmxSitemap `json:"sitemap,omitempty"`
417
418
419
420 googleapi.ServerResponse `json:"-"`
421
422
423
424
425
426
427
428 ForceSendFields []string `json:"-"`
429
430
431
432
433
434
435
436 NullFields []string `json:"-"`
437 }
438
439 func (s *SitemapsListResponse) MarshalJSON() ([]byte, error) {
440 type NoMethod SitemapsListResponse
441 raw := NoMethod(*s)
442 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
443 }
444
445
446 type SitesListResponse struct {
447
448
449
450 SiteEntry []*WmxSite `json:"siteEntry,omitempty"`
451
452
453
454 googleapi.ServerResponse `json:"-"`
455
456
457
458
459
460
461
462 ForceSendFields []string `json:"-"`
463
464
465
466
467
468
469
470 NullFields []string `json:"-"`
471 }
472
473 func (s *SitesListResponse) MarshalJSON() ([]byte, error) {
474 type NoMethod SitesListResponse
475 raw := NoMethod(*s)
476 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
477 }
478
479
480
481 type WmxSite struct {
482
483 PermissionLevel string `json:"permissionLevel,omitempty"`
484
485
486 SiteUrl string `json:"siteUrl,omitempty"`
487
488
489
490 googleapi.ServerResponse `json:"-"`
491
492
493
494
495
496
497
498 ForceSendFields []string `json:"-"`
499
500
501
502
503
504
505
506
507 NullFields []string `json:"-"`
508 }
509
510 func (s *WmxSite) MarshalJSON() ([]byte, error) {
511 type NoMethod WmxSite
512 raw := NoMethod(*s)
513 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
514 }
515
516
517
518 type WmxSitemap struct {
519
520 Contents []*WmxSitemapContent `json:"contents,omitempty"`
521
522
523
524
525 Errors int64 `json:"errors,omitempty,string"`
526
527
528 IsPending bool `json:"isPending,omitempty"`
529
530
531 IsSitemapsIndex bool `json:"isSitemapsIndex,omitempty"`
532
533
534
535 LastDownloaded string `json:"lastDownloaded,omitempty"`
536
537
538
539 LastSubmitted string `json:"lastSubmitted,omitempty"`
540
541
542 Path string `json:"path,omitempty"`
543
544
545 Type string `json:"type,omitempty"`
546
547
548
549 Warnings int64 `json:"warnings,omitempty,string"`
550
551
552
553 googleapi.ServerResponse `json:"-"`
554
555
556
557
558
559
560
561 ForceSendFields []string `json:"-"`
562
563
564
565
566
567
568
569 NullFields []string `json:"-"`
570 }
571
572 func (s *WmxSitemap) MarshalJSON() ([]byte, error) {
573 type NoMethod WmxSitemap
574 raw := NoMethod(*s)
575 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
576 }
577
578
579
580 type WmxSitemapContent struct {
581
582
583 Indexed int64 `json:"indexed,omitempty,string"`
584
585
586 Submitted int64 `json:"submitted,omitempty,string"`
587
588
589 Type string `json:"type,omitempty"`
590
591
592
593
594
595
596
597 ForceSendFields []string `json:"-"`
598
599
600
601
602
603
604
605 NullFields []string `json:"-"`
606 }
607
608 func (s *WmxSitemapContent) MarshalJSON() ([]byte, error) {
609 type NoMethod WmxSitemapContent
610 raw := NoMethod(*s)
611 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
612 }
613
614
615
616 type SearchanalyticsQueryCall struct {
617 s *Service
618 siteUrl string
619 searchanalyticsqueryrequest *SearchAnalyticsQueryRequest
620 urlParams_ gensupport.URLParams
621 ctx_ context.Context
622 header_ http.Header
623 }
624
625
626
627
628
629
630
631
632
633
634
635
636 func (r *SearchanalyticsService) Query(siteUrl string, searchanalyticsqueryrequest *SearchAnalyticsQueryRequest) *SearchanalyticsQueryCall {
637 c := &SearchanalyticsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
638 c.siteUrl = siteUrl
639 c.searchanalyticsqueryrequest = searchanalyticsqueryrequest
640 return c
641 }
642
643
644
645
646 func (c *SearchanalyticsQueryCall) Fields(s ...googleapi.Field) *SearchanalyticsQueryCall {
647 c.urlParams_.Set("fields", googleapi.CombineFields(s))
648 return c
649 }
650
651
652
653
654 func (c *SearchanalyticsQueryCall) Context(ctx context.Context) *SearchanalyticsQueryCall {
655 c.ctx_ = ctx
656 return c
657 }
658
659
660
661 func (c *SearchanalyticsQueryCall) Header() http.Header {
662 if c.header_ == nil {
663 c.header_ = make(http.Header)
664 }
665 return c.header_
666 }
667
668 func (c *SearchanalyticsQueryCall) doRequest(alt string) (*http.Response, error) {
669 reqHeaders := make(http.Header)
670 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
671 for k, v := range c.header_ {
672 reqHeaders[k] = v
673 }
674 reqHeaders.Set("User-Agent", c.s.userAgent())
675 var body io.Reader = nil
676 body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchanalyticsqueryrequest)
677 if err != nil {
678 return nil, err
679 }
680 reqHeaders.Set("Content-Type", "application/json")
681 c.urlParams_.Set("alt", alt)
682 c.urlParams_.Set("prettyPrint", "false")
683 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/searchAnalytics/query")
684 urls += "?" + c.urlParams_.Encode()
685 req, err := http.NewRequest("POST", urls, body)
686 if err != nil {
687 return nil, err
688 }
689 req.Header = reqHeaders
690 googleapi.Expand(req.URL, map[string]string{
691 "siteUrl": c.siteUrl,
692 })
693 return gensupport.SendRequest(c.ctx_, c.s.client, req)
694 }
695
696
697
698
699
700
701
702
703 func (c *SearchanalyticsQueryCall) Do(opts ...googleapi.CallOption) (*SearchAnalyticsQueryResponse, error) {
704 gensupport.SetOptions(c.urlParams_, opts...)
705 res, err := c.doRequest("json")
706 if res != nil && res.StatusCode == http.StatusNotModified {
707 if res.Body != nil {
708 res.Body.Close()
709 }
710 return nil, &googleapi.Error{
711 Code: res.StatusCode,
712 Header: res.Header,
713 }
714 }
715 if err != nil {
716 return nil, err
717 }
718 defer googleapi.CloseBody(res)
719 if err := googleapi.CheckResponse(res); err != nil {
720 return nil, err
721 }
722 ret := &SearchAnalyticsQueryResponse{
723 ServerResponse: googleapi.ServerResponse{
724 Header: res.Header,
725 HTTPStatusCode: res.StatusCode,
726 },
727 }
728 target := &ret
729 if err := gensupport.DecodeResponse(target, res); err != nil {
730 return nil, err
731 }
732 return ret, nil
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761 }
762
763
764
765 type SitemapsDeleteCall struct {
766 s *Service
767 siteUrl string
768 feedpath string
769 urlParams_ gensupport.URLParams
770 ctx_ context.Context
771 header_ http.Header
772 }
773
774
775
776
777
778
779
780 func (r *SitemapsService) Delete(siteUrl string, feedpath string) *SitemapsDeleteCall {
781 c := &SitemapsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
782 c.siteUrl = siteUrl
783 c.feedpath = feedpath
784 return c
785 }
786
787
788
789
790 func (c *SitemapsDeleteCall) Fields(s ...googleapi.Field) *SitemapsDeleteCall {
791 c.urlParams_.Set("fields", googleapi.CombineFields(s))
792 return c
793 }
794
795
796
797
798 func (c *SitemapsDeleteCall) Context(ctx context.Context) *SitemapsDeleteCall {
799 c.ctx_ = ctx
800 return c
801 }
802
803
804
805 func (c *SitemapsDeleteCall) Header() http.Header {
806 if c.header_ == nil {
807 c.header_ = make(http.Header)
808 }
809 return c.header_
810 }
811
812 func (c *SitemapsDeleteCall) doRequest(alt string) (*http.Response, error) {
813 reqHeaders := make(http.Header)
814 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
815 for k, v := range c.header_ {
816 reqHeaders[k] = v
817 }
818 reqHeaders.Set("User-Agent", c.s.userAgent())
819 var body io.Reader = nil
820 c.urlParams_.Set("alt", alt)
821 c.urlParams_.Set("prettyPrint", "false")
822 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}")
823 urls += "?" + c.urlParams_.Encode()
824 req, err := http.NewRequest("DELETE", urls, body)
825 if err != nil {
826 return nil, err
827 }
828 req.Header = reqHeaders
829 googleapi.Expand(req.URL, map[string]string{
830 "siteUrl": c.siteUrl,
831 "feedpath": c.feedpath,
832 })
833 return gensupport.SendRequest(c.ctx_, c.s.client, req)
834 }
835
836
837 func (c *SitemapsDeleteCall) Do(opts ...googleapi.CallOption) error {
838 gensupport.SetOptions(c.urlParams_, opts...)
839 res, err := c.doRequest("json")
840 if err != nil {
841 return err
842 }
843 defer googleapi.CloseBody(res)
844 if err := googleapi.CheckResponse(res); err != nil {
845 return err
846 }
847 return nil
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876 }
877
878
879
880 type SitemapsGetCall struct {
881 s *Service
882 siteUrl string
883 feedpath string
884 urlParams_ gensupport.URLParams
885 ifNoneMatch_ string
886 ctx_ context.Context
887 header_ http.Header
888 }
889
890
891
892
893
894
895
896 func (r *SitemapsService) Get(siteUrl string, feedpath string) *SitemapsGetCall {
897 c := &SitemapsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
898 c.siteUrl = siteUrl
899 c.feedpath = feedpath
900 return c
901 }
902
903
904
905
906 func (c *SitemapsGetCall) Fields(s ...googleapi.Field) *SitemapsGetCall {
907 c.urlParams_.Set("fields", googleapi.CombineFields(s))
908 return c
909 }
910
911
912
913
914
915
916 func (c *SitemapsGetCall) IfNoneMatch(entityTag string) *SitemapsGetCall {
917 c.ifNoneMatch_ = entityTag
918 return c
919 }
920
921
922
923
924 func (c *SitemapsGetCall) Context(ctx context.Context) *SitemapsGetCall {
925 c.ctx_ = ctx
926 return c
927 }
928
929
930
931 func (c *SitemapsGetCall) Header() http.Header {
932 if c.header_ == nil {
933 c.header_ = make(http.Header)
934 }
935 return c.header_
936 }
937
938 func (c *SitemapsGetCall) doRequest(alt string) (*http.Response, error) {
939 reqHeaders := make(http.Header)
940 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
941 for k, v := range c.header_ {
942 reqHeaders[k] = v
943 }
944 reqHeaders.Set("User-Agent", c.s.userAgent())
945 if c.ifNoneMatch_ != "" {
946 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
947 }
948 var body io.Reader = nil
949 c.urlParams_.Set("alt", alt)
950 c.urlParams_.Set("prettyPrint", "false")
951 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}")
952 urls += "?" + c.urlParams_.Encode()
953 req, err := http.NewRequest("GET", urls, body)
954 if err != nil {
955 return nil, err
956 }
957 req.Header = reqHeaders
958 googleapi.Expand(req.URL, map[string]string{
959 "siteUrl": c.siteUrl,
960 "feedpath": c.feedpath,
961 })
962 return gensupport.SendRequest(c.ctx_, c.s.client, req)
963 }
964
965
966
967
968
969
970
971
972 func (c *SitemapsGetCall) Do(opts ...googleapi.CallOption) (*WmxSitemap, error) {
973 gensupport.SetOptions(c.urlParams_, opts...)
974 res, err := c.doRequest("json")
975 if res != nil && res.StatusCode == http.StatusNotModified {
976 if res.Body != nil {
977 res.Body.Close()
978 }
979 return nil, &googleapi.Error{
980 Code: res.StatusCode,
981 Header: res.Header,
982 }
983 }
984 if err != nil {
985 return nil, err
986 }
987 defer googleapi.CloseBody(res)
988 if err := googleapi.CheckResponse(res); err != nil {
989 return nil, err
990 }
991 ret := &WmxSitemap{
992 ServerResponse: googleapi.ServerResponse{
993 Header: res.Header,
994 HTTPStatusCode: res.StatusCode,
995 },
996 }
997 target := &ret
998 if err := gensupport.DecodeResponse(target, res); err != nil {
999 return nil, err
1000 }
1001 return ret, nil
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034 }
1035
1036
1037
1038 type SitemapsListCall struct {
1039 s *Service
1040 siteUrl string
1041 urlParams_ gensupport.URLParams
1042 ifNoneMatch_ string
1043 ctx_ context.Context
1044 header_ http.Header
1045 }
1046
1047
1048
1049
1050
1051
1052
1053 func (r *SitemapsService) List(siteUrl string) *SitemapsListCall {
1054 c := &SitemapsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1055 c.siteUrl = siteUrl
1056 return c
1057 }
1058
1059
1060
1061
1062 func (c *SitemapsListCall) SitemapIndex(sitemapIndex string) *SitemapsListCall {
1063 c.urlParams_.Set("sitemapIndex", sitemapIndex)
1064 return c
1065 }
1066
1067
1068
1069
1070 func (c *SitemapsListCall) Fields(s ...googleapi.Field) *SitemapsListCall {
1071 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1072 return c
1073 }
1074
1075
1076
1077
1078
1079
1080 func (c *SitemapsListCall) IfNoneMatch(entityTag string) *SitemapsListCall {
1081 c.ifNoneMatch_ = entityTag
1082 return c
1083 }
1084
1085
1086
1087
1088 func (c *SitemapsListCall) Context(ctx context.Context) *SitemapsListCall {
1089 c.ctx_ = ctx
1090 return c
1091 }
1092
1093
1094
1095 func (c *SitemapsListCall) Header() http.Header {
1096 if c.header_ == nil {
1097 c.header_ = make(http.Header)
1098 }
1099 return c.header_
1100 }
1101
1102 func (c *SitemapsListCall) doRequest(alt string) (*http.Response, error) {
1103 reqHeaders := make(http.Header)
1104 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
1105 for k, v := range c.header_ {
1106 reqHeaders[k] = v
1107 }
1108 reqHeaders.Set("User-Agent", c.s.userAgent())
1109 if c.ifNoneMatch_ != "" {
1110 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1111 }
1112 var body io.Reader = nil
1113 c.urlParams_.Set("alt", alt)
1114 c.urlParams_.Set("prettyPrint", "false")
1115 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps")
1116 urls += "?" + c.urlParams_.Encode()
1117 req, err := http.NewRequest("GET", urls, body)
1118 if err != nil {
1119 return nil, err
1120 }
1121 req.Header = reqHeaders
1122 googleapi.Expand(req.URL, map[string]string{
1123 "siteUrl": c.siteUrl,
1124 })
1125 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1126 }
1127
1128
1129
1130
1131
1132
1133
1134
1135 func (c *SitemapsListCall) Do(opts ...googleapi.CallOption) (*SitemapsListResponse, error) {
1136 gensupport.SetOptions(c.urlParams_, opts...)
1137 res, err := c.doRequest("json")
1138 if res != nil && res.StatusCode == http.StatusNotModified {
1139 if res.Body != nil {
1140 res.Body.Close()
1141 }
1142 return nil, &googleapi.Error{
1143 Code: res.StatusCode,
1144 Header: res.Header,
1145 }
1146 }
1147 if err != nil {
1148 return nil, err
1149 }
1150 defer googleapi.CloseBody(res)
1151 if err := googleapi.CheckResponse(res); err != nil {
1152 return nil, err
1153 }
1154 ret := &SitemapsListResponse{
1155 ServerResponse: googleapi.ServerResponse{
1156 Header: res.Header,
1157 HTTPStatusCode: res.StatusCode,
1158 },
1159 }
1160 target := &ret
1161 if err := gensupport.DecodeResponse(target, res); err != nil {
1162 return nil, err
1163 }
1164 return ret, nil
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195 }
1196
1197
1198
1199 type SitemapsSubmitCall struct {
1200 s *Service
1201 siteUrl string
1202 feedpath string
1203 urlParams_ gensupport.URLParams
1204 ctx_ context.Context
1205 header_ http.Header
1206 }
1207
1208
1209
1210
1211
1212
1213
1214 func (r *SitemapsService) Submit(siteUrl string, feedpath string) *SitemapsSubmitCall {
1215 c := &SitemapsSubmitCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1216 c.siteUrl = siteUrl
1217 c.feedpath = feedpath
1218 return c
1219 }
1220
1221
1222
1223
1224 func (c *SitemapsSubmitCall) Fields(s ...googleapi.Field) *SitemapsSubmitCall {
1225 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1226 return c
1227 }
1228
1229
1230
1231
1232 func (c *SitemapsSubmitCall) Context(ctx context.Context) *SitemapsSubmitCall {
1233 c.ctx_ = ctx
1234 return c
1235 }
1236
1237
1238
1239 func (c *SitemapsSubmitCall) Header() http.Header {
1240 if c.header_ == nil {
1241 c.header_ = make(http.Header)
1242 }
1243 return c.header_
1244 }
1245
1246 func (c *SitemapsSubmitCall) doRequest(alt string) (*http.Response, error) {
1247 reqHeaders := make(http.Header)
1248 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
1249 for k, v := range c.header_ {
1250 reqHeaders[k] = v
1251 }
1252 reqHeaders.Set("User-Agent", c.s.userAgent())
1253 var body io.Reader = nil
1254 c.urlParams_.Set("alt", alt)
1255 c.urlParams_.Set("prettyPrint", "false")
1256 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}")
1257 urls += "?" + c.urlParams_.Encode()
1258 req, err := http.NewRequest("PUT", urls, body)
1259 if err != nil {
1260 return nil, err
1261 }
1262 req.Header = reqHeaders
1263 googleapi.Expand(req.URL, map[string]string{
1264 "siteUrl": c.siteUrl,
1265 "feedpath": c.feedpath,
1266 })
1267 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1268 }
1269
1270
1271 func (c *SitemapsSubmitCall) Do(opts ...googleapi.CallOption) error {
1272 gensupport.SetOptions(c.urlParams_, opts...)
1273 res, err := c.doRequest("json")
1274 if err != nil {
1275 return err
1276 }
1277 defer googleapi.CloseBody(res)
1278 if err := googleapi.CheckResponse(res); err != nil {
1279 return err
1280 }
1281 return nil
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310 }
1311
1312
1313
1314 type SitesAddCall struct {
1315 s *Service
1316 siteUrl string
1317 urlParams_ gensupport.URLParams
1318 ctx_ context.Context
1319 header_ http.Header
1320 }
1321
1322
1323
1324
1325 func (r *SitesService) Add(siteUrl string) *SitesAddCall {
1326 c := &SitesAddCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1327 c.siteUrl = siteUrl
1328 return c
1329 }
1330
1331
1332
1333
1334 func (c *SitesAddCall) Fields(s ...googleapi.Field) *SitesAddCall {
1335 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1336 return c
1337 }
1338
1339
1340
1341
1342 func (c *SitesAddCall) Context(ctx context.Context) *SitesAddCall {
1343 c.ctx_ = ctx
1344 return c
1345 }
1346
1347
1348
1349 func (c *SitesAddCall) Header() http.Header {
1350 if c.header_ == nil {
1351 c.header_ = make(http.Header)
1352 }
1353 return c.header_
1354 }
1355
1356 func (c *SitesAddCall) doRequest(alt string) (*http.Response, error) {
1357 reqHeaders := make(http.Header)
1358 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
1359 for k, v := range c.header_ {
1360 reqHeaders[k] = v
1361 }
1362 reqHeaders.Set("User-Agent", c.s.userAgent())
1363 var body io.Reader = nil
1364 c.urlParams_.Set("alt", alt)
1365 c.urlParams_.Set("prettyPrint", "false")
1366 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}")
1367 urls += "?" + c.urlParams_.Encode()
1368 req, err := http.NewRequest("PUT", urls, body)
1369 if err != nil {
1370 return nil, err
1371 }
1372 req.Header = reqHeaders
1373 googleapi.Expand(req.URL, map[string]string{
1374 "siteUrl": c.siteUrl,
1375 })
1376 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1377 }
1378
1379
1380 func (c *SitesAddCall) Do(opts ...googleapi.CallOption) error {
1381 gensupport.SetOptions(c.urlParams_, opts...)
1382 res, err := c.doRequest("json")
1383 if err != nil {
1384 return err
1385 }
1386 defer googleapi.CloseBody(res)
1387 if err := googleapi.CheckResponse(res); err != nil {
1388 return err
1389 }
1390 return nil
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412 }
1413
1414
1415
1416 type SitesDeleteCall struct {
1417 s *Service
1418 siteUrl string
1419 urlParams_ gensupport.URLParams
1420 ctx_ context.Context
1421 header_ http.Header
1422 }
1423
1424
1425
1426
1427
1428
1429
1430
1431 func (r *SitesService) Delete(siteUrl string) *SitesDeleteCall {
1432 c := &SitesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1433 c.siteUrl = siteUrl
1434 return c
1435 }
1436
1437
1438
1439
1440 func (c *SitesDeleteCall) Fields(s ...googleapi.Field) *SitesDeleteCall {
1441 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1442 return c
1443 }
1444
1445
1446
1447
1448 func (c *SitesDeleteCall) Context(ctx context.Context) *SitesDeleteCall {
1449 c.ctx_ = ctx
1450 return c
1451 }
1452
1453
1454
1455 func (c *SitesDeleteCall) Header() http.Header {
1456 if c.header_ == nil {
1457 c.header_ = make(http.Header)
1458 }
1459 return c.header_
1460 }
1461
1462 func (c *SitesDeleteCall) doRequest(alt string) (*http.Response, error) {
1463 reqHeaders := make(http.Header)
1464 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
1465 for k, v := range c.header_ {
1466 reqHeaders[k] = v
1467 }
1468 reqHeaders.Set("User-Agent", c.s.userAgent())
1469 var body io.Reader = nil
1470 c.urlParams_.Set("alt", alt)
1471 c.urlParams_.Set("prettyPrint", "false")
1472 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}")
1473 urls += "?" + c.urlParams_.Encode()
1474 req, err := http.NewRequest("DELETE", urls, body)
1475 if err != nil {
1476 return nil, err
1477 }
1478 req.Header = reqHeaders
1479 googleapi.Expand(req.URL, map[string]string{
1480 "siteUrl": c.siteUrl,
1481 })
1482 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1483 }
1484
1485
1486 func (c *SitesDeleteCall) Do(opts ...googleapi.CallOption) error {
1487 gensupport.SetOptions(c.urlParams_, opts...)
1488 res, err := c.doRequest("json")
1489 if err != nil {
1490 return err
1491 }
1492 defer googleapi.CloseBody(res)
1493 if err := googleapi.CheckResponse(res); err != nil {
1494 return err
1495 }
1496 return nil
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518 }
1519
1520
1521
1522 type SitesGetCall struct {
1523 s *Service
1524 siteUrl string
1525 urlParams_ gensupport.URLParams
1526 ifNoneMatch_ string
1527 ctx_ context.Context
1528 header_ http.Header
1529 }
1530
1531
1532
1533
1534
1535
1536
1537 func (r *SitesService) Get(siteUrl string) *SitesGetCall {
1538 c := &SitesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1539 c.siteUrl = siteUrl
1540 return c
1541 }
1542
1543
1544
1545
1546 func (c *SitesGetCall) Fields(s ...googleapi.Field) *SitesGetCall {
1547 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1548 return c
1549 }
1550
1551
1552
1553
1554
1555
1556 func (c *SitesGetCall) IfNoneMatch(entityTag string) *SitesGetCall {
1557 c.ifNoneMatch_ = entityTag
1558 return c
1559 }
1560
1561
1562
1563
1564 func (c *SitesGetCall) Context(ctx context.Context) *SitesGetCall {
1565 c.ctx_ = ctx
1566 return c
1567 }
1568
1569
1570
1571 func (c *SitesGetCall) Header() http.Header {
1572 if c.header_ == nil {
1573 c.header_ = make(http.Header)
1574 }
1575 return c.header_
1576 }
1577
1578 func (c *SitesGetCall) doRequest(alt string) (*http.Response, error) {
1579 reqHeaders := make(http.Header)
1580 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
1581 for k, v := range c.header_ {
1582 reqHeaders[k] = v
1583 }
1584 reqHeaders.Set("User-Agent", c.s.userAgent())
1585 if c.ifNoneMatch_ != "" {
1586 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1587 }
1588 var body io.Reader = nil
1589 c.urlParams_.Set("alt", alt)
1590 c.urlParams_.Set("prettyPrint", "false")
1591 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}")
1592 urls += "?" + c.urlParams_.Encode()
1593 req, err := http.NewRequest("GET", urls, body)
1594 if err != nil {
1595 return nil, err
1596 }
1597 req.Header = reqHeaders
1598 googleapi.Expand(req.URL, map[string]string{
1599 "siteUrl": c.siteUrl,
1600 })
1601 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1602 }
1603
1604
1605
1606
1607
1608
1609
1610
1611 func (c *SitesGetCall) Do(opts ...googleapi.CallOption) (*WmxSite, error) {
1612 gensupport.SetOptions(c.urlParams_, opts...)
1613 res, err := c.doRequest("json")
1614 if res != nil && res.StatusCode == http.StatusNotModified {
1615 if res.Body != nil {
1616 res.Body.Close()
1617 }
1618 return nil, &googleapi.Error{
1619 Code: res.StatusCode,
1620 Header: res.Header,
1621 }
1622 }
1623 if err != nil {
1624 return nil, err
1625 }
1626 defer googleapi.CloseBody(res)
1627 if err := googleapi.CheckResponse(res); err != nil {
1628 return nil, err
1629 }
1630 ret := &WmxSite{
1631 ServerResponse: googleapi.ServerResponse{
1632 Header: res.Header,
1633 HTTPStatusCode: res.StatusCode,
1634 },
1635 }
1636 target := &ret
1637 if err := gensupport.DecodeResponse(target, res); err != nil {
1638 return nil, err
1639 }
1640 return ret, nil
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666 }
1667
1668
1669
1670 type SitesListCall struct {
1671 s *Service
1672 urlParams_ gensupport.URLParams
1673 ifNoneMatch_ string
1674 ctx_ context.Context
1675 header_ http.Header
1676 }
1677
1678
1679 func (r *SitesService) List() *SitesListCall {
1680 c := &SitesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1681 return c
1682 }
1683
1684
1685
1686
1687 func (c *SitesListCall) Fields(s ...googleapi.Field) *SitesListCall {
1688 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1689 return c
1690 }
1691
1692
1693
1694
1695
1696
1697 func (c *SitesListCall) IfNoneMatch(entityTag string) *SitesListCall {
1698 c.ifNoneMatch_ = entityTag
1699 return c
1700 }
1701
1702
1703
1704
1705 func (c *SitesListCall) Context(ctx context.Context) *SitesListCall {
1706 c.ctx_ = ctx
1707 return c
1708 }
1709
1710
1711
1712 func (c *SitesListCall) Header() http.Header {
1713 if c.header_ == nil {
1714 c.header_ = make(http.Header)
1715 }
1716 return c.header_
1717 }
1718
1719 func (c *SitesListCall) doRequest(alt string) (*http.Response, error) {
1720 reqHeaders := make(http.Header)
1721 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102")
1722 for k, v := range c.header_ {
1723 reqHeaders[k] = v
1724 }
1725 reqHeaders.Set("User-Agent", c.s.userAgent())
1726 if c.ifNoneMatch_ != "" {
1727 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1728 }
1729 var body io.Reader = nil
1730 c.urlParams_.Set("alt", alt)
1731 c.urlParams_.Set("prettyPrint", "false")
1732 urls := googleapi.ResolveRelative(c.s.BasePath, "sites")
1733 urls += "?" + c.urlParams_.Encode()
1734 req, err := http.NewRequest("GET", urls, body)
1735 if err != nil {
1736 return nil, err
1737 }
1738 req.Header = reqHeaders
1739 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1740 }
1741
1742
1743
1744
1745
1746
1747
1748
1749 func (c *SitesListCall) Do(opts ...googleapi.CallOption) (*SitesListResponse, error) {
1750 gensupport.SetOptions(c.urlParams_, opts...)
1751 res, err := c.doRequest("json")
1752 if res != nil && res.StatusCode == http.StatusNotModified {
1753 if res.Body != nil {
1754 res.Body.Close()
1755 }
1756 return nil, &googleapi.Error{
1757 Code: res.StatusCode,
1758 Header: res.Header,
1759 }
1760 }
1761 if err != nil {
1762 return nil, err
1763 }
1764 defer googleapi.CloseBody(res)
1765 if err := googleapi.CheckResponse(res); err != nil {
1766 return nil, err
1767 }
1768 ret := &SitesListResponse{
1769 ServerResponse: googleapi.ServerResponse{
1770 Header: res.Header,
1771 HTTPStatusCode: res.StatusCode,
1772 },
1773 }
1774 target := &ret
1775 if err := gensupport.DecodeResponse(target, res); err != nil {
1776 return nil, err
1777 }
1778 return ret, nil
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793 }
1794
View as plain text