forked from googleapis/google-api-go-client
/
siteverification-gen.go
682 lines (618 loc) · 20.8 KB
/
siteverification-gen.go
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
// Package siteverification provides access to the Google Site Verification API.
//
// See https://developers.google.com/site-verification/
//
// Usage example:
//
// import "google.golang.org/api/siteverification/v1"
// ...
// siteverificationService, err := siteverification.New(oauthHttpClient)
package siteverification
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"google.golang.org/api/googleapi"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Background
const apiId = "siteVerification:v1"
const apiName = "siteVerification"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/siteVerification/v1/"
// OAuth2 scopes used by this API.
const (
// Manage the list of sites and domains you control
SiteverificationScope = "https://www.googleapis.com/auth/siteverification"
// Manage your new site verifications with Google
SiteverificationVerify_onlyScope = "https://www.googleapis.com/auth/siteverification.verify_only"
)
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.WebResource = NewWebResourceService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
WebResource *WebResourceService
}
func NewWebResourceService(s *Service) *WebResourceService {
rs := &WebResourceService{s: s}
return rs
}
type WebResourceService struct {
s *Service
}
type SiteVerificationWebResourceGettokenRequest struct {
// Site: The site for which a verification token will be generated.
Site *SiteVerificationWebResourceGettokenRequestSite `json:"site,omitempty"`
// VerificationMethod: The verification method that will be used to
// verify this site. For sites, 'FILE' or 'META' methods may be used.
// For domains, only 'DNS' may be used.
VerificationMethod string `json:"verificationMethod,omitempty"`
}
type SiteVerificationWebResourceGettokenRequestSite struct {
// Identifier: The site identifier. If the type is set to SITE, the
// identifier is a URL. If the type is set to INET_DOMAIN, the site
// identifier is a domain name.
Identifier string `json:"identifier,omitempty"`
// Type: The type of resource to be verified. Can be SITE or INET_DOMAIN
// (domain name).
Type string `json:"type,omitempty"`
}
type SiteVerificationWebResourceGettokenResponse struct {
// Method: The verification method to use in conjunction with this
// token. For FILE, the token should be placed in the top-level
// directory of the site, stored inside a file of the same name. For
// META, the token should be placed in the HEAD tag of the default page
// that is loaded for the site. For DNS, the token should be placed in a
// TXT record of the domain.
Method string `json:"method,omitempty"`
// Token: The verification token. The token must be placed appropriately
// in order for verification to succeed.
Token string `json:"token,omitempty"`
}
type SiteVerificationWebResourceListResponse struct {
// Items: The list of sites that are owned by the authenticated user.
Items []*SiteVerificationWebResourceResource `json:"items,omitempty"`
}
type SiteVerificationWebResourceResource struct {
// Id: The string used to identify this site. This value should be used
// in the "id" portion of the REST URL for the Get, Update, and Delete
// operations.
Id string `json:"id,omitempty"`
// Owners: The email addresses of all verified owners.
Owners []string `json:"owners,omitempty"`
// Site: The address and type of a site that is verified or will be
// verified.
Site *SiteVerificationWebResourceResourceSite `json:"site,omitempty"`
}
type SiteVerificationWebResourceResourceSite struct {
// Identifier: The site identifier. If the type is set to SITE, the
// identifier is a URL. If the type is set to INET_DOMAIN, the site
// identifier is a domain name.
Identifier string `json:"identifier,omitempty"`
// Type: The site type. Can be SITE or INET_DOMAIN (domain name).
Type string `json:"type,omitempty"`
}
// method id "siteVerification.webResource.delete":
type WebResourceDeleteCall struct {
s *Service
id string
opt_ map[string]interface{}
}
// Delete: Relinquish ownership of a website or domain.
func (r *WebResourceService) Delete(id string) *WebResourceDeleteCall {
c := &WebResourceDeleteCall{s: r.s, opt_: make(map[string]interface{})}
c.id = id
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *WebResourceDeleteCall) Fields(s ...googleapi.Field) *WebResourceDeleteCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *WebResourceDeleteCall) Do() error {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "webResource/{id}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
googleapi.Expand(req.URL, map[string]string{
"id": c.id,
})
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return err
}
return nil
// {
// "description": "Relinquish ownership of a website or domain.",
// "httpMethod": "DELETE",
// "id": "siteVerification.webResource.delete",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "description": "The id of a verified site or domain.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "webResource/{id}",
// "scopes": [
// "https://www.googleapis.com/auth/siteverification"
// ]
// }
}
// method id "siteVerification.webResource.get":
type WebResourceGetCall struct {
s *Service
id string
opt_ map[string]interface{}
}
// Get: Get the most current data for a website or domain.
func (r *WebResourceService) Get(id string) *WebResourceGetCall {
c := &WebResourceGetCall{s: r.s, opt_: make(map[string]interface{})}
c.id = id
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *WebResourceGetCall) Fields(s ...googleapi.Field) *WebResourceGetCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *WebResourceGetCall) Do() (*SiteVerificationWebResourceResource, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "webResource/{id}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"id": c.id,
})
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *SiteVerificationWebResourceResource
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get the most current data for a website or domain.",
// "httpMethod": "GET",
// "id": "siteVerification.webResource.get",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "description": "The id of a verified site or domain.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "webResource/{id}",
// "response": {
// "$ref": "SiteVerificationWebResourceResource"
// },
// "scopes": [
// "https://www.googleapis.com/auth/siteverification"
// ]
// }
}
// method id "siteVerification.webResource.getToken":
type WebResourceGetTokenCall struct {
s *Service
siteverificationwebresourcegettokenrequest *SiteVerificationWebResourceGettokenRequest
opt_ map[string]interface{}
}
// GetToken: Get a verification token for placing on a website or
// domain.
func (r *WebResourceService) GetToken(siteverificationwebresourcegettokenrequest *SiteVerificationWebResourceGettokenRequest) *WebResourceGetTokenCall {
c := &WebResourceGetTokenCall{s: r.s, opt_: make(map[string]interface{})}
c.siteverificationwebresourcegettokenrequest = siteverificationwebresourcegettokenrequest
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *WebResourceGetTokenCall) Fields(s ...googleapi.Field) *WebResourceGetTokenCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *WebResourceGetTokenCall) Do() (*SiteVerificationWebResourceGettokenResponse, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.siteverificationwebresourcegettokenrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "token")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *SiteVerificationWebResourceGettokenResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get a verification token for placing on a website or domain.",
// "httpMethod": "POST",
// "id": "siteVerification.webResource.getToken",
// "path": "token",
// "request": {
// "$ref": "SiteVerificationWebResourceGettokenRequest"
// },
// "response": {
// "$ref": "SiteVerificationWebResourceGettokenResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/siteverification",
// "https://www.googleapis.com/auth/siteverification.verify_only"
// ]
// }
}
// method id "siteVerification.webResource.insert":
type WebResourceInsertCall struct {
s *Service
verificationMethod string
siteverificationwebresourceresource *SiteVerificationWebResourceResource
opt_ map[string]interface{}
}
// Insert: Attempt verification of a website or domain.
func (r *WebResourceService) Insert(verificationMethod string, siteverificationwebresourceresource *SiteVerificationWebResourceResource) *WebResourceInsertCall {
c := &WebResourceInsertCall{s: r.s, opt_: make(map[string]interface{})}
c.verificationMethod = verificationMethod
c.siteverificationwebresourceresource = siteverificationwebresourceresource
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *WebResourceInsertCall) Fields(s ...googleapi.Field) *WebResourceInsertCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *WebResourceInsertCall) Do() (*SiteVerificationWebResourceResource, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.siteverificationwebresourceresource)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
params.Set("verificationMethod", fmt.Sprintf("%v", c.verificationMethod))
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "webResource")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *SiteVerificationWebResourceResource
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Attempt verification of a website or domain.",
// "httpMethod": "POST",
// "id": "siteVerification.webResource.insert",
// "parameterOrder": [
// "verificationMethod"
// ],
// "parameters": {
// "verificationMethod": {
// "description": "The method to use for verifying a site or domain.",
// "location": "query",
// "required": true,
// "type": "string"
// }
// },
// "path": "webResource",
// "request": {
// "$ref": "SiteVerificationWebResourceResource"
// },
// "response": {
// "$ref": "SiteVerificationWebResourceResource"
// },
// "scopes": [
// "https://www.googleapis.com/auth/siteverification",
// "https://www.googleapis.com/auth/siteverification.verify_only"
// ]
// }
}
// method id "siteVerification.webResource.list":
type WebResourceListCall struct {
s *Service
opt_ map[string]interface{}
}
// List: Get the list of your verified websites and domains.
func (r *WebResourceService) List() *WebResourceListCall {
c := &WebResourceListCall{s: r.s, opt_: make(map[string]interface{})}
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *WebResourceListCall) Fields(s ...googleapi.Field) *WebResourceListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *WebResourceListCall) Do() (*SiteVerificationWebResourceListResponse, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "webResource")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *SiteVerificationWebResourceListResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get the list of your verified websites and domains.",
// "httpMethod": "GET",
// "id": "siteVerification.webResource.list",
// "path": "webResource",
// "response": {
// "$ref": "SiteVerificationWebResourceListResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/siteverification"
// ]
// }
}
// method id "siteVerification.webResource.patch":
type WebResourcePatchCall struct {
s *Service
id string
siteverificationwebresourceresource *SiteVerificationWebResourceResource
opt_ map[string]interface{}
}
// Patch: Modify the list of owners for your website or domain. This
// method supports patch semantics.
func (r *WebResourceService) Patch(id string, siteverificationwebresourceresource *SiteVerificationWebResourceResource) *WebResourcePatchCall {
c := &WebResourcePatchCall{s: r.s, opt_: make(map[string]interface{})}
c.id = id
c.siteverificationwebresourceresource = siteverificationwebresourceresource
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *WebResourcePatchCall) Fields(s ...googleapi.Field) *WebResourcePatchCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *WebResourcePatchCall) Do() (*SiteVerificationWebResourceResource, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.siteverificationwebresourceresource)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "webResource/{id}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("PATCH", urls, body)
googleapi.Expand(req.URL, map[string]string{
"id": c.id,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *SiteVerificationWebResourceResource
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Modify the list of owners for your website or domain. This method supports patch semantics.",
// "httpMethod": "PATCH",
// "id": "siteVerification.webResource.patch",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "description": "The id of a verified site or domain.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "webResource/{id}",
// "request": {
// "$ref": "SiteVerificationWebResourceResource"
// },
// "response": {
// "$ref": "SiteVerificationWebResourceResource"
// },
// "scopes": [
// "https://www.googleapis.com/auth/siteverification"
// ]
// }
}
// method id "siteVerification.webResource.update":
type WebResourceUpdateCall struct {
s *Service
id string
siteverificationwebresourceresource *SiteVerificationWebResourceResource
opt_ map[string]interface{}
}
// Update: Modify the list of owners for your website or domain.
func (r *WebResourceService) Update(id string, siteverificationwebresourceresource *SiteVerificationWebResourceResource) *WebResourceUpdateCall {
c := &WebResourceUpdateCall{s: r.s, opt_: make(map[string]interface{})}
c.id = id
c.siteverificationwebresourceresource = siteverificationwebresourceresource
return c
}
// Fields allows partial responses to be retrieved.
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *WebResourceUpdateCall) Fields(s ...googleapi.Field) *WebResourceUpdateCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *WebResourceUpdateCall) Do() (*SiteVerificationWebResourceResource, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.siteverificationwebresourceresource)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["fields"]; ok {
params.Set("fields", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "webResource/{id}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("PUT", urls, body)
googleapi.Expand(req.URL, map[string]string{
"id": c.id,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *SiteVerificationWebResourceResource
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Modify the list of owners for your website or domain.",
// "httpMethod": "PUT",
// "id": "siteVerification.webResource.update",
// "parameterOrder": [
// "id"
// ],
// "parameters": {
// "id": {
// "description": "The id of a verified site or domain.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "webResource/{id}",
// "request": {
// "$ref": "SiteVerificationWebResourceResource"
// },
// "response": {
// "$ref": "SiteVerificationWebResourceResource"
// },
// "scopes": [
// "https://www.googleapis.com/auth/siteverification"
// ]
// }
}