1// Copyright 2021 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package webmasters provides access to the Search Console API. 8// 9// For product documentation, see: https://developers.google.com/webmaster-tools/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/webmasters/v3" 16// ... 17// ctx := context.Background() 18// webmastersService, err := webmasters.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// webmastersService, err := webmasters.NewService(ctx, option.WithScopes(webmasters.WebmastersReadonlyScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// webmastersService, err := webmasters.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// webmastersService, err := webmasters.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package webmasters // import "google.golang.org/api/webmasters/v3" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 internaloption "google.golang.org/api/option/internaloption" 60 htransport "google.golang.org/api/transport/http" 61) 62 63// Always reference these packages, just in case the auto-generated code 64// below doesn't. 65var _ = bytes.NewBuffer 66var _ = strconv.Itoa 67var _ = fmt.Sprintf 68var _ = json.NewDecoder 69var _ = io.Copy 70var _ = url.Parse 71var _ = gensupport.MarshalJSON 72var _ = googleapi.Version 73var _ = errors.New 74var _ = strings.Replace 75var _ = context.Canceled 76var _ = internaloption.WithDefaultEndpoint 77 78const apiId = "webmasters:v3" 79const apiName = "webmasters" 80const apiVersion = "v3" 81const basePath = "https://www.googleapis.com/webmasters/v3/" 82 83// OAuth2 scopes used by this API. 84const ( 85 // View and manage Search Console data for your verified sites 86 WebmastersScope = "https://www.googleapis.com/auth/webmasters" 87 88 // View Search Console data for your verified sites 89 WebmastersReadonlyScope = "https://www.googleapis.com/auth/webmasters.readonly" 90) 91 92// NewService creates a new Service. 93func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 94 scopesOption := option.WithScopes( 95 "https://www.googleapis.com/auth/webmasters", 96 "https://www.googleapis.com/auth/webmasters.readonly", 97 ) 98 // NOTE: prepend, so we don't override user-specified scopes. 99 opts = append([]option.ClientOption{scopesOption}, opts...) 100 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 101 client, endpoint, err := htransport.NewClient(ctx, opts...) 102 if err != nil { 103 return nil, err 104 } 105 s, err := New(client) 106 if err != nil { 107 return nil, err 108 } 109 if endpoint != "" { 110 s.BasePath = endpoint 111 } 112 return s, nil 113} 114 115// New creates a new Service. It uses the provided http.Client for requests. 116// 117// Deprecated: please use NewService instead. 118// To provide a custom HTTP client, use option.WithHTTPClient. 119// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 120func New(client *http.Client) (*Service, error) { 121 if client == nil { 122 return nil, errors.New("client is nil") 123 } 124 s := &Service{client: client, BasePath: basePath} 125 s.Searchanalytics = NewSearchanalyticsService(s) 126 s.Sitemaps = NewSitemapsService(s) 127 s.Sites = NewSitesService(s) 128 return s, nil 129} 130 131type Service struct { 132 client *http.Client 133 BasePath string // API endpoint base URL 134 UserAgent string // optional additional User-Agent fragment 135 136 Searchanalytics *SearchanalyticsService 137 138 Sitemaps *SitemapsService 139 140 Sites *SitesService 141} 142 143func (s *Service) userAgent() string { 144 if s.UserAgent == "" { 145 return googleapi.UserAgent 146 } 147 return googleapi.UserAgent + " " + s.UserAgent 148} 149 150func NewSearchanalyticsService(s *Service) *SearchanalyticsService { 151 rs := &SearchanalyticsService{s: s} 152 return rs 153} 154 155type SearchanalyticsService struct { 156 s *Service 157} 158 159func NewSitemapsService(s *Service) *SitemapsService { 160 rs := &SitemapsService{s: s} 161 return rs 162} 163 164type SitemapsService struct { 165 s *Service 166} 167 168func NewSitesService(s *Service) *SitesService { 169 rs := &SitesService{s: s} 170 return rs 171} 172 173type SitesService struct { 174 s *Service 175} 176 177type ApiDataRow struct { 178 Clicks float64 `json:"clicks,omitempty"` 179 180 Ctr float64 `json:"ctr,omitempty"` 181 182 Impressions float64 `json:"impressions,omitempty"` 183 184 Keys []string `json:"keys,omitempty"` 185 186 Position float64 `json:"position,omitempty"` 187 188 // ForceSendFields is a list of field names (e.g. "Clicks") to 189 // unconditionally include in API requests. By default, fields with 190 // empty or default values are omitted from API requests. However, any 191 // non-pointer, non-interface field appearing in ForceSendFields will be 192 // sent to the server regardless of whether the field is empty or not. 193 // This may be used to include empty fields in Patch requests. 194 ForceSendFields []string `json:"-"` 195 196 // NullFields is a list of field names (e.g. "Clicks") to include in API 197 // requests with the JSON null value. By default, fields with empty 198 // values are omitted from API requests. However, any field with an 199 // empty value appearing in NullFields will be sent to the server as 200 // null. It is an error if a field in this list has a non-empty value. 201 // This may be used to include null fields in Patch requests. 202 NullFields []string `json:"-"` 203} 204 205func (s *ApiDataRow) MarshalJSON() ([]byte, error) { 206 type NoMethod ApiDataRow 207 raw := NoMethod(*s) 208 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 209} 210 211func (s *ApiDataRow) UnmarshalJSON(data []byte) error { 212 type NoMethod ApiDataRow 213 var s1 struct { 214 Clicks gensupport.JSONFloat64 `json:"clicks"` 215 Ctr gensupport.JSONFloat64 `json:"ctr"` 216 Impressions gensupport.JSONFloat64 `json:"impressions"` 217 Position gensupport.JSONFloat64 `json:"position"` 218 *NoMethod 219 } 220 s1.NoMethod = (*NoMethod)(s) 221 if err := json.Unmarshal(data, &s1); err != nil { 222 return err 223 } 224 s.Clicks = float64(s1.Clicks) 225 s.Ctr = float64(s1.Ctr) 226 s.Impressions = float64(s1.Impressions) 227 s.Position = float64(s1.Position) 228 return nil 229} 230 231type ApiDimensionFilter struct { 232 Dimension string `json:"dimension,omitempty"` 233 234 Expression string `json:"expression,omitempty"` 235 236 Operator string `json:"operator,omitempty"` 237 238 // ForceSendFields is a list of field names (e.g. "Dimension") to 239 // unconditionally include in API requests. By default, fields with 240 // empty or default values are omitted from API requests. However, any 241 // non-pointer, non-interface field appearing in ForceSendFields will be 242 // sent to the server regardless of whether the field is empty or not. 243 // This may be used to include empty fields in Patch requests. 244 ForceSendFields []string `json:"-"` 245 246 // NullFields is a list of field names (e.g. "Dimension") to include in 247 // API requests with the JSON null value. By default, fields with empty 248 // values are omitted from API requests. However, any field with an 249 // empty value appearing in NullFields will be sent to the server as 250 // null. It is an error if a field in this list has a non-empty value. 251 // This may be used to include null fields in Patch requests. 252 NullFields []string `json:"-"` 253} 254 255func (s *ApiDimensionFilter) MarshalJSON() ([]byte, error) { 256 type NoMethod ApiDimensionFilter 257 raw := NoMethod(*s) 258 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 259} 260 261type ApiDimensionFilterGroup struct { 262 Filters []*ApiDimensionFilter `json:"filters,omitempty"` 263 264 GroupType string `json:"groupType,omitempty"` 265 266 // ForceSendFields is a list of field names (e.g. "Filters") to 267 // unconditionally include in API requests. By default, fields with 268 // empty or default values are omitted from API requests. However, any 269 // non-pointer, non-interface field appearing in ForceSendFields will be 270 // sent to the server regardless of whether the field is empty or not. 271 // This may be used to include empty fields in Patch requests. 272 ForceSendFields []string `json:"-"` 273 274 // NullFields is a list of field names (e.g. "Filters") to include in 275 // API requests with the JSON null value. By default, fields with empty 276 // values are omitted from API requests. However, any field with an 277 // empty value appearing in NullFields will be sent to the server as 278 // null. It is an error if a field in this list has a non-empty value. 279 // This may be used to include null fields in Patch requests. 280 NullFields []string `json:"-"` 281} 282 283func (s *ApiDimensionFilterGroup) MarshalJSON() ([]byte, error) { 284 type NoMethod ApiDimensionFilterGroup 285 raw := NoMethod(*s) 286 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 287} 288 289type SearchAnalyticsQueryRequest struct { 290 // AggregationType: [Optional; Default is "auto"] How data is 291 // aggregated. If aggregated by property, all data for the same property 292 // is aggregated; if aggregated by page, all data is aggregated by 293 // canonical URI. If you filter or group by page, choose AUTO; otherwise 294 // you can aggregate either by property or by page, depending on how you 295 // want your data calculated; see the help documentation to learn how 296 // data is calculated differently by site versus by page. 297 // 298 // Note: If you group or filter by page, you cannot aggregate by 299 // property. 300 // 301 // If you specify any value other than AUTO, the aggregation type in the 302 // result will match the requested type, or if you request an invalid 303 // type, you will get an error. The API will never change your 304 // aggregation type if the requested type is invalid. 305 AggregationType string `json:"aggregationType,omitempty"` 306 307 // DataState: [Optional] If "all" (case-insensitive), data will include 308 // fresh data. If "final" (case-insensitive) or if this parameter is 309 // omitted, the returned data will include only finalized data. 310 DataState string `json:"dataState,omitempty"` 311 312 // DimensionFilterGroups: [Optional] Zero or more filters to apply to 313 // the dimension grouping values; for example, 'query contains "buy"' to 314 // see only data where the query string contains the substring "buy" 315 // (not case-sensitive). You can filter by a dimension without grouping 316 // by it. 317 DimensionFilterGroups []*ApiDimensionFilterGroup `json:"dimensionFilterGroups,omitempty"` 318 319 // Dimensions: [Optional] Zero or more dimensions to group results by. 320 // Dimensions are the group-by values in the Search Analytics page. 321 // Dimensions are combined to create a unique row key for each row. 322 // Results are grouped in the order that you supply these dimensions. 323 Dimensions []string `json:"dimensions,omitempty"` 324 325 // EndDate: [Required] End date of the requested date range, in 326 // YYYY-MM-DD format, in PST (UTC - 8:00). Must be greater than or equal 327 // to the start date. This value is included in the range. 328 EndDate string `json:"endDate,omitempty"` 329 330 // RowLimit: [Optional; Default is 1000] The maximum number of rows to 331 // return. Must be a number from 1 to 5,000 (inclusive). 332 RowLimit int64 `json:"rowLimit,omitempty"` 333 334 // SearchType: [Optional; Default is "web"] The search type to filter 335 // for. 336 SearchType string `json:"searchType,omitempty"` 337 338 // StartDate: [Required] Start date of the requested date range, in 339 // YYYY-MM-DD format, in PST time (UTC - 8:00). Must be less than or 340 // equal to the end date. This value is included in the range. 341 StartDate string `json:"startDate,omitempty"` 342 343 // StartRow: [Optional; Default is 0] Zero-based index of the first row 344 // in the response. Must be a non-negative number. 345 StartRow int64 `json:"startRow,omitempty"` 346 347 // ForceSendFields is a list of field names (e.g. "AggregationType") to 348 // unconditionally include in API requests. By default, fields with 349 // empty or default values are omitted from API requests. However, any 350 // non-pointer, non-interface field appearing in ForceSendFields will be 351 // sent to the server regardless of whether the field is empty or not. 352 // This may be used to include empty fields in Patch requests. 353 ForceSendFields []string `json:"-"` 354 355 // NullFields is a list of field names (e.g. "AggregationType") to 356 // include in API requests with the JSON null value. By default, fields 357 // with empty values are omitted from API requests. However, any field 358 // with an empty value appearing in NullFields will be sent to the 359 // server as null. It is an error if a field in this list has a 360 // non-empty value. This may be used to include null fields in Patch 361 // requests. 362 NullFields []string `json:"-"` 363} 364 365func (s *SearchAnalyticsQueryRequest) MarshalJSON() ([]byte, error) { 366 type NoMethod SearchAnalyticsQueryRequest 367 raw := NoMethod(*s) 368 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 369} 370 371// SearchAnalyticsQueryResponse: A list of rows, one per result, grouped 372// by key. Metrics in each row are aggregated for all data grouped by 373// that key either by page or property, as specified by the aggregation 374// type parameter. 375type SearchAnalyticsQueryResponse struct { 376 // ResponseAggregationType: How the results were aggregated. 377 ResponseAggregationType string `json:"responseAggregationType,omitempty"` 378 379 // Rows: A list of rows grouped by the key values in the order given in 380 // the query. 381 Rows []*ApiDataRow `json:"rows,omitempty"` 382 383 // ServerResponse contains the HTTP response code and headers from the 384 // server. 385 googleapi.ServerResponse `json:"-"` 386 387 // ForceSendFields is a list of field names (e.g. 388 // "ResponseAggregationType") to unconditionally include in API 389 // requests. By default, fields with empty or default values are omitted 390 // from API requests. However, any non-pointer, non-interface field 391 // appearing in ForceSendFields will be sent to the server regardless of 392 // whether the field is empty or not. This may be used to include empty 393 // fields in Patch requests. 394 ForceSendFields []string `json:"-"` 395 396 // NullFields is a list of field names (e.g. "ResponseAggregationType") 397 // to include in API requests with the JSON null value. By default, 398 // fields with empty values are omitted from API requests. However, any 399 // field with an empty value appearing in NullFields will be sent to the 400 // server as null. It is an error if a field in this list has a 401 // non-empty value. This may be used to include null fields in Patch 402 // requests. 403 NullFields []string `json:"-"` 404} 405 406func (s *SearchAnalyticsQueryResponse) MarshalJSON() ([]byte, error) { 407 type NoMethod SearchAnalyticsQueryResponse 408 raw := NoMethod(*s) 409 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 410} 411 412// SitemapsListResponse: List of sitemaps. 413type SitemapsListResponse struct { 414 // Sitemap: Contains detailed information about a specific URL submitted 415 // as a sitemap. 416 Sitemap []*WmxSitemap `json:"sitemap,omitempty"` 417 418 // ServerResponse contains the HTTP response code and headers from the 419 // server. 420 googleapi.ServerResponse `json:"-"` 421 422 // ForceSendFields is a list of field names (e.g. "Sitemap") to 423 // unconditionally include in API requests. By default, fields with 424 // empty or default values are omitted from API requests. However, any 425 // non-pointer, non-interface field appearing in ForceSendFields will be 426 // sent to the server regardless of whether the field is empty or not. 427 // This may be used to include empty fields in Patch requests. 428 ForceSendFields []string `json:"-"` 429 430 // NullFields is a list of field names (e.g. "Sitemap") to include in 431 // API requests with the JSON null value. By default, fields with empty 432 // values are omitted from API requests. However, any field with an 433 // empty value appearing in NullFields will be sent to the server as 434 // null. It is an error if a field in this list has a non-empty value. 435 // This may be used to include null fields in Patch requests. 436 NullFields []string `json:"-"` 437} 438 439func (s *SitemapsListResponse) MarshalJSON() ([]byte, error) { 440 type NoMethod SitemapsListResponse 441 raw := NoMethod(*s) 442 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 443} 444 445// SitesListResponse: List of sites with access level information. 446type SitesListResponse struct { 447 // SiteEntry: Contains permission level information about a Search 448 // Console site. For more information, see Permissions in Search 449 // Console. 450 SiteEntry []*WmxSite `json:"siteEntry,omitempty"` 451 452 // ServerResponse contains the HTTP response code and headers from the 453 // server. 454 googleapi.ServerResponse `json:"-"` 455 456 // ForceSendFields is a list of field names (e.g. "SiteEntry") to 457 // unconditionally include in API requests. By default, fields with 458 // empty or default values are omitted from API requests. However, any 459 // non-pointer, non-interface field appearing in ForceSendFields will be 460 // sent to the server regardless of whether the field is empty or not. 461 // This may be used to include empty fields in Patch requests. 462 ForceSendFields []string `json:"-"` 463 464 // NullFields is a list of field names (e.g. "SiteEntry") to include in 465 // API requests with the JSON null value. By default, fields with empty 466 // values are omitted from API requests. However, any field with an 467 // empty value appearing in NullFields will be sent to the server as 468 // null. It is an error if a field in this list has a non-empty value. 469 // This may be used to include null fields in Patch requests. 470 NullFields []string `json:"-"` 471} 472 473func (s *SitesListResponse) MarshalJSON() ([]byte, error) { 474 type NoMethod SitesListResponse 475 raw := NoMethod(*s) 476 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 477} 478 479// WmxSite: Contains permission level information about a Search Console 480// site. For more information, see Permissions in Search Console. 481type WmxSite struct { 482 // PermissionLevel: The user's permission level for the site. 483 PermissionLevel string `json:"permissionLevel,omitempty"` 484 485 // SiteUrl: The URL of the site. 486 SiteUrl string `json:"siteUrl,omitempty"` 487 488 // ServerResponse contains the HTTP response code and headers from the 489 // server. 490 googleapi.ServerResponse `json:"-"` 491 492 // ForceSendFields is a list of field names (e.g. "PermissionLevel") to 493 // unconditionally include in API requests. By default, fields with 494 // empty or default values are omitted from API requests. However, any 495 // non-pointer, non-interface field appearing in ForceSendFields will be 496 // sent to the server regardless of whether the field is empty or not. 497 // This may be used to include empty fields in Patch requests. 498 ForceSendFields []string `json:"-"` 499 500 // NullFields is a list of field names (e.g. "PermissionLevel") to 501 // include in API requests with the JSON null value. By default, fields 502 // with empty values are omitted from API requests. However, any field 503 // with an empty value appearing in NullFields will be sent to the 504 // server as null. It is an error if a field in this list has a 505 // non-empty value. This may be used to include null fields in Patch 506 // requests. 507 NullFields []string `json:"-"` 508} 509 510func (s *WmxSite) MarshalJSON() ([]byte, error) { 511 type NoMethod WmxSite 512 raw := NoMethod(*s) 513 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 514} 515 516// WmxSitemap: Contains detailed information about a specific URL 517// submitted as a sitemap. 518type WmxSitemap struct { 519 // Contents: The various content types in the sitemap. 520 Contents []*WmxSitemapContent `json:"contents,omitempty"` 521 522 // Errors: Number of errors in the sitemap. These are issues with the 523 // sitemap itself that need to be fixed before it can be processed 524 // correctly. 525 Errors int64 `json:"errors,omitempty,string"` 526 527 // IsPending: If true, the sitemap has not been processed. 528 IsPending bool `json:"isPending,omitempty"` 529 530 // IsSitemapsIndex: If true, the sitemap is a collection of sitemaps. 531 IsSitemapsIndex bool `json:"isSitemapsIndex,omitempty"` 532 533 // LastDownloaded: Date & time in which this sitemap was last 534 // downloaded. Date format is in RFC 3339 format (yyyy-mm-dd). 535 LastDownloaded string `json:"lastDownloaded,omitempty"` 536 537 // LastSubmitted: Date & time in which this sitemap was submitted. Date 538 // format is in RFC 3339 format (yyyy-mm-dd). 539 LastSubmitted string `json:"lastSubmitted,omitempty"` 540 541 // Path: The url of the sitemap. 542 Path string `json:"path,omitempty"` 543 544 // Type: The type of the sitemap. For example: rssFeed. 545 Type string `json:"type,omitempty"` 546 547 // Warnings: Number of warnings for the sitemap. These are generally 548 // non-critical issues with URLs in the sitemaps. 549 Warnings int64 `json:"warnings,omitempty,string"` 550 551 // ServerResponse contains the HTTP response code and headers from the 552 // server. 553 googleapi.ServerResponse `json:"-"` 554 555 // ForceSendFields is a list of field names (e.g. "Contents") to 556 // unconditionally include in API requests. By default, fields with 557 // empty or default values are omitted from API requests. However, any 558 // non-pointer, non-interface field appearing in ForceSendFields will be 559 // sent to the server regardless of whether the field is empty or not. 560 // This may be used to include empty fields in Patch requests. 561 ForceSendFields []string `json:"-"` 562 563 // NullFields is a list of field names (e.g. "Contents") to include in 564 // API requests with the JSON null value. By default, fields with empty 565 // values are omitted from API requests. However, any field with an 566 // empty value appearing in NullFields will be sent to the server as 567 // null. It is an error if a field in this list has a non-empty value. 568 // This may be used to include null fields in Patch requests. 569 NullFields []string `json:"-"` 570} 571 572func (s *WmxSitemap) MarshalJSON() ([]byte, error) { 573 type NoMethod WmxSitemap 574 raw := NoMethod(*s) 575 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 576} 577 578// WmxSitemapContent: Information about the various content types in the 579// sitemap. 580type WmxSitemapContent struct { 581 // Indexed: The number of URLs from the sitemap that were indexed (of 582 // the content type). 583 Indexed int64 `json:"indexed,omitempty,string"` 584 585 // Submitted: The number of URLs in the sitemap (of the content type). 586 Submitted int64 `json:"submitted,omitempty,string"` 587 588 // Type: The specific type of content in this sitemap. For example: web. 589 Type string `json:"type,omitempty"` 590 591 // ForceSendFields is a list of field names (e.g. "Indexed") to 592 // unconditionally include in API requests. By default, fields with 593 // empty or default values are omitted from API requests. However, any 594 // non-pointer, non-interface field appearing in ForceSendFields will be 595 // sent to the server regardless of whether the field is empty or not. 596 // This may be used to include empty fields in Patch requests. 597 ForceSendFields []string `json:"-"` 598 599 // NullFields is a list of field names (e.g. "Indexed") to include in 600 // API requests with the JSON null value. By default, fields with empty 601 // values are omitted from API requests. However, any field with an 602 // empty value appearing in NullFields will be sent to the server as 603 // null. It is an error if a field in this list has a non-empty value. 604 // This may be used to include null fields in Patch requests. 605 NullFields []string `json:"-"` 606} 607 608func (s *WmxSitemapContent) MarshalJSON() ([]byte, error) { 609 type NoMethod WmxSitemapContent 610 raw := NoMethod(*s) 611 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 612} 613 614// method id "webmasters.searchanalytics.query": 615 616type SearchanalyticsQueryCall struct { 617 s *Service 618 siteUrl string 619 searchanalyticsqueryrequest *SearchAnalyticsQueryRequest 620 urlParams_ gensupport.URLParams 621 ctx_ context.Context 622 header_ http.Header 623} 624 625// Query: Query your data with filters and parameters that you define. 626// Returns zero or more rows grouped by the row keys that you define. 627// You must define a date range of one or more days. 628// 629// When date is one of the group by values, any days without data are 630// omitted from the result list. If you need to know which days have 631// data, issue a broad date range query grouped by date for any metric, 632// and see which day rows are returned. 633// 634// - siteUrl: The site's URL, including protocol. For example: 635// http://www.example.com/. 636func (r *SearchanalyticsService) Query(siteUrl string, searchanalyticsqueryrequest *SearchAnalyticsQueryRequest) *SearchanalyticsQueryCall { 637 c := &SearchanalyticsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)} 638 c.siteUrl = siteUrl 639 c.searchanalyticsqueryrequest = searchanalyticsqueryrequest 640 return c 641} 642 643// Fields allows partial responses to be retrieved. See 644// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 645// for more information. 646func (c *SearchanalyticsQueryCall) Fields(s ...googleapi.Field) *SearchanalyticsQueryCall { 647 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 648 return c 649} 650 651// Context sets the context to be used in this call's Do method. Any 652// pending HTTP request will be aborted if the provided context is 653// canceled. 654func (c *SearchanalyticsQueryCall) Context(ctx context.Context) *SearchanalyticsQueryCall { 655 c.ctx_ = ctx 656 return c 657} 658 659// Header returns an http.Header that can be modified by the caller to 660// add HTTP headers to the request. 661func (c *SearchanalyticsQueryCall) Header() http.Header { 662 if c.header_ == nil { 663 c.header_ = make(http.Header) 664 } 665 return c.header_ 666} 667 668func (c *SearchanalyticsQueryCall) doRequest(alt string) (*http.Response, error) { 669 reqHeaders := make(http.Header) 670 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 671 for k, v := range c.header_ { 672 reqHeaders[k] = v 673 } 674 reqHeaders.Set("User-Agent", c.s.userAgent()) 675 var body io.Reader = nil 676 body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchanalyticsqueryrequest) 677 if err != nil { 678 return nil, err 679 } 680 reqHeaders.Set("Content-Type", "application/json") 681 c.urlParams_.Set("alt", alt) 682 c.urlParams_.Set("prettyPrint", "false") 683 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/searchAnalytics/query") 684 urls += "?" + c.urlParams_.Encode() 685 req, err := http.NewRequest("POST", urls, body) 686 if err != nil { 687 return nil, err 688 } 689 req.Header = reqHeaders 690 googleapi.Expand(req.URL, map[string]string{ 691 "siteUrl": c.siteUrl, 692 }) 693 return gensupport.SendRequest(c.ctx_, c.s.client, req) 694} 695 696// Do executes the "webmasters.searchanalytics.query" call. 697// Exactly one of *SearchAnalyticsQueryResponse or error will be 698// non-nil. Any non-2xx status code is an error. Response headers are in 699// either *SearchAnalyticsQueryResponse.ServerResponse.Header or (if a 700// response was returned at all) in error.(*googleapi.Error).Header. Use 701// googleapi.IsNotModified to check whether the returned error was 702// because http.StatusNotModified was returned. 703func (c *SearchanalyticsQueryCall) Do(opts ...googleapi.CallOption) (*SearchAnalyticsQueryResponse, error) { 704 gensupport.SetOptions(c.urlParams_, opts...) 705 res, err := c.doRequest("json") 706 if res != nil && res.StatusCode == http.StatusNotModified { 707 if res.Body != nil { 708 res.Body.Close() 709 } 710 return nil, &googleapi.Error{ 711 Code: res.StatusCode, 712 Header: res.Header, 713 } 714 } 715 if err != nil { 716 return nil, err 717 } 718 defer googleapi.CloseBody(res) 719 if err := googleapi.CheckResponse(res); err != nil { 720 return nil, err 721 } 722 ret := &SearchAnalyticsQueryResponse{ 723 ServerResponse: googleapi.ServerResponse{ 724 Header: res.Header, 725 HTTPStatusCode: res.StatusCode, 726 }, 727 } 728 target := &ret 729 if err := gensupport.DecodeResponse(target, res); err != nil { 730 return nil, err 731 } 732 return ret, nil 733 // { 734 // "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.", 735 // "httpMethod": "POST", 736 // "id": "webmasters.searchanalytics.query", 737 // "parameterOrder": [ 738 // "siteUrl" 739 // ], 740 // "parameters": { 741 // "siteUrl": { 742 // "description": "The site's URL, including protocol. For example: http://www.example.com/", 743 // "location": "path", 744 // "required": true, 745 // "type": "string" 746 // } 747 // }, 748 // "path": "sites/{siteUrl}/searchAnalytics/query", 749 // "request": { 750 // "$ref": "SearchAnalyticsQueryRequest" 751 // }, 752 // "response": { 753 // "$ref": "SearchAnalyticsQueryResponse" 754 // }, 755 // "scopes": [ 756 // "https://www.googleapis.com/auth/webmasters", 757 // "https://www.googleapis.com/auth/webmasters.readonly" 758 // ] 759 // } 760 761} 762 763// method id "webmasters.sitemaps.delete": 764 765type SitemapsDeleteCall struct { 766 s *Service 767 siteUrl string 768 feedpath string 769 urlParams_ gensupport.URLParams 770 ctx_ context.Context 771 header_ http.Header 772} 773 774// Delete: Deletes a sitemap from this site. 775// 776// - feedpath: The URL of the actual sitemap. For example: 777// http://www.example.com/sitemap.xml. 778// - siteUrl: The site's URL, including protocol. For example: 779// http://www.example.com/. 780func (r *SitemapsService) Delete(siteUrl string, feedpath string) *SitemapsDeleteCall { 781 c := &SitemapsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 782 c.siteUrl = siteUrl 783 c.feedpath = feedpath 784 return c 785} 786 787// Fields allows partial responses to be retrieved. See 788// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 789// for more information. 790func (c *SitemapsDeleteCall) Fields(s ...googleapi.Field) *SitemapsDeleteCall { 791 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 792 return c 793} 794 795// Context sets the context to be used in this call's Do method. Any 796// pending HTTP request will be aborted if the provided context is 797// canceled. 798func (c *SitemapsDeleteCall) Context(ctx context.Context) *SitemapsDeleteCall { 799 c.ctx_ = ctx 800 return c 801} 802 803// Header returns an http.Header that can be modified by the caller to 804// add HTTP headers to the request. 805func (c *SitemapsDeleteCall) Header() http.Header { 806 if c.header_ == nil { 807 c.header_ = make(http.Header) 808 } 809 return c.header_ 810} 811 812func (c *SitemapsDeleteCall) doRequest(alt string) (*http.Response, error) { 813 reqHeaders := make(http.Header) 814 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 815 for k, v := range c.header_ { 816 reqHeaders[k] = v 817 } 818 reqHeaders.Set("User-Agent", c.s.userAgent()) 819 var body io.Reader = nil 820 c.urlParams_.Set("alt", alt) 821 c.urlParams_.Set("prettyPrint", "false") 822 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}") 823 urls += "?" + c.urlParams_.Encode() 824 req, err := http.NewRequest("DELETE", urls, body) 825 if err != nil { 826 return nil, err 827 } 828 req.Header = reqHeaders 829 googleapi.Expand(req.URL, map[string]string{ 830 "siteUrl": c.siteUrl, 831 "feedpath": c.feedpath, 832 }) 833 return gensupport.SendRequest(c.ctx_, c.s.client, req) 834} 835 836// Do executes the "webmasters.sitemaps.delete" call. 837func (c *SitemapsDeleteCall) Do(opts ...googleapi.CallOption) error { 838 gensupport.SetOptions(c.urlParams_, opts...) 839 res, err := c.doRequest("json") 840 if err != nil { 841 return err 842 } 843 defer googleapi.CloseBody(res) 844 if err := googleapi.CheckResponse(res); err != nil { 845 return err 846 } 847 return nil 848 // { 849 // "description": "Deletes a sitemap from this site.", 850 // "httpMethod": "DELETE", 851 // "id": "webmasters.sitemaps.delete", 852 // "parameterOrder": [ 853 // "siteUrl", 854 // "feedpath" 855 // ], 856 // "parameters": { 857 // "feedpath": { 858 // "description": "The URL of the actual sitemap. For example: http://www.example.com/sitemap.xml", 859 // "location": "path", 860 // "required": true, 861 // "type": "string" 862 // }, 863 // "siteUrl": { 864 // "description": "The site's URL, including protocol. For example: http://www.example.com/", 865 // "location": "path", 866 // "required": true, 867 // "type": "string" 868 // } 869 // }, 870 // "path": "sites/{siteUrl}/sitemaps/{feedpath}", 871 // "scopes": [ 872 // "https://www.googleapis.com/auth/webmasters" 873 // ] 874 // } 875 876} 877 878// method id "webmasters.sitemaps.get": 879 880type SitemapsGetCall struct { 881 s *Service 882 siteUrl string 883 feedpath string 884 urlParams_ gensupport.URLParams 885 ifNoneMatch_ string 886 ctx_ context.Context 887 header_ http.Header 888} 889 890// Get: Retrieves information about a specific sitemap. 891// 892// - feedpath: The URL of the actual sitemap. For example: 893// http://www.example.com/sitemap.xml. 894// - siteUrl: The site's URL, including protocol. For example: 895// http://www.example.com/. 896func (r *SitemapsService) Get(siteUrl string, feedpath string) *SitemapsGetCall { 897 c := &SitemapsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 898 c.siteUrl = siteUrl 899 c.feedpath = feedpath 900 return c 901} 902 903// Fields allows partial responses to be retrieved. See 904// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 905// for more information. 906func (c *SitemapsGetCall) Fields(s ...googleapi.Field) *SitemapsGetCall { 907 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 908 return c 909} 910 911// IfNoneMatch sets the optional parameter which makes the operation 912// fail if the object's ETag matches the given value. This is useful for 913// getting updates only after the object has changed since the last 914// request. Use googleapi.IsNotModified to check whether the response 915// error from Do is the result of In-None-Match. 916func (c *SitemapsGetCall) IfNoneMatch(entityTag string) *SitemapsGetCall { 917 c.ifNoneMatch_ = entityTag 918 return c 919} 920 921// Context sets the context to be used in this call's Do method. Any 922// pending HTTP request will be aborted if the provided context is 923// canceled. 924func (c *SitemapsGetCall) Context(ctx context.Context) *SitemapsGetCall { 925 c.ctx_ = ctx 926 return c 927} 928 929// Header returns an http.Header that can be modified by the caller to 930// add HTTP headers to the request. 931func (c *SitemapsGetCall) Header() http.Header { 932 if c.header_ == nil { 933 c.header_ = make(http.Header) 934 } 935 return c.header_ 936} 937 938func (c *SitemapsGetCall) doRequest(alt string) (*http.Response, error) { 939 reqHeaders := make(http.Header) 940 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 941 for k, v := range c.header_ { 942 reqHeaders[k] = v 943 } 944 reqHeaders.Set("User-Agent", c.s.userAgent()) 945 if c.ifNoneMatch_ != "" { 946 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 947 } 948 var body io.Reader = nil 949 c.urlParams_.Set("alt", alt) 950 c.urlParams_.Set("prettyPrint", "false") 951 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}") 952 urls += "?" + c.urlParams_.Encode() 953 req, err := http.NewRequest("GET", urls, body) 954 if err != nil { 955 return nil, err 956 } 957 req.Header = reqHeaders 958 googleapi.Expand(req.URL, map[string]string{ 959 "siteUrl": c.siteUrl, 960 "feedpath": c.feedpath, 961 }) 962 return gensupport.SendRequest(c.ctx_, c.s.client, req) 963} 964 965// Do executes the "webmasters.sitemaps.get" call. 966// Exactly one of *WmxSitemap or error will be non-nil. Any non-2xx 967// status code is an error. Response headers are in either 968// *WmxSitemap.ServerResponse.Header or (if a response was returned at 969// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 970// to check whether the returned error was because 971// http.StatusNotModified was returned. 972func (c *SitemapsGetCall) Do(opts ...googleapi.CallOption) (*WmxSitemap, error) { 973 gensupport.SetOptions(c.urlParams_, opts...) 974 res, err := c.doRequest("json") 975 if res != nil && res.StatusCode == http.StatusNotModified { 976 if res.Body != nil { 977 res.Body.Close() 978 } 979 return nil, &googleapi.Error{ 980 Code: res.StatusCode, 981 Header: res.Header, 982 } 983 } 984 if err != nil { 985 return nil, err 986 } 987 defer googleapi.CloseBody(res) 988 if err := googleapi.CheckResponse(res); err != nil { 989 return nil, err 990 } 991 ret := &WmxSitemap{ 992 ServerResponse: googleapi.ServerResponse{ 993 Header: res.Header, 994 HTTPStatusCode: res.StatusCode, 995 }, 996 } 997 target := &ret 998 if err := gensupport.DecodeResponse(target, res); err != nil { 999 return nil, err 1000 } 1001 return ret, nil 1002 // { 1003 // "description": "Retrieves information about a specific sitemap.", 1004 // "httpMethod": "GET", 1005 // "id": "webmasters.sitemaps.get", 1006 // "parameterOrder": [ 1007 // "siteUrl", 1008 // "feedpath" 1009 // ], 1010 // "parameters": { 1011 // "feedpath": { 1012 // "description": "The URL of the actual sitemap. For example: http://www.example.com/sitemap.xml", 1013 // "location": "path", 1014 // "required": true, 1015 // "type": "string" 1016 // }, 1017 // "siteUrl": { 1018 // "description": "The site's URL, including protocol. For example: http://www.example.com/", 1019 // "location": "path", 1020 // "required": true, 1021 // "type": "string" 1022 // } 1023 // }, 1024 // "path": "sites/{siteUrl}/sitemaps/{feedpath}", 1025 // "response": { 1026 // "$ref": "WmxSitemap" 1027 // }, 1028 // "scopes": [ 1029 // "https://www.googleapis.com/auth/webmasters", 1030 // "https://www.googleapis.com/auth/webmasters.readonly" 1031 // ] 1032 // } 1033 1034} 1035 1036// method id "webmasters.sitemaps.list": 1037 1038type SitemapsListCall struct { 1039 s *Service 1040 siteUrl string 1041 urlParams_ gensupport.URLParams 1042 ifNoneMatch_ string 1043 ctx_ context.Context 1044 header_ http.Header 1045} 1046 1047// List: Lists the sitemaps-entries submitted for this site, or included 1048// in the sitemap index file (if sitemapIndex is specified in the 1049// request). 1050// 1051// - siteUrl: The site's URL, including protocol. For example: 1052// http://www.example.com/. 1053func (r *SitemapsService) List(siteUrl string) *SitemapsListCall { 1054 c := &SitemapsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1055 c.siteUrl = siteUrl 1056 return c 1057} 1058 1059// SitemapIndex sets the optional parameter "sitemapIndex": A URL of a 1060// site's sitemap index. For example: 1061// http://www.example.com/sitemapindex.xml 1062func (c *SitemapsListCall) SitemapIndex(sitemapIndex string) *SitemapsListCall { 1063 c.urlParams_.Set("sitemapIndex", sitemapIndex) 1064 return c 1065} 1066 1067// Fields allows partial responses to be retrieved. See 1068// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1069// for more information. 1070func (c *SitemapsListCall) Fields(s ...googleapi.Field) *SitemapsListCall { 1071 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1072 return c 1073} 1074 1075// IfNoneMatch sets the optional parameter which makes the operation 1076// fail if the object's ETag matches the given value. This is useful for 1077// getting updates only after the object has changed since the last 1078// request. Use googleapi.IsNotModified to check whether the response 1079// error from Do is the result of In-None-Match. 1080func (c *SitemapsListCall) IfNoneMatch(entityTag string) *SitemapsListCall { 1081 c.ifNoneMatch_ = entityTag 1082 return c 1083} 1084 1085// Context sets the context to be used in this call's Do method. Any 1086// pending HTTP request will be aborted if the provided context is 1087// canceled. 1088func (c *SitemapsListCall) Context(ctx context.Context) *SitemapsListCall { 1089 c.ctx_ = ctx 1090 return c 1091} 1092 1093// Header returns an http.Header that can be modified by the caller to 1094// add HTTP headers to the request. 1095func (c *SitemapsListCall) Header() http.Header { 1096 if c.header_ == nil { 1097 c.header_ = make(http.Header) 1098 } 1099 return c.header_ 1100} 1101 1102func (c *SitemapsListCall) doRequest(alt string) (*http.Response, error) { 1103 reqHeaders := make(http.Header) 1104 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 1105 for k, v := range c.header_ { 1106 reqHeaders[k] = v 1107 } 1108 reqHeaders.Set("User-Agent", c.s.userAgent()) 1109 if c.ifNoneMatch_ != "" { 1110 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1111 } 1112 var body io.Reader = nil 1113 c.urlParams_.Set("alt", alt) 1114 c.urlParams_.Set("prettyPrint", "false") 1115 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps") 1116 urls += "?" + c.urlParams_.Encode() 1117 req, err := http.NewRequest("GET", urls, body) 1118 if err != nil { 1119 return nil, err 1120 } 1121 req.Header = reqHeaders 1122 googleapi.Expand(req.URL, map[string]string{ 1123 "siteUrl": c.siteUrl, 1124 }) 1125 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1126} 1127 1128// Do executes the "webmasters.sitemaps.list" call. 1129// Exactly one of *SitemapsListResponse or error will be non-nil. Any 1130// non-2xx status code is an error. Response headers are in either 1131// *SitemapsListResponse.ServerResponse.Header or (if a response was 1132// returned at all) in error.(*googleapi.Error).Header. Use 1133// googleapi.IsNotModified to check whether the returned error was 1134// because http.StatusNotModified was returned. 1135func (c *SitemapsListCall) Do(opts ...googleapi.CallOption) (*SitemapsListResponse, error) { 1136 gensupport.SetOptions(c.urlParams_, opts...) 1137 res, err := c.doRequest("json") 1138 if res != nil && res.StatusCode == http.StatusNotModified { 1139 if res.Body != nil { 1140 res.Body.Close() 1141 } 1142 return nil, &googleapi.Error{ 1143 Code: res.StatusCode, 1144 Header: res.Header, 1145 } 1146 } 1147 if err != nil { 1148 return nil, err 1149 } 1150 defer googleapi.CloseBody(res) 1151 if err := googleapi.CheckResponse(res); err != nil { 1152 return nil, err 1153 } 1154 ret := &SitemapsListResponse{ 1155 ServerResponse: googleapi.ServerResponse{ 1156 Header: res.Header, 1157 HTTPStatusCode: res.StatusCode, 1158 }, 1159 } 1160 target := &ret 1161 if err := gensupport.DecodeResponse(target, res); err != nil { 1162 return nil, err 1163 } 1164 return ret, nil 1165 // { 1166 // "description": "Lists the sitemaps-entries submitted for this site, or included in the sitemap index file (if sitemapIndex is specified in the request).", 1167 // "httpMethod": "GET", 1168 // "id": "webmasters.sitemaps.list", 1169 // "parameterOrder": [ 1170 // "siteUrl" 1171 // ], 1172 // "parameters": { 1173 // "siteUrl": { 1174 // "description": "The site's URL, including protocol. For example: http://www.example.com/", 1175 // "location": "path", 1176 // "required": true, 1177 // "type": "string" 1178 // }, 1179 // "sitemapIndex": { 1180 // "description": "A URL of a site's sitemap index. For example: http://www.example.com/sitemapindex.xml", 1181 // "location": "query", 1182 // "type": "string" 1183 // } 1184 // }, 1185 // "path": "sites/{siteUrl}/sitemaps", 1186 // "response": { 1187 // "$ref": "SitemapsListResponse" 1188 // }, 1189 // "scopes": [ 1190 // "https://www.googleapis.com/auth/webmasters", 1191 // "https://www.googleapis.com/auth/webmasters.readonly" 1192 // ] 1193 // } 1194 1195} 1196 1197// method id "webmasters.sitemaps.submit": 1198 1199type SitemapsSubmitCall struct { 1200 s *Service 1201 siteUrl string 1202 feedpath string 1203 urlParams_ gensupport.URLParams 1204 ctx_ context.Context 1205 header_ http.Header 1206} 1207 1208// Submit: Submits a sitemap for a site. 1209// 1210// - feedpath: The URL of the sitemap to add. For example: 1211// http://www.example.com/sitemap.xml. 1212// - siteUrl: The site's URL, including protocol. For example: 1213// http://www.example.com/. 1214func (r *SitemapsService) Submit(siteUrl string, feedpath string) *SitemapsSubmitCall { 1215 c := &SitemapsSubmitCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1216 c.siteUrl = siteUrl 1217 c.feedpath = feedpath 1218 return c 1219} 1220 1221// Fields allows partial responses to be retrieved. See 1222// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1223// for more information. 1224func (c *SitemapsSubmitCall) Fields(s ...googleapi.Field) *SitemapsSubmitCall { 1225 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1226 return c 1227} 1228 1229// Context sets the context to be used in this call's Do method. Any 1230// pending HTTP request will be aborted if the provided context is 1231// canceled. 1232func (c *SitemapsSubmitCall) Context(ctx context.Context) *SitemapsSubmitCall { 1233 c.ctx_ = ctx 1234 return c 1235} 1236 1237// Header returns an http.Header that can be modified by the caller to 1238// add HTTP headers to the request. 1239func (c *SitemapsSubmitCall) Header() http.Header { 1240 if c.header_ == nil { 1241 c.header_ = make(http.Header) 1242 } 1243 return c.header_ 1244} 1245 1246func (c *SitemapsSubmitCall) doRequest(alt string) (*http.Response, error) { 1247 reqHeaders := make(http.Header) 1248 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 1249 for k, v := range c.header_ { 1250 reqHeaders[k] = v 1251 } 1252 reqHeaders.Set("User-Agent", c.s.userAgent()) 1253 var body io.Reader = nil 1254 c.urlParams_.Set("alt", alt) 1255 c.urlParams_.Set("prettyPrint", "false") 1256 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}/sitemaps/{feedpath}") 1257 urls += "?" + c.urlParams_.Encode() 1258 req, err := http.NewRequest("PUT", urls, body) 1259 if err != nil { 1260 return nil, err 1261 } 1262 req.Header = reqHeaders 1263 googleapi.Expand(req.URL, map[string]string{ 1264 "siteUrl": c.siteUrl, 1265 "feedpath": c.feedpath, 1266 }) 1267 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1268} 1269 1270// Do executes the "webmasters.sitemaps.submit" call. 1271func (c *SitemapsSubmitCall) Do(opts ...googleapi.CallOption) error { 1272 gensupport.SetOptions(c.urlParams_, opts...) 1273 res, err := c.doRequest("json") 1274 if err != nil { 1275 return err 1276 } 1277 defer googleapi.CloseBody(res) 1278 if err := googleapi.CheckResponse(res); err != nil { 1279 return err 1280 } 1281 return nil 1282 // { 1283 // "description": "Submits a sitemap for a site.", 1284 // "httpMethod": "PUT", 1285 // "id": "webmasters.sitemaps.submit", 1286 // "parameterOrder": [ 1287 // "siteUrl", 1288 // "feedpath" 1289 // ], 1290 // "parameters": { 1291 // "feedpath": { 1292 // "description": "The URL of the sitemap to add. For example: http://www.example.com/sitemap.xml", 1293 // "location": "path", 1294 // "required": true, 1295 // "type": "string" 1296 // }, 1297 // "siteUrl": { 1298 // "description": "The site's URL, including protocol. For example: http://www.example.com/", 1299 // "location": "path", 1300 // "required": true, 1301 // "type": "string" 1302 // } 1303 // }, 1304 // "path": "sites/{siteUrl}/sitemaps/{feedpath}", 1305 // "scopes": [ 1306 // "https://www.googleapis.com/auth/webmasters" 1307 // ] 1308 // } 1309 1310} 1311 1312// method id "webmasters.sites.add": 1313 1314type SitesAddCall struct { 1315 s *Service 1316 siteUrl string 1317 urlParams_ gensupport.URLParams 1318 ctx_ context.Context 1319 header_ http.Header 1320} 1321 1322// Add: Adds a site to the set of the user's sites in Search Console. 1323// 1324// - siteUrl: The URL of the site to add. 1325func (r *SitesService) Add(siteUrl string) *SitesAddCall { 1326 c := &SitesAddCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1327 c.siteUrl = siteUrl 1328 return c 1329} 1330 1331// Fields allows partial responses to be retrieved. See 1332// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1333// for more information. 1334func (c *SitesAddCall) Fields(s ...googleapi.Field) *SitesAddCall { 1335 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1336 return c 1337} 1338 1339// Context sets the context to be used in this call's Do method. Any 1340// pending HTTP request will be aborted if the provided context is 1341// canceled. 1342func (c *SitesAddCall) Context(ctx context.Context) *SitesAddCall { 1343 c.ctx_ = ctx 1344 return c 1345} 1346 1347// Header returns an http.Header that can be modified by the caller to 1348// add HTTP headers to the request. 1349func (c *SitesAddCall) Header() http.Header { 1350 if c.header_ == nil { 1351 c.header_ = make(http.Header) 1352 } 1353 return c.header_ 1354} 1355 1356func (c *SitesAddCall) doRequest(alt string) (*http.Response, error) { 1357 reqHeaders := make(http.Header) 1358 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 1359 for k, v := range c.header_ { 1360 reqHeaders[k] = v 1361 } 1362 reqHeaders.Set("User-Agent", c.s.userAgent()) 1363 var body io.Reader = nil 1364 c.urlParams_.Set("alt", alt) 1365 c.urlParams_.Set("prettyPrint", "false") 1366 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}") 1367 urls += "?" + c.urlParams_.Encode() 1368 req, err := http.NewRequest("PUT", urls, body) 1369 if err != nil { 1370 return nil, err 1371 } 1372 req.Header = reqHeaders 1373 googleapi.Expand(req.URL, map[string]string{ 1374 "siteUrl": c.siteUrl, 1375 }) 1376 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1377} 1378 1379// Do executes the "webmasters.sites.add" call. 1380func (c *SitesAddCall) Do(opts ...googleapi.CallOption) error { 1381 gensupport.SetOptions(c.urlParams_, opts...) 1382 res, err := c.doRequest("json") 1383 if err != nil { 1384 return err 1385 } 1386 defer googleapi.CloseBody(res) 1387 if err := googleapi.CheckResponse(res); err != nil { 1388 return err 1389 } 1390 return nil 1391 // { 1392 // "description": "Adds a site to the set of the user's sites in Search Console.", 1393 // "httpMethod": "PUT", 1394 // "id": "webmasters.sites.add", 1395 // "parameterOrder": [ 1396 // "siteUrl" 1397 // ], 1398 // "parameters": { 1399 // "siteUrl": { 1400 // "description": "The URL of the site to add.", 1401 // "location": "path", 1402 // "required": true, 1403 // "type": "string" 1404 // } 1405 // }, 1406 // "path": "sites/{siteUrl}", 1407 // "scopes": [ 1408 // "https://www.googleapis.com/auth/webmasters" 1409 // ] 1410 // } 1411 1412} 1413 1414// method id "webmasters.sites.delete": 1415 1416type SitesDeleteCall struct { 1417 s *Service 1418 siteUrl string 1419 urlParams_ gensupport.URLParams 1420 ctx_ context.Context 1421 header_ http.Header 1422} 1423 1424// Delete: Removes a site from the set of the user's Search Console 1425// sites. 1426// 1427// - siteUrl: The URI of the property as defined in Search Console. 1428// Examples: http://www.example.com/ or android-app://com.example/ 1429// Note: for property-sets, use the URI that starts with sc-set: which 1430// is used in Search Console URLs. 1431func (r *SitesService) Delete(siteUrl string) *SitesDeleteCall { 1432 c := &SitesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1433 c.siteUrl = siteUrl 1434 return c 1435} 1436 1437// Fields allows partial responses to be retrieved. See 1438// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1439// for more information. 1440func (c *SitesDeleteCall) Fields(s ...googleapi.Field) *SitesDeleteCall { 1441 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1442 return c 1443} 1444 1445// Context sets the context to be used in this call's Do method. Any 1446// pending HTTP request will be aborted if the provided context is 1447// canceled. 1448func (c *SitesDeleteCall) Context(ctx context.Context) *SitesDeleteCall { 1449 c.ctx_ = ctx 1450 return c 1451} 1452 1453// Header returns an http.Header that can be modified by the caller to 1454// add HTTP headers to the request. 1455func (c *SitesDeleteCall) Header() http.Header { 1456 if c.header_ == nil { 1457 c.header_ = make(http.Header) 1458 } 1459 return c.header_ 1460} 1461 1462func (c *SitesDeleteCall) doRequest(alt string) (*http.Response, error) { 1463 reqHeaders := make(http.Header) 1464 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 1465 for k, v := range c.header_ { 1466 reqHeaders[k] = v 1467 } 1468 reqHeaders.Set("User-Agent", c.s.userAgent()) 1469 var body io.Reader = nil 1470 c.urlParams_.Set("alt", alt) 1471 c.urlParams_.Set("prettyPrint", "false") 1472 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}") 1473 urls += "?" + c.urlParams_.Encode() 1474 req, err := http.NewRequest("DELETE", urls, body) 1475 if err != nil { 1476 return nil, err 1477 } 1478 req.Header = reqHeaders 1479 googleapi.Expand(req.URL, map[string]string{ 1480 "siteUrl": c.siteUrl, 1481 }) 1482 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1483} 1484 1485// Do executes the "webmasters.sites.delete" call. 1486func (c *SitesDeleteCall) Do(opts ...googleapi.CallOption) error { 1487 gensupport.SetOptions(c.urlParams_, opts...) 1488 res, err := c.doRequest("json") 1489 if err != nil { 1490 return err 1491 } 1492 defer googleapi.CloseBody(res) 1493 if err := googleapi.CheckResponse(res); err != nil { 1494 return err 1495 } 1496 return nil 1497 // { 1498 // "description": "Removes a site from the set of the user's Search Console sites.", 1499 // "httpMethod": "DELETE", 1500 // "id": "webmasters.sites.delete", 1501 // "parameterOrder": [ 1502 // "siteUrl" 1503 // ], 1504 // "parameters": { 1505 // "siteUrl": { 1506 // "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.", 1507 // "location": "path", 1508 // "required": true, 1509 // "type": "string" 1510 // } 1511 // }, 1512 // "path": "sites/{siteUrl}", 1513 // "scopes": [ 1514 // "https://www.googleapis.com/auth/webmasters" 1515 // ] 1516 // } 1517 1518} 1519 1520// method id "webmasters.sites.get": 1521 1522type SitesGetCall struct { 1523 s *Service 1524 siteUrl string 1525 urlParams_ gensupport.URLParams 1526 ifNoneMatch_ string 1527 ctx_ context.Context 1528 header_ http.Header 1529} 1530 1531// Get: Retrieves information about specific site. 1532// 1533// - siteUrl: The URI of the property as defined in Search Console. 1534// Examples: http://www.example.com/ or android-app://com.example/ 1535// Note: for property-sets, use the URI that starts with sc-set: which 1536// is used in Search Console URLs. 1537func (r *SitesService) Get(siteUrl string) *SitesGetCall { 1538 c := &SitesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1539 c.siteUrl = siteUrl 1540 return c 1541} 1542 1543// Fields allows partial responses to be retrieved. See 1544// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1545// for more information. 1546func (c *SitesGetCall) Fields(s ...googleapi.Field) *SitesGetCall { 1547 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1548 return c 1549} 1550 1551// IfNoneMatch sets the optional parameter which makes the operation 1552// fail if the object's ETag matches the given value. This is useful for 1553// getting updates only after the object has changed since the last 1554// request. Use googleapi.IsNotModified to check whether the response 1555// error from Do is the result of In-None-Match. 1556func (c *SitesGetCall) IfNoneMatch(entityTag string) *SitesGetCall { 1557 c.ifNoneMatch_ = entityTag 1558 return c 1559} 1560 1561// Context sets the context to be used in this call's Do method. Any 1562// pending HTTP request will be aborted if the provided context is 1563// canceled. 1564func (c *SitesGetCall) Context(ctx context.Context) *SitesGetCall { 1565 c.ctx_ = ctx 1566 return c 1567} 1568 1569// Header returns an http.Header that can be modified by the caller to 1570// add HTTP headers to the request. 1571func (c *SitesGetCall) Header() http.Header { 1572 if c.header_ == nil { 1573 c.header_ = make(http.Header) 1574 } 1575 return c.header_ 1576} 1577 1578func (c *SitesGetCall) doRequest(alt string) (*http.Response, error) { 1579 reqHeaders := make(http.Header) 1580 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 1581 for k, v := range c.header_ { 1582 reqHeaders[k] = v 1583 } 1584 reqHeaders.Set("User-Agent", c.s.userAgent()) 1585 if c.ifNoneMatch_ != "" { 1586 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1587 } 1588 var body io.Reader = nil 1589 c.urlParams_.Set("alt", alt) 1590 c.urlParams_.Set("prettyPrint", "false") 1591 urls := googleapi.ResolveRelative(c.s.BasePath, "sites/{siteUrl}") 1592 urls += "?" + c.urlParams_.Encode() 1593 req, err := http.NewRequest("GET", urls, body) 1594 if err != nil { 1595 return nil, err 1596 } 1597 req.Header = reqHeaders 1598 googleapi.Expand(req.URL, map[string]string{ 1599 "siteUrl": c.siteUrl, 1600 }) 1601 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1602} 1603 1604// Do executes the "webmasters.sites.get" call. 1605// Exactly one of *WmxSite or error will be non-nil. Any non-2xx status 1606// code is an error. Response headers are in either 1607// *WmxSite.ServerResponse.Header or (if a response was returned at all) 1608// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1609// check whether the returned error was because http.StatusNotModified 1610// was returned. 1611func (c *SitesGetCall) Do(opts ...googleapi.CallOption) (*WmxSite, error) { 1612 gensupport.SetOptions(c.urlParams_, opts...) 1613 res, err := c.doRequest("json") 1614 if res != nil && res.StatusCode == http.StatusNotModified { 1615 if res.Body != nil { 1616 res.Body.Close() 1617 } 1618 return nil, &googleapi.Error{ 1619 Code: res.StatusCode, 1620 Header: res.Header, 1621 } 1622 } 1623 if err != nil { 1624 return nil, err 1625 } 1626 defer googleapi.CloseBody(res) 1627 if err := googleapi.CheckResponse(res); err != nil { 1628 return nil, err 1629 } 1630 ret := &WmxSite{ 1631 ServerResponse: googleapi.ServerResponse{ 1632 Header: res.Header, 1633 HTTPStatusCode: res.StatusCode, 1634 }, 1635 } 1636 target := &ret 1637 if err := gensupport.DecodeResponse(target, res); err != nil { 1638 return nil, err 1639 } 1640 return ret, nil 1641 // { 1642 // "description": "Retrieves information about specific site.", 1643 // "httpMethod": "GET", 1644 // "id": "webmasters.sites.get", 1645 // "parameterOrder": [ 1646 // "siteUrl" 1647 // ], 1648 // "parameters": { 1649 // "siteUrl": { 1650 // "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.", 1651 // "location": "path", 1652 // "required": true, 1653 // "type": "string" 1654 // } 1655 // }, 1656 // "path": "sites/{siteUrl}", 1657 // "response": { 1658 // "$ref": "WmxSite" 1659 // }, 1660 // "scopes": [ 1661 // "https://www.googleapis.com/auth/webmasters", 1662 // "https://www.googleapis.com/auth/webmasters.readonly" 1663 // ] 1664 // } 1665 1666} 1667 1668// method id "webmasters.sites.list": 1669 1670type SitesListCall struct { 1671 s *Service 1672 urlParams_ gensupport.URLParams 1673 ifNoneMatch_ string 1674 ctx_ context.Context 1675 header_ http.Header 1676} 1677 1678// List: Lists the user's Search Console sites. 1679func (r *SitesService) List() *SitesListCall { 1680 c := &SitesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1681 return c 1682} 1683 1684// Fields allows partial responses to be retrieved. See 1685// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1686// for more information. 1687func (c *SitesListCall) Fields(s ...googleapi.Field) *SitesListCall { 1688 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1689 return c 1690} 1691 1692// IfNoneMatch sets the optional parameter which makes the operation 1693// fail if the object's ETag matches the given value. This is useful for 1694// getting updates only after the object has changed since the last 1695// request. Use googleapi.IsNotModified to check whether the response 1696// error from Do is the result of In-None-Match. 1697func (c *SitesListCall) IfNoneMatch(entityTag string) *SitesListCall { 1698 c.ifNoneMatch_ = entityTag 1699 return c 1700} 1701 1702// Context sets the context to be used in this call's Do method. Any 1703// pending HTTP request will be aborted if the provided context is 1704// canceled. 1705func (c *SitesListCall) Context(ctx context.Context) *SitesListCall { 1706 c.ctx_ = ctx 1707 return c 1708} 1709 1710// Header returns an http.Header that can be modified by the caller to 1711// add HTTP headers to the request. 1712func (c *SitesListCall) Header() http.Header { 1713 if c.header_ == nil { 1714 c.header_ = make(http.Header) 1715 } 1716 return c.header_ 1717} 1718 1719func (c *SitesListCall) doRequest(alt string) (*http.Response, error) { 1720 reqHeaders := make(http.Header) 1721 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211102") 1722 for k, v := range c.header_ { 1723 reqHeaders[k] = v 1724 } 1725 reqHeaders.Set("User-Agent", c.s.userAgent()) 1726 if c.ifNoneMatch_ != "" { 1727 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1728 } 1729 var body io.Reader = nil 1730 c.urlParams_.Set("alt", alt) 1731 c.urlParams_.Set("prettyPrint", "false") 1732 urls := googleapi.ResolveRelative(c.s.BasePath, "sites") 1733 urls += "?" + c.urlParams_.Encode() 1734 req, err := http.NewRequest("GET", urls, body) 1735 if err != nil { 1736 return nil, err 1737 } 1738 req.Header = reqHeaders 1739 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1740} 1741 1742// Do executes the "webmasters.sites.list" call. 1743// Exactly one of *SitesListResponse or error will be non-nil. Any 1744// non-2xx status code is an error. Response headers are in either 1745// *SitesListResponse.ServerResponse.Header or (if a response was 1746// returned at all) in error.(*googleapi.Error).Header. Use 1747// googleapi.IsNotModified to check whether the returned error was 1748// because http.StatusNotModified was returned. 1749func (c *SitesListCall) Do(opts ...googleapi.CallOption) (*SitesListResponse, error) { 1750 gensupport.SetOptions(c.urlParams_, opts...) 1751 res, err := c.doRequest("json") 1752 if res != nil && res.StatusCode == http.StatusNotModified { 1753 if res.Body != nil { 1754 res.Body.Close() 1755 } 1756 return nil, &googleapi.Error{ 1757 Code: res.StatusCode, 1758 Header: res.Header, 1759 } 1760 } 1761 if err != nil { 1762 return nil, err 1763 } 1764 defer googleapi.CloseBody(res) 1765 if err := googleapi.CheckResponse(res); err != nil { 1766 return nil, err 1767 } 1768 ret := &SitesListResponse{ 1769 ServerResponse: googleapi.ServerResponse{ 1770 Header: res.Header, 1771 HTTPStatusCode: res.StatusCode, 1772 }, 1773 } 1774 target := &ret 1775 if err := gensupport.DecodeResponse(target, res); err != nil { 1776 return nil, err 1777 } 1778 return ret, nil 1779 // { 1780 // "description": "Lists the user's Search Console sites.", 1781 // "httpMethod": "GET", 1782 // "id": "webmasters.sites.list", 1783 // "path": "sites", 1784 // "response": { 1785 // "$ref": "SitesListResponse" 1786 // }, 1787 // "scopes": [ 1788 // "https://www.googleapis.com/auth/webmasters", 1789 // "https://www.googleapis.com/auth/webmasters.readonly" 1790 // ] 1791 // } 1792 1793} 1794