You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2766 lines
91 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package webmasters provides access to the Search Console API.
  6. //
  7. // For product documentation, see: https://developers.google.com/webmaster-tools/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/webmasters/v3"
  14. // ...
  15. // ctx := context.Background()
  16. // webmastersService, err := webmasters.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // webmastersService, err := webmasters.NewService(ctx, option.WithScopes(webmasters.WebmastersReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // webmastersService, err := webmasters.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // webmastersService, err := webmasters.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package webmasters // import "google.golang.org/api/webmasters/v3"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "webmasters:v3"
  71. const apiName = "webmasters"
  72. const apiVersion = "v3"
  73. const basePath = "https://www.googleapis.com/webmasters/v3/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage Search Console data for your verified sites
  77. WebmastersScope = "https://www.googleapis.com/auth/webmasters"
  78. // View Search Console data for your verified sites
  79. WebmastersReadonlyScope = "https://www.googleapis.com/auth/webmasters.readonly"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/webmasters",
  85. "https://www.googleapis.com/auth/webmasters.readonly",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Searchanalytics = NewSearchanalyticsService(s)
  113. s.Sitemaps = NewSitemapsService(s)
  114. s.Sites = NewSitesService(s)
  115. s.Urlcrawlerrorscounts = NewUrlcrawlerrorscountsService(s)
  116. s.Urlcrawlerrorssamples = NewUrlcrawlerrorssamplesService(s)
  117. return s, nil
  118. }
  119. type Service struct {
  120. client *http.Client
  121. BasePath string // API endpoint base URL
  122. UserAgent string // optional additional User-Agent fragment
  123. Searchanalytics *SearchanalyticsService
  124. Sitemaps *SitemapsService
  125. Sites *SitesService
  126. Urlcrawlerrorscounts *UrlcrawlerrorscountsService
  127. Urlcrawlerrorssamples *UrlcrawlerrorssamplesService
  128. }
  129. func (s *Service) userAgent() string {
  130. if s.UserAgent == "" {
  131. return googleapi.UserAgent
  132. }
  133. return googleapi.UserAgent + " " + s.UserAgent
  134. }
  135. func NewSearchanalyticsService(s *Service) *SearchanalyticsService {
  136. rs := &SearchanalyticsService{s: s}
  137. return rs
  138. }
  139. type SearchanalyticsService struct {
  140. s *Service
  141. }
  142. func NewSitemapsService(s *Service) *SitemapsService {
  143. rs := &SitemapsService{s: s}
  144. return rs
  145. }
  146. type SitemapsService struct {
  147. s *Service
  148. }
  149. func NewSitesService(s *Service) *SitesService {
  150. rs := &SitesService{s: s}
  151. return rs
  152. }
  153. type SitesService struct {
  154. s *Service
  155. }
  156. func NewUrlcrawlerrorscountsService(s *Service) *UrlcrawlerrorscountsService {
  157. rs := &UrlcrawlerrorscountsService{s: s}
  158. return rs
  159. }
  160. type UrlcrawlerrorscountsService struct {
  161. s *Service
  162. }
  163. func NewUrlcrawlerrorssamplesService(s *Service) *UrlcrawlerrorssamplesService {
  164. rs := &UrlcrawlerrorssamplesService{s: s}
  165. return rs
  166. }
  167. type UrlcrawlerrorssamplesService struct {
  168. s *Service
  169. }
  170. type ApiDataRow struct {
  171. Clicks float64 `json:"clicks,omitempty"`
  172. Ctr float64 `json:"ctr,omitempty"`
  173. Impressions float64 `json:"impressions,omitempty"`
  174. Keys []string `json:"keys,omitempty"`
  175. Position float64 `json:"position,omitempty"`
  176. // ForceSendFields is a list of field names (e.g. "Clicks") to
  177. // unconditionally include in API requests. By default, fields with
  178. // empty values are omitted from API requests. However, any non-pointer,
  179. // non-interface field appearing in ForceSendFields will be sent to the
  180. // server regardless of whether the field is empty or not. This may be
  181. // used to include empty fields in Patch requests.
  182. ForceSendFields []string `json:"-"`
  183. // NullFields is a list of field names (e.g. "Clicks") to include in API
  184. // requests with the JSON null value. By default, fields with empty
  185. // values are omitted from API requests. However, any field with an
  186. // empty value appearing in NullFields will be sent to the server as
  187. // null. It is an error if a field in this list has a non-empty value.
  188. // This may be used to include null fields in Patch requests.
  189. NullFields []string `json:"-"`
  190. }
  191. func (s *ApiDataRow) MarshalJSON() ([]byte, error) {
  192. type NoMethod ApiDataRow
  193. raw := NoMethod(*s)
  194. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  195. }
  196. func (s *ApiDataRow) UnmarshalJSON(data []byte) error {
  197. type NoMethod ApiDataRow
  198. var s1 struct {
  199. Clicks gensupport.JSONFloat64 `json:"clicks"`
  200. Ctr gensupport.JSONFloat64 `json:"ctr"`
  201. Impressions gensupport.JSONFloat64 `json:"impressions"`
  202. Position gensupport.JSONFloat64 `json:"position"`
  203. *NoMethod
  204. }
  205. s1.NoMethod = (*NoMethod)(s)
  206. if err := json.Unmarshal(data, &s1); err != nil {
  207. return err
  208. }
  209. s.Clicks = float64(s1.Clicks)
  210. s.Ctr = float64(s1.Ctr)
  211. s.Impressions = float64(s1.Impressions)
  212. s.Position = float64(s1.Position)
  213. return nil
  214. }
  215. type ApiDimensionFilter struct {
  216. Dimension string `json:"dimension,omitempty"`
  217. Expression string `json:"expression,omitempty"`
  218. Operator string `json:"operator,omitempty"`
  219. // ForceSendFields is a list of field names (e.g. "Dimension") to
  220. // unconditionally include in API requests. By default, fields with
  221. // empty values are omitted from API requests. However, any non-pointer,
  222. // non-interface field appearing in ForceSendFields will be sent to the
  223. // server regardless of whether the field is empty or not. This may be
  224. // used to include empty fields in Patch requests.
  225. ForceSendFields []string `json:"-"`
  226. // NullFields is a list of field names (e.g. "Dimension") to include in
  227. // API requests with the JSON null value. By default, fields with empty
  228. // values are omitted from API requests. However, any field with an
  229. // empty value appearing in NullFields will be sent to the server as
  230. // null. It is an error if a field in this list has a non-empty value.
  231. // This may be used to include null fields in Patch requests.
  232. NullFields []string `json:"-"`
  233. }
  234. func (s *ApiDimensionFilter) MarshalJSON() ([]byte, error) {
  235. type NoMethod ApiDimensionFilter
  236. raw := NoMethod(*s)
  237. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  238. }
  239. type ApiDimensionFilterGroup struct {
  240. Filters []*ApiDimensionFilter `json:"filters,omitempty"`
  241. GroupType string `json:"groupType,omitempty"`
  242. // ForceSendFields is a list of field names (e.g. "Filters") to
  243. // unconditionally include in API requests. By default, fields with
  244. // empty values are omitted from API requests. However, any non-pointer,
  245. // non-interface field appearing in ForceSendFields will be sent to the
  246. // server regardless of whether the field is empty or not. This may be
  247. // used to include empty fields in Patch requests.
  248. ForceSendFields []string `json:"-"`
  249. // NullFields is a list of field names (e.g. "Filters") to include in
  250. // API requests with the JSON null value. By default, fields with empty
  251. // values are omitted from API requests. However, any field with an
  252. // empty value appearing in NullFields will be sent to the server as
  253. // null. It is an error if a field in this list has a non-empty value.
  254. // This may be used to include null fields in Patch requests.
  255. NullFields []string `json:"-"`
  256. }
  257. func (s *ApiDimensionFilterGroup) MarshalJSON() ([]byte, error) {
  258. type NoMethod ApiDimensionFilterGroup
  259. raw := NoMethod(*s)
  260. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  261. }
  262. type SearchAnalyticsQueryRequest struct {
  263. // AggregationType: [Optional; Default is "auto"] How data is
  264. // aggregated. If aggregated by property, all data for the same property
  265. // is aggregated; if aggregated by page, all data is aggregated by
  266. // canonical URI. If you filter or group by page, choose AUTO; otherwise
  267. // you can aggregate either by property or by page, depending on how you
  268. // want your data calculated; see the help documentation to learn how
  269. // data is calculated differently by site versus by page.
  270. //
  271. // Note: If you group or filter by page, you cannot aggregate by
  272. // property.
  273. //
  274. // If you specify any value other than AUTO, the aggregation type in the
  275. // result will match the requested type, or if you request an invalid
  276. // type, you will get an error. The API will never change your
  277. // aggregation type if the requested type is invalid.
  278. AggregationType string `json:"aggregationType,omitempty"`
  279. // DimensionFilterGroups: [Optional] Zero or more filters to apply to
  280. // the dimension grouping values; for example, 'query contains "buy"' to
  281. // see only data where the query string contains the substring "buy"
  282. // (not case-sensitive). You can filter by a dimension without grouping
  283. // by it.
  284. DimensionFilterGroups []*ApiDimensionFilterGroup `json:"dimensionFilterGroups,omitempty"`
  285. // Dimensions: [Optional] Zero or more dimensions to group results by.
  286. // Dimensions are the group-by values in the Search Analytics page.
  287. // Dimensions are combined to create a unique row key for each row.
  288. // Results are grouped in the order that you supply these dimensions.
  289. Dimensions []string `json:"dimensions,omitempty"`
  290. // EndDate: [Required] End date of the requested date range, in
  291. // YYYY-MM-DD format, in PST (UTC - 8:00). Must be greater than or equal
  292. // to the start date. This value is included in the range.
  293. EndDate string `json:"endDate,omitempty"`
  294. // RowLimit: [Optional; Default is 1000] The maximum number of rows to
  295. // return. Must be a number from 1 to 5,000 (inclusive).
  296. RowLimit int64 `json:"rowLimit,omitempty"`
  297. // SearchType: [Optional; Default is "web"] The search type to filter
  298. // for.
  299. SearchType string `json:"searchType,omitempty"`
  300. // StartDate: [Required] Start date of the requested date range, in
  301. // YYYY-MM-DD format, in PST time (UTC - 8:00). Must be less than or
  302. // equal to the end date. This value is included in the range.
  303. StartDate string `json:"startDate,omitempty"`
  304. // StartRow: [Optional; Default is 0] Zero-based index of the first row
  305. // in the response. Must be a non-negative number.
  306. StartRow int64 `json:"startRow,omitempty"`
  307. // ForceSendFields is a list of field names (e.g. "AggregationType") to
  308. // unconditionally include in API requests. By default, fields with
  309. // empty values are omitted from API requests. However, any non-pointer,
  310. // non-interface field appearing in ForceSendFields will be sent to the
  311. // server regardless of whether the field is empty or not. This may be
  312. // used to include empty fields in Patch requests.
  313. ForceSendFields []string `json:"-"`
  314. // NullFields is a list of field names (e.g. "AggregationType") to
  315. // include in API requests with the JSON null value. By default, fields
  316. // with empty values are omitted from API requests. However, any field
  317. // with an empty value appearing in NullFields will be sent to the
  318. // server as null. It is an error if a field in this list has a
  319. // non-empty value. This may be used to include null fields in Patch
  320. // requests.
  321. NullFields []string `json:"-"`
  322. }
  323. func (s *SearchAnalyticsQueryRequest) MarshalJSON() ([]byte, error) {
  324. type NoMethod SearchAnalyticsQueryRequest
  325. raw := NoMethod(*s)
  326. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  327. }
  328. // SearchAnalyticsQueryResponse: A list of rows, one per result, grouped
  329. // by key. Metrics in each row are aggregated for all data grouped by
  330. // that key either by page or property, as specified by the aggregation
  331. // type parameter.
  332. type SearchAnalyticsQueryResponse struct {
  333. // ResponseAggregationType: How the results were aggregated.
  334. ResponseAggregationType string `json:"responseAggregationType,omitempty"`
  335. // Rows: A list of rows grouped by the key values in the order given in
  336. // the query.
  337. Rows []*ApiDataRow `json:"rows,omitempty"`
  338. // ServerResponse contains the HTTP response code and headers from the
  339. // server.
  340. googleapi.ServerResponse `json:"-"`
  341. // ForceSendFields is a list of field names (e.g.
  342. // "ResponseAggregationType") to unconditionally include in API
  343. // requests. By default, fields with empty values are omitted from API
  344. // requests. However, any non-pointer, non-interface field appearing in
  345. // ForceSendFields will be sent to the server regardless of whether the
  346. // field is empty or not. This may be used to include empty fields in
  347. // Patch requests.
  348. ForceSendFields []string `json:"-"`
  349. // NullFields is a list of field names (e.g. "ResponseAggregationType")
  350. // to include in API requests with the JSON null value. By default,
  351. // fields with empty values are omitted from API requests. However, any
  352. // field with an empty value appearing in NullFields will be sent to the
  353. // server as null. It is an error if a field in this list has a
  354. // non-empty value. This may be used to include null fields in Patch
  355. // requests.
  356. NullFields []string `json:"-"`
  357. }
  358. func (s *SearchAnalyticsQueryResponse) MarshalJSON() ([]byte, error) {
  359. type NoMethod SearchAnalyticsQueryResponse
  360. raw := NoMethod(*s)
  361. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  362. }
  363. // SitemapsListResponse: List of sitemaps.
  364. type SitemapsListResponse struct {
  365. // Sitemap: Contains detailed information about a specific URL submitted
  366. // as a sitemap.
  367. Sitemap []*WmxSitemap `json:"sitemap,omitempty"`
  368. // ServerResponse contains the HTTP response code and headers from the
  369. // server.
  370. googleapi.ServerResponse `json:"-"`
  371. // ForceSendFields is a list of field names (e.g. "Sitemap") to
  372. // unconditionally include in API requests. By default, fields with
  373. // empty values are omitted from API requests. However, any non-pointer,
  374. // non-interface field appearing in ForceSendFields will be sent to the
  375. // server regardless of whether the field is empty or not. This may be
  376. // used to include empty fields in Patch requests.
  377. ForceSendFields []string `json:"-"`
  378. // NullFields is a list of field names (e.g. "Sitemap") to include in
  379. // API requests with the JSON null value. By default, fields with empty
  380. // values are omitted from API requests. However, any field with an
  381. // empty value appearing in NullFields will be sent to the server as
  382. // null. It is an error if a field in this list has a non-empty value.
  383. // This may be used to include null fields in Patch requests.
  384. NullFields []string `json:"-"`
  385. }
  386. func (s *SitemapsListResponse) MarshalJSON() ([]byte, error) {
  387. type NoMethod SitemapsListResponse
  388. raw := NoMethod(*s)
  389. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  390. }
  391. // SitesListResponse: List of sites with access level information.
  392. type SitesListResponse struct {
  393. // SiteEntry: Contains permission level information about a Search
  394. // Console site. For more information, see Permissions in Search
  395. // Console.
  396. SiteEntry []*WmxSite `json:"siteEntry,omitempty"`
  397. // ServerResponse contains the HTTP response code and headers from the
  398. // server.
  399. googleapi.ServerResponse `json:"-"`
  400. // ForceSendFields is a list of field names (e.g. "SiteEntry") to
  401. // unconditionally include in API requests. By default, fields with
  402. // empty values are omitted from API requests. However, any non-pointer,
  403. // non-interface field appearing in ForceSendFields will be sent to the
  404. // server regardless of whether the field is empty or not. This may be
  405. // used to include empty fields in Patch requests.
  406. ForceSendFields []string `json:"-"`
  407. // NullFields is a list of field names (e.g. "SiteEntry") to include in
  408. // API requests with the JSON null value. By default, fields with empty
  409. // values are omitted from API requests. However, any field with an
  410. // empty value appearing in NullFields will be sent to the server as
  411. // null. It is an error if a field in this list has a non-empty value.
  412. // This may be used to include null fields in Patch requests.
  413. NullFields []string `json:"-"`
  414. }
  415. func (s *SitesListResponse) MarshalJSON() ([]byte, error) {
  416. type NoMethod SitesListResponse
  417. raw := NoMethod(*s)
  418. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  419. }
  420. // UrlCrawlErrorCount: An entry in a URL crawl errors time series.
  421. type UrlCrawlErrorCount struct {
  422. // Count: The error count at the given timestamp.
  423. Count int64 `json:"count,omitempty,string"`
  424. // Timestamp: The date and time when the crawl attempt took place, in
  425. // RFC 3339 format.
  426. Timestamp string `json:"timestamp,omitempty"`
  427. // ForceSendFields is a list of field names (e.g. "Count") to
  428. // unconditionally include in API requests. By default, fields with
  429. // empty values are omitted from API requests. However, any non-pointer,
  430. // non-interface field appearing in ForceSendFields will be sent to the
  431. // server regardless of whether the field is empty or not. This may be
  432. // used to include empty fields in Patch requests.
  433. ForceSendFields []string `json:"-"`
  434. // NullFields is a list of field names (e.g. "Count") to include in API
  435. // requests with the JSON null value. By default, fields with empty
  436. // values are omitted from API requests. However, any field with an
  437. // empty value appearing in NullFields will be sent to the server as
  438. // null. It is an error if a field in this list has a non-empty value.
  439. // This may be used to include null fields in Patch requests.
  440. NullFields []string `json:"-"`
  441. }
  442. func (s *UrlCrawlErrorCount) MarshalJSON() ([]byte, error) {
  443. type NoMethod UrlCrawlErrorCount
  444. raw := NoMethod(*s)
  445. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  446. }
  447. // UrlCrawlErrorCountsPerType: Number of errors per day for a specific
  448. // error type (defined by platform and category).
  449. type UrlCrawlErrorCountsPerType struct {
  450. // Category: The crawl error type.
  451. Category string `json:"category,omitempty"`
  452. // Entries: The error count entries time series.
  453. Entries []*UrlCrawlErrorCount `json:"entries,omitempty"`
  454. // Platform: The general type of Googlebot that made the request (see
  455. // list of Googlebot user-agents for the user-agents used).
  456. Platform string `json:"platform,omitempty"`
  457. // ForceSendFields is a list of field names (e.g. "Category") to
  458. // unconditionally include in API requests. By default, fields with
  459. // empty values are omitted from API requests. However, any non-pointer,
  460. // non-interface field appearing in ForceSendFields will be sent to the
  461. // server regardless of whether the field is empty or not. This may be
  462. // used to include empty fields in Patch requests.
  463. ForceSendFields []string `json:"-"`
  464. // NullFields is a list of field names (e.g. "Category") to include in
  465. // API requests with the JSON null value. By default, fields with empty
  466. // values are omitted from API requests. However, any field with an
  467. // empty value appearing in NullFields will be sent to the server as
  468. // null. It is an error if a field in this list has a non-empty value.
  469. // This may be used to include null fields in Patch requests.
  470. NullFields []string `json:"-"`
  471. }
  472. func (s *UrlCrawlErrorCountsPerType) MarshalJSON() ([]byte, error) {
  473. type NoMethod UrlCrawlErrorCountsPerType
  474. raw := NoMethod(*s)
  475. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  476. }
  477. // UrlCrawlErrorsCountsQueryResponse: A time series of the number of URL
  478. // crawl errors per error category and platform.
  479. type UrlCrawlErrorsCountsQueryResponse struct {
  480. // CountPerTypes: The time series of the number of URL crawl errors per
  481. // error category and platform.
  482. CountPerTypes []*UrlCrawlErrorCountsPerType `json:"countPerTypes,omitempty"`
  483. // ServerResponse contains the HTTP response code and headers from the
  484. // server.
  485. googleapi.ServerResponse `json:"-"`
  486. // ForceSendFields is a list of field names (e.g. "CountPerTypes") to
  487. // unconditionally include in API requests. By default, fields with
  488. // empty values are omitted from API requests. However, any non-pointer,
  489. // non-interface field appearing in ForceSendFields will be sent to the
  490. // server regardless of whether the field is empty or not. This may be
  491. // used to include empty fields in Patch requests.
  492. ForceSendFields []string `json:"-"`
  493. // NullFields is a list of field names (e.g. "CountPerTypes") to include
  494. // in API requests with the JSON null value. By default, fields with
  495. // empty values are omitted from API requests. However, any field with
  496. // an empty value appearing in NullFields will be sent to the server as
  497. // null. It is an error if a field in this list has a non-empty value.
  498. // This may be used to include null fields in Patch requests.
  499. NullFields []string `json:"-"`
  500. }
  501. func (s *UrlCrawlErrorsCountsQueryResponse) MarshalJSON() ([]byte, error) {
  502. type NoMethod UrlCrawlErrorsCountsQueryResponse
  503. raw := NoMethod(*s)
  504. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  505. }
  506. // UrlCrawlErrorsSample: Contains information about specific crawl
  507. // errors.
  508. type UrlCrawlErrorsSample struct {
  509. // FirstDetected: The time the error was first detected, in RFC 3339
  510. // format.
  511. FirstDetected string `json:"first_detected,omitempty"`
  512. // LastCrawled: The time when the URL was last crawled, in RFC 3339
  513. // format.
  514. LastCrawled string `json:"last_crawled,omitempty"`
  515. // PageUrl: The URL of an error, relative to the site.
  516. PageUrl string `json:"pageUrl,omitempty"`
  517. // ResponseCode: The HTTP response code, if any.
  518. ResponseCode int64 `json:"responseCode,omitempty"`
  519. // UrlDetails: Additional details about the URL, set only when calling
  520. // get().
  521. UrlDetails *UrlSampleDetails `json:"urlDetails,omitempty"`
  522. // ServerResponse contains the HTTP response code and headers from the
  523. // server.
  524. googleapi.ServerResponse `json:"-"`
  525. // ForceSendFields is a list of field names (e.g. "FirstDetected") to
  526. // unconditionally include in API requests. By default, fields with
  527. // empty values are omitted from API requests. However, any non-pointer,
  528. // non-interface field appearing in ForceSendFields will be sent to the
  529. // server regardless of whether the field is empty or not. This may be
  530. // used to include empty fields in Patch requests.
  531. ForceSendFields []string `json:"-"`
  532. // NullFields is a list of field names (e.g. "FirstDetected") to include
  533. // in API requests with the JSON null value. By default, fields with
  534. // empty values are omitted from API requests. However, any field with
  535. // an empty value appearing in NullFields will be sent to the server as
  536. // null. It is an error if a field in this list has a non-empty value.
  537. // This may be used to include null fields in Patch requests.
  538. NullFields []string `json:"-"`
  539. }
  540. func (s *UrlCrawlErrorsSample) MarshalJSON() ([]byte, error) {
  541. type NoMethod UrlCrawlErrorsSample
  542. raw := NoMethod(*s)
  543. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  544. }
  545. // UrlCrawlErrorsSamplesListResponse: List of crawl error samples.
  546. type UrlCrawlErrorsSamplesListResponse struct {
  547. // UrlCrawlErrorSample: Information about the sample URL and its crawl
  548. // error.
  549. UrlCrawlErrorSample []*UrlCrawlErrorsSample `json:"urlCrawlErrorSample,omitempty"`
  550. // ServerResponse contains the HTTP response code and headers from the
  551. // server.
  552. googleapi.ServerResponse `json:"-"`
  553. // ForceSendFields is a list of field names (e.g. "UrlCrawlErrorSample")
  554. // to unconditionally include in API requests. By default, fields with
  555. // empty values are omitted from API requests. However, any non-pointer,
  556. // non-interface field appearing in ForceSendFields will be sent to the
  557. // server regardless of whether the field is empty or not. This may be
  558. // used to include empty fields in Patch requests.
  559. ForceSendFields []string `json:"-"`
  560. // NullFields is a list of field names (e.g. "UrlCrawlErrorSample") to
  561. // include in API requests with the JSON null value. By default, fields
  562. // with empty values are omitted from API requests. However, any field
  563. // with an empty value appearing in NullFields will be sent to the
  564. // server as null. It is an error if a field in this list has a
  565. // non-empty value. This may be used to include null fields in Patch
  566. // requests.
  567. NullFields []string `json:"-"`
  568. }
  569. func (s *UrlCrawlErrorsSamplesListResponse) MarshalJSON() ([]byte, error) {
  570. type NoMethod UrlCrawlErrorsSamplesListResponse
  571. raw := NoMethod(*s)
  572. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  573. }
  574. // UrlSampleDetails: Additional details about the URL, set only when
  575. // calling get().
  576. type UrlSampleDetails struct {
  577. // ContainingSitemaps: List of sitemaps pointing at this URL.
  578. ContainingSitemaps []string `json:"containingSitemaps,omitempty"`
  579. // LinkedFromUrls: A sample set of URLs linking to this URL.
  580. LinkedFromUrls []string `json:"linkedFromUrls,omitempty"`
  581. // ForceSendFields is a list of field names (e.g. "ContainingSitemaps")
  582. // to unconditionally include in API requests. By default, fields with
  583. // empty values are omitted from API requests. However, any non-pointer,
  584. // non-interface field appearing in ForceSendFields will be sent to the
  585. // server regardless of whether the field is empty or not. This may be
  586. // used to include empty fields in Patch requests.
  587. ForceSendFields []string `json:"-"`
  588. // NullFields is a list of field names (e.g. "ContainingSitemaps") to
  589. // include in API requests with the JSON null value. By default, fields
  590. // with empty values are omitted from API requests. However, any field
  591. // with an empty value appearing in NullFields will be sent to the
  592. // server as null. It is an error if a field in this list has a
  593. // non-empty value. This may be used to include null fields in Patch
  594. // requests.
  595. NullFields []string `json:"-"`
  596. }
  597. func (s *UrlSampleDetails) MarshalJSON() ([]byte, error) {
  598. type NoMethod UrlSampleDetails
  599. raw := NoMethod(*s)
  600. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  601. }
  602. // WmxSite: Contains permission level information about a Search Console
  603. // site. For more information, see Permissions in Search Console.
  604. type WmxSite struct {
  605. // PermissionLevel: The user's permission level for the site.
  606. PermissionLevel string `json:"permissionLevel,omitempty"`
  607. // SiteUrl: The URL of the site.
  608. SiteUrl string `json:"siteUrl,omitempty"`
  609. // ServerResponse contains the HTTP response code and headers from the
  610. // server.
  611. googleapi.ServerResponse `json:"-"`
  612. // ForceSendFields is a list of field names (e.g. "PermissionLevel") to
  613. // unconditionally include in API requests. By default, fields with
  614. // empty values are omitted from API requests. However, any non-pointer,
  615. // non-interface field appearing in ForceSendFields will be sent to the
  616. // server regardless of whether the field is empty or not. This may be
  617. // used to include empty fields in Patch requests.
  618. ForceSendFields []string `json:"-"`
  619. // NullFields is a list of field names (e.g. "PermissionLevel") to
  620. // include in API requests with the JSON null value. By default, fields
  621. // with empty values are omitted from API requests. However, any field
  622. // with an empty value appearing in NullFields will be sent to the
  623. // server as null. It is an error if a field in this list has a
  624. // non-empty value. This may be used to include null fields in Patch
  625. // requests.
  626. NullFields []string `json:"-"`
  627. }
  628. func (s *WmxSite) MarshalJSON() ([]byte, error) {
  629. type NoMethod WmxSite
  630. raw := NoMethod(*s)
  631. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  632. }
  633. // WmxSitemap: Contains detailed information about a specific URL
  634. // submitted as a sitemap.
  635. type WmxSitemap struct {
  636. // Contents: The various content types in the sitemap.
  637. Contents []*WmxSitemapContent `json:"contents,omitempty"`
  638. // Errors: Number of errors in the sitemap. These are issues with the
  639. // sitemap itself that need to be fixed before it can be processed
  640. // correctly.
  641. Errors int64 `json:"errors,omitempty,string"`
  642. // IsPending: If true, the sitemap has not been processed.
  643. IsPending bool `json:"isPending,omitempty"`
  644. // IsSitemapsIndex: If true, the sitemap is a collection of sitemaps.
  645. IsSitemapsIndex bool `json:"isSitemapsIndex,omitempty"`
  646. // LastDownloaded: Date & time in which this sitemap was last
  647. // downloaded. Date format is in RFC 3339 format (yyyy-mm-dd).
  648. LastDownloaded string `json:"lastDownloaded,omitempty"`
  649. // LastSubmitted: Date & time in which this sitemap was submitted. Date
  650. // format is in RFC 3339 format (yyyy-mm-dd).
  651. LastSubmitted string `json:"lastSubmitted,omitempty"`
  652. // Path: The url of the sitemap.
  653. Path string `json:"path,omitempty"`
  654. // Type: The type of the sitemap. For example: rssFeed.
  655. Type string `json:"type,omitempty"`
  656. // Warnings: Number of warnings for the sitemap. These are generally
  657. // non-critical issues with URLs in the sitemaps.
  658. Warnings int64 `json:"warnings,omitempty,string"`
  659. // ServerResponse contains the HTTP response code and headers from the
  660. // server.
  661. googleapi.ServerResponse `json:"-"`
  662. // ForceSendFields is a list of field names (e.g. "Contents") to
  663. // unconditionally include in API requests. By default, fields with
  664. // empty values are omitted from API requests. However, any non-pointer,
  665. // non-interface field appearing in ForceSendFields will be sent to the
  666. // server regardless of whether the field is empty or not. This may be
  667. // used to include empty fields in Patch requests.
  668. ForceSendFields []string `json:"-"`
  669. // NullFields is a list of field names (e.g. "Contents") to include in
  670. // API requests with the JSON null value. By default, fields with empty
  671. // values are omitted from API requests. However, any field with an
  672. // empty value appearing in NullFields will be sent to the server as
  673. // null. It is an error if a field in this list has a non-empty value.
  674. // This may be used to include null fields in Patch requests.
  675. NullFields []string `json:"-"`
  676. }
  677. func (s *WmxSitemap) MarshalJSON() ([]byte, error) {
  678. type NoMethod WmxSitemap
  679. raw := NoMethod(*s)
  680. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  681. }
  682. // WmxSitemapContent: Information about the various content types in the
  683. // sitemap.
  684. type WmxSitemapContent struct {
  685. // Indexed: The number of URLs from the sitemap that were indexed (of
  686. // the content type).
  687. Indexed int64 `json:"indexed,omitempty,string"`
  688. // Submitted: The number of URLs in the sitemap (of the content type).
  689. Submitted int64 `json:"submitted,omitempty,string"`
  690. // Type: The specific type of content in this sitemap. For example: web.
  691. Type string `json:"type,omitempty"`
  692. // ForceSendFields is a list of field names (e.g. "Indexed") to
  693. // unconditionally include in API requests. By default, fields with
  694. // empty values are omitted from API requests. However, any non-pointer,
  695. // non-interface field appearing in ForceSendFields will be sent to the
  696. // server regardless of whether the field is empty or not. This may be
  697. // used to include empty fields in Patch requests.
  698. ForceSendFields []string `json:"-"`
  699. // NullFields is a list of field names (e.g. "Indexed") to include in
  700. // API requests with the JSON null value. By default, fields with empty
  701. // values are omitted from API requests. However, any field with an
  702. // empty value appearing in NullFields will be sent to the server as
  703. // null. It is an error if a field in this list has a non-empty value.
  704. // This may be used to include null fields in Patch requests.
  705. NullFields []string `json:"-"`
  706. }
  707. func (s *WmxSitemapContent) MarshalJSON() ([]byte, error) {
  708. type NoMethod WmxSitemapContent
  709. raw := NoMethod(*s)
  710. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  711. }
  712. // method id "webmasters.searchanalytics.query":
  713. type SearchanalyticsQueryCall struct {
  714. s *Service
  715. siteUrl string
  716. searchanalyticsqueryrequest *SearchAnalyticsQueryRequest
  717. urlParams_ gensupport.URLParams
  718. ctx_ context.Context
  719. header_ http.Header
  720. }
  721. // Query: Query your data with filters and parameters that you define.
  722. // Returns zero or more rows grouped by the row keys that you define.
  723. // You must define a date range of one or more days.
  724. //
  725. // When date is one of the group by values, any days without data are
  726. // omitted from the result list. If you need to know which days have
  727. // data, issue a broad date range query grouped by date for any metric,
  728. // and see which day rows are returned.
  729. func (r *SearchanalyticsService) Query(siteUrl string, searchanalyticsqueryrequest *SearchAnalyticsQueryRequest) *SearchanalyticsQueryCall {
  730. c := &SearchanalyticsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  731. c.siteUrl = siteUrl
  732. c.searchanalyticsqueryrequest = searchanalyticsqueryrequest
  733. return c
  734. }
  735. // Fields allows partial responses to be retrieved. See
  736. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  737. // for more information.
  738. func (c *SearchanalyticsQueryCall) Fields(s ...googleapi.Field) *SearchanalyticsQueryCall {
  739. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  740. return c
  741. }
  742. // Context sets the context to be used in this call's Do method. Any
  743. // pending HTTP request will be aborted if the provided context is
  744. // canceled.
  745. func (c *SearchanalyticsQueryCall) Context(ctx context.Context) *SearchanalyticsQueryCall {
  746. c.ctx_ = ctx
  747. return c
  748. }
  749. // Header returns an http.Header that can be modified by the caller to
  750. // add HTTP headers to the request.
  751. func (c *SearchanalyticsQueryCall) Header() http.Header {
  752. if c.header_ == nil {
  753. c.header_ = make(http.Header)
  754. }
  755. return c.header_
  756. }
  757. func (c *SearchanalyticsQueryCall) doRequest(alt string) (*http.Response, error) {
  758. reqHeaders := make(http.Header)
  759. for k, v := range c.header_ {
  760. reqHeaders[k] = v
  761. }
  762. reqHeaders.Set("User-Agent", c.s.userAgent())
  763. var body io.Reader = nil
  764. body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchanalyticsqueryrequest)
  765. if err != nil {
  766. return nil, err
  767. }
  768. reqHeaders.Set("Content-Type", "application/json")
  769. c.urlParams_.Set("alt", alt)
  770. c.urlParams_.Set("prettyPrint", "false")
  771. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/searchAnalytics/query")
  772. urls += "?" + c.urlParams_.Encode()
  773. req, err := http.NewRequest("POST", urls, body)
  774. if err != nil {
  775. return nil, err
  776. }
  777. req.Header = reqHeaders
  778. googleapi.Expand(req.URL, map[string]string{
  779. "siteUrl": c.siteUrl,
  780. })
  781. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  782. }
  783. // Do executes the "webmasters.searchanalytics.query" call.
  784. // Exactly one of *SearchAnalyticsQueryResponse or error will be
  785. // non-nil. Any non-2xx status code is an error. Response headers are in
  786. // either *SearchAnalyticsQueryResponse.ServerResponse.Header or (if a
  787. // response was returned at all) in error.(*googleapi.Error).Header. Use
  788. // googleapi.IsNotModified to check whether the returned error was
  789. // because http.StatusNotModified was returned.
  790. func (c *SearchanalyticsQueryCall) Do(opts ...googleapi.CallOption) (*SearchAnalyticsQueryResponse, error) {
  791. gensupport.SetOptions(c.urlParams_, opts...)
  792. res, err := c.doRequest("json")
  793. if res != nil && res.StatusCode == http.StatusNotModified {
  794. if res.Body != nil {
  795. res.Body.Close()
  796. }
  797. return nil, &googleapi.Error{
  798. Code: res.StatusCode,
  799. Header: res.Header,
  800. }
  801. }
  802. if err != nil {
  803. return nil, err
  804. }
  805. defer googleapi.CloseBody(res)
  806. if err := googleapi.CheckResponse(res); err != nil {
  807. return nil, err
  808. }
  809. ret := &SearchAnalyticsQueryResponse{
  810. ServerResponse: googleapi.ServerResponse{
  811. Header: res.Header,
  812. HTTPStatusCode: res.StatusCode,
  813. },
  814. }
  815. target := &ret
  816. if err := gensupport.DecodeResponse(target, res); err != nil {
  817. return nil, err
  818. }
  819. return ret, nil
  820. // {
  821. // "description": "Query your data with filters and parameters that you define. Returns zero or more rows grouped by the row keys that you define. You must define a date range of one or more days.\n\nWhen date is one of the group by values, any days without data are omitted from the result list. If you need to know which days have data, issue a broad date range query grouped by date for any metric, and see which day rows are returned.",
  822. // "httpMethod": "POST",
  823. // "id": "webmasters.searchanalytics.query",
  824. // "parameterOrder": [
  825. // "siteUrl"
  826. // ],
  827. // "parameters": {
  828. // "siteUrl": {
  829. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  830. // "location": "path",
  831. // "required": true,
  832. // "type": "string"
  833. // }
  834. // },
  835. // "path": "sites/{siteUrl}/searchAnalytics/query",
  836. // "request": {
  837. // "$ref": "SearchAnalyticsQueryRequest"
  838. // },
  839. // "response": {
  840. // "$ref": "SearchAnalyticsQueryResponse"
  841. // },
  842. // "scopes": [
  843. // "https://www.googleapis.com/auth/webmasters",
  844. // "https://www.googleapis.com/auth/webmasters.readonly"
  845. // ]
  846. // }
  847. }
  848. // method id "webmasters.sitemaps.delete":
  849. type SitemapsDeleteCall struct {
  850. s *Service
  851. siteUrl string
  852. feedpath string
  853. urlParams_ gensupport.URLParams
  854. ctx_ context.Context
  855. header_ http.Header
  856. }
  857. // Delete: Deletes a sitemap from this site.
  858. func (r *SitemapsService) Delete(siteUrl string, feedpath string) *SitemapsDeleteCall {
  859. c := &SitemapsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  860. c.siteUrl = siteUrl
  861. c.feedpath = feedpath
  862. return c
  863. }
  864. // Fields allows partial responses to be retrieved. See
  865. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  866. // for more information.
  867. func (c *SitemapsDeleteCall) Fields(s ...googleapi.Field) *SitemapsDeleteCall {
  868. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  869. return c
  870. }
  871. // Context sets the context to be used in this call's Do method. Any
  872. // pending HTTP request will be aborted if the provided context is
  873. // canceled.
  874. func (c *SitemapsDeleteCall) Context(ctx context.Context) *SitemapsDeleteCall {
  875. c.ctx_ = ctx
  876. return c
  877. }
  878. // Header returns an http.Header that can be modified by the caller to
  879. // add HTTP headers to the request.
  880. func (c *SitemapsDeleteCall) Header() http.Header {
  881. if c.header_ == nil {
  882. c.header_ = make(http.Header)
  883. }
  884. return c.header_
  885. }
  886. func (c *SitemapsDeleteCall) doRequest(alt string) (*http.Response, error) {
  887. reqHeaders := make(http.Header)
  888. for k, v := range c.header_ {
  889. reqHeaders[k] = v
  890. }
  891. reqHeaders.Set("User-Agent", c.s.userAgent())
  892. var body io.Reader = nil
  893. c.urlParams_.Set("alt", alt)
  894. c.urlParams_.Set("prettyPrint", "false")
  895. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}")
  896. urls += "?" + c.urlParams_.Encode()
  897. req, err := http.NewRequest("DELETE", urls, body)
  898. if err != nil {
  899. return nil, err
  900. }
  901. req.Header = reqHeaders
  902. googleapi.Expand(req.URL, map[string]string{
  903. "siteUrl": c.siteUrl,
  904. "feedpath": c.feedpath,
  905. })
  906. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  907. }
  908. // Do executes the "webmasters.sitemaps.delete" call.
  909. func (c *SitemapsDeleteCall) Do(opts ...googleapi.CallOption) error {
  910. gensupport.SetOptions(c.urlParams_, opts...)
  911. res, err := c.doRequest("json")
  912. if err != nil {
  913. return err
  914. }
  915. defer googleapi.CloseBody(res)
  916. if err := googleapi.CheckResponse(res); err != nil {
  917. return err
  918. }
  919. return nil
  920. // {
  921. // "description": "Deletes a sitemap from this site.",
  922. // "httpMethod": "DELETE",
  923. // "id": "webmasters.sitemaps.delete",
  924. // "parameterOrder": [
  925. // "siteUrl",
  926. // "feedpath"
  927. // ],
  928. // "parameters": {
  929. // "feedpath": {
  930. // "description": "The URL of the actual sitemap. For example: http://www.example.com/sitemap.xml",
  931. // "location": "path",
  932. // "required": true,
  933. // "type": "string"
  934. // },
  935. // "siteUrl": {
  936. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  937. // "location": "path",
  938. // "required": true,
  939. // "type": "string"
  940. // }
  941. // },
  942. // "path": "sites/{siteUrl}/sitemaps/{feedpath}",
  943. // "scopes": [
  944. // "https://www.googleapis.com/auth/webmasters"
  945. // ]
  946. // }
  947. }
  948. // method id "webmasters.sitemaps.get":
  949. type SitemapsGetCall struct {
  950. s *Service
  951. siteUrl string
  952. feedpath string
  953. urlParams_ gensupport.URLParams
  954. ifNoneMatch_ string
  955. ctx_ context.Context
  956. header_ http.Header
  957. }
  958. // Get: Retrieves information about a specific sitemap.
  959. func (r *SitemapsService) Get(siteUrl string, feedpath string) *SitemapsGetCall {
  960. c := &SitemapsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  961. c.siteUrl = siteUrl
  962. c.feedpath = feedpath
  963. return c
  964. }
  965. // Fields allows partial responses to be retrieved. See
  966. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  967. // for more information.
  968. func (c *SitemapsGetCall) Fields(s ...googleapi.Field) *SitemapsGetCall {
  969. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  970. return c
  971. }
  972. // IfNoneMatch sets the optional parameter which makes the operation
  973. // fail if the object's ETag matches the given value. This is useful for
  974. // getting updates only after the object has changed since the last
  975. // request. Use googleapi.IsNotModified to check whether the response
  976. // error from Do is the result of In-None-Match.
  977. func (c *SitemapsGetCall) IfNoneMatch(entityTag string) *SitemapsGetCall {
  978. c.ifNoneMatch_ = entityTag
  979. return c
  980. }
  981. // Context sets the context to be used in this call's Do method. Any
  982. // pending HTTP request will be aborted if the provided context is
  983. // canceled.
  984. func (c *SitemapsGetCall) Context(ctx context.Context) *SitemapsGetCall {
  985. c.ctx_ = ctx
  986. return c
  987. }
  988. // Header returns an http.Header that can be modified by the caller to
  989. // add HTTP headers to the request.
  990. func (c *SitemapsGetCall) Header() http.Header {
  991. if c.header_ == nil {
  992. c.header_ = make(http.Header)
  993. }
  994. return c.header_
  995. }
  996. func (c *SitemapsGetCall) doRequest(alt string) (*http.Response, error) {
  997. reqHeaders := make(http.Header)
  998. for k, v := range c.header_ {
  999. reqHeaders[k] = v
  1000. }
  1001. reqHeaders.Set("User-Agent", c.s.userAgent())
  1002. if c.ifNoneMatch_ != "" {
  1003. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1004. }
  1005. var body io.Reader = nil
  1006. c.urlParams_.Set("alt", alt)
  1007. c.urlParams_.Set("prettyPrint", "false")
  1008. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}")
  1009. urls += "?" + c.urlParams_.Encode()
  1010. req, err := http.NewRequest("GET", urls, body)
  1011. if err != nil {
  1012. return nil, err
  1013. }
  1014. req.Header = reqHeaders
  1015. googleapi.Expand(req.URL, map[string]string{
  1016. "siteUrl": c.siteUrl,
  1017. "feedpath": c.feedpath,
  1018. })
  1019. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1020. }
  1021. // Do executes the "webmasters.sitemaps.get" call.
  1022. // Exactly one of *WmxSitemap or error will be non-nil. Any non-2xx
  1023. // status code is an error. Response headers are in either
  1024. // *WmxSitemap.ServerResponse.Header or (if a response was returned at
  1025. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1026. // to check whether the returned error was because
  1027. // http.StatusNotModified was returned.
  1028. func (c *SitemapsGetCall) Do(opts ...googleapi.CallOption) (*WmxSitemap, error) {
  1029. gensupport.SetOptions(c.urlParams_, opts...)
  1030. res, err := c.doRequest("json")
  1031. if res != nil && res.StatusCode == http.StatusNotModified {
  1032. if res.Body != nil {
  1033. res.Body.Close()
  1034. }
  1035. return nil, &googleapi.Error{
  1036. Code: res.StatusCode,
  1037. Header: res.Header,
  1038. }
  1039. }
  1040. if err != nil {
  1041. return nil, err
  1042. }
  1043. defer googleapi.CloseBody(res)
  1044. if err := googleapi.CheckResponse(res); err != nil {
  1045. return nil, err
  1046. }
  1047. ret := &WmxSitemap{
  1048. ServerResponse: googleapi.ServerResponse{
  1049. Header: res.Header,
  1050. HTTPStatusCode: res.StatusCode,
  1051. },
  1052. }
  1053. target := &ret
  1054. if err := gensupport.DecodeResponse(target, res); err != nil {
  1055. return nil, err
  1056. }
  1057. return ret, nil
  1058. // {
  1059. // "description": "Retrieves information about a specific sitemap.",
  1060. // "httpMethod": "GET",
  1061. // "id": "webmasters.sitemaps.get",
  1062. // "parameterOrder": [
  1063. // "siteUrl",
  1064. // "feedpath"
  1065. // ],
  1066. // "parameters": {
  1067. // "feedpath": {
  1068. // "description": "The URL of the actual sitemap. For example: http://www.example.com/sitemap.xml",
  1069. // "location": "path",
  1070. // "required": true,
  1071. // "type": "string"
  1072. // },
  1073. // "siteUrl": {
  1074. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  1075. // "location": "path",
  1076. // "required": true,
  1077. // "type": "string"
  1078. // }
  1079. // },
  1080. // "path": "sites/{siteUrl}/sitemaps/{feedpath}",
  1081. // "response": {
  1082. // "$ref": "WmxSitemap"
  1083. // },
  1084. // "scopes": [
  1085. // "https://www.googleapis.com/auth/webmasters",
  1086. // "https://www.googleapis.com/auth/webmasters.readonly"
  1087. // ]
  1088. // }
  1089. }
  1090. // method id "webmasters.sitemaps.list":
  1091. type SitemapsListCall struct {
  1092. s *Service
  1093. siteUrl string
  1094. urlParams_ gensupport.URLParams
  1095. ifNoneMatch_ string
  1096. ctx_ context.Context
  1097. header_ http.Header
  1098. }
  1099. // List: Lists the sitemaps-entries submitted for this site, or included
  1100. // in the sitemap index file (if sitemapIndex is specified in the
  1101. // request).
  1102. func (r *SitemapsService) List(siteUrl string) *SitemapsListCall {
  1103. c := &SitemapsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1104. c.siteUrl = siteUrl
  1105. return c
  1106. }
  1107. // SitemapIndex sets the optional parameter "sitemapIndex": A URL of a
  1108. // site's sitemap index. For example:
  1109. // http://www.example.com/sitemapindex.xml
  1110. func (c *SitemapsListCall) SitemapIndex(sitemapIndex string) *SitemapsListCall {
  1111. c.urlParams_.Set("sitemapIndex", sitemapIndex)
  1112. return c
  1113. }
  1114. // Fields allows partial responses to be retrieved. See
  1115. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1116. // for more information.
  1117. func (c *SitemapsListCall) Fields(s ...googleapi.Field) *SitemapsListCall {
  1118. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1119. return c
  1120. }
  1121. // IfNoneMatch sets the optional parameter which makes the operation
  1122. // fail if the object's ETag matches the given value. This is useful for
  1123. // getting updates only after the object has changed since the last
  1124. // request. Use googleapi.IsNotModified to check whether the response
  1125. // error from Do is the result of In-None-Match.
  1126. func (c *SitemapsListCall) IfNoneMatch(entityTag string) *SitemapsListCall {
  1127. c.ifNoneMatch_ = entityTag
  1128. return c
  1129. }
  1130. // Context sets the context to be used in this call's Do method. Any
  1131. // pending HTTP request will be aborted if the provided context is
  1132. // canceled.
  1133. func (c *SitemapsListCall) Context(ctx context.Context) *SitemapsListCall {
  1134. c.ctx_ = ctx
  1135. return c
  1136. }
  1137. // Header returns an http.Header that can be modified by the caller to
  1138. // add HTTP headers to the request.
  1139. func (c *SitemapsListCall) Header() http.Header {
  1140. if c.header_ == nil {
  1141. c.header_ = make(http.Header)
  1142. }
  1143. return c.header_
  1144. }
  1145. func (c *SitemapsListCall) doRequest(alt string) (*http.Response, error) {
  1146. reqHeaders := make(http.Header)
  1147. for k, v := range c.header_ {
  1148. reqHeaders[k] = v
  1149. }
  1150. reqHeaders.Set("User-Agent", c.s.userAgent())
  1151. if c.ifNoneMatch_ != "" {
  1152. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1153. }
  1154. var body io.Reader = nil
  1155. c.urlParams_.Set("alt", alt)
  1156. c.urlParams_.Set("prettyPrint", "false")
  1157. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps")
  1158. urls += "?" + c.urlParams_.Encode()
  1159. req, err := http.NewRequest("GET", urls, body)
  1160. if err != nil {
  1161. return nil, err
  1162. }
  1163. req.Header = reqHeaders
  1164. googleapi.Expand(req.URL, map[string]string{
  1165. "siteUrl": c.siteUrl,
  1166. })
  1167. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1168. }
  1169. // Do executes the "webmasters.sitemaps.list" call.
  1170. // Exactly one of *SitemapsListResponse or error will be non-nil. Any
  1171. // non-2xx status code is an error. Response headers are in either
  1172. // *SitemapsListResponse.ServerResponse.Header or (if a response was
  1173. // returned at all) in error.(*googleapi.Error).Header. Use
  1174. // googleapi.IsNotModified to check whether the returned error was
  1175. // because http.StatusNotModified was returned.
  1176. func (c *SitemapsListCall) Do(opts ...googleapi.CallOption) (*SitemapsListResponse, error) {
  1177. gensupport.SetOptions(c.urlParams_, opts...)
  1178. res, err := c.doRequest("json")
  1179. if res != nil && res.StatusCode == http.StatusNotModified {
  1180. if res.Body != nil {
  1181. res.Body.Close()
  1182. }
  1183. return nil, &googleapi.Error{
  1184. Code: res.StatusCode,
  1185. Header: res.Header,
  1186. }
  1187. }
  1188. if err != nil {
  1189. return nil, err
  1190. }
  1191. defer googleapi.CloseBody(res)
  1192. if err := googleapi.CheckResponse(res); err != nil {
  1193. return nil, err
  1194. }
  1195. ret := &SitemapsListResponse{
  1196. ServerResponse: googleapi.ServerResponse{
  1197. Header: res.Header,
  1198. HTTPStatusCode: res.StatusCode,
  1199. },
  1200. }
  1201. target := &ret
  1202. if err := gensupport.DecodeResponse(target, res); err != nil {
  1203. return nil, err
  1204. }
  1205. return ret, nil
  1206. // {
  1207. // "description": "Lists the sitemaps-entries submitted for this site, or included in the sitemap index file (if sitemapIndex is specified in the request).",
  1208. // "httpMethod": "GET",
  1209. // "id": "webmasters.sitemaps.list",
  1210. // "parameterOrder": [
  1211. // "siteUrl"
  1212. // ],
  1213. // "parameters": {
  1214. // "siteUrl": {
  1215. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  1216. // "location": "path",
  1217. // "required": true,
  1218. // "type": "string"
  1219. // },
  1220. // "sitemapIndex": {
  1221. // "description": "A URL of a site's sitemap index. For example: http://www.example.com/sitemapindex.xml",
  1222. // "location": "query",
  1223. // "type": "string"
  1224. // }
  1225. // },
  1226. // "path": "sites/{siteUrl}/sitemaps",
  1227. // "response": {
  1228. // "$ref": "SitemapsListResponse"
  1229. // },
  1230. // "scopes": [
  1231. // "https://www.googleapis.com/auth/webmasters",
  1232. // "https://www.googleapis.com/auth/webmasters.readonly"
  1233. // ]
  1234. // }
  1235. }
  1236. // method id "webmasters.sitemaps.submit":
  1237. type SitemapsSubmitCall struct {
  1238. s *Service
  1239. siteUrl string
  1240. feedpath string
  1241. urlParams_ gensupport.URLParams
  1242. ctx_ context.Context
  1243. header_ http.Header
  1244. }
  1245. // Submit: Submits a sitemap for a site.
  1246. func (r *SitemapsService) Submit(siteUrl string, feedpath string) *SitemapsSubmitCall {
  1247. c := &SitemapsSubmitCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1248. c.siteUrl = siteUrl
  1249. c.feedpath = feedpath
  1250. return c
  1251. }
  1252. // Fields allows partial responses to be retrieved. See
  1253. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1254. // for more information.
  1255. func (c *SitemapsSubmitCall) Fields(s ...googleapi.Field) *SitemapsSubmitCall {
  1256. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1257. return c
  1258. }
  1259. // Context sets the context to be used in this call's Do method. Any
  1260. // pending HTTP request will be aborted if the provided context is
  1261. // canceled.
  1262. func (c *SitemapsSubmitCall) Context(ctx context.Context) *SitemapsSubmitCall {
  1263. c.ctx_ = ctx
  1264. return c
  1265. }
  1266. // Header returns an http.Header that can be modified by the caller to
  1267. // add HTTP headers to the request.
  1268. func (c *SitemapsSubmitCall) Header() http.Header {
  1269. if c.header_ == nil {
  1270. c.header_ = make(http.Header)
  1271. }
  1272. return c.header_
  1273. }
  1274. func (c *SitemapsSubmitCall) doRequest(alt string) (*http.Response, error) {
  1275. reqHeaders := make(http.Header)
  1276. for k, v := range c.header_ {
  1277. reqHeaders[k] = v
  1278. }
  1279. reqHeaders.Set("User-Agent", c.s.userAgent())
  1280. var body io.Reader = nil
  1281. c.urlParams_.Set("alt", alt)
  1282. c.urlParams_.Set("prettyPrint", "false")
  1283. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}")
  1284. urls += "?" + c.urlParams_.Encode()
  1285. req, err := http.NewRequest("PUT", urls, body)
  1286. if err != nil {
  1287. return nil, err
  1288. }
  1289. req.Header = reqHeaders
  1290. googleapi.Expand(req.URL, map[string]string{
  1291. "siteUrl": c.siteUrl,
  1292. "feedpath": c.feedpath,
  1293. })
  1294. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1295. }
  1296. // Do executes the "webmasters.sitemaps.submit" call.
  1297. func (c *SitemapsSubmitCall) Do(opts ...googleapi.CallOption) error {
  1298. gensupport.SetOptions(c.urlParams_, opts...)
  1299. res, err := c.doRequest("json")
  1300. if err != nil {
  1301. return err
  1302. }
  1303. defer googleapi.CloseBody(res)
  1304. if err := googleapi.CheckResponse(res); err != nil {
  1305. return err
  1306. }
  1307. return nil
  1308. // {
  1309. // "description": "Submits a sitemap for a site.",
  1310. // "httpMethod": "PUT",
  1311. // "id": "webmasters.sitemaps.submit",
  1312. // "parameterOrder": [
  1313. // "siteUrl",
  1314. // "feedpath"
  1315. // ],
  1316. // "parameters": {
  1317. // "feedpath": {
  1318. // "description": "The URL of the sitemap to add. For example: http://www.example.com/sitemap.xml",
  1319. // "location": "path",
  1320. // "required": true,
  1321. // "type": "string"
  1322. // },
  1323. // "siteUrl": {
  1324. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  1325. // "location": "path",
  1326. // "required": true,
  1327. // "type": "string"
  1328. // }
  1329. // },
  1330. // "path": "sites/{siteUrl}/sitemaps/{feedpath}",
  1331. // "scopes": [
  1332. // "https://www.googleapis.com/auth/webmasters"
  1333. // ]
  1334. // }
  1335. }
  1336. // method id "webmasters.sites.add":
  1337. type SitesAddCall struct {
  1338. s *Service
  1339. siteUrl string
  1340. urlParams_ gensupport.URLParams
  1341. ctx_ context.Context
  1342. header_ http.Header
  1343. }
  1344. // Add: Adds a site to the set of the user's sites in Search Console.
  1345. func (r *SitesService) Add(siteUrl string) *SitesAddCall {
  1346. c := &SitesAddCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1347. c.siteUrl = siteUrl
  1348. return c
  1349. }
  1350. // Fields allows partial responses to be retrieved. See
  1351. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1352. // for more information.
  1353. func (c *SitesAddCall) Fields(s ...googleapi.Field) *SitesAddCall {
  1354. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1355. return c
  1356. }
  1357. // Context sets the context to be used in this call's Do method. Any
  1358. // pending HTTP request will be aborted if the provided context is
  1359. // canceled.
  1360. func (c *SitesAddCall) Context(ctx context.Context) *SitesAddCall {
  1361. c.ctx_ = ctx
  1362. return c
  1363. }
  1364. // Header returns an http.Header that can be modified by the caller to
  1365. // add HTTP headers to the request.
  1366. func (c *SitesAddCall) Header() http.Header {
  1367. if c.header_ == nil {
  1368. c.header_ = make(http.Header)
  1369. }
  1370. return c.header_
  1371. }
  1372. func (c *SitesAddCall) doRequest(alt string) (*http.Response, error) {
  1373. reqHeaders := make(http.Header)
  1374. for k, v := range c.header_ {
  1375. reqHeaders[k] = v
  1376. }
  1377. reqHeaders.Set("User-Agent", c.s.userAgent())
  1378. var body io.Reader = nil
  1379. c.urlParams_.Set("alt", alt)
  1380. c.urlParams_.Set("prettyPrint", "false")
  1381. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}")
  1382. urls += "?" + c.urlParams_.Encode()
  1383. req, err := http.NewRequest("PUT", urls, body)
  1384. if err != nil {
  1385. return nil, err
  1386. }
  1387. req.Header = reqHeaders
  1388. googleapi.Expand(req.URL, map[string]string{
  1389. "siteUrl": c.siteUrl,
  1390. })
  1391. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1392. }
  1393. // Do executes the "webmasters.sites.add" call.
  1394. func (c *SitesAddCall) Do(opts ...googleapi.CallOption) error {
  1395. gensupport.SetOptions(c.urlParams_, opts...)
  1396. res, err := c.doRequest("json")
  1397. if err != nil {
  1398. return err
  1399. }
  1400. defer googleapi.CloseBody(res)
  1401. if err := googleapi.CheckResponse(res); err != nil {
  1402. return err
  1403. }
  1404. return nil
  1405. // {
  1406. // "description": "Adds a site to the set of the user's sites in Search Console.",
  1407. // "httpMethod": "PUT",
  1408. // "id": "webmasters.sites.add",
  1409. // "parameterOrder": [
  1410. // "siteUrl"
  1411. // ],
  1412. // "parameters": {
  1413. // "siteUrl": {
  1414. // "description": "The URL of the site to add.",
  1415. // "location": "path",
  1416. // "required": true,
  1417. // "type": "string"
  1418. // }
  1419. // },
  1420. // "path": "sites/{siteUrl}",
  1421. // "scopes": [
  1422. // "https://www.googleapis.com/auth/webmasters"
  1423. // ]
  1424. // }
  1425. }
  1426. // method id "webmasters.sites.delete":
  1427. type SitesDeleteCall struct {
  1428. s *Service
  1429. siteUrl string
  1430. urlParams_ gensupport.URLParams
  1431. ctx_ context.Context
  1432. header_ http.Header
  1433. }
  1434. // Delete: Removes a site from the set of the user's Search Console
  1435. // sites.
  1436. func (r *SitesService) Delete(siteUrl string) *SitesDeleteCall {
  1437. c := &SitesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1438. c.siteUrl = siteUrl
  1439. return c
  1440. }
  1441. // Fields allows partial responses to be retrieved. See
  1442. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1443. // for more information.
  1444. func (c *SitesDeleteCall) Fields(s ...googleapi.Field) *SitesDeleteCall {
  1445. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1446. return c
  1447. }
  1448. // Context sets the context to be used in this call's Do method. Any
  1449. // pending HTTP request will be aborted if the provided context is
  1450. // canceled.
  1451. func (c *SitesDeleteCall) Context(ctx context.Context) *SitesDeleteCall {
  1452. c.ctx_ = ctx
  1453. return c
  1454. }
  1455. // Header returns an http.Header that can be modified by the caller to
  1456. // add HTTP headers to the request.
  1457. func (c *SitesDeleteCall) Header() http.Header {
  1458. if c.header_ == nil {
  1459. c.header_ = make(http.Header)
  1460. }
  1461. return c.header_
  1462. }
  1463. func (c *SitesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1464. reqHeaders := make(http.Header)
  1465. for k, v := range c.header_ {
  1466. reqHeaders[k] = v
  1467. }
  1468. reqHeaders.Set("User-Agent", c.s.userAgent())
  1469. var body io.Reader = nil
  1470. c.urlParams_.Set("alt", alt)
  1471. c.urlParams_.Set("prettyPrint", "false")
  1472. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}")
  1473. urls += "?" + c.urlParams_.Encode()
  1474. req, err := http.NewRequest("DELETE", urls, body)
  1475. if err != nil {
  1476. return nil, err
  1477. }
  1478. req.Header = reqHeaders
  1479. googleapi.Expand(req.URL, map[string]string{
  1480. "siteUrl": c.siteUrl,
  1481. })
  1482. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1483. }
  1484. // Do executes the "webmasters.sites.delete" call.
  1485. func (c *SitesDeleteCall) Do(opts ...googleapi.CallOption) error {
  1486. gensupport.SetOptions(c.urlParams_, opts...)
  1487. res, err := c.doRequest("json")
  1488. if err != nil {
  1489. return err
  1490. }
  1491. defer googleapi.CloseBody(res)
  1492. if err := googleapi.CheckResponse(res); err != nil {
  1493. return err
  1494. }
  1495. return nil
  1496. // {
  1497. // "description": "Removes a site from the set of the user's Search Console sites.",
  1498. // "httpMethod": "DELETE",
  1499. // "id": "webmasters.sites.delete",
  1500. // "parameterOrder": [
  1501. // "siteUrl"
  1502. // ],
  1503. // "parameters": {
  1504. // "siteUrl": {
  1505. // "description": "The URI of the property as defined in Search Console. Examples: http://www.example.com/ or android-app://com.example/ Note: for property-sets, use the URI that starts with sc-set: which is used in Search Console URLs.",
  1506. // "location": "path",
  1507. // "required": true,
  1508. // "type": "string"
  1509. // }
  1510. // },
  1511. // "path": "sites/{siteUrl}",
  1512. // "scopes": [
  1513. // "https://www.googleapis.com/auth/webmasters"
  1514. // ]
  1515. // }
  1516. }
  1517. // method id "webmasters.sites.get":
  1518. type SitesGetCall struct {
  1519. s *Service
  1520. siteUrl string
  1521. urlParams_ gensupport.URLParams
  1522. ifNoneMatch_ string
  1523. ctx_ context.Context
  1524. header_ http.Header
  1525. }
  1526. // Get: Retrieves information about specific site.
  1527. func (r *SitesService) Get(siteUrl string) *SitesGetCall {
  1528. c := &SitesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1529. c.siteUrl = siteUrl
  1530. return c
  1531. }
  1532. // Fields allows partial responses to be retrieved. See
  1533. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1534. // for more information.
  1535. func (c *SitesGetCall) Fields(s ...googleapi.Field) *SitesGetCall {
  1536. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1537. return c
  1538. }
  1539. // IfNoneMatch sets the optional parameter which makes the operation
  1540. // fail if the object's ETag matches the given value. This is useful for
  1541. // getting updates only after the object has changed since the last
  1542. // request. Use googleapi.IsNotModified to check whether the response
  1543. // error from Do is the result of In-None-Match.
  1544. func (c *SitesGetCall) IfNoneMatch(entityTag string) *SitesGetCall {
  1545. c.ifNoneMatch_ = entityTag
  1546. return c
  1547. }
  1548. // Context sets the context to be used in this call's Do method. Any
  1549. // pending HTTP request will be aborted if the provided context is
  1550. // canceled.
  1551. func (c *SitesGetCall) Context(ctx context.Context) *SitesGetCall {
  1552. c.ctx_ = ctx
  1553. return c
  1554. }
  1555. // Header returns an http.Header that can be modified by the caller to
  1556. // add HTTP headers to the request.
  1557. func (c *SitesGetCall) Header() http.Header {
  1558. if c.header_ == nil {
  1559. c.header_ = make(http.Header)
  1560. }
  1561. return c.header_
  1562. }
  1563. func (c *SitesGetCall) doRequest(alt string) (*http.Response, error) {
  1564. reqHeaders := make(http.Header)
  1565. for k, v := range c.header_ {
  1566. reqHeaders[k] = v
  1567. }
  1568. reqHeaders.Set("User-Agent", c.s.userAgent())
  1569. if c.ifNoneMatch_ != "" {
  1570. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1571. }
  1572. var body io.Reader = nil
  1573. c.urlParams_.Set("alt", alt)
  1574. c.urlParams_.Set("prettyPrint", "false")
  1575. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}")
  1576. urls += "?" + c.urlParams_.Encode()
  1577. req, err := http.NewRequest("GET", urls, body)
  1578. if err != nil {
  1579. return nil, err
  1580. }
  1581. req.Header = reqHeaders
  1582. googleapi.Expand(req.URL, map[string]string{
  1583. "siteUrl": c.siteUrl,
  1584. })
  1585. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1586. }
  1587. // Do executes the "webmasters.sites.get" call.
  1588. // Exactly one of *WmxSite or error will be non-nil. Any non-2xx status
  1589. // code is an error. Response headers are in either
  1590. // *WmxSite.ServerResponse.Header or (if a response was returned at all)
  1591. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1592. // check whether the returned error was because http.StatusNotModified
  1593. // was returned.
  1594. func (c *SitesGetCall) Do(opts ...googleapi.CallOption) (*WmxSite, error) {
  1595. gensupport.SetOptions(c.urlParams_, opts...)
  1596. res, err := c.doRequest("json")
  1597. if res != nil && res.StatusCode == http.StatusNotModified {
  1598. if res.Body != nil {
  1599. res.Body.Close()
  1600. }
  1601. return nil, &googleapi.Error{
  1602. Code: res.StatusCode,
  1603. Header: res.Header,
  1604. }
  1605. }
  1606. if err != nil {
  1607. return nil, err
  1608. }
  1609. defer googleapi.CloseBody(res)
  1610. if err := googleapi.CheckResponse(res); err != nil {
  1611. return nil, err
  1612. }
  1613. ret := &WmxSite{
  1614. ServerResponse: googleapi.ServerResponse{
  1615. Header: res.Header,
  1616. HTTPStatusCode: res.StatusCode,
  1617. },
  1618. }
  1619. target := &ret
  1620. if err := gensupport.DecodeResponse(target, res); err != nil {
  1621. return nil, err
  1622. }
  1623. return ret, nil
  1624. // {
  1625. // "description": "Retrieves information about specific site.",
  1626. // "httpMethod": "GET",
  1627. // "id": "webmasters.sites.get",
  1628. // "parameterOrder": [
  1629. // "siteUrl"
  1630. // ],
  1631. // "parameters": {
  1632. // "siteUrl": {
  1633. // "description": "The URI of the property as defined in Search Console. Examples: http://www.example.com/ or android-app://com.example/ Note: for property-sets, use the URI that starts with sc-set: which is used in Search Console URLs.",
  1634. // "location": "path",
  1635. // "required": true,
  1636. // "type": "string"
  1637. // }
  1638. // },
  1639. // "path": "sites/{siteUrl}",
  1640. // "response": {
  1641. // "$ref": "WmxSite"
  1642. // },
  1643. // "scopes": [
  1644. // "https://www.googleapis.com/auth/webmasters",
  1645. // "https://www.googleapis.com/auth/webmasters.readonly"
  1646. // ]
  1647. // }
  1648. }
  1649. // method id "webmasters.sites.list":
  1650. type SitesListCall struct {
  1651. s *Service
  1652. urlParams_ gensupport.URLParams
  1653. ifNoneMatch_ string
  1654. ctx_ context.Context
  1655. header_ http.Header
  1656. }
  1657. // List: Lists the user's Search Console sites.
  1658. func (r *SitesService) List() *SitesListCall {
  1659. c := &SitesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1660. return c
  1661. }
  1662. // Fields allows partial responses to be retrieved. See
  1663. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1664. // for more information.
  1665. func (c *SitesListCall) Fields(s ...googleapi.Field) *SitesListCall {
  1666. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1667. return c
  1668. }
  1669. // IfNoneMatch sets the optional parameter which makes the operation
  1670. // fail if the object's ETag matches the given value. This is useful for
  1671. // getting updates only after the object has changed since the last
  1672. // request. Use googleapi.IsNotModified to check whether the response
  1673. // error from Do is the result of In-None-Match.
  1674. func (c *SitesListCall) IfNoneMatch(entityTag string) *SitesListCall {
  1675. c.ifNoneMatch_ = entityTag
  1676. return c
  1677. }
  1678. // Context sets the context to be used in this call's Do method. Any
  1679. // pending HTTP request will be aborted if the provided context is
  1680. // canceled.
  1681. func (c *SitesListCall) Context(ctx context.Context) *SitesListCall {
  1682. c.ctx_ = ctx
  1683. return c
  1684. }
  1685. // Header returns an http.Header that can be modified by the caller to
  1686. // add HTTP headers to the request.
  1687. func (c *SitesListCall) Header() http.Header {
  1688. if c.header_ == nil {
  1689. c.header_ = make(http.Header)
  1690. }
  1691. return c.header_
  1692. }
  1693. func (c *SitesListCall) doRequest(alt string) (*http.Response, error) {
  1694. reqHeaders := make(http.Header)
  1695. for k, v := range c.header_ {
  1696. reqHeaders[k] = v
  1697. }
  1698. reqHeaders.Set("User-Agent", c.s.userAgent())
  1699. if c.ifNoneMatch_ != "" {
  1700. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1701. }
  1702. var body io.Reader = nil
  1703. c.urlParams_.Set("alt", alt)
  1704. c.urlParams_.Set("prettyPrint", "false")
  1705. urls := googleapi.ResolveRelative(c.s.BasePath, "sites")
  1706. urls += "?" + c.urlParams_.Encode()
  1707. req, err := http.NewRequest("GET", urls, body)
  1708. if err != nil {
  1709. return nil, err
  1710. }
  1711. req.Header = reqHeaders
  1712. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1713. }
  1714. // Do executes the "webmasters.sites.list" call.
  1715. // Exactly one of *SitesListResponse or error will be non-nil. Any
  1716. // non-2xx status code is an error. Response headers are in either
  1717. // *SitesListResponse.ServerResponse.Header or (if a response was
  1718. // returned at all) in error.(*googleapi.Error).Header. Use
  1719. // googleapi.IsNotModified to check whether the returned error was
  1720. // because http.StatusNotModified was returned.
  1721. func (c *SitesListCall) Do(opts ...googleapi.CallOption) (*SitesListResponse, error) {
  1722. gensupport.SetOptions(c.urlParams_, opts...)
  1723. res, err := c.doRequest("json")
  1724. if res != nil && res.StatusCode == http.StatusNotModified {
  1725. if res.Body != nil {
  1726. res.Body.Close()
  1727. }
  1728. return nil, &googleapi.Error{
  1729. Code: res.StatusCode,
  1730. Header: res.Header,
  1731. }
  1732. }
  1733. if err != nil {
  1734. return nil, err
  1735. }
  1736. defer googleapi.CloseBody(res)
  1737. if err := googleapi.CheckResponse(res); err != nil {
  1738. return nil, err
  1739. }
  1740. ret := &SitesListResponse{
  1741. ServerResponse: googleapi.ServerResponse{
  1742. Header: res.Header,
  1743. HTTPStatusCode: res.StatusCode,
  1744. },
  1745. }
  1746. target := &ret
  1747. if err := gensupport.DecodeResponse(target, res); err != nil {
  1748. return nil, err
  1749. }
  1750. return ret, nil
  1751. // {
  1752. // "description": "Lists the user's Search Console sites.",
  1753. // "httpMethod": "GET",
  1754. // "id": "webmasters.sites.list",
  1755. // "path": "sites",
  1756. // "response": {
  1757. // "$ref": "SitesListResponse"
  1758. // },
  1759. // "scopes": [
  1760. // "https://www.googleapis.com/auth/webmasters",
  1761. // "https://www.googleapis.com/auth/webmasters.readonly"
  1762. // ]
  1763. // }
  1764. }
  1765. // method id "webmasters.urlcrawlerrorscounts.query":
  1766. type UrlcrawlerrorscountsQueryCall struct {
  1767. s *Service
  1768. siteUrl string
  1769. urlParams_ gensupport.URLParams
  1770. ifNoneMatch_ string
  1771. ctx_ context.Context
  1772. header_ http.Header
  1773. }
  1774. // Query: Retrieves a time series of the number of URL crawl errors per
  1775. // error category and platform.
  1776. func (r *UrlcrawlerrorscountsService) Query(siteUrl string) *UrlcrawlerrorscountsQueryCall {
  1777. c := &UrlcrawlerrorscountsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1778. c.siteUrl = siteUrl
  1779. return c
  1780. }
  1781. // Category sets the optional parameter "category": The crawl error
  1782. // category. For example: serverError. If not specified, returns results
  1783. // for all categories.
  1784. //
  1785. // Possible values:
  1786. // "authPermissions"
  1787. // "flashContent"
  1788. // "manyToOneRedirect"
  1789. // "notFollowed"
  1790. // "notFound"
  1791. // "other"
  1792. // "roboted"
  1793. // "serverError"
  1794. // "soft404"
  1795. func (c *UrlcrawlerrorscountsQueryCall) Category(category string) *UrlcrawlerrorscountsQueryCall {
  1796. c.urlParams_.Set("category", category)
  1797. return c
  1798. }
  1799. // LatestCountsOnly sets the optional parameter "latestCountsOnly": If
  1800. // true, returns only the latest crawl error counts.
  1801. func (c *UrlcrawlerrorscountsQueryCall) LatestCountsOnly(latestCountsOnly bool) *UrlcrawlerrorscountsQueryCall {
  1802. c.urlParams_.Set("latestCountsOnly", fmt.Sprint(latestCountsOnly))
  1803. return c
  1804. }
  1805. // Platform sets the optional parameter "platform": The user agent type
  1806. // (platform) that made the request. For example: web. If not specified,
  1807. // returns results for all platforms.
  1808. //
  1809. // Possible values:
  1810. // "mobile"
  1811. // "smartphoneOnly"
  1812. // "web"
  1813. func (c *UrlcrawlerrorscountsQueryCall) Platform(platform string) *UrlcrawlerrorscountsQueryCall {
  1814. c.urlParams_.Set("platform", platform)
  1815. return c
  1816. }
  1817. // Fields allows partial responses to be retrieved. See
  1818. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1819. // for more information.
  1820. func (c *UrlcrawlerrorscountsQueryCall) Fields(s ...googleapi.Field) *UrlcrawlerrorscountsQueryCall {
  1821. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1822. return c
  1823. }
  1824. // IfNoneMatch sets the optional parameter which makes the operation
  1825. // fail if the object's ETag matches the given value. This is useful for
  1826. // getting updates only after the object has changed since the last
  1827. // request. Use googleapi.IsNotModified to check whether the response
  1828. // error from Do is the result of In-None-Match.
  1829. func (c *UrlcrawlerrorscountsQueryCall) IfNoneMatch(entityTag string) *UrlcrawlerrorscountsQueryCall {
  1830. c.ifNoneMatch_ = entityTag
  1831. return c
  1832. }
  1833. // Context sets the context to be used in this call's Do method. Any
  1834. // pending HTTP request will be aborted if the provided context is
  1835. // canceled.
  1836. func (c *UrlcrawlerrorscountsQueryCall) Context(ctx context.Context) *UrlcrawlerrorscountsQueryCall {
  1837. c.ctx_ = ctx
  1838. return c
  1839. }
  1840. // Header returns an http.Header that can be modified by the caller to
  1841. // add HTTP headers to the request.
  1842. func (c *UrlcrawlerrorscountsQueryCall) Header() http.Header {
  1843. if c.header_ == nil {
  1844. c.header_ = make(http.Header)
  1845. }
  1846. return c.header_
  1847. }
  1848. func (c *UrlcrawlerrorscountsQueryCall) doRequest(alt string) (*http.Response, error) {
  1849. reqHeaders := make(http.Header)
  1850. for k, v := range c.header_ {
  1851. reqHeaders[k] = v
  1852. }
  1853. reqHeaders.Set("User-Agent", c.s.userAgent())
  1854. if c.ifNoneMatch_ != "" {
  1855. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1856. }
  1857. var body io.Reader = nil
  1858. c.urlParams_.Set("alt", alt)
  1859. c.urlParams_.Set("prettyPrint", "false")
  1860. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/urlCrawlErrorsCounts/query")
  1861. urls += "?" + c.urlParams_.Encode()
  1862. req, err := http.NewRequest("GET", urls, body)
  1863. if err != nil {
  1864. return nil, err
  1865. }
  1866. req.Header = reqHeaders
  1867. googleapi.Expand(req.URL, map[string]string{
  1868. "siteUrl": c.siteUrl,
  1869. })
  1870. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1871. }
  1872. // Do executes the "webmasters.urlcrawlerrorscounts.query" call.
  1873. // Exactly one of *UrlCrawlErrorsCountsQueryResponse or error will be
  1874. // non-nil. Any non-2xx status code is an error. Response headers are in
  1875. // either *UrlCrawlErrorsCountsQueryResponse.ServerResponse.Header or
  1876. // (if a response was returned at all) in
  1877. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1878. // whether the returned error was because http.StatusNotModified was
  1879. // returned.
  1880. func (c *UrlcrawlerrorscountsQueryCall) Do(opts ...googleapi.CallOption) (*UrlCrawlErrorsCountsQueryResponse, error) {
  1881. gensupport.SetOptions(c.urlParams_, opts...)
  1882. res, err := c.doRequest("json")
  1883. if res != nil && res.StatusCode == http.StatusNotModified {
  1884. if res.Body != nil {
  1885. res.Body.Close()
  1886. }
  1887. return nil, &googleapi.Error{
  1888. Code: res.StatusCode,
  1889. Header: res.Header,
  1890. }
  1891. }
  1892. if err != nil {
  1893. return nil, err
  1894. }
  1895. defer googleapi.CloseBody(res)
  1896. if err := googleapi.CheckResponse(res); err != nil {
  1897. return nil, err
  1898. }
  1899. ret := &UrlCrawlErrorsCountsQueryResponse{
  1900. ServerResponse: googleapi.ServerResponse{
  1901. Header: res.Header,
  1902. HTTPStatusCode: res.StatusCode,
  1903. },
  1904. }
  1905. target := &ret
  1906. if err := gensupport.DecodeResponse(target, res); err != nil {
  1907. return nil, err
  1908. }
  1909. return ret, nil
  1910. // {
  1911. // "description": "Retrieves a time series of the number of URL crawl errors per error category and platform.",
  1912. // "httpMethod": "GET",
  1913. // "id": "webmasters.urlcrawlerrorscounts.query",
  1914. // "parameterOrder": [
  1915. // "siteUrl"
  1916. // ],
  1917. // "parameters": {
  1918. // "category": {
  1919. // "description": "The crawl error category. For example: serverError. If not specified, returns results for all categories.",
  1920. // "enum": [
  1921. // "authPermissions",
  1922. // "flashContent",
  1923. // "manyToOneRedirect",
  1924. // "notFollowed",
  1925. // "notFound",
  1926. // "other",
  1927. // "roboted",
  1928. // "serverError",
  1929. // "soft404"
  1930. // ],
  1931. // "enumDescriptions": [
  1932. // "",
  1933. // "",
  1934. // "",
  1935. // "",
  1936. // "",
  1937. // "",
  1938. // "",
  1939. // "",
  1940. // ""
  1941. // ],
  1942. // "location": "query",
  1943. // "type": "string"
  1944. // },
  1945. // "latestCountsOnly": {
  1946. // "default": "true",
  1947. // "description": "If true, returns only the latest crawl error counts.",
  1948. // "location": "query",
  1949. // "type": "boolean"
  1950. // },
  1951. // "platform": {
  1952. // "description": "The user agent type (platform) that made the request. For example: web. If not specified, returns results for all platforms.",
  1953. // "enum": [
  1954. // "mobile",
  1955. // "smartphoneOnly",
  1956. // "web"
  1957. // ],
  1958. // "enumDescriptions": [
  1959. // "",
  1960. // "",
  1961. // ""
  1962. // ],
  1963. // "location": "query",
  1964. // "type": "string"
  1965. // },
  1966. // "siteUrl": {
  1967. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  1968. // "location": "path",
  1969. // "required": true,
  1970. // "type": "string"
  1971. // }
  1972. // },
  1973. // "path": "sites/{siteUrl}/urlCrawlErrorsCounts/query",
  1974. // "response": {
  1975. // "$ref": "UrlCrawlErrorsCountsQueryResponse"
  1976. // },
  1977. // "scopes": [
  1978. // "https://www.googleapis.com/auth/webmasters",
  1979. // "https://www.googleapis.com/auth/webmasters.readonly"
  1980. // ]
  1981. // }
  1982. }
  1983. // method id "webmasters.urlcrawlerrorssamples.get":
  1984. type UrlcrawlerrorssamplesGetCall struct {
  1985. s *Service
  1986. siteUrl string
  1987. url string
  1988. urlParams_ gensupport.URLParams
  1989. ifNoneMatch_ string
  1990. ctx_ context.Context
  1991. header_ http.Header
  1992. }
  1993. // Get: Retrieves details about crawl errors for a site's sample URL.
  1994. func (r *UrlcrawlerrorssamplesService) Get(siteUrl string, url string, category string, platform string) *UrlcrawlerrorssamplesGetCall {
  1995. c := &UrlcrawlerrorssamplesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1996. c.siteUrl = siteUrl
  1997. c.url = url
  1998. c.urlParams_.Set("category", category)
  1999. c.urlParams_.Set("platform", platform)
  2000. return c
  2001. }
  2002. // Fields allows partial responses to be retrieved. See
  2003. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2004. // for more information.
  2005. func (c *UrlcrawlerrorssamplesGetCall) Fields(s ...googleapi.Field) *UrlcrawlerrorssamplesGetCall {
  2006. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2007. return c
  2008. }
  2009. // IfNoneMatch sets the optional parameter which makes the operation
  2010. // fail if the object's ETag matches the given value. This is useful for
  2011. // getting updates only after the object has changed since the last
  2012. // request. Use googleapi.IsNotModified to check whether the response
  2013. // error from Do is the result of In-None-Match.
  2014. func (c *UrlcrawlerrorssamplesGetCall) IfNoneMatch(entityTag string) *UrlcrawlerrorssamplesGetCall {
  2015. c.ifNoneMatch_ = entityTag
  2016. return c
  2017. }
  2018. // Context sets the context to be used in this call's Do method. Any
  2019. // pending HTTP request will be aborted if the provided context is
  2020. // canceled.
  2021. func (c *UrlcrawlerrorssamplesGetCall) Context(ctx context.Context) *UrlcrawlerrorssamplesGetCall {
  2022. c.ctx_ = ctx
  2023. return c
  2024. }
  2025. // Header returns an http.Header that can be modified by the caller to
  2026. // add HTTP headers to the request.
  2027. func (c *UrlcrawlerrorssamplesGetCall) Header() http.Header {
  2028. if c.header_ == nil {
  2029. c.header_ = make(http.Header)
  2030. }
  2031. return c.header_
  2032. }
  2033. func (c *UrlcrawlerrorssamplesGetCall) doRequest(alt string) (*http.Response, error) {
  2034. reqHeaders := make(http.Header)
  2035. for k, v := range c.header_ {
  2036. reqHeaders[k] = v
  2037. }
  2038. reqHeaders.Set("User-Agent", c.s.userAgent())
  2039. if c.ifNoneMatch_ != "" {
  2040. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2041. }
  2042. var body io.Reader = nil
  2043. c.urlParams_.Set("alt", alt)
  2044. c.urlParams_.Set("prettyPrint", "false")
  2045. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/urlCrawlErrorsSamples/{url}")
  2046. urls += "?" + c.urlParams_.Encode()
  2047. req, err := http.NewRequest("GET", urls, body)
  2048. if err != nil {
  2049. return nil, err
  2050. }
  2051. req.Header = reqHeaders
  2052. googleapi.Expand(req.URL, map[string]string{
  2053. "siteUrl": c.siteUrl,
  2054. "url": c.url,
  2055. })
  2056. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2057. }
  2058. // Do executes the "webmasters.urlcrawlerrorssamples.get" call.
  2059. // Exactly one of *UrlCrawlErrorsSample or error will be non-nil. Any
  2060. // non-2xx status code is an error. Response headers are in either
  2061. // *UrlCrawlErrorsSample.ServerResponse.Header or (if a response was
  2062. // returned at all) in error.(*googleapi.Error).Header. Use
  2063. // googleapi.IsNotModified to check whether the returned error was
  2064. // because http.StatusNotModified was returned.
  2065. func (c *UrlcrawlerrorssamplesGetCall) Do(opts ...googleapi.CallOption) (*UrlCrawlErrorsSample, error) {
  2066. gensupport.SetOptions(c.urlParams_, opts...)
  2067. res, err := c.doRequest("json")
  2068. if res != nil && res.StatusCode == http.StatusNotModified {
  2069. if res.Body != nil {
  2070. res.Body.Close()
  2071. }
  2072. return nil, &googleapi.Error{
  2073. Code: res.StatusCode,
  2074. Header: res.Header,
  2075. }
  2076. }
  2077. if err != nil {
  2078. return nil, err
  2079. }
  2080. defer googleapi.CloseBody(res)
  2081. if err := googleapi.CheckResponse(res); err != nil {
  2082. return nil, err
  2083. }
  2084. ret := &UrlCrawlErrorsSample{
  2085. ServerResponse: googleapi.ServerResponse{
  2086. Header: res.Header,
  2087. HTTPStatusCode: res.StatusCode,
  2088. },
  2089. }
  2090. target := &ret
  2091. if err := gensupport.DecodeResponse(target, res); err != nil {
  2092. return nil, err
  2093. }
  2094. return ret, nil
  2095. // {
  2096. // "description": "Retrieves details about crawl errors for a site's sample URL.",
  2097. // "httpMethod": "GET",
  2098. // "id": "webmasters.urlcrawlerrorssamples.get",
  2099. // "parameterOrder": [
  2100. // "siteUrl",
  2101. // "url",
  2102. // "category",
  2103. // "platform"
  2104. // ],
  2105. // "parameters": {
  2106. // "category": {
  2107. // "description": "The crawl error category. For example: authPermissions",
  2108. // "enum": [
  2109. // "authPermissions",
  2110. // "flashContent",
  2111. // "manyToOneRedirect",
  2112. // "notFollowed",
  2113. // "notFound",
  2114. // "other",
  2115. // "roboted",
  2116. // "serverError",
  2117. // "soft404"
  2118. // ],
  2119. // "enumDescriptions": [
  2120. // "",
  2121. // "",
  2122. // "",
  2123. // "",
  2124. // "",
  2125. // "",
  2126. // "",
  2127. // "",
  2128. // ""
  2129. // ],
  2130. // "location": "query",
  2131. // "required": true,
  2132. // "type": "string"
  2133. // },
  2134. // "platform": {
  2135. // "description": "The user agent type (platform) that made the request. For example: web",
  2136. // "enum": [
  2137. // "mobile",
  2138. // "smartphoneOnly",
  2139. // "web"
  2140. // ],
  2141. // "enumDescriptions": [
  2142. // "",
  2143. // "",
  2144. // ""
  2145. // ],
  2146. // "location": "query",
  2147. // "required": true,
  2148. // "type": "string"
  2149. // },
  2150. // "siteUrl": {
  2151. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  2152. // "location": "path",
  2153. // "required": true,
  2154. // "type": "string"
  2155. // },
  2156. // "url": {
  2157. // "description": "The relative path (without the site) of the sample URL. It must be one of the URLs returned by list(). For example, for the URL https://www.example.com/pagename on the site https://www.example.com/, the url value is pagename",
  2158. // "location": "path",
  2159. // "required": true,
  2160. // "type": "string"
  2161. // }
  2162. // },
  2163. // "path": "sites/{siteUrl}/urlCrawlErrorsSamples/{url}",
  2164. // "response": {
  2165. // "$ref": "UrlCrawlErrorsSample"
  2166. // },
  2167. // "scopes": [
  2168. // "https://www.googleapis.com/auth/webmasters",
  2169. // "https://www.googleapis.com/auth/webmasters.readonly"
  2170. // ]
  2171. // }
  2172. }
  2173. // method id "webmasters.urlcrawlerrorssamples.list":
  2174. type UrlcrawlerrorssamplesListCall struct {
  2175. s *Service
  2176. siteUrl string
  2177. urlParams_ gensupport.URLParams
  2178. ifNoneMatch_ string
  2179. ctx_ context.Context
  2180. header_ http.Header
  2181. }
  2182. // List: Lists a site's sample URLs for the specified crawl error
  2183. // category and platform.
  2184. func (r *UrlcrawlerrorssamplesService) List(siteUrl string, category string, platform string) *UrlcrawlerrorssamplesListCall {
  2185. c := &UrlcrawlerrorssamplesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2186. c.siteUrl = siteUrl
  2187. c.urlParams_.Set("category", category)
  2188. c.urlParams_.Set("platform", platform)
  2189. return c
  2190. }
  2191. // Fields allows partial responses to be retrieved. See
  2192. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2193. // for more information.
  2194. func (c *UrlcrawlerrorssamplesListCall) Fields(s ...googleapi.Field) *UrlcrawlerrorssamplesListCall {
  2195. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2196. return c
  2197. }
  2198. // IfNoneMatch sets the optional parameter which makes the operation
  2199. // fail if the object's ETag matches the given value. This is useful for
  2200. // getting updates only after the object has changed since the last
  2201. // request. Use googleapi.IsNotModified to check whether the response
  2202. // error from Do is the result of In-None-Match.
  2203. func (c *UrlcrawlerrorssamplesListCall) IfNoneMatch(entityTag string) *UrlcrawlerrorssamplesListCall {
  2204. c.ifNoneMatch_ = entityTag
  2205. return c
  2206. }
  2207. // Context sets the context to be used in this call's Do method. Any
  2208. // pending HTTP request will be aborted if the provided context is
  2209. // canceled.
  2210. func (c *UrlcrawlerrorssamplesListCall) Context(ctx context.Context) *UrlcrawlerrorssamplesListCall {
  2211. c.ctx_ = ctx
  2212. return c
  2213. }
  2214. // Header returns an http.Header that can be modified by the caller to
  2215. // add HTTP headers to the request.
  2216. func (c *UrlcrawlerrorssamplesListCall) Header() http.Header {
  2217. if c.header_ == nil {
  2218. c.header_ = make(http.Header)
  2219. }
  2220. return c.header_
  2221. }
  2222. func (c *UrlcrawlerrorssamplesListCall) doRequest(alt string) (*http.Response, error) {
  2223. reqHeaders := make(http.Header)
  2224. for k, v := range c.header_ {
  2225. reqHeaders[k] = v
  2226. }
  2227. reqHeaders.Set("User-Agent", c.s.userAgent())
  2228. if c.ifNoneMatch_ != "" {
  2229. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2230. }
  2231. var body io.Reader = nil
  2232. c.urlParams_.Set("alt", alt)
  2233. c.urlParams_.Set("prettyPrint", "false")
  2234. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/urlCrawlErrorsSamples")
  2235. urls += "?" + c.urlParams_.Encode()
  2236. req, err := http.NewRequest("GET", urls, body)
  2237. if err != nil {
  2238. return nil, err
  2239. }
  2240. req.Header = reqHeaders
  2241. googleapi.Expand(req.URL, map[string]string{
  2242. "siteUrl": c.siteUrl,
  2243. })
  2244. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2245. }
  2246. // Do executes the "webmasters.urlcrawlerrorssamples.list" call.
  2247. // Exactly one of *UrlCrawlErrorsSamplesListResponse or error will be
  2248. // non-nil. Any non-2xx status code is an error. Response headers are in
  2249. // either *UrlCrawlErrorsSamplesListResponse.ServerResponse.Header or
  2250. // (if a response was returned at all) in
  2251. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2252. // whether the returned error was because http.StatusNotModified was
  2253. // returned.
  2254. func (c *UrlcrawlerrorssamplesListCall) Do(opts ...googleapi.CallOption) (*UrlCrawlErrorsSamplesListResponse, error) {
  2255. gensupport.SetOptions(c.urlParams_, opts...)
  2256. res, err := c.doRequest("json")
  2257. if res != nil && res.StatusCode == http.StatusNotModified {
  2258. if res.Body != nil {
  2259. res.Body.Close()
  2260. }
  2261. return nil, &googleapi.Error{
  2262. Code: res.StatusCode,
  2263. Header: res.Header,
  2264. }
  2265. }
  2266. if err != nil {
  2267. return nil, err
  2268. }
  2269. defer googleapi.CloseBody(res)
  2270. if err := googleapi.CheckResponse(res); err != nil {
  2271. return nil, err
  2272. }
  2273. ret := &UrlCrawlErrorsSamplesListResponse{
  2274. ServerResponse: googleapi.ServerResponse{
  2275. Header: res.Header,
  2276. HTTPStatusCode: res.StatusCode,
  2277. },
  2278. }
  2279. target := &ret
  2280. if err := gensupport.DecodeResponse(target, res); err != nil {
  2281. return nil, err
  2282. }
  2283. return ret, nil
  2284. // {
  2285. // "description": "Lists a site's sample URLs for the specified crawl error category and platform.",
  2286. // "httpMethod": "GET",
  2287. // "id": "webmasters.urlcrawlerrorssamples.list",
  2288. // "parameterOrder": [
  2289. // "siteUrl",
  2290. // "category",
  2291. // "platform"
  2292. // ],
  2293. // "parameters": {
  2294. // "category": {
  2295. // "description": "The crawl error category. For example: authPermissions",
  2296. // "enum": [
  2297. // "authPermissions",
  2298. // "flashContent",
  2299. // "manyToOneRedirect",
  2300. // "notFollowed",
  2301. // "notFound",
  2302. // "other",
  2303. // "roboted",
  2304. // "serverError",
  2305. // "soft404"
  2306. // ],
  2307. // "enumDescriptions": [
  2308. // "",
  2309. // "",
  2310. // "",
  2311. // "",
  2312. // "",
  2313. // "",
  2314. // "",
  2315. // "",
  2316. // ""
  2317. // ],
  2318. // "location": "query",
  2319. // "required": true,
  2320. // "type": "string"
  2321. // },
  2322. // "platform": {
  2323. // "description": "The user agent type (platform) that made the request. For example: web",
  2324. // "enum": [
  2325. // "mobile",
  2326. // "smartphoneOnly",
  2327. // "web"
  2328. // ],
  2329. // "enumDescriptions": [
  2330. // "",
  2331. // "",
  2332. // ""
  2333. // ],
  2334. // "location": "query",
  2335. // "required": true,
  2336. // "type": "string"
  2337. // },
  2338. // "siteUrl": {
  2339. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  2340. // "location": "path",
  2341. // "required": true,
  2342. // "type": "string"
  2343. // }
  2344. // },
  2345. // "path": "sites/{siteUrl}/urlCrawlErrorsSamples",
  2346. // "response": {
  2347. // "$ref": "UrlCrawlErrorsSamplesListResponse"
  2348. // },
  2349. // "scopes": [
  2350. // "https://www.googleapis.com/auth/webmasters",
  2351. // "https://www.googleapis.com/auth/webmasters.readonly"
  2352. // ]
  2353. // }
  2354. }
  2355. // method id "webmasters.urlcrawlerrorssamples.markAsFixed":
  2356. type UrlcrawlerrorssamplesMarkAsFixedCall struct {
  2357. s *Service
  2358. siteUrl string
  2359. url string
  2360. urlParams_ gensupport.URLParams
  2361. ctx_ context.Context
  2362. header_ http.Header
  2363. }
  2364. // MarkAsFixed: Marks the provided site's sample URL as fixed, and
  2365. // removes it from the samples list.
  2366. func (r *UrlcrawlerrorssamplesService) MarkAsFixed(siteUrl string, url string, category string, platform string) *UrlcrawlerrorssamplesMarkAsFixedCall {
  2367. c := &UrlcrawlerrorssamplesMarkAsFixedCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2368. c.siteUrl = siteUrl
  2369. c.url = url
  2370. c.urlParams_.Set("category", category)
  2371. c.urlParams_.Set("platform", platform)
  2372. return c
  2373. }
  2374. // Fields allows partial responses to be retrieved. See
  2375. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2376. // for more information.
  2377. func (c *UrlcrawlerrorssamplesMarkAsFixedCall) Fields(s ...googleapi.Field) *UrlcrawlerrorssamplesMarkAsFixedCall {
  2378. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2379. return c
  2380. }
  2381. // Context sets the context to be used in this call's Do method. Any
  2382. // pending HTTP request will be aborted if the provided context is
  2383. // canceled.
  2384. func (c *UrlcrawlerrorssamplesMarkAsFixedCall) Context(ctx context.Context) *UrlcrawlerrorssamplesMarkAsFixedCall {
  2385. c.ctx_ = ctx
  2386. return c
  2387. }
  2388. // Header returns an http.Header that can be modified by the caller to
  2389. // add HTTP headers to the request.
  2390. func (c *UrlcrawlerrorssamplesMarkAsFixedCall) Header() http.Header {
  2391. if c.header_ == nil {
  2392. c.header_ = make(http.Header)
  2393. }
  2394. return c.header_
  2395. }
  2396. func (c *UrlcrawlerrorssamplesMarkAsFixedCall) doRequest(alt string) (*http.Response, error) {
  2397. reqHeaders := make(http.Header)
  2398. for k, v := range c.header_ {
  2399. reqHeaders[k] = v
  2400. }
  2401. reqHeaders.Set("User-Agent", c.s.userAgent())
  2402. var body io.Reader = nil
  2403. c.urlParams_.Set("alt", alt)
  2404. c.urlParams_.Set("prettyPrint", "false")
  2405. urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/urlCrawlErrorsSamples/{url}")
  2406. urls += "?" + c.urlParams_.Encode()
  2407. req, err := http.NewRequest("DELETE", urls, body)
  2408. if err != nil {
  2409. return nil, err
  2410. }
  2411. req.Header = reqHeaders
  2412. googleapi.Expand(req.URL, map[string]string{
  2413. "siteUrl": c.siteUrl,
  2414. "url": c.url,
  2415. })
  2416. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2417. }
  2418. // Do executes the "webmasters.urlcrawlerrorssamples.markAsFixed" call.
  2419. func (c *UrlcrawlerrorssamplesMarkAsFixedCall) Do(opts ...googleapi.CallOption) error {
  2420. gensupport.SetOptions(c.urlParams_, opts...)
  2421. res, err := c.doRequest("json")
  2422. if err != nil {
  2423. return err
  2424. }
  2425. defer googleapi.CloseBody(res)
  2426. if err := googleapi.CheckResponse(res); err != nil {
  2427. return err
  2428. }
  2429. return nil
  2430. // {
  2431. // "description": "Marks the provided site's sample URL as fixed, and removes it from the samples list.",
  2432. // "httpMethod": "DELETE",
  2433. // "id": "webmasters.urlcrawlerrorssamples.markAsFixed",
  2434. // "parameterOrder": [
  2435. // "siteUrl",
  2436. // "url",
  2437. // "category",
  2438. // "platform"
  2439. // ],
  2440. // "parameters": {
  2441. // "category": {
  2442. // "description": "The crawl error category. For example: authPermissions",
  2443. // "enum": [
  2444. // "authPermissions",
  2445. // "flashContent",
  2446. // "manyToOneRedirect",
  2447. // "notFollowed",
  2448. // "notFound",
  2449. // "other",
  2450. // "roboted",
  2451. // "serverError",
  2452. // "soft404"
  2453. // ],
  2454. // "enumDescriptions": [
  2455. // "",
  2456. // "",
  2457. // "",
  2458. // "",
  2459. // "",
  2460. // "",
  2461. // "",
  2462. // "",
  2463. // ""
  2464. // ],
  2465. // "location": "query",
  2466. // "required": true,
  2467. // "type": "string"
  2468. // },
  2469. // "platform": {
  2470. // "description": "The user agent type (platform) that made the request. For example: web",
  2471. // "enum": [
  2472. // "mobile",
  2473. // "smartphoneOnly",
  2474. // "web"
  2475. // ],
  2476. // "enumDescriptions": [
  2477. // "",
  2478. // "",
  2479. // ""
  2480. // ],
  2481. // "location": "query",
  2482. // "required": true,
  2483. // "type": "string"
  2484. // },
  2485. // "siteUrl": {
  2486. // "description": "The site's URL, including protocol. For example: http://www.example.com/",
  2487. // "location": "path",
  2488. // "required": true,
  2489. // "type": "string"
  2490. // },
  2491. // "url": {
  2492. // "description": "The relative path (without the site) of the sample URL. It must be one of the URLs returned by list(). For example, for the URL https://www.example.com/pagename on the site https://www.example.com/, the url value is pagename",
  2493. // "location": "path",
  2494. // "required": true,
  2495. // "type": "string"
  2496. // }
  2497. // },
  2498. // "path": "sites/{siteUrl}/urlCrawlErrorsSamples/{url}",
  2499. // "scopes": [
  2500. // "https://www.googleapis.com/auth/webmasters"
  2501. // ]
  2502. // }
  2503. }