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