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.
 
 
 

2654 lines
88 KiB

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