1.1.34
by Curtis Hovey
Import upstream version 1.24.6 |
1 |
// Package webmasters provides access to the Webmaster Tools API.
|
2 |
//
|
|
3 |
// See https://developers.google.com/webmaster-tools/v3/welcome
|
|
4 |
//
|
|
5 |
// Usage example:
|
|
6 |
//
|
|
7 |
// import "google.golang.org/api/webmasters/v3"
|
|
8 |
// ...
|
|
9 |
// webmastersService, err := webmasters.New(oauthHttpClient)
|
|
10 |
package webmasters |
|
11 |
||
12 |
import ( |
|
13 |
"bytes"
|
|
14 |
"encoding/json"
|
|
15 |
"errors"
|
|
16 |
"fmt"
|
|
17 |
"google.golang.org/api/googleapi"
|
|
18 |
"io"
|
|
19 |
"net/http"
|
|
20 |
"net/url"
|
|
21 |
"strconv"
|
|
22 |
"strings"
|
|
23 |
)
|
|
24 |
||
25 |
// Always reference these packages, just in case the auto-generated code
|
|
26 |
// below doesn't.
|
|
27 |
var _ = bytes.NewBuffer |
|
28 |
var _ = strconv.Itoa |
|
29 |
var _ = fmt.Sprintf |
|
30 |
var _ = json.NewDecoder |
|
31 |
var _ = io.Copy |
|
32 |
var _ = url.Parse |
|
33 |
var _ = googleapi.Version |
|
34 |
var _ = errors.New |
|
35 |
var _ = strings.Replace |
|
36 |
||
37 |
const apiId = "webmasters:v3" |
|
38 |
const apiName = "webmasters" |
|
39 |
const apiVersion = "v3" |
|
40 |
const basePath = "https://www.googleapis.com/webmasters/v3/" |
|
41 |
||
42 |
// OAuth2 scopes used by this API.
|
|
43 |
const ( |
|
44 |
// View and modify Webmaster Tools data for your verified sites
|
|
45 |
WebmastersScope = "https://www.googleapis.com/auth/webmasters" |
|
46 |
||
47 |
// View Webmaster Tools data for your verified sites
|
|
48 |
WebmastersReadonlyScope = "https://www.googleapis.com/auth/webmasters.readonly" |
|
49 |
)
|
|
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.Sitemaps = NewSitemapsService(s) |
|
57 |
s.Sites = NewSitesService(s) |
|
58 |
s.Urlcrawlerrorscounts = NewUrlcrawlerrorscountsService(s) |
|
59 |
s.Urlcrawlerrorssamples = NewUrlcrawlerrorssamplesService(s) |
|
60 |
return s, nil |
|
61 |
}
|
|
62 |
||
63 |
type Service struct { |
|
64 |
client *http.Client |
|
65 |
BasePath string // API endpoint base URL |
|
66 |
||
67 |
Sitemaps *SitemapsService |
|
68 |
||
69 |
Sites *SitesService |
|
70 |
||
71 |
Urlcrawlerrorscounts *UrlcrawlerrorscountsService |
|
72 |
||
73 |
Urlcrawlerrorssamples *UrlcrawlerrorssamplesService |
|
74 |
}
|
|
75 |
||
76 |
func NewSitemapsService(s *Service) *SitemapsService { |
|
77 |
rs := &SitemapsService{s: s} |
|
78 |
return rs |
|
79 |
}
|
|
80 |
||
81 |
type SitemapsService struct { |
|
82 |
s *Service |
|
83 |
}
|
|
84 |
||
85 |
func NewSitesService(s *Service) *SitesService { |
|
86 |
rs := &SitesService{s: s} |
|
87 |
return rs |
|
88 |
}
|
|
89 |
||
90 |
type SitesService struct { |
|
91 |
s *Service |
|
92 |
}
|
|
93 |
||
94 |
func NewUrlcrawlerrorscountsService(s *Service) *UrlcrawlerrorscountsService { |
|
95 |
rs := &UrlcrawlerrorscountsService{s: s} |
|
96 |
return rs |
|
97 |
}
|
|
98 |
||
99 |
type UrlcrawlerrorscountsService struct { |
|
100 |
s *Service |
|
101 |
}
|
|
102 |
||
103 |
func NewUrlcrawlerrorssamplesService(s *Service) *UrlcrawlerrorssamplesService { |
|
104 |
rs := &UrlcrawlerrorssamplesService{s: s} |
|
105 |
return rs |
|
106 |
}
|
|
107 |
||
108 |
type UrlcrawlerrorssamplesService struct { |
|
109 |
s *Service |
|
110 |
}
|
|
111 |
||
112 |
type SitemapsListResponse struct { |
|
113 |
// Sitemap: Information about a sitemap entry.
|
|
114 |
Sitemap []*WmxSitemap `json:"sitemap,omitempty"` |
|
115 |
}
|
|
116 |
||
117 |
type SitesListResponse struct { |
|
118 |
// SiteEntry: Access level information for a Webmaster Tools site.
|
|
119 |
SiteEntry []*WmxSite `json:"siteEntry,omitempty"` |
|
120 |
}
|
|
121 |
||
122 |
type UrlCrawlErrorCount struct { |
|
123 |
// Count: The error count at the given timestamp.
|
|
124 |
Count int64 `json:"count,omitempty,string"` |
|
125 |
||
126 |
// Timestamp: The time (well, date) when errors were detected, in RFC
|
|
127 |
// 3339 format.
|
|
128 |
Timestamp string `json:"timestamp,omitempty"` |
|
129 |
}
|
|
130 |
||
131 |
type UrlCrawlErrorCountsPerType struct { |
|
132 |
// Category: The crawl error type.
|
|
133 |
Category string `json:"category,omitempty"` |
|
134 |
||
135 |
// Entries: The error count entries time series.
|
|
136 |
Entries []*UrlCrawlErrorCount `json:"entries,omitempty"` |
|
137 |
||
138 |
// Platform: Corresponding to the user agent that made the request.
|
|
139 |
Platform string `json:"platform,omitempty"` |
|
140 |
}
|
|
141 |
||
142 |
type UrlCrawlErrorsCountsQueryResponse struct { |
|
143 |
// CountPerTypes: The time series of the number of URL crawl errors for
|
|
144 |
// per error category and platform.
|
|
145 |
CountPerTypes []*UrlCrawlErrorCountsPerType `json:"countPerTypes,omitempty"` |
|
146 |
}
|
|
147 |
||
148 |
type UrlCrawlErrorsSample struct { |
|
149 |
// First_detected: The time the error was first detected, in RFC 3339
|
|
150 |
// format.
|
|
151 |
First_detected string `json:"first_detected,omitempty"` |
|
152 |
||
153 |
// Last_crawled: The time when the URL was last crawled, in RFC 3339
|
|
154 |
// format.
|
|
155 |
Last_crawled string `json:"last_crawled,omitempty"` |
|
156 |
||
157 |
// PageUrl: The URL of an error, relative to the site.
|
|
158 |
PageUrl string `json:"pageUrl,omitempty"` |
|
159 |
||
160 |
// ResponseCode: The HTTP response code, if any.
|
|
161 |
ResponseCode int64 `json:"responseCode,omitempty"` |
|
162 |
||
163 |
// UrlDetails: Additional details about the URL, set only when calling
|
|
164 |
// get().
|
|
165 |
UrlDetails *UrlSampleDetails `json:"urlDetails,omitempty"` |
|
166 |
}
|
|
167 |
||
168 |
type UrlCrawlErrorsSamplesListResponse struct { |
|
169 |
// UrlCrawlErrorSample: Information about the sample URL and its crawl
|
|
170 |
// error.
|
|
171 |
UrlCrawlErrorSample []*UrlCrawlErrorsSample `json:"urlCrawlErrorSample,omitempty"` |
|
172 |
}
|
|
173 |
||
174 |
type UrlSampleDetails struct { |
|
175 |
// ContainingSitemaps: List of sitemaps pointing at this URL.
|
|
176 |
ContainingSitemaps []string `json:"containingSitemaps,omitempty"` |
|
177 |
||
178 |
// LinkedFromUrls: A sample set of URLs linking to this URL.
|
|
179 |
LinkedFromUrls []string `json:"linkedFromUrls,omitempty"` |
|
180 |
}
|
|
181 |
||
182 |
type WmxSite struct { |
|
183 |
// PermissionLevel: The user's permission level for the site.
|
|
184 |
PermissionLevel string `json:"permissionLevel,omitempty"` |
|
185 |
||
186 |
// SiteUrl: The URL of the site.
|
|
187 |
SiteUrl string `json:"siteUrl,omitempty"` |
|
188 |
}
|
|
189 |
||
190 |
type WmxSitemap struct { |
|
191 |
// Contents: The various content types in the sitemap.
|
|
192 |
Contents []*WmxSitemapContent `json:"contents,omitempty"` |
|
193 |
||
194 |
// Errors: Number of errors in the sitemap - issues with the sitemap
|
|
195 |
// itself, that needs to be fixed before it can be processed correctly.
|
|
196 |
Errors int64 `json:"errors,omitempty,string"` |
|
197 |
||
198 |
// IsPending: If true, the sitemap has not been processed.
|
|
199 |
IsPending bool `json:"isPending,omitempty"` |
|
200 |
||
201 |
// IsSitemapsIndex: If true, the sitemap is a collection of sitemaps.
|
|
202 |
IsSitemapsIndex bool `json:"isSitemapsIndex,omitempty"` |
|
203 |
||
204 |
// LastDownloaded: Date & time in which this sitemap was last
|
|
205 |
// downloaded. Date format is in RFC 3339 format (yyyy-mm-dd).
|
|
206 |
LastDownloaded string `json:"lastDownloaded,omitempty"` |
|
207 |
||
208 |
// LastSubmitted: Date & time in which this sitemap was submitted. Date
|
|
209 |
// format is in RFC 3339 format (yyyy-mm-dd).
|
|
210 |
LastSubmitted string `json:"lastSubmitted,omitempty"` |
|
211 |
||
212 |
// Path: The url of the sitemap.
|
|
213 |
Path string `json:"path,omitempty"` |
|
214 |
||
215 |
// Type: The type of the sitemap (for example "sitemap").
|
|
216 |
Type string `json:"type,omitempty"` |
|
217 |
||
218 |
// Warnings: Number of warnings for the sitemap - issues with URLs in
|
|
219 |
// the sitemaps.
|
|
220 |
Warnings int64 `json:"warnings,omitempty,string"` |
|
221 |
}
|
|
222 |
||
223 |
type WmxSitemapContent struct { |
|
224 |
// Indexed: The number of URLs from the sitemap that were indexed (of
|
|
225 |
// the content type).
|
|
226 |
Indexed int64 `json:"indexed,omitempty,string"` |
|
227 |
||
228 |
// Submitted: The number of URLs in the sitemap (of the content type).
|
|
229 |
Submitted int64 `json:"submitted,omitempty,string"` |
|
230 |
||
231 |
// Type: The specific type of content in this sitemap (for example
|
|
232 |
// "web", "images").
|
|
233 |
Type string `json:"type,omitempty"` |
|
234 |
}
|
|
235 |
||
236 |
// method id "webmasters.sitemaps.delete":
|
|
237 |
||
238 |
type SitemapsDeleteCall struct { |
|
239 |
s *Service |
|
240 |
siteUrl string |
|
241 |
feedpath string |
|
242 |
opt_ map[string]interface{} |
|
243 |
}
|
|
244 |
||
245 |
// Delete: Deletes a sitemap from this site.
|
|
246 |
func (r *SitemapsService) Delete(siteUrl string, feedpath string) *SitemapsDeleteCall { |
|
247 |
c := &SitemapsDeleteCall{s: r.s, opt_: make(map[string]interface{})} |
|
248 |
c.siteUrl = siteUrl |
|
249 |
c.feedpath = feedpath |
|
250 |
return c |
|
251 |
}
|
|
252 |
||
253 |
// Fields allows partial responses to be retrieved.
|
|
254 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
255 |
// for more information.
|
|
256 |
func (c *SitemapsDeleteCall) Fields(s ...googleapi.Field) *SitemapsDeleteCall { |
|
257 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
258 |
return c |
|
259 |
}
|
|
260 |
||
261 |
func (c *SitemapsDeleteCall) Do() error { |
|
262 |
var body io.Reader = nil |
|
263 |
params := make(url.Values) |
|
264 |
params.Set("alt", "json") |
|
265 |
if v, ok := c.opt_["fields"]; ok { |
|
266 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
267 |
}
|
|
268 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}") |
|
269 |
urls += "?" + params.Encode() |
|
270 |
req, _ := http.NewRequest("DELETE", urls, body) |
|
271 |
googleapi.Expand(req.URL, map[string]string{ |
|
272 |
"siteUrl": c.siteUrl, |
|
273 |
"feedpath": c.feedpath, |
|
274 |
})
|
|
275 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
276 |
res, err := c.s.client.Do(req) |
|
277 |
if err != nil { |
|
278 |
return err |
|
279 |
}
|
|
280 |
defer googleapi.CloseBody(res) |
|
281 |
if err := googleapi.CheckResponse(res); err != nil { |
|
282 |
return err |
|
283 |
}
|
|
284 |
return nil |
|
285 |
// {
|
|
286 |
// "description": "Deletes a sitemap from this site.",
|
|
287 |
// "httpMethod": "DELETE",
|
|
288 |
// "id": "webmasters.sitemaps.delete",
|
|
289 |
// "parameterOrder": [
|
|
290 |
// "siteUrl",
|
|
291 |
// "feedpath"
|
|
292 |
// ],
|
|
293 |
// "parameters": {
|
|
294 |
// "feedpath": {
|
|
295 |
// "description": "The URL of the actual sitemap (for example http://www.example.com/sitemap.xml).",
|
|
296 |
// "location": "path",
|
|
297 |
// "required": true,
|
|
298 |
// "type": "string"
|
|
299 |
// },
|
|
300 |
// "siteUrl": {
|
|
301 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
302 |
// "location": "path",
|
|
303 |
// "required": true,
|
|
304 |
// "type": "string"
|
|
305 |
// }
|
|
306 |
// },
|
|
307 |
// "path": "sites/{siteUrl}/sitemaps/{feedpath}",
|
|
308 |
// "scopes": [
|
|
309 |
// "https://www.googleapis.com/auth/webmasters"
|
|
310 |
// ]
|
|
311 |
// }
|
|
312 |
||
313 |
}
|
|
314 |
||
315 |
// method id "webmasters.sitemaps.get":
|
|
316 |
||
317 |
type SitemapsGetCall struct { |
|
318 |
s *Service |
|
319 |
siteUrl string |
|
320 |
feedpath string |
|
321 |
opt_ map[string]interface{} |
|
322 |
}
|
|
323 |
||
324 |
// Get: Retrieves information about a specific sitemap.
|
|
325 |
func (r *SitemapsService) Get(siteUrl string, feedpath string) *SitemapsGetCall { |
|
326 |
c := &SitemapsGetCall{s: r.s, opt_: make(map[string]interface{})} |
|
327 |
c.siteUrl = siteUrl |
|
328 |
c.feedpath = feedpath |
|
329 |
return c |
|
330 |
}
|
|
331 |
||
332 |
// Fields allows partial responses to be retrieved.
|
|
333 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
334 |
// for more information.
|
|
335 |
func (c *SitemapsGetCall) Fields(s ...googleapi.Field) *SitemapsGetCall { |
|
336 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
337 |
return c |
|
338 |
}
|
|
339 |
||
340 |
func (c *SitemapsGetCall) Do() (*WmxSitemap, error) { |
|
341 |
var body io.Reader = nil |
|
342 |
params := make(url.Values) |
|
343 |
params.Set("alt", "json") |
|
344 |
if v, ok := c.opt_["fields"]; ok { |
|
345 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
346 |
}
|
|
347 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}") |
|
348 |
urls += "?" + params.Encode() |
|
349 |
req, _ := http.NewRequest("GET", urls, body) |
|
350 |
googleapi.Expand(req.URL, map[string]string{ |
|
351 |
"siteUrl": c.siteUrl, |
|
352 |
"feedpath": c.feedpath, |
|
353 |
})
|
|
354 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
355 |
res, err := c.s.client.Do(req) |
|
356 |
if err != nil { |
|
357 |
return nil, err |
|
358 |
}
|
|
359 |
defer googleapi.CloseBody(res) |
|
360 |
if err := googleapi.CheckResponse(res); err != nil { |
|
361 |
return nil, err |
|
362 |
}
|
|
363 |
var ret *WmxSitemap |
|
364 |
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { |
|
365 |
return nil, err |
|
366 |
}
|
|
367 |
return ret, nil |
|
368 |
// {
|
|
369 |
// "description": "Retrieves information about a specific sitemap.",
|
|
370 |
// "httpMethod": "GET",
|
|
371 |
// "id": "webmasters.sitemaps.get",
|
|
372 |
// "parameterOrder": [
|
|
373 |
// "siteUrl",
|
|
374 |
// "feedpath"
|
|
375 |
// ],
|
|
376 |
// "parameters": {
|
|
377 |
// "feedpath": {
|
|
378 |
// "description": "The URL of the actual sitemap (for example http://www.example.com/sitemap.xml).",
|
|
379 |
// "location": "path",
|
|
380 |
// "required": true,
|
|
381 |
// "type": "string"
|
|
382 |
// },
|
|
383 |
// "siteUrl": {
|
|
384 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
385 |
// "location": "path",
|
|
386 |
// "required": true,
|
|
387 |
// "type": "string"
|
|
388 |
// }
|
|
389 |
// },
|
|
390 |
// "path": "sites/{siteUrl}/sitemaps/{feedpath}",
|
|
391 |
// "response": {
|
|
392 |
// "$ref": "WmxSitemap"
|
|
393 |
// },
|
|
394 |
// "scopes": [
|
|
395 |
// "https://www.googleapis.com/auth/webmasters",
|
|
396 |
// "https://www.googleapis.com/auth/webmasters.readonly"
|
|
397 |
// ]
|
|
398 |
// }
|
|
399 |
||
400 |
}
|
|
401 |
||
402 |
// method id "webmasters.sitemaps.list":
|
|
403 |
||
404 |
type SitemapsListCall struct { |
|
405 |
s *Service |
|
406 |
siteUrl string |
|
407 |
opt_ map[string]interface{} |
|
408 |
}
|
|
409 |
||
410 |
// List: Lists sitemaps uploaded to the site.
|
|
411 |
func (r *SitemapsService) List(siteUrl string) *SitemapsListCall { |
|
412 |
c := &SitemapsListCall{s: r.s, opt_: make(map[string]interface{})} |
|
413 |
c.siteUrl = siteUrl |
|
414 |
return c |
|
415 |
}
|
|
416 |
||
417 |
// SitemapIndex sets the optional parameter "sitemapIndex": A URL of a
|
|
418 |
// site's sitemap index.
|
|
419 |
func (c *SitemapsListCall) SitemapIndex(sitemapIndex string) *SitemapsListCall { |
|
420 |
c.opt_["sitemapIndex"] = sitemapIndex |
|
421 |
return c |
|
422 |
}
|
|
423 |
||
424 |
// Fields allows partial responses to be retrieved.
|
|
425 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
426 |
// for more information.
|
|
427 |
func (c *SitemapsListCall) Fields(s ...googleapi.Field) *SitemapsListCall { |
|
428 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
429 |
return c |
|
430 |
}
|
|
431 |
||
432 |
func (c *SitemapsListCall) Do() (*SitemapsListResponse, error) { |
|
433 |
var body io.Reader = nil |
|
434 |
params := make(url.Values) |
|
435 |
params.Set("alt", "json") |
|
436 |
if v, ok := c.opt_["sitemapIndex"]; ok { |
|
437 |
params.Set("sitemapIndex", fmt.Sprintf("%v", v)) |
|
438 |
}
|
|
439 |
if v, ok := c.opt_["fields"]; ok { |
|
440 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
441 |
}
|
|
442 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps") |
|
443 |
urls += "?" + params.Encode() |
|
444 |
req, _ := http.NewRequest("GET", urls, body) |
|
445 |
googleapi.Expand(req.URL, map[string]string{ |
|
446 |
"siteUrl": c.siteUrl, |
|
447 |
})
|
|
448 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
449 |
res, err := c.s.client.Do(req) |
|
450 |
if err != nil { |
|
451 |
return nil, err |
|
452 |
}
|
|
453 |
defer googleapi.CloseBody(res) |
|
454 |
if err := googleapi.CheckResponse(res); err != nil { |
|
455 |
return nil, err |
|
456 |
}
|
|
457 |
var ret *SitemapsListResponse |
|
458 |
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { |
|
459 |
return nil, err |
|
460 |
}
|
|
461 |
return ret, nil |
|
462 |
// {
|
|
463 |
// "description": "Lists sitemaps uploaded to the site.",
|
|
464 |
// "httpMethod": "GET",
|
|
465 |
// "id": "webmasters.sitemaps.list",
|
|
466 |
// "parameterOrder": [
|
|
467 |
// "siteUrl"
|
|
468 |
// ],
|
|
469 |
// "parameters": {
|
|
470 |
// "siteUrl": {
|
|
471 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
472 |
// "location": "path",
|
|
473 |
// "required": true,
|
|
474 |
// "type": "string"
|
|
475 |
// },
|
|
476 |
// "sitemapIndex": {
|
|
477 |
// "description": "A URL of a site's sitemap index.",
|
|
478 |
// "location": "query",
|
|
479 |
// "type": "string"
|
|
480 |
// }
|
|
481 |
// },
|
|
482 |
// "path": "sites/{siteUrl}/sitemaps",
|
|
483 |
// "response": {
|
|
484 |
// "$ref": "SitemapsListResponse"
|
|
485 |
// },
|
|
486 |
// "scopes": [
|
|
487 |
// "https://www.googleapis.com/auth/webmasters",
|
|
488 |
// "https://www.googleapis.com/auth/webmasters.readonly"
|
|
489 |
// ]
|
|
490 |
// }
|
|
491 |
||
492 |
}
|
|
493 |
||
494 |
// method id "webmasters.sitemaps.submit":
|
|
495 |
||
496 |
type SitemapsSubmitCall struct { |
|
497 |
s *Service |
|
498 |
siteUrl string |
|
499 |
feedpath string |
|
500 |
opt_ map[string]interface{} |
|
501 |
}
|
|
502 |
||
503 |
// Submit: Submits a sitemap for a site.
|
|
504 |
func (r *SitemapsService) Submit(siteUrl string, feedpath string) *SitemapsSubmitCall { |
|
505 |
c := &SitemapsSubmitCall{s: r.s, opt_: make(map[string]interface{})} |
|
506 |
c.siteUrl = siteUrl |
|
507 |
c.feedpath = feedpath |
|
508 |
return c |
|
509 |
}
|
|
510 |
||
511 |
// Fields allows partial responses to be retrieved.
|
|
512 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
513 |
// for more information.
|
|
514 |
func (c *SitemapsSubmitCall) Fields(s ...googleapi.Field) *SitemapsSubmitCall { |
|
515 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
516 |
return c |
|
517 |
}
|
|
518 |
||
519 |
func (c *SitemapsSubmitCall) Do() error { |
|
520 |
var body io.Reader = nil |
|
521 |
params := make(url.Values) |
|
522 |
params.Set("alt", "json") |
|
523 |
if v, ok := c.opt_["fields"]; ok { |
|
524 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
525 |
}
|
|
526 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}") |
|
527 |
urls += "?" + params.Encode() |
|
528 |
req, _ := http.NewRequest("PUT", urls, body) |
|
529 |
googleapi.Expand(req.URL, map[string]string{ |
|
530 |
"siteUrl": c.siteUrl, |
|
531 |
"feedpath": c.feedpath, |
|
532 |
})
|
|
533 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
534 |
res, err := c.s.client.Do(req) |
|
535 |
if err != nil { |
|
536 |
return err |
|
537 |
}
|
|
538 |
defer googleapi.CloseBody(res) |
|
539 |
if err := googleapi.CheckResponse(res); err != nil { |
|
540 |
return err |
|
541 |
}
|
|
542 |
return nil |
|
543 |
// {
|
|
544 |
// "description": "Submits a sitemap for a site.",
|
|
545 |
// "httpMethod": "PUT",
|
|
546 |
// "id": "webmasters.sitemaps.submit",
|
|
547 |
// "parameterOrder": [
|
|
548 |
// "siteUrl",
|
|
549 |
// "feedpath"
|
|
550 |
// ],
|
|
551 |
// "parameters": {
|
|
552 |
// "feedpath": {
|
|
553 |
// "description": "The URL of the sitemap to add.",
|
|
554 |
// "location": "path",
|
|
555 |
// "required": true,
|
|
556 |
// "type": "string"
|
|
557 |
// },
|
|
558 |
// "siteUrl": {
|
|
559 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
560 |
// "location": "path",
|
|
561 |
// "required": true,
|
|
562 |
// "type": "string"
|
|
563 |
// }
|
|
564 |
// },
|
|
565 |
// "path": "sites/{siteUrl}/sitemaps/{feedpath}",
|
|
566 |
// "scopes": [
|
|
567 |
// "https://www.googleapis.com/auth/webmasters"
|
|
568 |
// ]
|
|
569 |
// }
|
|
570 |
||
571 |
}
|
|
572 |
||
573 |
// method id "webmasters.sites.add":
|
|
574 |
||
575 |
type SitesAddCall struct { |
|
576 |
s *Service |
|
577 |
siteUrl string |
|
578 |
opt_ map[string]interface{} |
|
579 |
}
|
|
580 |
||
581 |
// Add: Adds a site to the set of the user's sites in Webmaster Tools.
|
|
582 |
func (r *SitesService) Add(siteUrl string) *SitesAddCall { |
|
583 |
c := &SitesAddCall{s: r.s, opt_: make(map[string]interface{})} |
|
584 |
c.siteUrl = siteUrl |
|
585 |
return c |
|
586 |
}
|
|
587 |
||
588 |
// Fields allows partial responses to be retrieved.
|
|
589 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
590 |
// for more information.
|
|
591 |
func (c *SitesAddCall) Fields(s ...googleapi.Field) *SitesAddCall { |
|
592 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
593 |
return c |
|
594 |
}
|
|
595 |
||
596 |
func (c *SitesAddCall) Do() error { |
|
597 |
var body io.Reader = nil |
|
598 |
params := make(url.Values) |
|
599 |
params.Set("alt", "json") |
|
600 |
if v, ok := c.opt_["fields"]; ok { |
|
601 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
602 |
}
|
|
603 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}") |
|
604 |
urls += "?" + params.Encode() |
|
605 |
req, _ := http.NewRequest("PUT", urls, body) |
|
606 |
googleapi.Expand(req.URL, map[string]string{ |
|
607 |
"siteUrl": c.siteUrl, |
|
608 |
})
|
|
609 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
610 |
res, err := c.s.client.Do(req) |
|
611 |
if err != nil { |
|
612 |
return err |
|
613 |
}
|
|
614 |
defer googleapi.CloseBody(res) |
|
615 |
if err := googleapi.CheckResponse(res); err != nil { |
|
616 |
return err |
|
617 |
}
|
|
618 |
return nil |
|
619 |
// {
|
|
620 |
// "description": "Adds a site to the set of the user's sites in Webmaster Tools.",
|
|
621 |
// "httpMethod": "PUT",
|
|
622 |
// "id": "webmasters.sites.add",
|
|
623 |
// "parameterOrder": [
|
|
624 |
// "siteUrl"
|
|
625 |
// ],
|
|
626 |
// "parameters": {
|
|
627 |
// "siteUrl": {
|
|
628 |
// "description": "The URL of the site to add.",
|
|
629 |
// "location": "path",
|
|
630 |
// "required": true,
|
|
631 |
// "type": "string"
|
|
632 |
// }
|
|
633 |
// },
|
|
634 |
// "path": "sites/{siteUrl}",
|
|
635 |
// "scopes": [
|
|
636 |
// "https://www.googleapis.com/auth/webmasters"
|
|
637 |
// ]
|
|
638 |
// }
|
|
639 |
||
640 |
}
|
|
641 |
||
642 |
// method id "webmasters.sites.delete":
|
|
643 |
||
644 |
type SitesDeleteCall struct { |
|
645 |
s *Service |
|
646 |
siteUrl string |
|
647 |
opt_ map[string]interface{} |
|
648 |
}
|
|
649 |
||
650 |
// Delete: Removes a site from the set of the user's Webmaster Tools
|
|
651 |
// sites.
|
|
652 |
func (r *SitesService) Delete(siteUrl string) *SitesDeleteCall { |
|
653 |
c := &SitesDeleteCall{s: r.s, opt_: make(map[string]interface{})} |
|
654 |
c.siteUrl = siteUrl |
|
655 |
return c |
|
656 |
}
|
|
657 |
||
658 |
// Fields allows partial responses to be retrieved.
|
|
659 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
660 |
// for more information.
|
|
661 |
func (c *SitesDeleteCall) Fields(s ...googleapi.Field) *SitesDeleteCall { |
|
662 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
663 |
return c |
|
664 |
}
|
|
665 |
||
666 |
func (c *SitesDeleteCall) Do() error { |
|
667 |
var body io.Reader = nil |
|
668 |
params := make(url.Values) |
|
669 |
params.Set("alt", "json") |
|
670 |
if v, ok := c.opt_["fields"]; ok { |
|
671 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
672 |
}
|
|
673 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}") |
|
674 |
urls += "?" + params.Encode() |
|
675 |
req, _ := http.NewRequest("DELETE", urls, body) |
|
676 |
googleapi.Expand(req.URL, map[string]string{ |
|
677 |
"siteUrl": c.siteUrl, |
|
678 |
})
|
|
679 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
680 |
res, err := c.s.client.Do(req) |
|
681 |
if err != nil { |
|
682 |
return err |
|
683 |
}
|
|
684 |
defer googleapi.CloseBody(res) |
|
685 |
if err := googleapi.CheckResponse(res); err != nil { |
|
686 |
return err |
|
687 |
}
|
|
688 |
return nil |
|
689 |
// {
|
|
690 |
// "description": "Removes a site from the set of the user's Webmaster Tools sites.",
|
|
691 |
// "httpMethod": "DELETE",
|
|
692 |
// "id": "webmasters.sites.delete",
|
|
693 |
// "parameterOrder": [
|
|
694 |
// "siteUrl"
|
|
695 |
// ],
|
|
696 |
// "parameters": {
|
|
697 |
// "siteUrl": {
|
|
698 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
699 |
// "location": "path",
|
|
700 |
// "required": true,
|
|
701 |
// "type": "string"
|
|
702 |
// }
|
|
703 |
// },
|
|
704 |
// "path": "sites/{siteUrl}",
|
|
705 |
// "scopes": [
|
|
706 |
// "https://www.googleapis.com/auth/webmasters"
|
|
707 |
// ]
|
|
708 |
// }
|
|
709 |
||
710 |
}
|
|
711 |
||
712 |
// method id "webmasters.sites.get":
|
|
713 |
||
714 |
type SitesGetCall struct { |
|
715 |
s *Service |
|
716 |
siteUrl string |
|
717 |
opt_ map[string]interface{} |
|
718 |
}
|
|
719 |
||
720 |
// Get: Retrieves information about specific site.
|
|
721 |
func (r *SitesService) Get(siteUrl string) *SitesGetCall { |
|
722 |
c := &SitesGetCall{s: r.s, opt_: make(map[string]interface{})} |
|
723 |
c.siteUrl = siteUrl |
|
724 |
return c |
|
725 |
}
|
|
726 |
||
727 |
// Fields allows partial responses to be retrieved.
|
|
728 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
729 |
// for more information.
|
|
730 |
func (c *SitesGetCall) Fields(s ...googleapi.Field) *SitesGetCall { |
|
731 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
732 |
return c |
|
733 |
}
|
|
734 |
||
735 |
func (c *SitesGetCall) Do() (*WmxSite, error) { |
|
736 |
var body io.Reader = nil |
|
737 |
params := make(url.Values) |
|
738 |
params.Set("alt", "json") |
|
739 |
if v, ok := c.opt_["fields"]; ok { |
|
740 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
741 |
}
|
|
742 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}") |
|
743 |
urls += "?" + params.Encode() |
|
744 |
req, _ := http.NewRequest("GET", urls, body) |
|
745 |
googleapi.Expand(req.URL, map[string]string{ |
|
746 |
"siteUrl": c.siteUrl, |
|
747 |
})
|
|
748 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
749 |
res, err := c.s.client.Do(req) |
|
750 |
if err != nil { |
|
751 |
return nil, err |
|
752 |
}
|
|
753 |
defer googleapi.CloseBody(res) |
|
754 |
if err := googleapi.CheckResponse(res); err != nil { |
|
755 |
return nil, err |
|
756 |
}
|
|
757 |
var ret *WmxSite |
|
758 |
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { |
|
759 |
return nil, err |
|
760 |
}
|
|
761 |
return ret, nil |
|
762 |
// {
|
|
763 |
// "description": "Retrieves information about specific site.",
|
|
764 |
// "httpMethod": "GET",
|
|
765 |
// "id": "webmasters.sites.get",
|
|
766 |
// "parameterOrder": [
|
|
767 |
// "siteUrl"
|
|
768 |
// ],
|
|
769 |
// "parameters": {
|
|
770 |
// "siteUrl": {
|
|
771 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
772 |
// "location": "path",
|
|
773 |
// "required": true,
|
|
774 |
// "type": "string"
|
|
775 |
// }
|
|
776 |
// },
|
|
777 |
// "path": "sites/{siteUrl}",
|
|
778 |
// "response": {
|
|
779 |
// "$ref": "WmxSite"
|
|
780 |
// },
|
|
781 |
// "scopes": [
|
|
782 |
// "https://www.googleapis.com/auth/webmasters",
|
|
783 |
// "https://www.googleapis.com/auth/webmasters.readonly"
|
|
784 |
// ]
|
|
785 |
// }
|
|
786 |
||
787 |
}
|
|
788 |
||
789 |
// method id "webmasters.sites.list":
|
|
790 |
||
791 |
type SitesListCall struct { |
|
792 |
s *Service |
|
793 |
opt_ map[string]interface{} |
|
794 |
}
|
|
795 |
||
796 |
// List: Lists your Webmaster Tools sites.
|
|
797 |
func (r *SitesService) List() *SitesListCall { |
|
798 |
c := &SitesListCall{s: r.s, opt_: make(map[string]interface{})} |
|
799 |
return c |
|
800 |
}
|
|
801 |
||
802 |
// Fields allows partial responses to be retrieved.
|
|
803 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
804 |
// for more information.
|
|
805 |
func (c *SitesListCall) Fields(s ...googleapi.Field) *SitesListCall { |
|
806 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
807 |
return c |
|
808 |
}
|
|
809 |
||
810 |
func (c *SitesListCall) Do() (*SitesListResponse, error) { |
|
811 |
var body io.Reader = nil |
|
812 |
params := make(url.Values) |
|
813 |
params.Set("alt", "json") |
|
814 |
if v, ok := c.opt_["fields"]; ok { |
|
815 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
816 |
}
|
|
817 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites") |
|
818 |
urls += "?" + params.Encode() |
|
819 |
req, _ := http.NewRequest("GET", urls, body) |
|
820 |
googleapi.SetOpaque(req.URL) |
|
821 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
822 |
res, err := c.s.client.Do(req) |
|
823 |
if err != nil { |
|
824 |
return nil, err |
|
825 |
}
|
|
826 |
defer googleapi.CloseBody(res) |
|
827 |
if err := googleapi.CheckResponse(res); err != nil { |
|
828 |
return nil, err |
|
829 |
}
|
|
830 |
var ret *SitesListResponse |
|
831 |
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { |
|
832 |
return nil, err |
|
833 |
}
|
|
834 |
return ret, nil |
|
835 |
// {
|
|
836 |
// "description": "Lists your Webmaster Tools sites.",
|
|
837 |
// "httpMethod": "GET",
|
|
838 |
// "id": "webmasters.sites.list",
|
|
839 |
// "path": "sites",
|
|
840 |
// "response": {
|
|
841 |
// "$ref": "SitesListResponse"
|
|
842 |
// },
|
|
843 |
// "scopes": [
|
|
844 |
// "https://www.googleapis.com/auth/webmasters",
|
|
845 |
// "https://www.googleapis.com/auth/webmasters.readonly"
|
|
846 |
// ]
|
|
847 |
// }
|
|
848 |
||
849 |
}
|
|
850 |
||
851 |
// method id "webmasters.urlcrawlerrorscounts.query":
|
|
852 |
||
853 |
type UrlcrawlerrorscountsQueryCall struct { |
|
854 |
s *Service |
|
855 |
siteUrl string |
|
856 |
opt_ map[string]interface{} |
|
857 |
}
|
|
858 |
||
859 |
// Query: Retrieves a time series of the number of URL crawl errors per
|
|
860 |
// error category and platform.
|
|
861 |
func (r *UrlcrawlerrorscountsService) Query(siteUrl string) *UrlcrawlerrorscountsQueryCall { |
|
862 |
c := &UrlcrawlerrorscountsQueryCall{s: r.s, opt_: make(map[string]interface{})} |
|
863 |
c.siteUrl = siteUrl |
|
864 |
return c |
|
865 |
}
|
|
866 |
||
867 |
// Category sets the optional parameter "category": The crawl error
|
|
868 |
// category, for example 'serverError'. If not specified, we return
|
|
869 |
// results for all categories.
|
|
870 |
func (c *UrlcrawlerrorscountsQueryCall) Category(category string) *UrlcrawlerrorscountsQueryCall { |
|
871 |
c.opt_["category"] = category |
|
872 |
return c |
|
873 |
}
|
|
874 |
||
875 |
// LatestCountsOnly sets the optional parameter "latestCountsOnly": If
|
|
876 |
// true, returns only the latest crawl error counts.
|
|
877 |
func (c *UrlcrawlerrorscountsQueryCall) LatestCountsOnly(latestCountsOnly bool) *UrlcrawlerrorscountsQueryCall { |
|
878 |
c.opt_["latestCountsOnly"] = latestCountsOnly |
|
879 |
return c |
|
880 |
}
|
|
881 |
||
882 |
// Platform sets the optional parameter "platform": The user agent type
|
|
883 |
// (platform) that made the request, for example 'web'. If not
|
|
884 |
// specified, we return results for all platforms.
|
|
885 |
func (c *UrlcrawlerrorscountsQueryCall) Platform(platform string) *UrlcrawlerrorscountsQueryCall { |
|
886 |
c.opt_["platform"] = platform |
|
887 |
return c |
|
888 |
}
|
|
889 |
||
890 |
// Fields allows partial responses to be retrieved.
|
|
891 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
892 |
// for more information.
|
|
893 |
func (c *UrlcrawlerrorscountsQueryCall) Fields(s ...googleapi.Field) *UrlcrawlerrorscountsQueryCall { |
|
894 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
895 |
return c |
|
896 |
}
|
|
897 |
||
898 |
func (c *UrlcrawlerrorscountsQueryCall) Do() (*UrlCrawlErrorsCountsQueryResponse, error) { |
|
899 |
var body io.Reader = nil |
|
900 |
params := make(url.Values) |
|
901 |
params.Set("alt", "json") |
|
902 |
if v, ok := c.opt_["category"]; ok { |
|
903 |
params.Set("category", fmt.Sprintf("%v", v)) |
|
904 |
}
|
|
905 |
if v, ok := c.opt_["latestCountsOnly"]; ok { |
|
906 |
params.Set("latestCountsOnly", fmt.Sprintf("%v", v)) |
|
907 |
}
|
|
908 |
if v, ok := c.opt_["platform"]; ok { |
|
909 |
params.Set("platform", fmt.Sprintf("%v", v)) |
|
910 |
}
|
|
911 |
if v, ok := c.opt_["fields"]; ok { |
|
912 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
913 |
}
|
|
914 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/urlCrawlErrorsCounts/query") |
|
915 |
urls += "?" + params.Encode() |
|
916 |
req, _ := http.NewRequest("GET", urls, body) |
|
917 |
googleapi.Expand(req.URL, map[string]string{ |
|
918 |
"siteUrl": c.siteUrl, |
|
919 |
})
|
|
920 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
921 |
res, err := c.s.client.Do(req) |
|
922 |
if err != nil { |
|
923 |
return nil, err |
|
924 |
}
|
|
925 |
defer googleapi.CloseBody(res) |
|
926 |
if err := googleapi.CheckResponse(res); err != nil { |
|
927 |
return nil, err |
|
928 |
}
|
|
929 |
var ret *UrlCrawlErrorsCountsQueryResponse |
|
930 |
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { |
|
931 |
return nil, err |
|
932 |
}
|
|
933 |
return ret, nil |
|
934 |
// {
|
|
935 |
// "description": "Retrieves a time series of the number of URL crawl errors per error category and platform.",
|
|
936 |
// "httpMethod": "GET",
|
|
937 |
// "id": "webmasters.urlcrawlerrorscounts.query",
|
|
938 |
// "parameterOrder": [
|
|
939 |
// "siteUrl"
|
|
940 |
// ],
|
|
941 |
// "parameters": {
|
|
942 |
// "category": {
|
|
943 |
// "description": "The crawl error category, for example 'serverError'. If not specified, we return results for all categories.",
|
|
944 |
// "enum": [
|
|
945 |
// "authPermissions",
|
|
946 |
// "manyToOneRedirect",
|
|
947 |
// "notFollowed",
|
|
948 |
// "notFound",
|
|
949 |
// "other",
|
|
950 |
// "roboted",
|
|
951 |
// "serverError",
|
|
952 |
// "soft404"
|
|
953 |
// ],
|
|
954 |
// "enumDescriptions": [
|
|
955 |
// "",
|
|
956 |
// "",
|
|
957 |
// "",
|
|
958 |
// "",
|
|
959 |
// "",
|
|
960 |
// "",
|
|
961 |
// "",
|
|
962 |
// ""
|
|
963 |
// ],
|
|
964 |
// "location": "query",
|
|
965 |
// "type": "string"
|
|
966 |
// },
|
|
967 |
// "latestCountsOnly": {
|
|
968 |
// "default": "true",
|
|
969 |
// "description": "If true, returns only the latest crawl error counts.",
|
|
970 |
// "location": "query",
|
|
971 |
// "type": "boolean"
|
|
972 |
// },
|
|
973 |
// "platform": {
|
|
974 |
// "description": "The user agent type (platform) that made the request, for example 'web'. If not specified, we return results for all platforms.",
|
|
975 |
// "enum": [
|
|
976 |
// "mobile",
|
|
977 |
// "smartphoneOnly",
|
|
978 |
// "web"
|
|
979 |
// ],
|
|
980 |
// "enumDescriptions": [
|
|
981 |
// "",
|
|
982 |
// "",
|
|
983 |
// ""
|
|
984 |
// ],
|
|
985 |
// "location": "query",
|
|
986 |
// "type": "string"
|
|
987 |
// },
|
|
988 |
// "siteUrl": {
|
|
989 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
990 |
// "location": "path",
|
|
991 |
// "required": true,
|
|
992 |
// "type": "string"
|
|
993 |
// }
|
|
994 |
// },
|
|
995 |
// "path": "sites/{siteUrl}/urlCrawlErrorsCounts/query",
|
|
996 |
// "response": {
|
|
997 |
// "$ref": "UrlCrawlErrorsCountsQueryResponse"
|
|
998 |
// },
|
|
999 |
// "scopes": [
|
|
1000 |
// "https://www.googleapis.com/auth/webmasters",
|
|
1001 |
// "https://www.googleapis.com/auth/webmasters.readonly"
|
|
1002 |
// ]
|
|
1003 |
// }
|
|
1004 |
||
1005 |
}
|
|
1006 |
||
1007 |
// method id "webmasters.urlcrawlerrorssamples.get":
|
|
1008 |
||
1009 |
type UrlcrawlerrorssamplesGetCall struct { |
|
1010 |
s *Service |
|
1011 |
siteUrl string |
|
1012 |
url string |
|
1013 |
category string |
|
1014 |
platform string |
|
1015 |
opt_ map[string]interface{} |
|
1016 |
}
|
|
1017 |
||
1018 |
// Get: Retrieves details about crawl errors for a site's sample URL.
|
|
1019 |
func (r *UrlcrawlerrorssamplesService) Get(siteUrl string, url string, category string, platform string) *UrlcrawlerrorssamplesGetCall { |
|
1020 |
c := &UrlcrawlerrorssamplesGetCall{s: r.s, opt_: make(map[string]interface{})} |
|
1021 |
c.siteUrl = siteUrl |
|
1022 |
c.url = url |
|
1023 |
c.category = category |
|
1024 |
c.platform = platform |
|
1025 |
return c |
|
1026 |
}
|
|
1027 |
||
1028 |
// Fields allows partial responses to be retrieved.
|
|
1029 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
1030 |
// for more information.
|
|
1031 |
func (c *UrlcrawlerrorssamplesGetCall) Fields(s ...googleapi.Field) *UrlcrawlerrorssamplesGetCall { |
|
1032 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
1033 |
return c |
|
1034 |
}
|
|
1035 |
||
1036 |
func (c *UrlcrawlerrorssamplesGetCall) Do() (*UrlCrawlErrorsSample, error) { |
|
1037 |
var body io.Reader = nil |
|
1038 |
params := make(url.Values) |
|
1039 |
params.Set("alt", "json") |
|
1040 |
params.Set("category", fmt.Sprintf("%v", c.category)) |
|
1041 |
params.Set("platform", fmt.Sprintf("%v", c.platform)) |
|
1042 |
if v, ok := c.opt_["fields"]; ok { |
|
1043 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
1044 |
}
|
|
1045 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/urlCrawlErrorsSamples/{url}") |
|
1046 |
urls += "?" + params.Encode() |
|
1047 |
req, _ := http.NewRequest("GET", urls, body) |
|
1048 |
googleapi.Expand(req.URL, map[string]string{ |
|
1049 |
"siteUrl": c.siteUrl, |
|
1050 |
"url": c.url, |
|
1051 |
})
|
|
1052 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
1053 |
res, err := c.s.client.Do(req) |
|
1054 |
if err != nil { |
|
1055 |
return nil, err |
|
1056 |
}
|
|
1057 |
defer googleapi.CloseBody(res) |
|
1058 |
if err := googleapi.CheckResponse(res); err != nil { |
|
1059 |
return nil, err |
|
1060 |
}
|
|
1061 |
var ret *UrlCrawlErrorsSample |
|
1062 |
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { |
|
1063 |
return nil, err |
|
1064 |
}
|
|
1065 |
return ret, nil |
|
1066 |
// {
|
|
1067 |
// "description": "Retrieves details about crawl errors for a site's sample URL.",
|
|
1068 |
// "httpMethod": "GET",
|
|
1069 |
// "id": "webmasters.urlcrawlerrorssamples.get",
|
|
1070 |
// "parameterOrder": [
|
|
1071 |
// "siteUrl",
|
|
1072 |
// "url",
|
|
1073 |
// "category",
|
|
1074 |
// "platform"
|
|
1075 |
// ],
|
|
1076 |
// "parameters": {
|
|
1077 |
// "category": {
|
|
1078 |
// "description": "The crawl error category, for example 'authPermissions'",
|
|
1079 |
// "enum": [
|
|
1080 |
// "authPermissions",
|
|
1081 |
// "manyToOneRedirect",
|
|
1082 |
// "notFollowed",
|
|
1083 |
// "notFound",
|
|
1084 |
// "other",
|
|
1085 |
// "roboted",
|
|
1086 |
// "serverError",
|
|
1087 |
// "soft404"
|
|
1088 |
// ],
|
|
1089 |
// "enumDescriptions": [
|
|
1090 |
// "",
|
|
1091 |
// "",
|
|
1092 |
// "",
|
|
1093 |
// "",
|
|
1094 |
// "",
|
|
1095 |
// "",
|
|
1096 |
// "",
|
|
1097 |
// ""
|
|
1098 |
// ],
|
|
1099 |
// "location": "query",
|
|
1100 |
// "required": true,
|
|
1101 |
// "type": "string"
|
|
1102 |
// },
|
|
1103 |
// "platform": {
|
|
1104 |
// "description": "The user agent type (platform) that made the request, for example 'web'",
|
|
1105 |
// "enum": [
|
|
1106 |
// "mobile",
|
|
1107 |
// "smartphoneOnly",
|
|
1108 |
// "web"
|
|
1109 |
// ],
|
|
1110 |
// "enumDescriptions": [
|
|
1111 |
// "",
|
|
1112 |
// "",
|
|
1113 |
// ""
|
|
1114 |
// ],
|
|
1115 |
// "location": "query",
|
|
1116 |
// "required": true,
|
|
1117 |
// "type": "string"
|
|
1118 |
// },
|
|
1119 |
// "siteUrl": {
|
|
1120 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
1121 |
// "location": "path",
|
|
1122 |
// "required": true,
|
|
1123 |
// "type": "string"
|
|
1124 |
// },
|
|
1125 |
// "url": {
|
|
1126 |
// "description": "The relative path (without the site) of the sample URL; must be one of the URLs returned by list",
|
|
1127 |
// "location": "path",
|
|
1128 |
// "required": true,
|
|
1129 |
// "type": "string"
|
|
1130 |
// }
|
|
1131 |
// },
|
|
1132 |
// "path": "sites/{siteUrl}/urlCrawlErrorsSamples/{url}",
|
|
1133 |
// "response": {
|
|
1134 |
// "$ref": "UrlCrawlErrorsSample"
|
|
1135 |
// },
|
|
1136 |
// "scopes": [
|
|
1137 |
// "https://www.googleapis.com/auth/webmasters",
|
|
1138 |
// "https://www.googleapis.com/auth/webmasters.readonly"
|
|
1139 |
// ]
|
|
1140 |
// }
|
|
1141 |
||
1142 |
}
|
|
1143 |
||
1144 |
// method id "webmasters.urlcrawlerrorssamples.list":
|
|
1145 |
||
1146 |
type UrlcrawlerrorssamplesListCall struct { |
|
1147 |
s *Service |
|
1148 |
siteUrl string |
|
1149 |
category string |
|
1150 |
platform string |
|
1151 |
opt_ map[string]interface{} |
|
1152 |
}
|
|
1153 |
||
1154 |
// List: Lists a site's sample URLs for the specified crawl error
|
|
1155 |
// category and platform.
|
|
1156 |
func (r *UrlcrawlerrorssamplesService) List(siteUrl string, category string, platform string) *UrlcrawlerrorssamplesListCall { |
|
1157 |
c := &UrlcrawlerrorssamplesListCall{s: r.s, opt_: make(map[string]interface{})} |
|
1158 |
c.siteUrl = siteUrl |
|
1159 |
c.category = category |
|
1160 |
c.platform = platform |
|
1161 |
return c |
|
1162 |
}
|
|
1163 |
||
1164 |
// Fields allows partial responses to be retrieved.
|
|
1165 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
1166 |
// for more information.
|
|
1167 |
func (c *UrlcrawlerrorssamplesListCall) Fields(s ...googleapi.Field) *UrlcrawlerrorssamplesListCall { |
|
1168 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
1169 |
return c |
|
1170 |
}
|
|
1171 |
||
1172 |
func (c *UrlcrawlerrorssamplesListCall) Do() (*UrlCrawlErrorsSamplesListResponse, error) { |
|
1173 |
var body io.Reader = nil |
|
1174 |
params := make(url.Values) |
|
1175 |
params.Set("alt", "json") |
|
1176 |
params.Set("category", fmt.Sprintf("%v", c.category)) |
|
1177 |
params.Set("platform", fmt.Sprintf("%v", c.platform)) |
|
1178 |
if v, ok := c.opt_["fields"]; ok { |
|
1179 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
1180 |
}
|
|
1181 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/urlCrawlErrorsSamples") |
|
1182 |
urls += "?" + params.Encode() |
|
1183 |
req, _ := http.NewRequest("GET", urls, body) |
|
1184 |
googleapi.Expand(req.URL, map[string]string{ |
|
1185 |
"siteUrl": c.siteUrl, |
|
1186 |
})
|
|
1187 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
1188 |
res, err := c.s.client.Do(req) |
|
1189 |
if err != nil { |
|
1190 |
return nil, err |
|
1191 |
}
|
|
1192 |
defer googleapi.CloseBody(res) |
|
1193 |
if err := googleapi.CheckResponse(res); err != nil { |
|
1194 |
return nil, err |
|
1195 |
}
|
|
1196 |
var ret *UrlCrawlErrorsSamplesListResponse |
|
1197 |
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { |
|
1198 |
return nil, err |
|
1199 |
}
|
|
1200 |
return ret, nil |
|
1201 |
// {
|
|
1202 |
// "description": "Lists a site's sample URLs for the specified crawl error category and platform.",
|
|
1203 |
// "httpMethod": "GET",
|
|
1204 |
// "id": "webmasters.urlcrawlerrorssamples.list",
|
|
1205 |
// "parameterOrder": [
|
|
1206 |
// "siteUrl",
|
|
1207 |
// "category",
|
|
1208 |
// "platform"
|
|
1209 |
// ],
|
|
1210 |
// "parameters": {
|
|
1211 |
// "category": {
|
|
1212 |
// "description": "The crawl error category, for example 'authPermissions'",
|
|
1213 |
// "enum": [
|
|
1214 |
// "authPermissions",
|
|
1215 |
// "manyToOneRedirect",
|
|
1216 |
// "notFollowed",
|
|
1217 |
// "notFound",
|
|
1218 |
// "other",
|
|
1219 |
// "roboted",
|
|
1220 |
// "serverError",
|
|
1221 |
// "soft404"
|
|
1222 |
// ],
|
|
1223 |
// "enumDescriptions": [
|
|
1224 |
// "",
|
|
1225 |
// "",
|
|
1226 |
// "",
|
|
1227 |
// "",
|
|
1228 |
// "",
|
|
1229 |
// "",
|
|
1230 |
// "",
|
|
1231 |
// ""
|
|
1232 |
// ],
|
|
1233 |
// "location": "query",
|
|
1234 |
// "required": true,
|
|
1235 |
// "type": "string"
|
|
1236 |
// },
|
|
1237 |
// "platform": {
|
|
1238 |
// "description": "The user agent type (platform) that made the request, for example 'web'",
|
|
1239 |
// "enum": [
|
|
1240 |
// "mobile",
|
|
1241 |
// "smartphoneOnly",
|
|
1242 |
// "web"
|
|
1243 |
// ],
|
|
1244 |
// "enumDescriptions": [
|
|
1245 |
// "",
|
|
1246 |
// "",
|
|
1247 |
// ""
|
|
1248 |
// ],
|
|
1249 |
// "location": "query",
|
|
1250 |
// "required": true,
|
|
1251 |
// "type": "string"
|
|
1252 |
// },
|
|
1253 |
// "siteUrl": {
|
|
1254 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
1255 |
// "location": "path",
|
|
1256 |
// "required": true,
|
|
1257 |
// "type": "string"
|
|
1258 |
// }
|
|
1259 |
// },
|
|
1260 |
// "path": "sites/{siteUrl}/urlCrawlErrorsSamples",
|
|
1261 |
// "response": {
|
|
1262 |
// "$ref": "UrlCrawlErrorsSamplesListResponse"
|
|
1263 |
// },
|
|
1264 |
// "scopes": [
|
|
1265 |
// "https://www.googleapis.com/auth/webmasters",
|
|
1266 |
// "https://www.googleapis.com/auth/webmasters.readonly"
|
|
1267 |
// ]
|
|
1268 |
// }
|
|
1269 |
||
1270 |
}
|
|
1271 |
||
1272 |
// method id "webmasters.urlcrawlerrorssamples.markAsFixed":
|
|
1273 |
||
1274 |
type UrlcrawlerrorssamplesMarkAsFixedCall struct { |
|
1275 |
s *Service |
|
1276 |
siteUrl string |
|
1277 |
url string |
|
1278 |
category string |
|
1279 |
platform string |
|
1280 |
opt_ map[string]interface{} |
|
1281 |
}
|
|
1282 |
||
1283 |
// MarkAsFixed: Marks the provided site's sample URL as fixed, and
|
|
1284 |
// removes it from the samples list.
|
|
1285 |
func (r *UrlcrawlerrorssamplesService) MarkAsFixed(siteUrl string, url string, category string, platform string) *UrlcrawlerrorssamplesMarkAsFixedCall { |
|
1286 |
c := &UrlcrawlerrorssamplesMarkAsFixedCall{s: r.s, opt_: make(map[string]interface{})} |
|
1287 |
c.siteUrl = siteUrl |
|
1288 |
c.url = url |
|
1289 |
c.category = category |
|
1290 |
c.platform = platform |
|
1291 |
return c |
|
1292 |
}
|
|
1293 |
||
1294 |
// Fields allows partial responses to be retrieved.
|
|
1295 |
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
|
|
1296 |
// for more information.
|
|
1297 |
func (c *UrlcrawlerrorssamplesMarkAsFixedCall) Fields(s ...googleapi.Field) *UrlcrawlerrorssamplesMarkAsFixedCall { |
|
1298 |
c.opt_["fields"] = googleapi.CombineFields(s) |
|
1299 |
return c |
|
1300 |
}
|
|
1301 |
||
1302 |
func (c *UrlcrawlerrorssamplesMarkAsFixedCall) Do() error { |
|
1303 |
var body io.Reader = nil |
|
1304 |
params := make(url.Values) |
|
1305 |
params.Set("alt", "json") |
|
1306 |
params.Set("category", fmt.Sprintf("%v", c.category)) |
|
1307 |
params.Set("platform", fmt.Sprintf("%v", c.platform)) |
|
1308 |
if v, ok := c.opt_["fields"]; ok { |
|
1309 |
params.Set("fields", fmt.Sprintf("%v", v)) |
|
1310 |
}
|
|
1311 |
urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/urlCrawlErrorsSamples/{url}") |
|
1312 |
urls += "?" + params.Encode() |
|
1313 |
req, _ := http.NewRequest("DELETE", urls, body) |
|
1314 |
googleapi.Expand(req.URL, map[string]string{ |
|
1315 |
"siteUrl": c.siteUrl, |
|
1316 |
"url": c.url, |
|
1317 |
})
|
|
1318 |
req.Header.Set("User-Agent", "google-api-go-client/0.5") |
|
1319 |
res, err := c.s.client.Do(req) |
|
1320 |
if err != nil { |
|
1321 |
return err |
|
1322 |
}
|
|
1323 |
defer googleapi.CloseBody(res) |
|
1324 |
if err := googleapi.CheckResponse(res); err != nil { |
|
1325 |
return err |
|
1326 |
}
|
|
1327 |
return nil |
|
1328 |
// {
|
|
1329 |
// "description": "Marks the provided site's sample URL as fixed, and removes it from the samples list.",
|
|
1330 |
// "httpMethod": "DELETE",
|
|
1331 |
// "id": "webmasters.urlcrawlerrorssamples.markAsFixed",
|
|
1332 |
// "parameterOrder": [
|
|
1333 |
// "siteUrl",
|
|
1334 |
// "url",
|
|
1335 |
// "category",
|
|
1336 |
// "platform"
|
|
1337 |
// ],
|
|
1338 |
// "parameters": {
|
|
1339 |
// "category": {
|
|
1340 |
// "description": "The crawl error category, for example 'authPermissions'",
|
|
1341 |
// "enum": [
|
|
1342 |
// "authPermissions",
|
|
1343 |
// "manyToOneRedirect",
|
|
1344 |
// "notFollowed",
|
|
1345 |
// "notFound",
|
|
1346 |
// "other",
|
|
1347 |
// "roboted",
|
|
1348 |
// "serverError",
|
|
1349 |
// "soft404"
|
|
1350 |
// ],
|
|
1351 |
// "enumDescriptions": [
|
|
1352 |
// "",
|
|
1353 |
// "",
|
|
1354 |
// "",
|
|
1355 |
// "",
|
|
1356 |
// "",
|
|
1357 |
// "",
|
|
1358 |
// "",
|
|
1359 |
// ""
|
|
1360 |
// ],
|
|
1361 |
// "location": "query",
|
|
1362 |
// "required": true,
|
|
1363 |
// "type": "string"
|
|
1364 |
// },
|
|
1365 |
// "platform": {
|
|
1366 |
// "description": "The user agent type (platform) that made the request, for example 'web'",
|
|
1367 |
// "enum": [
|
|
1368 |
// "mobile",
|
|
1369 |
// "smartphoneOnly",
|
|
1370 |
// "web"
|
|
1371 |
// ],
|
|
1372 |
// "enumDescriptions": [
|
|
1373 |
// "",
|
|
1374 |
// "",
|
|
1375 |
// ""
|
|
1376 |
// ],
|
|
1377 |
// "location": "query",
|
|
1378 |
// "required": true,
|
|
1379 |
// "type": "string"
|
|
1380 |
// },
|
|
1381 |
// "siteUrl": {
|
|
1382 |
// "description": "The site's URL, including protocol, for example 'http://www.example.com/'",
|
|
1383 |
// "location": "path",
|
|
1384 |
// "required": true,
|
|
1385 |
// "type": "string"
|
|
1386 |
// },
|
|
1387 |
// "url": {
|
|
1388 |
// "description": "The relative path (without the site) of the sample URL; must be one of the URLs returned by list",
|
|
1389 |
// "location": "path",
|
|
1390 |
// "required": true,
|
|
1391 |
// "type": "string"
|
|
1392 |
// }
|
|
1393 |
// },
|
|
1394 |
// "path": "sites/{siteUrl}/urlCrawlErrorsSamples/{url}",
|
|
1395 |
// "scopes": [
|
|
1396 |
// "https://www.googleapis.com/auth/webmasters"
|
|
1397 |
// ]
|
|
1398 |
// }
|
|
1399 |
||
1400 |
}
|