Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

1177 строки
40 KiB

  1. // Package siteverification provides access to the Google Site Verification API.
  2. //
  3. // See https://developers.google.com/site-verification/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/siteverification/v1"
  8. // ...
  9. // siteverificationService, err := siteverification.New(oauthHttpClient)
  10. package siteverification // import "google.golang.org/api/siteverification/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "siteVerification:v1"
  41. const apiName = "siteVerification"
  42. const apiVersion = "v1"
  43. const basePath = "https://www.googleapis.com/siteVerification/v1/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // Manage the list of sites and domains you control
  47. SiteverificationScope = "https://www.googleapis.com/auth/siteverification"
  48. // Manage your new site verifications with Google
  49. SiteverificationVerifyOnlyScope = "https://www.googleapis.com/auth/siteverification.verify_only"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.WebResource = NewWebResourceService(s)
  57. return s, nil
  58. }
  59. type Service struct {
  60. client *http.Client
  61. BasePath string // API endpoint base URL
  62. UserAgent string // optional additional User-Agent fragment
  63. WebResource *WebResourceService
  64. }
  65. func (s *Service) userAgent() string {
  66. if s.UserAgent == "" {
  67. return googleapi.UserAgent
  68. }
  69. return googleapi.UserAgent + " " + s.UserAgent
  70. }
  71. func NewWebResourceService(s *Service) *WebResourceService {
  72. rs := &WebResourceService{s: s}
  73. return rs
  74. }
  75. type WebResourceService struct {
  76. s *Service
  77. }
  78. type SiteVerificationWebResourceGettokenRequest struct {
  79. // Site: The site for which a verification token will be generated.
  80. Site *SiteVerificationWebResourceGettokenRequestSite `json:"site,omitempty"`
  81. // VerificationMethod: The verification method that will be used to
  82. // verify this site. For sites, 'FILE' or 'META' methods may be used.
  83. // For domains, only 'DNS' may be used.
  84. VerificationMethod string `json:"verificationMethod,omitempty"`
  85. // ForceSendFields is a list of field names (e.g. "Site") to
  86. // unconditionally include in API requests. By default, fields with
  87. // empty values are omitted from API requests. However, any non-pointer,
  88. // non-interface field appearing in ForceSendFields will be sent to the
  89. // server regardless of whether the field is empty or not. This may be
  90. // used to include empty fields in Patch requests.
  91. ForceSendFields []string `json:"-"`
  92. // NullFields is a list of field names (e.g. "Site") to include in API
  93. // requests with the JSON null value. By default, fields with empty
  94. // values are omitted from API requests. However, any field with an
  95. // empty value appearing in NullFields will be sent to the server as
  96. // null. It is an error if a field in this list has a non-empty value.
  97. // This may be used to include null fields in Patch requests.
  98. NullFields []string `json:"-"`
  99. }
  100. func (s *SiteVerificationWebResourceGettokenRequest) MarshalJSON() ([]byte, error) {
  101. type NoMethod SiteVerificationWebResourceGettokenRequest
  102. raw := NoMethod(*s)
  103. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  104. }
  105. // SiteVerificationWebResourceGettokenRequestSite: The site for which a
  106. // verification token will be generated.
  107. type SiteVerificationWebResourceGettokenRequestSite struct {
  108. // Identifier: The site identifier. If the type is set to SITE, the
  109. // identifier is a URL. If the type is set to INET_DOMAIN, the site
  110. // identifier is a domain name.
  111. Identifier string `json:"identifier,omitempty"`
  112. // Type: The type of resource to be verified. Can be SITE or INET_DOMAIN
  113. // (domain name).
  114. Type string `json:"type,omitempty"`
  115. // ForceSendFields is a list of field names (e.g. "Identifier") to
  116. // unconditionally include in API requests. By default, fields with
  117. // empty values are omitted from API requests. However, any non-pointer,
  118. // non-interface field appearing in ForceSendFields will be sent to the
  119. // server regardless of whether the field is empty or not. This may be
  120. // used to include empty fields in Patch requests.
  121. ForceSendFields []string `json:"-"`
  122. // NullFields is a list of field names (e.g. "Identifier") to include in
  123. // API requests with the JSON null value. By default, fields with empty
  124. // values are omitted from API requests. However, any field with an
  125. // empty value appearing in NullFields will be sent to the server as
  126. // null. It is an error if a field in this list has a non-empty value.
  127. // This may be used to include null fields in Patch requests.
  128. NullFields []string `json:"-"`
  129. }
  130. func (s *SiteVerificationWebResourceGettokenRequestSite) MarshalJSON() ([]byte, error) {
  131. type NoMethod SiteVerificationWebResourceGettokenRequestSite
  132. raw := NoMethod(*s)
  133. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  134. }
  135. type SiteVerificationWebResourceGettokenResponse struct {
  136. // Method: The verification method to use in conjunction with this
  137. // token. For FILE, the token should be placed in the top-level
  138. // directory of the site, stored inside a file of the same name. For
  139. // META, the token should be placed in the HEAD tag of the default page
  140. // that is loaded for the site. For DNS, the token should be placed in a
  141. // TXT record of the domain.
  142. Method string `json:"method,omitempty"`
  143. // Token: The verification token. The token must be placed appropriately
  144. // in order for verification to succeed.
  145. Token string `json:"token,omitempty"`
  146. // ServerResponse contains the HTTP response code and headers from the
  147. // server.
  148. googleapi.ServerResponse `json:"-"`
  149. // ForceSendFields is a list of field names (e.g. "Method") to
  150. // unconditionally include in API requests. By default, fields with
  151. // empty values are omitted from API requests. However, any non-pointer,
  152. // non-interface field appearing in ForceSendFields will be sent to the
  153. // server regardless of whether the field is empty or not. This may be
  154. // used to include empty fields in Patch requests.
  155. ForceSendFields []string `json:"-"`
  156. // NullFields is a list of field names (e.g. "Method") to include in API
  157. // requests with the JSON null value. By default, fields with empty
  158. // values are omitted from API requests. However, any field with an
  159. // empty value appearing in NullFields will be sent to the server as
  160. // null. It is an error if a field in this list has a non-empty value.
  161. // This may be used to include null fields in Patch requests.
  162. NullFields []string `json:"-"`
  163. }
  164. func (s *SiteVerificationWebResourceGettokenResponse) MarshalJSON() ([]byte, error) {
  165. type NoMethod SiteVerificationWebResourceGettokenResponse
  166. raw := NoMethod(*s)
  167. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  168. }
  169. type SiteVerificationWebResourceListResponse struct {
  170. // Items: The list of sites that are owned by the authenticated user.
  171. Items []*SiteVerificationWebResourceResource `json:"items,omitempty"`
  172. // ServerResponse contains the HTTP response code and headers from the
  173. // server.
  174. googleapi.ServerResponse `json:"-"`
  175. // ForceSendFields is a list of field names (e.g. "Items") to
  176. // unconditionally include in API requests. By default, fields with
  177. // empty values are omitted from API requests. However, any non-pointer,
  178. // non-interface field appearing in ForceSendFields will be sent to the
  179. // server regardless of whether the field is empty or not. This may be
  180. // used to include empty fields in Patch requests.
  181. ForceSendFields []string `json:"-"`
  182. // NullFields is a list of field names (e.g. "Items") to include in API
  183. // requests with the JSON null value. By default, fields with empty
  184. // values are omitted from API requests. However, any field with an
  185. // empty value appearing in NullFields will be sent to the server as
  186. // null. It is an error if a field in this list has a non-empty value.
  187. // This may be used to include null fields in Patch requests.
  188. NullFields []string `json:"-"`
  189. }
  190. func (s *SiteVerificationWebResourceListResponse) MarshalJSON() ([]byte, error) {
  191. type NoMethod SiteVerificationWebResourceListResponse
  192. raw := NoMethod(*s)
  193. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  194. }
  195. type SiteVerificationWebResourceResource struct {
  196. // Id: The string used to identify this site. This value should be used
  197. // in the "id" portion of the REST URL for the Get, Update, and Delete
  198. // operations.
  199. Id string `json:"id,omitempty"`
  200. // Owners: The email addresses of all verified owners.
  201. Owners []string `json:"owners,omitempty"`
  202. // Site: The address and type of a site that is verified or will be
  203. // verified.
  204. Site *SiteVerificationWebResourceResourceSite `json:"site,omitempty"`
  205. // ServerResponse contains the HTTP response code and headers from the
  206. // server.
  207. googleapi.ServerResponse `json:"-"`
  208. // ForceSendFields is a list of field names (e.g. "Id") to
  209. // unconditionally include in API requests. By default, fields with
  210. // empty values are omitted from API requests. However, any non-pointer,
  211. // non-interface field appearing in ForceSendFields will be sent to the
  212. // server regardless of whether the field is empty or not. This may be
  213. // used to include empty fields in Patch requests.
  214. ForceSendFields []string `json:"-"`
  215. // NullFields is a list of field names (e.g. "Id") to include in API
  216. // requests with the JSON null value. By default, fields with empty
  217. // values are omitted from API requests. However, any field with an
  218. // empty value appearing in NullFields will be sent to the server as
  219. // null. It is an error if a field in this list has a non-empty value.
  220. // This may be used to include null fields in Patch requests.
  221. NullFields []string `json:"-"`
  222. }
  223. func (s *SiteVerificationWebResourceResource) MarshalJSON() ([]byte, error) {
  224. type NoMethod SiteVerificationWebResourceResource
  225. raw := NoMethod(*s)
  226. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  227. }
  228. // SiteVerificationWebResourceResourceSite: The address and type of a
  229. // site that is verified or will be verified.
  230. type SiteVerificationWebResourceResourceSite struct {
  231. // Identifier: The site identifier. If the type is set to SITE, the
  232. // identifier is a URL. If the type is set to INET_DOMAIN, the site
  233. // identifier is a domain name.
  234. Identifier string `json:"identifier,omitempty"`
  235. // Type: The site type. Can be SITE or INET_DOMAIN (domain name).
  236. Type string `json:"type,omitempty"`
  237. // ForceSendFields is a list of field names (e.g. "Identifier") to
  238. // unconditionally include in API requests. By default, fields with
  239. // empty values are omitted from API requests. However, any non-pointer,
  240. // non-interface field appearing in ForceSendFields will be sent to the
  241. // server regardless of whether the field is empty or not. This may be
  242. // used to include empty fields in Patch requests.
  243. ForceSendFields []string `json:"-"`
  244. // NullFields is a list of field names (e.g. "Identifier") to include in
  245. // API requests with the JSON null value. By default, fields with empty
  246. // values are omitted from API requests. However, any field with an
  247. // empty value appearing in NullFields will be sent to the server as
  248. // null. It is an error if a field in this list has a non-empty value.
  249. // This may be used to include null fields in Patch requests.
  250. NullFields []string `json:"-"`
  251. }
  252. func (s *SiteVerificationWebResourceResourceSite) MarshalJSON() ([]byte, error) {
  253. type NoMethod SiteVerificationWebResourceResourceSite
  254. raw := NoMethod(*s)
  255. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  256. }
  257. // method id "siteVerification.webResource.delete":
  258. type WebResourceDeleteCall struct {
  259. s *Service
  260. id string
  261. urlParams_ gensupport.URLParams
  262. ctx_ context.Context
  263. header_ http.Header
  264. }
  265. // Delete: Relinquish ownership of a website or domain.
  266. func (r *WebResourceService) Delete(id string) *WebResourceDeleteCall {
  267. c := &WebResourceDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  268. c.id = id
  269. return c
  270. }
  271. // Fields allows partial responses to be retrieved. See
  272. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  273. // for more information.
  274. func (c *WebResourceDeleteCall) Fields(s ...googleapi.Field) *WebResourceDeleteCall {
  275. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  276. return c
  277. }
  278. // Context sets the context to be used in this call's Do method. Any
  279. // pending HTTP request will be aborted if the provided context is
  280. // canceled.
  281. func (c *WebResourceDeleteCall) Context(ctx context.Context) *WebResourceDeleteCall {
  282. c.ctx_ = ctx
  283. return c
  284. }
  285. // Header returns an http.Header that can be modified by the caller to
  286. // add HTTP headers to the request.
  287. func (c *WebResourceDeleteCall) Header() http.Header {
  288. if c.header_ == nil {
  289. c.header_ = make(http.Header)
  290. }
  291. return c.header_
  292. }
  293. func (c *WebResourceDeleteCall) doRequest(alt string) (*http.Response, error) {
  294. reqHeaders := make(http.Header)
  295. for k, v := range c.header_ {
  296. reqHeaders[k] = v
  297. }
  298. reqHeaders.Set("User-Agent", c.s.userAgent())
  299. var body io.Reader = nil
  300. c.urlParams_.Set("alt", alt)
  301. urls := googleapi.ResolveRelative(c.s.BasePath, "webResource/{id}")
  302. urls += "?" + c.urlParams_.Encode()
  303. req, _ := http.NewRequest("DELETE", urls, body)
  304. req.Header = reqHeaders
  305. googleapi.Expand(req.URL, map[string]string{
  306. "id": c.id,
  307. })
  308. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  309. }
  310. // Do executes the "siteVerification.webResource.delete" call.
  311. func (c *WebResourceDeleteCall) Do(opts ...googleapi.CallOption) error {
  312. gensupport.SetOptions(c.urlParams_, opts...)
  313. res, err := c.doRequest("json")
  314. if err != nil {
  315. return err
  316. }
  317. defer googleapi.CloseBody(res)
  318. if err := googleapi.CheckResponse(res); err != nil {
  319. return err
  320. }
  321. return nil
  322. // {
  323. // "description": "Relinquish ownership of a website or domain.",
  324. // "httpMethod": "DELETE",
  325. // "id": "siteVerification.webResource.delete",
  326. // "parameterOrder": [
  327. // "id"
  328. // ],
  329. // "parameters": {
  330. // "id": {
  331. // "description": "The id of a verified site or domain.",
  332. // "location": "path",
  333. // "required": true,
  334. // "type": "string"
  335. // }
  336. // },
  337. // "path": "webResource/{id}",
  338. // "scopes": [
  339. // "https://www.googleapis.com/auth/siteverification"
  340. // ]
  341. // }
  342. }
  343. // method id "siteVerification.webResource.get":
  344. type WebResourceGetCall struct {
  345. s *Service
  346. id string
  347. urlParams_ gensupport.URLParams
  348. ifNoneMatch_ string
  349. ctx_ context.Context
  350. header_ http.Header
  351. }
  352. // Get: Get the most current data for a website or domain.
  353. func (r *WebResourceService) Get(id string) *WebResourceGetCall {
  354. c := &WebResourceGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  355. c.id = id
  356. return c
  357. }
  358. // Fields allows partial responses to be retrieved. See
  359. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  360. // for more information.
  361. func (c *WebResourceGetCall) Fields(s ...googleapi.Field) *WebResourceGetCall {
  362. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  363. return c
  364. }
  365. // IfNoneMatch sets the optional parameter which makes the operation
  366. // fail if the object's ETag matches the given value. This is useful for
  367. // getting updates only after the object has changed since the last
  368. // request. Use googleapi.IsNotModified to check whether the response
  369. // error from Do is the result of In-None-Match.
  370. func (c *WebResourceGetCall) IfNoneMatch(entityTag string) *WebResourceGetCall {
  371. c.ifNoneMatch_ = entityTag
  372. return c
  373. }
  374. // Context sets the context to be used in this call's Do method. Any
  375. // pending HTTP request will be aborted if the provided context is
  376. // canceled.
  377. func (c *WebResourceGetCall) Context(ctx context.Context) *WebResourceGetCall {
  378. c.ctx_ = ctx
  379. return c
  380. }
  381. // Header returns an http.Header that can be modified by the caller to
  382. // add HTTP headers to the request.
  383. func (c *WebResourceGetCall) Header() http.Header {
  384. if c.header_ == nil {
  385. c.header_ = make(http.Header)
  386. }
  387. return c.header_
  388. }
  389. func (c *WebResourceGetCall) doRequest(alt string) (*http.Response, error) {
  390. reqHeaders := make(http.Header)
  391. for k, v := range c.header_ {
  392. reqHeaders[k] = v
  393. }
  394. reqHeaders.Set("User-Agent", c.s.userAgent())
  395. if c.ifNoneMatch_ != "" {
  396. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  397. }
  398. var body io.Reader = nil
  399. c.urlParams_.Set("alt", alt)
  400. urls := googleapi.ResolveRelative(c.s.BasePath, "webResource/{id}")
  401. urls += "?" + c.urlParams_.Encode()
  402. req, _ := http.NewRequest("GET", urls, body)
  403. req.Header = reqHeaders
  404. googleapi.Expand(req.URL, map[string]string{
  405. "id": c.id,
  406. })
  407. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  408. }
  409. // Do executes the "siteVerification.webResource.get" call.
  410. // Exactly one of *SiteVerificationWebResourceResource or error will be
  411. // non-nil. Any non-2xx status code is an error. Response headers are in
  412. // either *SiteVerificationWebResourceResource.ServerResponse.Header or
  413. // (if a response was returned at all) in
  414. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  415. // whether the returned error was because http.StatusNotModified was
  416. // returned.
  417. func (c *WebResourceGetCall) Do(opts ...googleapi.CallOption) (*SiteVerificationWebResourceResource, error) {
  418. gensupport.SetOptions(c.urlParams_, opts...)
  419. res, err := c.doRequest("json")
  420. if res != nil && res.StatusCode == http.StatusNotModified {
  421. if res.Body != nil {
  422. res.Body.Close()
  423. }
  424. return nil, &googleapi.Error{
  425. Code: res.StatusCode,
  426. Header: res.Header,
  427. }
  428. }
  429. if err != nil {
  430. return nil, err
  431. }
  432. defer googleapi.CloseBody(res)
  433. if err := googleapi.CheckResponse(res); err != nil {
  434. return nil, err
  435. }
  436. ret := &SiteVerificationWebResourceResource{
  437. ServerResponse: googleapi.ServerResponse{
  438. Header: res.Header,
  439. HTTPStatusCode: res.StatusCode,
  440. },
  441. }
  442. target := &ret
  443. if err := gensupport.DecodeResponse(target, res); err != nil {
  444. return nil, err
  445. }
  446. return ret, nil
  447. // {
  448. // "description": "Get the most current data for a website or domain.",
  449. // "httpMethod": "GET",
  450. // "id": "siteVerification.webResource.get",
  451. // "parameterOrder": [
  452. // "id"
  453. // ],
  454. // "parameters": {
  455. // "id": {
  456. // "description": "The id of a verified site or domain.",
  457. // "location": "path",
  458. // "required": true,
  459. // "type": "string"
  460. // }
  461. // },
  462. // "path": "webResource/{id}",
  463. // "response": {
  464. // "$ref": "SiteVerificationWebResourceResource"
  465. // },
  466. // "scopes": [
  467. // "https://www.googleapis.com/auth/siteverification"
  468. // ]
  469. // }
  470. }
  471. // method id "siteVerification.webResource.getToken":
  472. type WebResourceGetTokenCall struct {
  473. s *Service
  474. siteverificationwebresourcegettokenrequest *SiteVerificationWebResourceGettokenRequest
  475. urlParams_ gensupport.URLParams
  476. ctx_ context.Context
  477. header_ http.Header
  478. }
  479. // GetToken: Get a verification token for placing on a website or
  480. // domain.
  481. func (r *WebResourceService) GetToken(siteverificationwebresourcegettokenrequest *SiteVerificationWebResourceGettokenRequest) *WebResourceGetTokenCall {
  482. c := &WebResourceGetTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  483. c.siteverificationwebresourcegettokenrequest = siteverificationwebresourcegettokenrequest
  484. return c
  485. }
  486. // Fields allows partial responses to be retrieved. See
  487. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  488. // for more information.
  489. func (c *WebResourceGetTokenCall) Fields(s ...googleapi.Field) *WebResourceGetTokenCall {
  490. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  491. return c
  492. }
  493. // Context sets the context to be used in this call's Do method. Any
  494. // pending HTTP request will be aborted if the provided context is
  495. // canceled.
  496. func (c *WebResourceGetTokenCall) Context(ctx context.Context) *WebResourceGetTokenCall {
  497. c.ctx_ = ctx
  498. return c
  499. }
  500. // Header returns an http.Header that can be modified by the caller to
  501. // add HTTP headers to the request.
  502. func (c *WebResourceGetTokenCall) Header() http.Header {
  503. if c.header_ == nil {
  504. c.header_ = make(http.Header)
  505. }
  506. return c.header_
  507. }
  508. func (c *WebResourceGetTokenCall) doRequest(alt string) (*http.Response, error) {
  509. reqHeaders := make(http.Header)
  510. for k, v := range c.header_ {
  511. reqHeaders[k] = v
  512. }
  513. reqHeaders.Set("User-Agent", c.s.userAgent())
  514. var body io.Reader = nil
  515. body, err := googleapi.WithoutDataWrapper.JSONReader(c.siteverificationwebresourcegettokenrequest)
  516. if err != nil {
  517. return nil, err
  518. }
  519. reqHeaders.Set("Content-Type", "application/json")
  520. c.urlParams_.Set("alt", alt)
  521. urls := googleapi.ResolveRelative(c.s.BasePath, "token")
  522. urls += "?" + c.urlParams_.Encode()
  523. req, _ := http.NewRequest("POST", urls, body)
  524. req.Header = reqHeaders
  525. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  526. }
  527. // Do executes the "siteVerification.webResource.getToken" call.
  528. // Exactly one of *SiteVerificationWebResourceGettokenResponse or error
  529. // will be non-nil. Any non-2xx status code is an error. Response
  530. // headers are in either
  531. // *SiteVerificationWebResourceGettokenResponse.ServerResponse.Header or
  532. // (if a response was returned at all) in
  533. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  534. // whether the returned error was because http.StatusNotModified was
  535. // returned.
  536. func (c *WebResourceGetTokenCall) Do(opts ...googleapi.CallOption) (*SiteVerificationWebResourceGettokenResponse, error) {
  537. gensupport.SetOptions(c.urlParams_, opts...)
  538. res, err := c.doRequest("json")
  539. if res != nil && res.StatusCode == http.StatusNotModified {
  540. if res.Body != nil {
  541. res.Body.Close()
  542. }
  543. return nil, &googleapi.Error{
  544. Code: res.StatusCode,
  545. Header: res.Header,
  546. }
  547. }
  548. if err != nil {
  549. return nil, err
  550. }
  551. defer googleapi.CloseBody(res)
  552. if err := googleapi.CheckResponse(res); err != nil {
  553. return nil, err
  554. }
  555. ret := &SiteVerificationWebResourceGettokenResponse{
  556. ServerResponse: googleapi.ServerResponse{
  557. Header: res.Header,
  558. HTTPStatusCode: res.StatusCode,
  559. },
  560. }
  561. target := &ret
  562. if err := gensupport.DecodeResponse(target, res); err != nil {
  563. return nil, err
  564. }
  565. return ret, nil
  566. // {
  567. // "description": "Get a verification token for placing on a website or domain.",
  568. // "httpMethod": "POST",
  569. // "id": "siteVerification.webResource.getToken",
  570. // "path": "token",
  571. // "request": {
  572. // "$ref": "SiteVerificationWebResourceGettokenRequest"
  573. // },
  574. // "response": {
  575. // "$ref": "SiteVerificationWebResourceGettokenResponse"
  576. // },
  577. // "scopes": [
  578. // "https://www.googleapis.com/auth/siteverification",
  579. // "https://www.googleapis.com/auth/siteverification.verify_only"
  580. // ]
  581. // }
  582. }
  583. // method id "siteVerification.webResource.insert":
  584. type WebResourceInsertCall struct {
  585. s *Service
  586. siteverificationwebresourceresource *SiteVerificationWebResourceResource
  587. urlParams_ gensupport.URLParams
  588. ctx_ context.Context
  589. header_ http.Header
  590. }
  591. // Insert: Attempt verification of a website or domain.
  592. func (r *WebResourceService) Insert(verificationMethod string, siteverificationwebresourceresource *SiteVerificationWebResourceResource) *WebResourceInsertCall {
  593. c := &WebResourceInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  594. c.urlParams_.Set("verificationMethod", verificationMethod)
  595. c.siteverificationwebresourceresource = siteverificationwebresourceresource
  596. return c
  597. }
  598. // Fields allows partial responses to be retrieved. See
  599. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  600. // for more information.
  601. func (c *WebResourceInsertCall) Fields(s ...googleapi.Field) *WebResourceInsertCall {
  602. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  603. return c
  604. }
  605. // Context sets the context to be used in this call's Do method. Any
  606. // pending HTTP request will be aborted if the provided context is
  607. // canceled.
  608. func (c *WebResourceInsertCall) Context(ctx context.Context) *WebResourceInsertCall {
  609. c.ctx_ = ctx
  610. return c
  611. }
  612. // Header returns an http.Header that can be modified by the caller to
  613. // add HTTP headers to the request.
  614. func (c *WebResourceInsertCall) Header() http.Header {
  615. if c.header_ == nil {
  616. c.header_ = make(http.Header)
  617. }
  618. return c.header_
  619. }
  620. func (c *WebResourceInsertCall) doRequest(alt string) (*http.Response, error) {
  621. reqHeaders := make(http.Header)
  622. for k, v := range c.header_ {
  623. reqHeaders[k] = v
  624. }
  625. reqHeaders.Set("User-Agent", c.s.userAgent())
  626. var body io.Reader = nil
  627. body, err := googleapi.WithoutDataWrapper.JSONReader(c.siteverificationwebresourceresource)
  628. if err != nil {
  629. return nil, err
  630. }
  631. reqHeaders.Set("Content-Type", "application/json")
  632. c.urlParams_.Set("alt", alt)
  633. urls := googleapi.ResolveRelative(c.s.BasePath, "webResource")
  634. urls += "?" + c.urlParams_.Encode()
  635. req, _ := http.NewRequest("POST", urls, body)
  636. req.Header = reqHeaders
  637. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  638. }
  639. // Do executes the "siteVerification.webResource.insert" call.
  640. // Exactly one of *SiteVerificationWebResourceResource or error will be
  641. // non-nil. Any non-2xx status code is an error. Response headers are in
  642. // either *SiteVerificationWebResourceResource.ServerResponse.Header or
  643. // (if a response was returned at all) in
  644. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  645. // whether the returned error was because http.StatusNotModified was
  646. // returned.
  647. func (c *WebResourceInsertCall) Do(opts ...googleapi.CallOption) (*SiteVerificationWebResourceResource, error) {
  648. gensupport.SetOptions(c.urlParams_, opts...)
  649. res, err := c.doRequest("json")
  650. if res != nil && res.StatusCode == http.StatusNotModified {
  651. if res.Body != nil {
  652. res.Body.Close()
  653. }
  654. return nil, &googleapi.Error{
  655. Code: res.StatusCode,
  656. Header: res.Header,
  657. }
  658. }
  659. if err != nil {
  660. return nil, err
  661. }
  662. defer googleapi.CloseBody(res)
  663. if err := googleapi.CheckResponse(res); err != nil {
  664. return nil, err
  665. }
  666. ret := &SiteVerificationWebResourceResource{
  667. ServerResponse: googleapi.ServerResponse{
  668. Header: res.Header,
  669. HTTPStatusCode: res.StatusCode,
  670. },
  671. }
  672. target := &ret
  673. if err := gensupport.DecodeResponse(target, res); err != nil {
  674. return nil, err
  675. }
  676. return ret, nil
  677. // {
  678. // "description": "Attempt verification of a website or domain.",
  679. // "httpMethod": "POST",
  680. // "id": "siteVerification.webResource.insert",
  681. // "parameterOrder": [
  682. // "verificationMethod"
  683. // ],
  684. // "parameters": {
  685. // "verificationMethod": {
  686. // "description": "The method to use for verifying a site or domain.",
  687. // "location": "query",
  688. // "required": true,
  689. // "type": "string"
  690. // }
  691. // },
  692. // "path": "webResource",
  693. // "request": {
  694. // "$ref": "SiteVerificationWebResourceResource"
  695. // },
  696. // "response": {
  697. // "$ref": "SiteVerificationWebResourceResource"
  698. // },
  699. // "scopes": [
  700. // "https://www.googleapis.com/auth/siteverification",
  701. // "https://www.googleapis.com/auth/siteverification.verify_only"
  702. // ]
  703. // }
  704. }
  705. // method id "siteVerification.webResource.list":
  706. type WebResourceListCall struct {
  707. s *Service
  708. urlParams_ gensupport.URLParams
  709. ifNoneMatch_ string
  710. ctx_ context.Context
  711. header_ http.Header
  712. }
  713. // List: Get the list of your verified websites and domains.
  714. func (r *WebResourceService) List() *WebResourceListCall {
  715. c := &WebResourceListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  716. return c
  717. }
  718. // Fields allows partial responses to be retrieved. See
  719. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  720. // for more information.
  721. func (c *WebResourceListCall) Fields(s ...googleapi.Field) *WebResourceListCall {
  722. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  723. return c
  724. }
  725. // IfNoneMatch sets the optional parameter which makes the operation
  726. // fail if the object's ETag matches the given value. This is useful for
  727. // getting updates only after the object has changed since the last
  728. // request. Use googleapi.IsNotModified to check whether the response
  729. // error from Do is the result of In-None-Match.
  730. func (c *WebResourceListCall) IfNoneMatch(entityTag string) *WebResourceListCall {
  731. c.ifNoneMatch_ = entityTag
  732. return c
  733. }
  734. // Context sets the context to be used in this call's Do method. Any
  735. // pending HTTP request will be aborted if the provided context is
  736. // canceled.
  737. func (c *WebResourceListCall) Context(ctx context.Context) *WebResourceListCall {
  738. c.ctx_ = ctx
  739. return c
  740. }
  741. // Header returns an http.Header that can be modified by the caller to
  742. // add HTTP headers to the request.
  743. func (c *WebResourceListCall) Header() http.Header {
  744. if c.header_ == nil {
  745. c.header_ = make(http.Header)
  746. }
  747. return c.header_
  748. }
  749. func (c *WebResourceListCall) doRequest(alt string) (*http.Response, error) {
  750. reqHeaders := make(http.Header)
  751. for k, v := range c.header_ {
  752. reqHeaders[k] = v
  753. }
  754. reqHeaders.Set("User-Agent", c.s.userAgent())
  755. if c.ifNoneMatch_ != "" {
  756. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  757. }
  758. var body io.Reader = nil
  759. c.urlParams_.Set("alt", alt)
  760. urls := googleapi.ResolveRelative(c.s.BasePath, "webResource")
  761. urls += "?" + c.urlParams_.Encode()
  762. req, _ := http.NewRequest("GET", urls, body)
  763. req.Header = reqHeaders
  764. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  765. }
  766. // Do executes the "siteVerification.webResource.list" call.
  767. // Exactly one of *SiteVerificationWebResourceListResponse or error will
  768. // be non-nil. Any non-2xx status code is an error. Response headers are
  769. // in either
  770. // *SiteVerificationWebResourceListResponse.ServerResponse.Header or (if
  771. // a response was returned at all) in error.(*googleapi.Error).Header.
  772. // Use googleapi.IsNotModified to check whether the returned error was
  773. // because http.StatusNotModified was returned.
  774. func (c *WebResourceListCall) Do(opts ...googleapi.CallOption) (*SiteVerificationWebResourceListResponse, error) {
  775. gensupport.SetOptions(c.urlParams_, opts...)
  776. res, err := c.doRequest("json")
  777. if res != nil && res.StatusCode == http.StatusNotModified {
  778. if res.Body != nil {
  779. res.Body.Close()
  780. }
  781. return nil, &googleapi.Error{
  782. Code: res.StatusCode,
  783. Header: res.Header,
  784. }
  785. }
  786. if err != nil {
  787. return nil, err
  788. }
  789. defer googleapi.CloseBody(res)
  790. if err := googleapi.CheckResponse(res); err != nil {
  791. return nil, err
  792. }
  793. ret := &SiteVerificationWebResourceListResponse{
  794. ServerResponse: googleapi.ServerResponse{
  795. Header: res.Header,
  796. HTTPStatusCode: res.StatusCode,
  797. },
  798. }
  799. target := &ret
  800. if err := gensupport.DecodeResponse(target, res); err != nil {
  801. return nil, err
  802. }
  803. return ret, nil
  804. // {
  805. // "description": "Get the list of your verified websites and domains.",
  806. // "httpMethod": "GET",
  807. // "id": "siteVerification.webResource.list",
  808. // "path": "webResource",
  809. // "response": {
  810. // "$ref": "SiteVerificationWebResourceListResponse"
  811. // },
  812. // "scopes": [
  813. // "https://www.googleapis.com/auth/siteverification"
  814. // ]
  815. // }
  816. }
  817. // method id "siteVerification.webResource.patch":
  818. type WebResourcePatchCall struct {
  819. s *Service
  820. id string
  821. siteverificationwebresourceresource *SiteVerificationWebResourceResource
  822. urlParams_ gensupport.URLParams
  823. ctx_ context.Context
  824. header_ http.Header
  825. }
  826. // Patch: Modify the list of owners for your website or domain. This
  827. // method supports patch semantics.
  828. func (r *WebResourceService) Patch(id string, siteverificationwebresourceresource *SiteVerificationWebResourceResource) *WebResourcePatchCall {
  829. c := &WebResourcePatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  830. c.id = id
  831. c.siteverificationwebresourceresource = siteverificationwebresourceresource
  832. return c
  833. }
  834. // Fields allows partial responses to be retrieved. See
  835. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  836. // for more information.
  837. func (c *WebResourcePatchCall) Fields(s ...googleapi.Field) *WebResourcePatchCall {
  838. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  839. return c
  840. }
  841. // Context sets the context to be used in this call's Do method. Any
  842. // pending HTTP request will be aborted if the provided context is
  843. // canceled.
  844. func (c *WebResourcePatchCall) Context(ctx context.Context) *WebResourcePatchCall {
  845. c.ctx_ = ctx
  846. return c
  847. }
  848. // Header returns an http.Header that can be modified by the caller to
  849. // add HTTP headers to the request.
  850. func (c *WebResourcePatchCall) Header() http.Header {
  851. if c.header_ == nil {
  852. c.header_ = make(http.Header)
  853. }
  854. return c.header_
  855. }
  856. func (c *WebResourcePatchCall) doRequest(alt string) (*http.Response, error) {
  857. reqHeaders := make(http.Header)
  858. for k, v := range c.header_ {
  859. reqHeaders[k] = v
  860. }
  861. reqHeaders.Set("User-Agent", c.s.userAgent())
  862. var body io.Reader = nil
  863. body, err := googleapi.WithoutDataWrapper.JSONReader(c.siteverificationwebresourceresource)
  864. if err != nil {
  865. return nil, err
  866. }
  867. reqHeaders.Set("Content-Type", "application/json")
  868. c.urlParams_.Set("alt", alt)
  869. urls := googleapi.ResolveRelative(c.s.BasePath, "webResource/{id}")
  870. urls += "?" + c.urlParams_.Encode()
  871. req, _ := http.NewRequest("PATCH", urls, body)
  872. req.Header = reqHeaders
  873. googleapi.Expand(req.URL, map[string]string{
  874. "id": c.id,
  875. })
  876. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  877. }
  878. // Do executes the "siteVerification.webResource.patch" call.
  879. // Exactly one of *SiteVerificationWebResourceResource or error will be
  880. // non-nil. Any non-2xx status code is an error. Response headers are in
  881. // either *SiteVerificationWebResourceResource.ServerResponse.Header or
  882. // (if a response was returned at all) in
  883. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  884. // whether the returned error was because http.StatusNotModified was
  885. // returned.
  886. func (c *WebResourcePatchCall) Do(opts ...googleapi.CallOption) (*SiteVerificationWebResourceResource, error) {
  887. gensupport.SetOptions(c.urlParams_, opts...)
  888. res, err := c.doRequest("json")
  889. if res != nil && res.StatusCode == http.StatusNotModified {
  890. if res.Body != nil {
  891. res.Body.Close()
  892. }
  893. return nil, &googleapi.Error{
  894. Code: res.StatusCode,
  895. Header: res.Header,
  896. }
  897. }
  898. if err != nil {
  899. return nil, err
  900. }
  901. defer googleapi.CloseBody(res)
  902. if err := googleapi.CheckResponse(res); err != nil {
  903. return nil, err
  904. }
  905. ret := &SiteVerificationWebResourceResource{
  906. ServerResponse: googleapi.ServerResponse{
  907. Header: res.Header,
  908. HTTPStatusCode: res.StatusCode,
  909. },
  910. }
  911. target := &ret
  912. if err := gensupport.DecodeResponse(target, res); err != nil {
  913. return nil, err
  914. }
  915. return ret, nil
  916. // {
  917. // "description": "Modify the list of owners for your website or domain. This method supports patch semantics.",
  918. // "httpMethod": "PATCH",
  919. // "id": "siteVerification.webResource.patch",
  920. // "parameterOrder": [
  921. // "id"
  922. // ],
  923. // "parameters": {
  924. // "id": {
  925. // "description": "The id of a verified site or domain.",
  926. // "location": "path",
  927. // "required": true,
  928. // "type": "string"
  929. // }
  930. // },
  931. // "path": "webResource/{id}",
  932. // "request": {
  933. // "$ref": "SiteVerificationWebResourceResource"
  934. // },
  935. // "response": {
  936. // "$ref": "SiteVerificationWebResourceResource"
  937. // },
  938. // "scopes": [
  939. // "https://www.googleapis.com/auth/siteverification"
  940. // ]
  941. // }
  942. }
  943. // method id "siteVerification.webResource.update":
  944. type WebResourceUpdateCall struct {
  945. s *Service
  946. id string
  947. siteverificationwebresourceresource *SiteVerificationWebResourceResource
  948. urlParams_ gensupport.URLParams
  949. ctx_ context.Context
  950. header_ http.Header
  951. }
  952. // Update: Modify the list of owners for your website or domain.
  953. func (r *WebResourceService) Update(id string, siteverificationwebresourceresource *SiteVerificationWebResourceResource) *WebResourceUpdateCall {
  954. c := &WebResourceUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  955. c.id = id
  956. c.siteverificationwebresourceresource = siteverificationwebresourceresource
  957. return c
  958. }
  959. // Fields allows partial responses to be retrieved. See
  960. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  961. // for more information.
  962. func (c *WebResourceUpdateCall) Fields(s ...googleapi.Field) *WebResourceUpdateCall {
  963. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  964. return c
  965. }
  966. // Context sets the context to be used in this call's Do method. Any
  967. // pending HTTP request will be aborted if the provided context is
  968. // canceled.
  969. func (c *WebResourceUpdateCall) Context(ctx context.Context) *WebResourceUpdateCall {
  970. c.ctx_ = ctx
  971. return c
  972. }
  973. // Header returns an http.Header that can be modified by the caller to
  974. // add HTTP headers to the request.
  975. func (c *WebResourceUpdateCall) Header() http.Header {
  976. if c.header_ == nil {
  977. c.header_ = make(http.Header)
  978. }
  979. return c.header_
  980. }
  981. func (c *WebResourceUpdateCall) doRequest(alt string) (*http.Response, error) {
  982. reqHeaders := make(http.Header)
  983. for k, v := range c.header_ {
  984. reqHeaders[k] = v
  985. }
  986. reqHeaders.Set("User-Agent", c.s.userAgent())
  987. var body io.Reader = nil
  988. body, err := googleapi.WithoutDataWrapper.JSONReader(c.siteverificationwebresourceresource)
  989. if err != nil {
  990. return nil, err
  991. }
  992. reqHeaders.Set("Content-Type", "application/json")
  993. c.urlParams_.Set("alt", alt)
  994. urls := googleapi.ResolveRelative(c.s.BasePath, "webResource/{id}")
  995. urls += "?" + c.urlParams_.Encode()
  996. req, _ := http.NewRequest("PUT", urls, body)
  997. req.Header = reqHeaders
  998. googleapi.Expand(req.URL, map[string]string{
  999. "id": c.id,
  1000. })
  1001. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1002. }
  1003. // Do executes the "siteVerification.webResource.update" call.
  1004. // Exactly one of *SiteVerificationWebResourceResource or error will be
  1005. // non-nil. Any non-2xx status code is an error. Response headers are in
  1006. // either *SiteVerificationWebResourceResource.ServerResponse.Header or
  1007. // (if a response was returned at all) in
  1008. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1009. // whether the returned error was because http.StatusNotModified was
  1010. // returned.
  1011. func (c *WebResourceUpdateCall) Do(opts ...googleapi.CallOption) (*SiteVerificationWebResourceResource, error) {
  1012. gensupport.SetOptions(c.urlParams_, opts...)
  1013. res, err := c.doRequest("json")
  1014. if res != nil && res.StatusCode == http.StatusNotModified {
  1015. if res.Body != nil {
  1016. res.Body.Close()
  1017. }
  1018. return nil, &googleapi.Error{
  1019. Code: res.StatusCode,
  1020. Header: res.Header,
  1021. }
  1022. }
  1023. if err != nil {
  1024. return nil, err
  1025. }
  1026. defer googleapi.CloseBody(res)
  1027. if err := googleapi.CheckResponse(res); err != nil {
  1028. return nil, err
  1029. }
  1030. ret := &SiteVerificationWebResourceResource{
  1031. ServerResponse: googleapi.ServerResponse{
  1032. Header: res.Header,
  1033. HTTPStatusCode: res.StatusCode,
  1034. },
  1035. }
  1036. target := &ret
  1037. if err := gensupport.DecodeResponse(target, res); err != nil {
  1038. return nil, err
  1039. }
  1040. return ret, nil
  1041. // {
  1042. // "description": "Modify the list of owners for your website or domain.",
  1043. // "httpMethod": "PUT",
  1044. // "id": "siteVerification.webResource.update",
  1045. // "parameterOrder": [
  1046. // "id"
  1047. // ],
  1048. // "parameters": {
  1049. // "id": {
  1050. // "description": "The id of a verified site or domain.",
  1051. // "location": "path",
  1052. // "required": true,
  1053. // "type": "string"
  1054. // }
  1055. // },
  1056. // "path": "webResource/{id}",
  1057. // "request": {
  1058. // "$ref": "SiteVerificationWebResourceResource"
  1059. // },
  1060. // "response": {
  1061. // "$ref": "SiteVerificationWebResourceResource"
  1062. // },
  1063. // "scopes": [
  1064. // "https://www.googleapis.com/auth/siteverification"
  1065. // ]
  1066. // }
  1067. }