1// Copyright 2020 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 fusiontables provides access to the Fusion Tables API. 8// 9// For product documentation, see: https://developers.google.com/fusiontables 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/fusiontables/v2" 16// ... 17// ctx := context.Background() 18// fusiontablesService, err := fusiontables.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// fusiontablesService, err := fusiontables.NewService(ctx, option.WithScopes(fusiontables.FusiontablesReadonlyScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// fusiontablesService, err := fusiontables.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// fusiontablesService, err := fusiontables.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package fusiontables // import "google.golang.org/api/fusiontables/v2" 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 htransport "google.golang.org/api/transport/http" 60) 61 62// Always reference these packages, just in case the auto-generated code 63// below doesn't. 64var _ = bytes.NewBuffer 65var _ = strconv.Itoa 66var _ = fmt.Sprintf 67var _ = json.NewDecoder 68var _ = io.Copy 69var _ = url.Parse 70var _ = gensupport.MarshalJSON 71var _ = googleapi.Version 72var _ = errors.New 73var _ = strings.Replace 74var _ = context.Canceled 75 76const apiId = "fusiontables:v2" 77const apiName = "fusiontables" 78const apiVersion = "v2" 79const basePath = "https://www.googleapis.com/fusiontables/v2/" 80 81// OAuth2 scopes used by this API. 82const ( 83 // Manage your Fusion Tables 84 FusiontablesScope = "https://www.googleapis.com/auth/fusiontables" 85 86 // View your Fusion Tables 87 FusiontablesReadonlyScope = "https://www.googleapis.com/auth/fusiontables.readonly" 88) 89 90// NewService creates a new Service. 91func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 92 scopesOption := option.WithScopes( 93 "https://www.googleapis.com/auth/fusiontables", 94 "https://www.googleapis.com/auth/fusiontables.readonly", 95 ) 96 // NOTE: prepend, so we don't override user-specified scopes. 97 opts = append([]option.ClientOption{scopesOption}, opts...) 98 client, endpoint, err := htransport.NewClient(ctx, opts...) 99 if err != nil { 100 return nil, err 101 } 102 s, err := New(client) 103 if err != nil { 104 return nil, err 105 } 106 if endpoint != "" { 107 s.BasePath = endpoint 108 } 109 return s, nil 110} 111 112// New creates a new Service. It uses the provided http.Client for requests. 113// 114// Deprecated: please use NewService instead. 115// To provide a custom HTTP client, use option.WithHTTPClient. 116// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 117func New(client *http.Client) (*Service, error) { 118 if client == nil { 119 return nil, errors.New("client is nil") 120 } 121 s := &Service{client: client, BasePath: basePath} 122 s.Column = NewColumnService(s) 123 s.Query = NewQueryService(s) 124 s.Style = NewStyleService(s) 125 s.Table = NewTableService(s) 126 s.Task = NewTaskService(s) 127 s.Template = NewTemplateService(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 Column *ColumnService 137 138 Query *QueryService 139 140 Style *StyleService 141 142 Table *TableService 143 144 Task *TaskService 145 146 Template *TemplateService 147} 148 149func (s *Service) userAgent() string { 150 if s.UserAgent == "" { 151 return googleapi.UserAgent 152 } 153 return googleapi.UserAgent + " " + s.UserAgent 154} 155 156func NewColumnService(s *Service) *ColumnService { 157 rs := &ColumnService{s: s} 158 return rs 159} 160 161type ColumnService struct { 162 s *Service 163} 164 165func NewQueryService(s *Service) *QueryService { 166 rs := &QueryService{s: s} 167 return rs 168} 169 170type QueryService struct { 171 s *Service 172} 173 174func NewStyleService(s *Service) *StyleService { 175 rs := &StyleService{s: s} 176 return rs 177} 178 179type StyleService struct { 180 s *Service 181} 182 183func NewTableService(s *Service) *TableService { 184 rs := &TableService{s: s} 185 return rs 186} 187 188type TableService struct { 189 s *Service 190} 191 192func NewTaskService(s *Service) *TaskService { 193 rs := &TaskService{s: s} 194 return rs 195} 196 197type TaskService struct { 198 s *Service 199} 200 201func NewTemplateService(s *Service) *TemplateService { 202 rs := &TemplateService{s: s} 203 return rs 204} 205 206type TemplateService struct { 207 s *Service 208} 209 210// Bucket: Specifies the minimum and maximum values, the color, opacity, 211// icon and weight of a bucket within a StyleSetting. 212type Bucket struct { 213 // Color: Color of line or the interior of a polygon in #RRGGBB format. 214 Color string `json:"color,omitempty"` 215 216 // Icon: Icon name used for a point. 217 Icon string `json:"icon,omitempty"` 218 219 // Max: Maximum value in the selected column for a row to be styled 220 // according to the bucket color, opacity, icon, or weight. 221 Max float64 `json:"max,omitempty"` 222 223 // Min: Minimum value in the selected column for a row to be styled 224 // according to the bucket color, opacity, icon, or weight. 225 Min float64 `json:"min,omitempty"` 226 227 // Opacity: Opacity of the color: 0.0 (transparent) to 1.0 (opaque). 228 Opacity float64 `json:"opacity,omitempty"` 229 230 // Weight: Width of a line (in pixels). 231 Weight int64 `json:"weight,omitempty"` 232 233 // ForceSendFields is a list of field names (e.g. "Color") to 234 // unconditionally include in API requests. By default, fields with 235 // empty values are omitted from API requests. However, any non-pointer, 236 // non-interface field appearing in ForceSendFields will be sent to the 237 // server regardless of whether the field is empty or not. This may be 238 // used to include empty fields in Patch requests. 239 ForceSendFields []string `json:"-"` 240 241 // NullFields is a list of field names (e.g. "Color") to include in API 242 // requests with the JSON null value. By default, fields with empty 243 // values are omitted from API requests. However, any field with an 244 // empty value appearing in NullFields will be sent to the server as 245 // null. It is an error if a field in this list has a non-empty value. 246 // This may be used to include null fields in Patch requests. 247 NullFields []string `json:"-"` 248} 249 250func (s *Bucket) MarshalJSON() ([]byte, error) { 251 type NoMethod Bucket 252 raw := NoMethod(*s) 253 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 254} 255 256func (s *Bucket) UnmarshalJSON(data []byte) error { 257 type NoMethod Bucket 258 var s1 struct { 259 Max gensupport.JSONFloat64 `json:"max"` 260 Min gensupport.JSONFloat64 `json:"min"` 261 Opacity gensupport.JSONFloat64 `json:"opacity"` 262 *NoMethod 263 } 264 s1.NoMethod = (*NoMethod)(s) 265 if err := json.Unmarshal(data, &s1); err != nil { 266 return err 267 } 268 s.Max = float64(s1.Max) 269 s.Min = float64(s1.Min) 270 s.Opacity = float64(s1.Opacity) 271 return nil 272} 273 274// Column: Specifies the details of a column in a table. 275type Column struct { 276 // BaseColumn: Identifier of the base column. If present, this column is 277 // derived from the specified base column. 278 BaseColumn *ColumnBaseColumn `json:"baseColumn,omitempty"` 279 280 // ColumnId: Identifier for the column. 281 ColumnId int64 `json:"columnId,omitempty"` 282 283 // ColumnJsonSchema: JSON schema for interpreting JSON in this column. 284 ColumnJsonSchema string `json:"columnJsonSchema,omitempty"` 285 286 // ColumnPropertiesJson: JSON object containing custom column 287 // properties. 288 ColumnPropertiesJson string `json:"columnPropertiesJson,omitempty"` 289 290 // Description: Column description. 291 Description string `json:"description,omitempty"` 292 293 // FormatPattern: Format pattern. 294 // Acceptable values are DT_DATE_MEDIUMe.g Dec 24, 2008 DT_DATE_SHORTfor 295 // example 12/24/08 DT_DATE_TIME_MEDIUMfor example Dec 24, 2008 8:30:45 296 // PM DT_DATE_TIME_SHORTfor example 12/24/08 8:30 PM 297 // DT_DAY_MONTH_2_DIGIT_YEARfor example 24/12/08 298 // DT_DAY_MONTH_2_DIGIT_YEAR_TIMEfor example 24/12/08 20:30 299 // DT_DAY_MONTH_2_DIGIT_YEAR_TIME_MERIDIANfor example 24/12/08 8:30 PM 300 // DT_DAY_MONTH_4_DIGIT_YEARfor example 24/12/2008 301 // DT_DAY_MONTH_4_DIGIT_YEAR_TIMEfor example 24/12/2008 20:30 302 // DT_DAY_MONTH_4_DIGIT_YEAR_TIME_MERIDIANfor example 24/12/2008 8:30 PM 303 // DT_ISO_YEAR_MONTH_DAYfor example 2008-12-24 304 // DT_ISO_YEAR_MONTH_DAY_TIMEfor example 2008-12-24 20:30:45 305 // DT_MONTH_DAY_4_DIGIT_YEARfor example 12/24/2008 DT_TIME_LONGfor 306 // example 8:30:45 PM UTC-6 DT_TIME_MEDIUMfor example 8:30:45 PM 307 // DT_TIME_SHORTfor example 8:30 PM DT_YEAR_ONLYfor example 2008 308 // HIGHLIGHT_UNTYPED_CELLSHighlight cell data that does not match the 309 // data type NONENo formatting (default) NUMBER_CURRENCYfor example 310 // $1234.56 NUMBER_DEFAULTfor example 1,234.56 NUMBER_INTEGERfor example 311 // 1235 NUMBER_NO_SEPARATORfor example 1234.56 NUMBER_PERCENTfor example 312 // 123,456% NUMBER_SCIENTIFICfor example 1E3 313 // STRING_EIGHT_LINE_IMAGEDisplays thumbnail images as tall as eight 314 // lines of text STRING_FOUR_LINE_IMAGEDisplays thumbnail images as tall 315 // as four lines of text STRING_JSON_TEXTAllows editing of text as JSON 316 // in UI STRING_JSON_LISTAllows editing of text as a JSON list in UI 317 // STRING_LINKTreats cell as a link (must start with http:// or 318 // https://) STRING_ONE_LINE_IMAGEDisplays thumbnail images as tall as 319 // one line of text STRING_VIDEO_OR_MAPDisplay a video or map thumbnail 320 FormatPattern string `json:"formatPattern,omitempty"` 321 322 // GraphPredicate: Column graph predicate. 323 // Used to map table to graph data model (subject,predicate,object) 324 // See W3C Graph-based Data Model. 325 GraphPredicate string `json:"graphPredicate,omitempty"` 326 327 // Kind: The kind of item this is. For a column, this is always 328 // fusiontables#column. 329 Kind string `json:"kind,omitempty"` 330 331 // Name: Name of the column. 332 Name string `json:"name,omitempty"` 333 334 // Type: Type of the column. 335 Type string `json:"type,omitempty"` 336 337 // ValidValues: List of valid values used to validate data and supply a 338 // drop-down list of values in the web application. 339 ValidValues []string `json:"validValues,omitempty"` 340 341 // ValidateData: If true, data entered via the web application is 342 // validated. 343 ValidateData bool `json:"validateData,omitempty"` 344 345 // ServerResponse contains the HTTP response code and headers from the 346 // server. 347 googleapi.ServerResponse `json:"-"` 348 349 // ForceSendFields is a list of field names (e.g. "BaseColumn") to 350 // unconditionally include in API requests. By default, fields with 351 // empty values are omitted from API requests. However, any non-pointer, 352 // non-interface field appearing in ForceSendFields will be sent to the 353 // server regardless of whether the field is empty or not. This may be 354 // used to include empty fields in Patch requests. 355 ForceSendFields []string `json:"-"` 356 357 // NullFields is a list of field names (e.g. "BaseColumn") to include in 358 // API requests with the JSON null value. By default, fields with empty 359 // values are omitted from API requests. However, any field with an 360 // empty value appearing in NullFields will be sent to the server as 361 // null. It is an error if a field in this list has a non-empty value. 362 // This may be used to include null fields in Patch requests. 363 NullFields []string `json:"-"` 364} 365 366func (s *Column) MarshalJSON() ([]byte, error) { 367 type NoMethod Column 368 raw := NoMethod(*s) 369 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 370} 371 372// ColumnBaseColumn: Identifier of the base column. If present, this 373// column is derived from the specified base column. 374type ColumnBaseColumn struct { 375 // ColumnId: The id of the column in the base table from which this 376 // column is derived. 377 ColumnId int64 `json:"columnId,omitempty"` 378 379 // TableIndex: Offset to the entry in the list of base tables in the 380 // table definition. 381 TableIndex int64 `json:"tableIndex,omitempty"` 382 383 // ForceSendFields is a list of field names (e.g. "ColumnId") to 384 // unconditionally include in API requests. By default, fields with 385 // empty values are omitted from API requests. However, any non-pointer, 386 // non-interface field appearing in ForceSendFields will be sent to the 387 // server regardless of whether the field is empty or not. This may be 388 // used to include empty fields in Patch requests. 389 ForceSendFields []string `json:"-"` 390 391 // NullFields is a list of field names (e.g. "ColumnId") to include in 392 // API requests with the JSON null value. By default, fields with empty 393 // values are omitted from API requests. However, any field with an 394 // empty value appearing in NullFields will be sent to the server as 395 // null. It is an error if a field in this list has a non-empty value. 396 // This may be used to include null fields in Patch requests. 397 NullFields []string `json:"-"` 398} 399 400func (s *ColumnBaseColumn) MarshalJSON() ([]byte, error) { 401 type NoMethod ColumnBaseColumn 402 raw := NoMethod(*s) 403 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 404} 405 406// ColumnList: Represents a list of columns in a table. 407type ColumnList struct { 408 // Items: List of all requested columns. 409 Items []*Column `json:"items,omitempty"` 410 411 // Kind: The kind of item this is. For a column list, this is always 412 // fusiontables#columnList. 413 Kind string `json:"kind,omitempty"` 414 415 // NextPageToken: Token used to access the next page of this result. No 416 // token is displayed if there are no more pages left. 417 NextPageToken string `json:"nextPageToken,omitempty"` 418 419 // TotalItems: Total number of columns for the table. 420 TotalItems int64 `json:"totalItems,omitempty"` 421 422 // ServerResponse contains the HTTP response code and headers from the 423 // server. 424 googleapi.ServerResponse `json:"-"` 425 426 // ForceSendFields is a list of field names (e.g. "Items") to 427 // unconditionally include in API requests. By default, fields with 428 // empty values are omitted from API requests. However, any non-pointer, 429 // non-interface field appearing in ForceSendFields will be sent to the 430 // server regardless of whether the field is empty or not. This may be 431 // used to include empty fields in Patch requests. 432 ForceSendFields []string `json:"-"` 433 434 // NullFields is a list of field names (e.g. "Items") to include in API 435 // requests with the JSON null value. By default, fields with empty 436 // values are omitted from API requests. However, any field with an 437 // empty value appearing in NullFields will be sent to the server as 438 // null. It is an error if a field in this list has a non-empty value. 439 // This may be used to include null fields in Patch requests. 440 NullFields []string `json:"-"` 441} 442 443func (s *ColumnList) MarshalJSON() ([]byte, error) { 444 type NoMethod ColumnList 445 raw := NoMethod(*s) 446 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 447} 448 449// Geometry: Represents a Geometry object. 450type Geometry struct { 451 // Geometries: The list of geometries in this geometry collection. 452 Geometries []interface{} `json:"geometries,omitempty"` 453 454 Geometry interface{} `json:"geometry,omitempty"` 455 456 // Type: Type: A collection of geometries. 457 Type string `json:"type,omitempty"` 458 459 // ForceSendFields is a list of field names (e.g. "Geometries") to 460 // unconditionally include in API requests. By default, fields with 461 // empty values are omitted from API requests. However, any non-pointer, 462 // non-interface field appearing in ForceSendFields will be sent to the 463 // server regardless of whether the field is empty or not. This may be 464 // used to include empty fields in Patch requests. 465 ForceSendFields []string `json:"-"` 466 467 // NullFields is a list of field names (e.g. "Geometries") to include in 468 // API requests with the JSON null value. By default, fields with empty 469 // values are omitted from API requests. However, any field with an 470 // empty value appearing in NullFields will be sent to the server as 471 // null. It is an error if a field in this list has a non-empty value. 472 // This may be used to include null fields in Patch requests. 473 NullFields []string `json:"-"` 474} 475 476func (s *Geometry) MarshalJSON() ([]byte, error) { 477 type NoMethod Geometry 478 raw := NoMethod(*s) 479 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 480} 481 482// Import: Represents an import request. 483type Import struct { 484 // Kind: The kind of item this is. For an import, this is always 485 // fusiontables#import. 486 Kind string `json:"kind,omitempty"` 487 488 // NumRowsReceived: The number of rows received from the import request. 489 NumRowsReceived int64 `json:"numRowsReceived,omitempty,string"` 490 491 // ServerResponse contains the HTTP response code and headers from the 492 // server. 493 googleapi.ServerResponse `json:"-"` 494 495 // ForceSendFields is a list of field names (e.g. "Kind") to 496 // unconditionally include in API requests. By default, fields with 497 // empty values are omitted from API requests. However, any non-pointer, 498 // non-interface field appearing in ForceSendFields will be sent to the 499 // server regardless of whether the field is empty or not. This may be 500 // used to include empty fields in Patch requests. 501 ForceSendFields []string `json:"-"` 502 503 // NullFields is a list of field names (e.g. "Kind") to include in API 504 // requests with the JSON null value. By default, fields with empty 505 // values are omitted from API requests. However, any field with an 506 // empty value appearing in NullFields will be sent to the server as 507 // null. It is an error if a field in this list has a non-empty value. 508 // This may be used to include null fields in Patch requests. 509 NullFields []string `json:"-"` 510} 511 512func (s *Import) MarshalJSON() ([]byte, error) { 513 type NoMethod Import 514 raw := NoMethod(*s) 515 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 516} 517 518// Line: Represents a line geometry. 519type Line struct { 520 // Coordinates: The coordinates that define the line. 521 Coordinates [][]float64 `json:"coordinates,omitempty"` 522 523 // Type: Type: A line geometry. 524 Type string `json:"type,omitempty"` 525 526 // ForceSendFields is a list of field names (e.g. "Coordinates") to 527 // unconditionally include in API requests. By default, fields with 528 // empty values are omitted from API requests. However, any non-pointer, 529 // non-interface field appearing in ForceSendFields will be sent to the 530 // server regardless of whether the field is empty or not. This may be 531 // used to include empty fields in Patch requests. 532 ForceSendFields []string `json:"-"` 533 534 // NullFields is a list of field names (e.g. "Coordinates") to include 535 // in API requests with the JSON null value. By default, fields with 536 // empty values are omitted from API requests. However, any field with 537 // an empty value appearing in NullFields will be sent to the server as 538 // null. It is an error if a field in this list has a non-empty value. 539 // This may be used to include null fields in Patch requests. 540 NullFields []string `json:"-"` 541} 542 543func (s *Line) MarshalJSON() ([]byte, error) { 544 type NoMethod Line 545 raw := NoMethod(*s) 546 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 547} 548 549// LineStyle: Represents a LineStyle within a StyleSetting 550type LineStyle struct { 551 // StrokeColor: Color of the line in #RRGGBB format. 552 StrokeColor string `json:"strokeColor,omitempty"` 553 554 // StrokeColorStyler: Column-value, gradient or buckets styler that is 555 // used to determine the line color and opacity. 556 StrokeColorStyler *StyleFunction `json:"strokeColorStyler,omitempty"` 557 558 // StrokeOpacity: Opacity of the line : 0.0 (transparent) to 1.0 559 // (opaque). 560 StrokeOpacity float64 `json:"strokeOpacity,omitempty"` 561 562 // StrokeWeight: Width of the line in pixels. 563 StrokeWeight int64 `json:"strokeWeight,omitempty"` 564 565 // StrokeWeightStyler: Column-value or bucket styler that is used to 566 // determine the width of the line. 567 StrokeWeightStyler *StyleFunction `json:"strokeWeightStyler,omitempty"` 568 569 // ForceSendFields is a list of field names (e.g. "StrokeColor") to 570 // unconditionally include in API requests. By default, fields with 571 // empty values are omitted from API requests. However, any non-pointer, 572 // non-interface field appearing in ForceSendFields will be sent to the 573 // server regardless of whether the field is empty or not. This may be 574 // used to include empty fields in Patch requests. 575 ForceSendFields []string `json:"-"` 576 577 // NullFields is a list of field names (e.g. "StrokeColor") to include 578 // in API requests with the JSON null value. By default, fields with 579 // empty values are omitted from API requests. However, any field with 580 // an empty value appearing in NullFields will be sent to the server as 581 // null. It is an error if a field in this list has a non-empty value. 582 // This may be used to include null fields in Patch requests. 583 NullFields []string `json:"-"` 584} 585 586func (s *LineStyle) MarshalJSON() ([]byte, error) { 587 type NoMethod LineStyle 588 raw := NoMethod(*s) 589 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 590} 591 592func (s *LineStyle) UnmarshalJSON(data []byte) error { 593 type NoMethod LineStyle 594 var s1 struct { 595 StrokeOpacity gensupport.JSONFloat64 `json:"strokeOpacity"` 596 *NoMethod 597 } 598 s1.NoMethod = (*NoMethod)(s) 599 if err := json.Unmarshal(data, &s1); err != nil { 600 return err 601 } 602 s.StrokeOpacity = float64(s1.StrokeOpacity) 603 return nil 604} 605 606// Point: Represents a point object. 607type Point struct { 608 // Coordinates: The coordinates that define the point. 609 Coordinates []float64 `json:"coordinates,omitempty"` 610 611 // Type: Point: A point geometry. 612 Type string `json:"type,omitempty"` 613 614 // ForceSendFields is a list of field names (e.g. "Coordinates") to 615 // unconditionally include in API requests. By default, fields with 616 // empty values are omitted from API requests. However, any non-pointer, 617 // non-interface field appearing in ForceSendFields will be sent to the 618 // server regardless of whether the field is empty or not. This may be 619 // used to include empty fields in Patch requests. 620 ForceSendFields []string `json:"-"` 621 622 // NullFields is a list of field names (e.g. "Coordinates") to include 623 // in API requests with the JSON null value. By default, fields with 624 // empty values are omitted from API requests. However, any field with 625 // an empty value appearing in NullFields will be sent to the server as 626 // null. It is an error if a field in this list has a non-empty value. 627 // This may be used to include null fields in Patch requests. 628 NullFields []string `json:"-"` 629} 630 631func (s *Point) MarshalJSON() ([]byte, error) { 632 type NoMethod Point 633 raw := NoMethod(*s) 634 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 635} 636 637// PointStyle: Represents a PointStyle within a StyleSetting 638type PointStyle struct { 639 // IconName: Name of the icon. Use values defined in 640 // http://www.google.com/fusiontables/DataSource?dsrcid=308519 641 IconName string `json:"iconName,omitempty"` 642 643 // IconStyler: Column or a bucket value from which the icon name is to 644 // be determined. 645 IconStyler *StyleFunction `json:"iconStyler,omitempty"` 646 647 // ForceSendFields is a list of field names (e.g. "IconName") to 648 // unconditionally include in API requests. By default, fields with 649 // empty values are omitted from API requests. However, any non-pointer, 650 // non-interface field appearing in ForceSendFields will be sent to the 651 // server regardless of whether the field is empty or not. This may be 652 // used to include empty fields in Patch requests. 653 ForceSendFields []string `json:"-"` 654 655 // NullFields is a list of field names (e.g. "IconName") to include in 656 // API requests with the JSON null value. By default, fields with empty 657 // values are omitted from API requests. However, any field with an 658 // empty value appearing in NullFields will be sent to the server as 659 // null. It is an error if a field in this list has a non-empty value. 660 // This may be used to include null fields in Patch requests. 661 NullFields []string `json:"-"` 662} 663 664func (s *PointStyle) MarshalJSON() ([]byte, error) { 665 type NoMethod PointStyle 666 raw := NoMethod(*s) 667 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 668} 669 670// Polygon: Represents a polygon object. 671type Polygon struct { 672 // Coordinates: The coordinates that define the polygon. 673 Coordinates [][][]float64 `json:"coordinates,omitempty"` 674 675 // Type: Type: A polygon geometry. 676 Type string `json:"type,omitempty"` 677 678 // ForceSendFields is a list of field names (e.g. "Coordinates") to 679 // unconditionally include in API requests. By default, fields with 680 // empty values are omitted from API requests. However, any non-pointer, 681 // non-interface field appearing in ForceSendFields will be sent to the 682 // server regardless of whether the field is empty or not. This may be 683 // used to include empty fields in Patch requests. 684 ForceSendFields []string `json:"-"` 685 686 // NullFields is a list of field names (e.g. "Coordinates") to include 687 // in API requests with the JSON null value. By default, fields with 688 // empty values are omitted from API requests. However, any field with 689 // an empty value appearing in NullFields will be sent to the server as 690 // null. It is an error if a field in this list has a non-empty value. 691 // This may be used to include null fields in Patch requests. 692 NullFields []string `json:"-"` 693} 694 695func (s *Polygon) MarshalJSON() ([]byte, error) { 696 type NoMethod Polygon 697 raw := NoMethod(*s) 698 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 699} 700 701// PolygonStyle: Represents a PolygonStyle within a StyleSetting 702type PolygonStyle struct { 703 // FillColor: Color of the interior of the polygon in #RRGGBB format. 704 FillColor string `json:"fillColor,omitempty"` 705 706 // FillColorStyler: Column-value, gradient, or bucket styler that is 707 // used to determine the interior color and opacity of the polygon. 708 FillColorStyler *StyleFunction `json:"fillColorStyler,omitempty"` 709 710 // FillOpacity: Opacity of the interior of the polygon: 0.0 711 // (transparent) to 1.0 (opaque). 712 FillOpacity float64 `json:"fillOpacity,omitempty"` 713 714 // StrokeColor: Color of the polygon border in #RRGGBB format. 715 StrokeColor string `json:"strokeColor,omitempty"` 716 717 // StrokeColorStyler: Column-value, gradient or buckets styler that is 718 // used to determine the border color and opacity. 719 StrokeColorStyler *StyleFunction `json:"strokeColorStyler,omitempty"` 720 721 // StrokeOpacity: Opacity of the polygon border: 0.0 (transparent) to 722 // 1.0 (opaque). 723 StrokeOpacity float64 `json:"strokeOpacity,omitempty"` 724 725 // StrokeWeight: Width of the polyon border in pixels. 726 StrokeWeight int64 `json:"strokeWeight,omitempty"` 727 728 // StrokeWeightStyler: Column-value or bucket styler that is used to 729 // determine the width of the polygon border. 730 StrokeWeightStyler *StyleFunction `json:"strokeWeightStyler,omitempty"` 731 732 // ForceSendFields is a list of field names (e.g. "FillColor") to 733 // unconditionally include in API requests. By default, fields with 734 // empty values are omitted from API requests. However, any non-pointer, 735 // non-interface field appearing in ForceSendFields will be sent to the 736 // server regardless of whether the field is empty or not. This may be 737 // used to include empty fields in Patch requests. 738 ForceSendFields []string `json:"-"` 739 740 // NullFields is a list of field names (e.g. "FillColor") to include in 741 // API requests with the JSON null value. By default, fields with empty 742 // values are omitted from API requests. However, any field with an 743 // empty value appearing in NullFields will be sent to the server as 744 // null. It is an error if a field in this list has a non-empty value. 745 // This may be used to include null fields in Patch requests. 746 NullFields []string `json:"-"` 747} 748 749func (s *PolygonStyle) MarshalJSON() ([]byte, error) { 750 type NoMethod PolygonStyle 751 raw := NoMethod(*s) 752 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 753} 754 755func (s *PolygonStyle) UnmarshalJSON(data []byte) error { 756 type NoMethod PolygonStyle 757 var s1 struct { 758 FillOpacity gensupport.JSONFloat64 `json:"fillOpacity"` 759 StrokeOpacity gensupport.JSONFloat64 `json:"strokeOpacity"` 760 *NoMethod 761 } 762 s1.NoMethod = (*NoMethod)(s) 763 if err := json.Unmarshal(data, &s1); err != nil { 764 return err 765 } 766 s.FillOpacity = float64(s1.FillOpacity) 767 s.StrokeOpacity = float64(s1.StrokeOpacity) 768 return nil 769} 770 771// Sqlresponse: Represents a response to a SQL statement. 772type Sqlresponse struct { 773 // Columns: Columns in the table. 774 Columns []string `json:"columns,omitempty"` 775 776 // Kind: The kind of item this is. For responses to SQL queries, this is 777 // always fusiontables#sqlresponse. 778 Kind string `json:"kind,omitempty"` 779 780 // Rows: The rows in the table. For each cell we print out whatever cell 781 // value (e.g., numeric, string) exists. Thus it is important that each 782 // cell contains only one value. 783 Rows [][]interface{} `json:"rows,omitempty"` 784 785 // ServerResponse contains the HTTP response code and headers from the 786 // server. 787 googleapi.ServerResponse `json:"-"` 788 789 // ForceSendFields is a list of field names (e.g. "Columns") to 790 // unconditionally include in API requests. By default, fields with 791 // empty values are omitted from API requests. However, any non-pointer, 792 // non-interface field appearing in ForceSendFields will be sent to the 793 // server regardless of whether the field is empty or not. This may be 794 // used to include empty fields in Patch requests. 795 ForceSendFields []string `json:"-"` 796 797 // NullFields is a list of field names (e.g. "Columns") to include in 798 // API requests with the JSON null value. By default, fields with empty 799 // values are omitted from API requests. However, any field with an 800 // empty value appearing in NullFields will be sent to the server as 801 // null. It is an error if a field in this list has a non-empty value. 802 // This may be used to include null fields in Patch requests. 803 NullFields []string `json:"-"` 804} 805 806func (s *Sqlresponse) MarshalJSON() ([]byte, error) { 807 type NoMethod Sqlresponse 808 raw := NoMethod(*s) 809 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 810} 811 812// StyleFunction: Represents a StyleFunction within a StyleSetting 813type StyleFunction struct { 814 // Buckets: Bucket function that assigns a style based on the range a 815 // column value falls into. 816 Buckets []*Bucket `json:"buckets,omitempty"` 817 818 // ColumnName: Name of the column whose value is used in the style. 819 ColumnName string `json:"columnName,omitempty"` 820 821 // Gradient: Gradient function that interpolates a range of colors based 822 // on column value. 823 Gradient *StyleFunctionGradient `json:"gradient,omitempty"` 824 825 // Kind: Stylers can be one of three kinds: "fusiontables#fromColumn if 826 // the column value is to be used as is, i.e., the column values can 827 // have colors in #RRGGBBAA format or integer line widths or icon names; 828 // fusiontables#gradient if the styling of the row is to be based on 829 // applying the gradient function on the column value; or 830 // fusiontables#buckets if the styling is to based on the bucket into 831 // which the the column value falls. 832 Kind string `json:"kind,omitempty"` 833 834 // ForceSendFields is a list of field names (e.g. "Buckets") to 835 // unconditionally include in API requests. By default, fields with 836 // empty values are omitted from API requests. However, any non-pointer, 837 // non-interface field appearing in ForceSendFields will be sent to the 838 // server regardless of whether the field is empty or not. This may be 839 // used to include empty fields in Patch requests. 840 ForceSendFields []string `json:"-"` 841 842 // NullFields is a list of field names (e.g. "Buckets") to include in 843 // API requests with the JSON null value. By default, fields with empty 844 // values are omitted from API requests. However, any field with an 845 // empty value appearing in NullFields will be sent to the server as 846 // null. It is an error if a field in this list has a non-empty value. 847 // This may be used to include null fields in Patch requests. 848 NullFields []string `json:"-"` 849} 850 851func (s *StyleFunction) MarshalJSON() ([]byte, error) { 852 type NoMethod StyleFunction 853 raw := NoMethod(*s) 854 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 855} 856 857// StyleFunctionGradient: Gradient function that interpolates a range of 858// colors based on column value. 859type StyleFunctionGradient struct { 860 // Colors: Array with two or more colors. 861 Colors []*StyleFunctionGradientColors `json:"colors,omitempty"` 862 863 // Max: Higher-end of the interpolation range: rows with this value will 864 // be assigned to colors[n-1]. 865 Max float64 `json:"max,omitempty"` 866 867 // Min: Lower-end of the interpolation range: rows with this value will 868 // be assigned to colors[0]. 869 Min float64 `json:"min,omitempty"` 870 871 // ForceSendFields is a list of field names (e.g. "Colors") to 872 // unconditionally include in API requests. By default, fields with 873 // empty values are omitted from API requests. However, any non-pointer, 874 // non-interface field appearing in ForceSendFields will be sent to the 875 // server regardless of whether the field is empty or not. This may be 876 // used to include empty fields in Patch requests. 877 ForceSendFields []string `json:"-"` 878 879 // NullFields is a list of field names (e.g. "Colors") to include in API 880 // requests with the JSON null value. By default, fields with empty 881 // values are omitted from API requests. However, any field with an 882 // empty value appearing in NullFields will be sent to the server as 883 // null. It is an error if a field in this list has a non-empty value. 884 // This may be used to include null fields in Patch requests. 885 NullFields []string `json:"-"` 886} 887 888func (s *StyleFunctionGradient) MarshalJSON() ([]byte, error) { 889 type NoMethod StyleFunctionGradient 890 raw := NoMethod(*s) 891 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 892} 893 894func (s *StyleFunctionGradient) UnmarshalJSON(data []byte) error { 895 type NoMethod StyleFunctionGradient 896 var s1 struct { 897 Max gensupport.JSONFloat64 `json:"max"` 898 Min gensupport.JSONFloat64 `json:"min"` 899 *NoMethod 900 } 901 s1.NoMethod = (*NoMethod)(s) 902 if err := json.Unmarshal(data, &s1); err != nil { 903 return err 904 } 905 s.Max = float64(s1.Max) 906 s.Min = float64(s1.Min) 907 return nil 908} 909 910type StyleFunctionGradientColors struct { 911 // Color: Color in #RRGGBB format. 912 Color string `json:"color,omitempty"` 913 914 // Opacity: Opacity of the color: 0.0 (transparent) to 1.0 (opaque). 915 Opacity float64 `json:"opacity,omitempty"` 916 917 // ForceSendFields is a list of field names (e.g. "Color") to 918 // unconditionally include in API requests. By default, fields with 919 // empty values are omitted from API requests. However, any non-pointer, 920 // non-interface field appearing in ForceSendFields will be sent to the 921 // server regardless of whether the field is empty or not. This may be 922 // used to include empty fields in Patch requests. 923 ForceSendFields []string `json:"-"` 924 925 // NullFields is a list of field names (e.g. "Color") to include in API 926 // requests with the JSON null value. By default, fields with empty 927 // values are omitted from API requests. However, any field with an 928 // empty value appearing in NullFields will be sent to the server as 929 // null. It is an error if a field in this list has a non-empty value. 930 // This may be used to include null fields in Patch requests. 931 NullFields []string `json:"-"` 932} 933 934func (s *StyleFunctionGradientColors) MarshalJSON() ([]byte, error) { 935 type NoMethod StyleFunctionGradientColors 936 raw := NoMethod(*s) 937 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 938} 939 940func (s *StyleFunctionGradientColors) UnmarshalJSON(data []byte) error { 941 type NoMethod StyleFunctionGradientColors 942 var s1 struct { 943 Opacity gensupport.JSONFloat64 `json:"opacity"` 944 *NoMethod 945 } 946 s1.NoMethod = (*NoMethod)(s) 947 if err := json.Unmarshal(data, &s1); err != nil { 948 return err 949 } 950 s.Opacity = float64(s1.Opacity) 951 return nil 952} 953 954// StyleSetting: Represents a complete StyleSettings object. The primary 955// key is a combination of the tableId and a styleId. 956type StyleSetting struct { 957 // Kind: The kind of item this is. A StyleSetting contains the style 958 // definitions for points, lines, and polygons in a table. Since a table 959 // can have any one or all of them, a style definition can have point, 960 // line and polygon style definitions. 961 Kind string `json:"kind,omitempty"` 962 963 // MarkerOptions: Style definition for points in the table. 964 MarkerOptions *PointStyle `json:"markerOptions,omitempty"` 965 966 // Name: Optional name for the style setting. 967 Name string `json:"name,omitempty"` 968 969 // PolygonOptions: Style definition for polygons in the table. 970 PolygonOptions *PolygonStyle `json:"polygonOptions,omitempty"` 971 972 // PolylineOptions: Style definition for lines in the table. 973 PolylineOptions *LineStyle `json:"polylineOptions,omitempty"` 974 975 // StyleId: Identifier for the style setting (unique only within 976 // tables). 977 StyleId int64 `json:"styleId,omitempty"` 978 979 // TableId: Identifier for the table. 980 TableId string `json:"tableId,omitempty"` 981 982 // ServerResponse contains the HTTP response code and headers from the 983 // server. 984 googleapi.ServerResponse `json:"-"` 985 986 // ForceSendFields is a list of field names (e.g. "Kind") to 987 // unconditionally include in API requests. By default, fields with 988 // empty values are omitted from API requests. However, any non-pointer, 989 // non-interface field appearing in ForceSendFields will be sent to the 990 // server regardless of whether the field is empty or not. This may be 991 // used to include empty fields in Patch requests. 992 ForceSendFields []string `json:"-"` 993 994 // NullFields is a list of field names (e.g. "Kind") to include in API 995 // requests with the JSON null value. By default, fields with empty 996 // values are omitted from API requests. However, any field with an 997 // empty value appearing in NullFields will be sent to the server as 998 // null. It is an error if a field in this list has a non-empty value. 999 // This may be used to include null fields in Patch requests. 1000 NullFields []string `json:"-"` 1001} 1002 1003func (s *StyleSetting) MarshalJSON() ([]byte, error) { 1004 type NoMethod StyleSetting 1005 raw := NoMethod(*s) 1006 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1007} 1008 1009// StyleSettingList: Represents a list of styles for a given table. 1010type StyleSettingList struct { 1011 // Items: All requested style settings. 1012 Items []*StyleSetting `json:"items,omitempty"` 1013 1014 // Kind: The kind of item this is. For a style list, this is always 1015 // fusiontables#styleSettingList . 1016 Kind string `json:"kind,omitempty"` 1017 1018 // NextPageToken: Token used to access the next page of this result. No 1019 // token is displayed if there are no more styles left. 1020 NextPageToken string `json:"nextPageToken,omitempty"` 1021 1022 // TotalItems: Total number of styles for the table. 1023 TotalItems int64 `json:"totalItems,omitempty"` 1024 1025 // ServerResponse contains the HTTP response code and headers from the 1026 // server. 1027 googleapi.ServerResponse `json:"-"` 1028 1029 // ForceSendFields is a list of field names (e.g. "Items") to 1030 // unconditionally include in API requests. By default, fields with 1031 // empty values are omitted from API requests. However, any non-pointer, 1032 // non-interface field appearing in ForceSendFields will be sent to the 1033 // server regardless of whether the field is empty or not. This may be 1034 // used to include empty fields in Patch requests. 1035 ForceSendFields []string `json:"-"` 1036 1037 // NullFields is a list of field names (e.g. "Items") to include in API 1038 // requests with the JSON null value. By default, fields with empty 1039 // values are omitted from API requests. However, any field with an 1040 // empty value appearing in NullFields will be sent to the server as 1041 // null. It is an error if a field in this list has a non-empty value. 1042 // This may be used to include null fields in Patch requests. 1043 NullFields []string `json:"-"` 1044} 1045 1046func (s *StyleSettingList) MarshalJSON() ([]byte, error) { 1047 type NoMethod StyleSettingList 1048 raw := NoMethod(*s) 1049 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1050} 1051 1052// Table: Represents a table. 1053type Table struct { 1054 // Attribution: Attribution assigned to the table. 1055 Attribution string `json:"attribution,omitempty"` 1056 1057 // AttributionLink: Optional link for attribution. 1058 AttributionLink string `json:"attributionLink,omitempty"` 1059 1060 // BaseTableIds: Base table identifier if this table is a view or merged 1061 // table. 1062 BaseTableIds []string `json:"baseTableIds,omitempty"` 1063 1064 // ColumnPropertiesJsonSchema: Default JSON schema for validating all 1065 // JSON column properties. 1066 ColumnPropertiesJsonSchema string `json:"columnPropertiesJsonSchema,omitempty"` 1067 1068 // Columns: Columns in the table. 1069 Columns []*Column `json:"columns,omitempty"` 1070 1071 // Description: Description assigned to the table. 1072 Description string `json:"description,omitempty"` 1073 1074 // IsExportable: Variable for whether table is exportable. 1075 IsExportable bool `json:"isExportable,omitempty"` 1076 1077 // Kind: The kind of item this is. For a table, this is always 1078 // fusiontables#table. 1079 Kind string `json:"kind,omitempty"` 1080 1081 // Name: Name assigned to a table. 1082 Name string `json:"name,omitempty"` 1083 1084 // Sql: SQL that encodes the table definition for derived tables. 1085 Sql string `json:"sql,omitempty"` 1086 1087 // TableId: Encrypted unique alphanumeric identifier for the table. 1088 TableId string `json:"tableId,omitempty"` 1089 1090 // TablePropertiesJson: JSON object containing custom table properties. 1091 TablePropertiesJson string `json:"tablePropertiesJson,omitempty"` 1092 1093 // TablePropertiesJsonSchema: JSON schema for validating the JSON table 1094 // properties. 1095 TablePropertiesJsonSchema string `json:"tablePropertiesJsonSchema,omitempty"` 1096 1097 // ServerResponse contains the HTTP response code and headers from the 1098 // server. 1099 googleapi.ServerResponse `json:"-"` 1100 1101 // ForceSendFields is a list of field names (e.g. "Attribution") to 1102 // unconditionally include in API requests. By default, fields with 1103 // empty values are omitted from API requests. However, any non-pointer, 1104 // non-interface field appearing in ForceSendFields will be sent to the 1105 // server regardless of whether the field is empty or not. This may be 1106 // used to include empty fields in Patch requests. 1107 ForceSendFields []string `json:"-"` 1108 1109 // NullFields is a list of field names (e.g. "Attribution") to include 1110 // in API requests with the JSON null value. By default, fields with 1111 // empty values are omitted from API requests. However, any field with 1112 // an empty value appearing in NullFields will be sent to the server as 1113 // null. It is an error if a field in this list has a non-empty value. 1114 // This may be used to include null fields in Patch requests. 1115 NullFields []string `json:"-"` 1116} 1117 1118func (s *Table) MarshalJSON() ([]byte, error) { 1119 type NoMethod Table 1120 raw := NoMethod(*s) 1121 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1122} 1123 1124// TableList: Represents a list of tables. 1125type TableList struct { 1126 // Items: List of all requested tables. 1127 Items []*Table `json:"items,omitempty"` 1128 1129 // Kind: The kind of item this is. For table list, this is always 1130 // fusiontables#tableList. 1131 Kind string `json:"kind,omitempty"` 1132 1133 // NextPageToken: Token used to access the next page of this result. No 1134 // token is displayed if there are no more pages left. 1135 NextPageToken string `json:"nextPageToken,omitempty"` 1136 1137 // ServerResponse contains the HTTP response code and headers from the 1138 // server. 1139 googleapi.ServerResponse `json:"-"` 1140 1141 // ForceSendFields is a list of field names (e.g. "Items") to 1142 // unconditionally include in API requests. By default, fields with 1143 // empty values are omitted from API requests. However, any non-pointer, 1144 // non-interface field appearing in ForceSendFields will be sent to the 1145 // server regardless of whether the field is empty or not. This may be 1146 // used to include empty fields in Patch requests. 1147 ForceSendFields []string `json:"-"` 1148 1149 // NullFields is a list of field names (e.g. "Items") to include in API 1150 // requests with the JSON null value. By default, fields with empty 1151 // values are omitted from API requests. However, any field with an 1152 // empty value appearing in NullFields will be sent to the server as 1153 // null. It is an error if a field in this list has a non-empty value. 1154 // This may be used to include null fields in Patch requests. 1155 NullFields []string `json:"-"` 1156} 1157 1158func (s *TableList) MarshalJSON() ([]byte, error) { 1159 type NoMethod TableList 1160 raw := NoMethod(*s) 1161 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1162} 1163 1164// Task: A background task on a table, initiated for time- or 1165// resource-consuming operations such as changing column types or 1166// deleting all rows. 1167type Task struct { 1168 // Kind: Type of the resource. This is always "fusiontables#task". 1169 Kind string `json:"kind,omitempty"` 1170 1171 // Progress: Task percentage completion. 1172 Progress string `json:"progress,omitempty"` 1173 1174 // Started: false while the table is busy with some other task. true if 1175 // this background task is currently running. 1176 Started bool `json:"started,omitempty"` 1177 1178 // TaskId: Identifier for the task. 1179 TaskId int64 `json:"taskId,omitempty,string"` 1180 1181 // Type: Type of background task. 1182 Type string `json:"type,omitempty"` 1183 1184 // ServerResponse contains the HTTP response code and headers from the 1185 // server. 1186 googleapi.ServerResponse `json:"-"` 1187 1188 // ForceSendFields is a list of field names (e.g. "Kind") to 1189 // unconditionally include in API requests. By default, fields with 1190 // empty values are omitted from API requests. However, any non-pointer, 1191 // non-interface field appearing in ForceSendFields will be sent to the 1192 // server regardless of whether the field is empty or not. This may be 1193 // used to include empty fields in Patch requests. 1194 ForceSendFields []string `json:"-"` 1195 1196 // NullFields is a list of field names (e.g. "Kind") to include in API 1197 // requests with the JSON null value. By default, fields with empty 1198 // values are omitted from API requests. However, any field with an 1199 // empty value appearing in NullFields will be sent to the server as 1200 // null. It is an error if a field in this list has a non-empty value. 1201 // This may be used to include null fields in Patch requests. 1202 NullFields []string `json:"-"` 1203} 1204 1205func (s *Task) MarshalJSON() ([]byte, error) { 1206 type NoMethod Task 1207 raw := NoMethod(*s) 1208 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1209} 1210 1211// TaskList: Represents a list of tasks for a table. 1212type TaskList struct { 1213 // Items: List of all requested tasks. 1214 Items []*Task `json:"items,omitempty"` 1215 1216 // Kind: Type of the resource. This is always "fusiontables#taskList". 1217 Kind string `json:"kind,omitempty"` 1218 1219 // NextPageToken: Token used to access the next page of this result. No 1220 // token is displayed if there are no more pages left. 1221 NextPageToken string `json:"nextPageToken,omitempty"` 1222 1223 // TotalItems: Total number of tasks for the table. 1224 TotalItems int64 `json:"totalItems,omitempty"` 1225 1226 // ServerResponse contains the HTTP response code and headers from the 1227 // server. 1228 googleapi.ServerResponse `json:"-"` 1229 1230 // ForceSendFields is a list of field names (e.g. "Items") to 1231 // unconditionally include in API requests. By default, fields with 1232 // empty values are omitted from API requests. However, any non-pointer, 1233 // non-interface field appearing in ForceSendFields will be sent to the 1234 // server regardless of whether the field is empty or not. This may be 1235 // used to include empty fields in Patch requests. 1236 ForceSendFields []string `json:"-"` 1237 1238 // NullFields is a list of field names (e.g. "Items") to include in API 1239 // requests with the JSON null value. By default, fields with empty 1240 // values are omitted from API requests. However, any field with an 1241 // empty value appearing in NullFields will be sent to the server as 1242 // null. It is an error if a field in this list has a non-empty value. 1243 // This may be used to include null fields in Patch requests. 1244 NullFields []string `json:"-"` 1245} 1246 1247func (s *TaskList) MarshalJSON() ([]byte, error) { 1248 type NoMethod TaskList 1249 raw := NoMethod(*s) 1250 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1251} 1252 1253// Template: Represents the contents of InfoWindow templates. 1254type Template struct { 1255 // AutomaticColumnNames: List of columns from which the template is to 1256 // be automatically constructed. Only one of body or automaticColumns 1257 // can be specified. 1258 AutomaticColumnNames []string `json:"automaticColumnNames,omitempty"` 1259 1260 // Body: Body of the template. It contains HTML with {column_name} to 1261 // insert values from a particular column. The body is sanitized to 1262 // remove certain tags, e.g., script. Only one of body or 1263 // automaticColumns can be specified. 1264 Body string `json:"body,omitempty"` 1265 1266 // Kind: The kind of item this is. For a template, this is always 1267 // fusiontables#template. 1268 Kind string `json:"kind,omitempty"` 1269 1270 // Name: Optional name assigned to a template. 1271 Name string `json:"name,omitempty"` 1272 1273 // TableId: Identifier for the table for which the template is defined. 1274 TableId string `json:"tableId,omitempty"` 1275 1276 // TemplateId: Identifier for the template, unique within the context of 1277 // a particular table. 1278 TemplateId int64 `json:"templateId,omitempty"` 1279 1280 // ServerResponse contains the HTTP response code and headers from the 1281 // server. 1282 googleapi.ServerResponse `json:"-"` 1283 1284 // ForceSendFields is a list of field names (e.g. 1285 // "AutomaticColumnNames") to unconditionally include in API requests. 1286 // By default, fields with empty values are omitted from API requests. 1287 // However, any non-pointer, non-interface field appearing in 1288 // ForceSendFields will be sent to the server regardless of whether the 1289 // field is empty or not. This may be used to include empty fields in 1290 // Patch requests. 1291 ForceSendFields []string `json:"-"` 1292 1293 // NullFields is a list of field names (e.g. "AutomaticColumnNames") to 1294 // include in API requests with the JSON null value. By default, fields 1295 // with empty values are omitted from API requests. However, any field 1296 // with an empty value appearing in NullFields will be sent to the 1297 // server as null. It is an error if a field in this list has a 1298 // non-empty value. This may be used to include null fields in Patch 1299 // requests. 1300 NullFields []string `json:"-"` 1301} 1302 1303func (s *Template) MarshalJSON() ([]byte, error) { 1304 type NoMethod Template 1305 raw := NoMethod(*s) 1306 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1307} 1308 1309// TemplateList: Represents a list of templates for a given table. 1310type TemplateList struct { 1311 // Items: List of all requested templates. 1312 Items []*Template `json:"items,omitempty"` 1313 1314 // Kind: The kind of item this is. For a template list, this is always 1315 // fusiontables#templateList . 1316 Kind string `json:"kind,omitempty"` 1317 1318 // NextPageToken: Token used to access the next page of this result. No 1319 // token is displayed if there are no more pages left. 1320 NextPageToken string `json:"nextPageToken,omitempty"` 1321 1322 // TotalItems: Total number of templates for the table. 1323 TotalItems int64 `json:"totalItems,omitempty"` 1324 1325 // ServerResponse contains the HTTP response code and headers from the 1326 // server. 1327 googleapi.ServerResponse `json:"-"` 1328 1329 // ForceSendFields is a list of field names (e.g. "Items") to 1330 // unconditionally include in API requests. By default, fields with 1331 // empty values are omitted from API requests. However, any non-pointer, 1332 // non-interface field appearing in ForceSendFields will be sent to the 1333 // server regardless of whether the field is empty or not. This may be 1334 // used to include empty fields in Patch requests. 1335 ForceSendFields []string `json:"-"` 1336 1337 // NullFields is a list of field names (e.g. "Items") to include in API 1338 // requests with the JSON null value. By default, fields with empty 1339 // values are omitted from API requests. However, any field with an 1340 // empty value appearing in NullFields will be sent to the server as 1341 // null. It is an error if a field in this list has a non-empty value. 1342 // This may be used to include null fields in Patch requests. 1343 NullFields []string `json:"-"` 1344} 1345 1346func (s *TemplateList) MarshalJSON() ([]byte, error) { 1347 type NoMethod TemplateList 1348 raw := NoMethod(*s) 1349 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1350} 1351 1352// method id "fusiontables.column.delete": 1353 1354type ColumnDeleteCall struct { 1355 s *Service 1356 tableId string 1357 columnId string 1358 urlParams_ gensupport.URLParams 1359 ctx_ context.Context 1360 header_ http.Header 1361} 1362 1363// Delete: Deletes the specified column. 1364func (r *ColumnService) Delete(tableId string, columnId string) *ColumnDeleteCall { 1365 c := &ColumnDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1366 c.tableId = tableId 1367 c.columnId = columnId 1368 return c 1369} 1370 1371// Fields allows partial responses to be retrieved. See 1372// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1373// for more information. 1374func (c *ColumnDeleteCall) Fields(s ...googleapi.Field) *ColumnDeleteCall { 1375 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1376 return c 1377} 1378 1379// Context sets the context to be used in this call's Do method. Any 1380// pending HTTP request will be aborted if the provided context is 1381// canceled. 1382func (c *ColumnDeleteCall) Context(ctx context.Context) *ColumnDeleteCall { 1383 c.ctx_ = ctx 1384 return c 1385} 1386 1387// Header returns an http.Header that can be modified by the caller to 1388// add HTTP headers to the request. 1389func (c *ColumnDeleteCall) Header() http.Header { 1390 if c.header_ == nil { 1391 c.header_ = make(http.Header) 1392 } 1393 return c.header_ 1394} 1395 1396func (c *ColumnDeleteCall) doRequest(alt string) (*http.Response, error) { 1397 reqHeaders := make(http.Header) 1398 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1399 for k, v := range c.header_ { 1400 reqHeaders[k] = v 1401 } 1402 reqHeaders.Set("User-Agent", c.s.userAgent()) 1403 var body io.Reader = nil 1404 c.urlParams_.Set("alt", alt) 1405 c.urlParams_.Set("prettyPrint", "false") 1406 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/columns/{columnId}") 1407 urls += "?" + c.urlParams_.Encode() 1408 req, err := http.NewRequest("DELETE", urls, body) 1409 if err != nil { 1410 return nil, err 1411 } 1412 req.Header = reqHeaders 1413 googleapi.Expand(req.URL, map[string]string{ 1414 "tableId": c.tableId, 1415 "columnId": c.columnId, 1416 }) 1417 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1418} 1419 1420// Do executes the "fusiontables.column.delete" call. 1421func (c *ColumnDeleteCall) Do(opts ...googleapi.CallOption) error { 1422 gensupport.SetOptions(c.urlParams_, opts...) 1423 res, err := c.doRequest("json") 1424 if err != nil { 1425 return err 1426 } 1427 defer googleapi.CloseBody(res) 1428 if err := googleapi.CheckResponse(res); err != nil { 1429 return err 1430 } 1431 return nil 1432 // { 1433 // "description": "Deletes the specified column.", 1434 // "httpMethod": "DELETE", 1435 // "id": "fusiontables.column.delete", 1436 // "parameterOrder": [ 1437 // "tableId", 1438 // "columnId" 1439 // ], 1440 // "parameters": { 1441 // "columnId": { 1442 // "description": "Name or identifier for the column being deleted.", 1443 // "location": "path", 1444 // "required": true, 1445 // "type": "string" 1446 // }, 1447 // "tableId": { 1448 // "description": "Table from which the column is being deleted.", 1449 // "location": "path", 1450 // "required": true, 1451 // "type": "string" 1452 // } 1453 // }, 1454 // "path": "tables/{tableId}/columns/{columnId}", 1455 // "scopes": [ 1456 // "https://www.googleapis.com/auth/fusiontables" 1457 // ] 1458 // } 1459 1460} 1461 1462// method id "fusiontables.column.get": 1463 1464type ColumnGetCall struct { 1465 s *Service 1466 tableId string 1467 columnId string 1468 urlParams_ gensupport.URLParams 1469 ifNoneMatch_ string 1470 ctx_ context.Context 1471 header_ http.Header 1472} 1473 1474// Get: Retrieves a specific column by its ID. 1475func (r *ColumnService) Get(tableId string, columnId string) *ColumnGetCall { 1476 c := &ColumnGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1477 c.tableId = tableId 1478 c.columnId = columnId 1479 return c 1480} 1481 1482// Fields allows partial responses to be retrieved. See 1483// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1484// for more information. 1485func (c *ColumnGetCall) Fields(s ...googleapi.Field) *ColumnGetCall { 1486 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1487 return c 1488} 1489 1490// IfNoneMatch sets the optional parameter which makes the operation 1491// fail if the object's ETag matches the given value. This is useful for 1492// getting updates only after the object has changed since the last 1493// request. Use googleapi.IsNotModified to check whether the response 1494// error from Do is the result of In-None-Match. 1495func (c *ColumnGetCall) IfNoneMatch(entityTag string) *ColumnGetCall { 1496 c.ifNoneMatch_ = entityTag 1497 return c 1498} 1499 1500// Context sets the context to be used in this call's Do method. Any 1501// pending HTTP request will be aborted if the provided context is 1502// canceled. 1503func (c *ColumnGetCall) Context(ctx context.Context) *ColumnGetCall { 1504 c.ctx_ = ctx 1505 return c 1506} 1507 1508// Header returns an http.Header that can be modified by the caller to 1509// add HTTP headers to the request. 1510func (c *ColumnGetCall) Header() http.Header { 1511 if c.header_ == nil { 1512 c.header_ = make(http.Header) 1513 } 1514 return c.header_ 1515} 1516 1517func (c *ColumnGetCall) doRequest(alt string) (*http.Response, error) { 1518 reqHeaders := make(http.Header) 1519 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1520 for k, v := range c.header_ { 1521 reqHeaders[k] = v 1522 } 1523 reqHeaders.Set("User-Agent", c.s.userAgent()) 1524 if c.ifNoneMatch_ != "" { 1525 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1526 } 1527 var body io.Reader = nil 1528 c.urlParams_.Set("alt", alt) 1529 c.urlParams_.Set("prettyPrint", "false") 1530 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/columns/{columnId}") 1531 urls += "?" + c.urlParams_.Encode() 1532 req, err := http.NewRequest("GET", urls, body) 1533 if err != nil { 1534 return nil, err 1535 } 1536 req.Header = reqHeaders 1537 googleapi.Expand(req.URL, map[string]string{ 1538 "tableId": c.tableId, 1539 "columnId": c.columnId, 1540 }) 1541 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1542} 1543 1544// Do executes the "fusiontables.column.get" call. 1545// Exactly one of *Column or error will be non-nil. Any non-2xx status 1546// code is an error. Response headers are in either 1547// *Column.ServerResponse.Header or (if a response was returned at all) 1548// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1549// check whether the returned error was because http.StatusNotModified 1550// was returned. 1551func (c *ColumnGetCall) Do(opts ...googleapi.CallOption) (*Column, error) { 1552 gensupport.SetOptions(c.urlParams_, opts...) 1553 res, err := c.doRequest("json") 1554 if res != nil && res.StatusCode == http.StatusNotModified { 1555 if res.Body != nil { 1556 res.Body.Close() 1557 } 1558 return nil, &googleapi.Error{ 1559 Code: res.StatusCode, 1560 Header: res.Header, 1561 } 1562 } 1563 if err != nil { 1564 return nil, err 1565 } 1566 defer googleapi.CloseBody(res) 1567 if err := googleapi.CheckResponse(res); err != nil { 1568 return nil, err 1569 } 1570 ret := &Column{ 1571 ServerResponse: googleapi.ServerResponse{ 1572 Header: res.Header, 1573 HTTPStatusCode: res.StatusCode, 1574 }, 1575 } 1576 target := &ret 1577 if err := gensupport.DecodeResponse(target, res); err != nil { 1578 return nil, err 1579 } 1580 return ret, nil 1581 // { 1582 // "description": "Retrieves a specific column by its ID.", 1583 // "httpMethod": "GET", 1584 // "id": "fusiontables.column.get", 1585 // "parameterOrder": [ 1586 // "tableId", 1587 // "columnId" 1588 // ], 1589 // "parameters": { 1590 // "columnId": { 1591 // "description": "Name or identifier for the column that is being requested.", 1592 // "location": "path", 1593 // "required": true, 1594 // "type": "string" 1595 // }, 1596 // "tableId": { 1597 // "description": "Table to which the column belongs.", 1598 // "location": "path", 1599 // "required": true, 1600 // "type": "string" 1601 // } 1602 // }, 1603 // "path": "tables/{tableId}/columns/{columnId}", 1604 // "response": { 1605 // "$ref": "Column" 1606 // }, 1607 // "scopes": [ 1608 // "https://www.googleapis.com/auth/fusiontables", 1609 // "https://www.googleapis.com/auth/fusiontables.readonly" 1610 // ] 1611 // } 1612 1613} 1614 1615// method id "fusiontables.column.insert": 1616 1617type ColumnInsertCall struct { 1618 s *Service 1619 tableId string 1620 column *Column 1621 urlParams_ gensupport.URLParams 1622 ctx_ context.Context 1623 header_ http.Header 1624} 1625 1626// Insert: Adds a new column to the table. 1627func (r *ColumnService) Insert(tableId string, column *Column) *ColumnInsertCall { 1628 c := &ColumnInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1629 c.tableId = tableId 1630 c.column = column 1631 return c 1632} 1633 1634// Fields allows partial responses to be retrieved. See 1635// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1636// for more information. 1637func (c *ColumnInsertCall) Fields(s ...googleapi.Field) *ColumnInsertCall { 1638 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1639 return c 1640} 1641 1642// Context sets the context to be used in this call's Do method. Any 1643// pending HTTP request will be aborted if the provided context is 1644// canceled. 1645func (c *ColumnInsertCall) Context(ctx context.Context) *ColumnInsertCall { 1646 c.ctx_ = ctx 1647 return c 1648} 1649 1650// Header returns an http.Header that can be modified by the caller to 1651// add HTTP headers to the request. 1652func (c *ColumnInsertCall) Header() http.Header { 1653 if c.header_ == nil { 1654 c.header_ = make(http.Header) 1655 } 1656 return c.header_ 1657} 1658 1659func (c *ColumnInsertCall) doRequest(alt string) (*http.Response, error) { 1660 reqHeaders := make(http.Header) 1661 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1662 for k, v := range c.header_ { 1663 reqHeaders[k] = v 1664 } 1665 reqHeaders.Set("User-Agent", c.s.userAgent()) 1666 var body io.Reader = nil 1667 body, err := googleapi.WithoutDataWrapper.JSONReader(c.column) 1668 if err != nil { 1669 return nil, err 1670 } 1671 reqHeaders.Set("Content-Type", "application/json") 1672 c.urlParams_.Set("alt", alt) 1673 c.urlParams_.Set("prettyPrint", "false") 1674 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/columns") 1675 urls += "?" + c.urlParams_.Encode() 1676 req, err := http.NewRequest("POST", urls, body) 1677 if err != nil { 1678 return nil, err 1679 } 1680 req.Header = reqHeaders 1681 googleapi.Expand(req.URL, map[string]string{ 1682 "tableId": c.tableId, 1683 }) 1684 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1685} 1686 1687// Do executes the "fusiontables.column.insert" call. 1688// Exactly one of *Column or error will be non-nil. Any non-2xx status 1689// code is an error. Response headers are in either 1690// *Column.ServerResponse.Header or (if a response was returned at all) 1691// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1692// check whether the returned error was because http.StatusNotModified 1693// was returned. 1694func (c *ColumnInsertCall) Do(opts ...googleapi.CallOption) (*Column, error) { 1695 gensupport.SetOptions(c.urlParams_, opts...) 1696 res, err := c.doRequest("json") 1697 if res != nil && res.StatusCode == http.StatusNotModified { 1698 if res.Body != nil { 1699 res.Body.Close() 1700 } 1701 return nil, &googleapi.Error{ 1702 Code: res.StatusCode, 1703 Header: res.Header, 1704 } 1705 } 1706 if err != nil { 1707 return nil, err 1708 } 1709 defer googleapi.CloseBody(res) 1710 if err := googleapi.CheckResponse(res); err != nil { 1711 return nil, err 1712 } 1713 ret := &Column{ 1714 ServerResponse: googleapi.ServerResponse{ 1715 Header: res.Header, 1716 HTTPStatusCode: res.StatusCode, 1717 }, 1718 } 1719 target := &ret 1720 if err := gensupport.DecodeResponse(target, res); err != nil { 1721 return nil, err 1722 } 1723 return ret, nil 1724 // { 1725 // "description": "Adds a new column to the table.", 1726 // "httpMethod": "POST", 1727 // "id": "fusiontables.column.insert", 1728 // "parameterOrder": [ 1729 // "tableId" 1730 // ], 1731 // "parameters": { 1732 // "tableId": { 1733 // "description": "Table for which a new column is being added.", 1734 // "location": "path", 1735 // "required": true, 1736 // "type": "string" 1737 // } 1738 // }, 1739 // "path": "tables/{tableId}/columns", 1740 // "request": { 1741 // "$ref": "Column" 1742 // }, 1743 // "response": { 1744 // "$ref": "Column" 1745 // }, 1746 // "scopes": [ 1747 // "https://www.googleapis.com/auth/fusiontables" 1748 // ] 1749 // } 1750 1751} 1752 1753// method id "fusiontables.column.list": 1754 1755type ColumnListCall struct { 1756 s *Service 1757 tableId string 1758 urlParams_ gensupport.URLParams 1759 ifNoneMatch_ string 1760 ctx_ context.Context 1761 header_ http.Header 1762} 1763 1764// List: Retrieves a list of columns. 1765func (r *ColumnService) List(tableId string) *ColumnListCall { 1766 c := &ColumnListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1767 c.tableId = tableId 1768 return c 1769} 1770 1771// MaxResults sets the optional parameter "maxResults": Maximum number 1772// of columns to return. Default is 5. 1773func (c *ColumnListCall) MaxResults(maxResults int64) *ColumnListCall { 1774 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1775 return c 1776} 1777 1778// PageToken sets the optional parameter "pageToken": Continuation token 1779// specifying which result page to return. 1780func (c *ColumnListCall) PageToken(pageToken string) *ColumnListCall { 1781 c.urlParams_.Set("pageToken", pageToken) 1782 return c 1783} 1784 1785// Fields allows partial responses to be retrieved. See 1786// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1787// for more information. 1788func (c *ColumnListCall) Fields(s ...googleapi.Field) *ColumnListCall { 1789 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1790 return c 1791} 1792 1793// IfNoneMatch sets the optional parameter which makes the operation 1794// fail if the object's ETag matches the given value. This is useful for 1795// getting updates only after the object has changed since the last 1796// request. Use googleapi.IsNotModified to check whether the response 1797// error from Do is the result of In-None-Match. 1798func (c *ColumnListCall) IfNoneMatch(entityTag string) *ColumnListCall { 1799 c.ifNoneMatch_ = entityTag 1800 return c 1801} 1802 1803// Context sets the context to be used in this call's Do method. Any 1804// pending HTTP request will be aborted if the provided context is 1805// canceled. 1806func (c *ColumnListCall) Context(ctx context.Context) *ColumnListCall { 1807 c.ctx_ = ctx 1808 return c 1809} 1810 1811// Header returns an http.Header that can be modified by the caller to 1812// add HTTP headers to the request. 1813func (c *ColumnListCall) Header() http.Header { 1814 if c.header_ == nil { 1815 c.header_ = make(http.Header) 1816 } 1817 return c.header_ 1818} 1819 1820func (c *ColumnListCall) doRequest(alt string) (*http.Response, error) { 1821 reqHeaders := make(http.Header) 1822 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1823 for k, v := range c.header_ { 1824 reqHeaders[k] = v 1825 } 1826 reqHeaders.Set("User-Agent", c.s.userAgent()) 1827 if c.ifNoneMatch_ != "" { 1828 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1829 } 1830 var body io.Reader = nil 1831 c.urlParams_.Set("alt", alt) 1832 c.urlParams_.Set("prettyPrint", "false") 1833 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/columns") 1834 urls += "?" + c.urlParams_.Encode() 1835 req, err := http.NewRequest("GET", urls, body) 1836 if err != nil { 1837 return nil, err 1838 } 1839 req.Header = reqHeaders 1840 googleapi.Expand(req.URL, map[string]string{ 1841 "tableId": c.tableId, 1842 }) 1843 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1844} 1845 1846// Do executes the "fusiontables.column.list" call. 1847// Exactly one of *ColumnList or error will be non-nil. Any non-2xx 1848// status code is an error. Response headers are in either 1849// *ColumnList.ServerResponse.Header or (if a response was returned at 1850// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1851// to check whether the returned error was because 1852// http.StatusNotModified was returned. 1853func (c *ColumnListCall) Do(opts ...googleapi.CallOption) (*ColumnList, error) { 1854 gensupport.SetOptions(c.urlParams_, opts...) 1855 res, err := c.doRequest("json") 1856 if res != nil && res.StatusCode == http.StatusNotModified { 1857 if res.Body != nil { 1858 res.Body.Close() 1859 } 1860 return nil, &googleapi.Error{ 1861 Code: res.StatusCode, 1862 Header: res.Header, 1863 } 1864 } 1865 if err != nil { 1866 return nil, err 1867 } 1868 defer googleapi.CloseBody(res) 1869 if err := googleapi.CheckResponse(res); err != nil { 1870 return nil, err 1871 } 1872 ret := &ColumnList{ 1873 ServerResponse: googleapi.ServerResponse{ 1874 Header: res.Header, 1875 HTTPStatusCode: res.StatusCode, 1876 }, 1877 } 1878 target := &ret 1879 if err := gensupport.DecodeResponse(target, res); err != nil { 1880 return nil, err 1881 } 1882 return ret, nil 1883 // { 1884 // "description": "Retrieves a list of columns.", 1885 // "httpMethod": "GET", 1886 // "id": "fusiontables.column.list", 1887 // "parameterOrder": [ 1888 // "tableId" 1889 // ], 1890 // "parameters": { 1891 // "maxResults": { 1892 // "description": "Maximum number of columns to return. Default is 5.", 1893 // "format": "uint32", 1894 // "location": "query", 1895 // "minimum": "0", 1896 // "type": "integer" 1897 // }, 1898 // "pageToken": { 1899 // "description": "Continuation token specifying which result page to return.", 1900 // "location": "query", 1901 // "type": "string" 1902 // }, 1903 // "tableId": { 1904 // "description": "Table whose columns are being listed.", 1905 // "location": "path", 1906 // "required": true, 1907 // "type": "string" 1908 // } 1909 // }, 1910 // "path": "tables/{tableId}/columns", 1911 // "response": { 1912 // "$ref": "ColumnList" 1913 // }, 1914 // "scopes": [ 1915 // "https://www.googleapis.com/auth/fusiontables", 1916 // "https://www.googleapis.com/auth/fusiontables.readonly" 1917 // ] 1918 // } 1919 1920} 1921 1922// Pages invokes f for each page of results. 1923// A non-nil error returned from f will halt the iteration. 1924// The provided context supersedes any context provided to the Context method. 1925func (c *ColumnListCall) Pages(ctx context.Context, f func(*ColumnList) error) error { 1926 c.ctx_ = ctx 1927 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1928 for { 1929 x, err := c.Do() 1930 if err != nil { 1931 return err 1932 } 1933 if err := f(x); err != nil { 1934 return err 1935 } 1936 if x.NextPageToken == "" { 1937 return nil 1938 } 1939 c.PageToken(x.NextPageToken) 1940 } 1941} 1942 1943// method id "fusiontables.column.patch": 1944 1945type ColumnPatchCall struct { 1946 s *Service 1947 tableId string 1948 columnId string 1949 column *Column 1950 urlParams_ gensupport.URLParams 1951 ctx_ context.Context 1952 header_ http.Header 1953} 1954 1955// Patch: Updates the name or type of an existing column. This method 1956// supports patch semantics. 1957func (r *ColumnService) Patch(tableId string, columnId string, column *Column) *ColumnPatchCall { 1958 c := &ColumnPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1959 c.tableId = tableId 1960 c.columnId = columnId 1961 c.column = column 1962 return c 1963} 1964 1965// Fields allows partial responses to be retrieved. See 1966// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1967// for more information. 1968func (c *ColumnPatchCall) Fields(s ...googleapi.Field) *ColumnPatchCall { 1969 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1970 return c 1971} 1972 1973// Context sets the context to be used in this call's Do method. Any 1974// pending HTTP request will be aborted if the provided context is 1975// canceled. 1976func (c *ColumnPatchCall) Context(ctx context.Context) *ColumnPatchCall { 1977 c.ctx_ = ctx 1978 return c 1979} 1980 1981// Header returns an http.Header that can be modified by the caller to 1982// add HTTP headers to the request. 1983func (c *ColumnPatchCall) Header() http.Header { 1984 if c.header_ == nil { 1985 c.header_ = make(http.Header) 1986 } 1987 return c.header_ 1988} 1989 1990func (c *ColumnPatchCall) doRequest(alt string) (*http.Response, error) { 1991 reqHeaders := make(http.Header) 1992 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1993 for k, v := range c.header_ { 1994 reqHeaders[k] = v 1995 } 1996 reqHeaders.Set("User-Agent", c.s.userAgent()) 1997 var body io.Reader = nil 1998 body, err := googleapi.WithoutDataWrapper.JSONReader(c.column) 1999 if err != nil { 2000 return nil, err 2001 } 2002 reqHeaders.Set("Content-Type", "application/json") 2003 c.urlParams_.Set("alt", alt) 2004 c.urlParams_.Set("prettyPrint", "false") 2005 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/columns/{columnId}") 2006 urls += "?" + c.urlParams_.Encode() 2007 req, err := http.NewRequest("PATCH", urls, body) 2008 if err != nil { 2009 return nil, err 2010 } 2011 req.Header = reqHeaders 2012 googleapi.Expand(req.URL, map[string]string{ 2013 "tableId": c.tableId, 2014 "columnId": c.columnId, 2015 }) 2016 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2017} 2018 2019// Do executes the "fusiontables.column.patch" call. 2020// Exactly one of *Column or error will be non-nil. Any non-2xx status 2021// code is an error. Response headers are in either 2022// *Column.ServerResponse.Header or (if a response was returned at all) 2023// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2024// check whether the returned error was because http.StatusNotModified 2025// was returned. 2026func (c *ColumnPatchCall) Do(opts ...googleapi.CallOption) (*Column, error) { 2027 gensupport.SetOptions(c.urlParams_, opts...) 2028 res, err := c.doRequest("json") 2029 if res != nil && res.StatusCode == http.StatusNotModified { 2030 if res.Body != nil { 2031 res.Body.Close() 2032 } 2033 return nil, &googleapi.Error{ 2034 Code: res.StatusCode, 2035 Header: res.Header, 2036 } 2037 } 2038 if err != nil { 2039 return nil, err 2040 } 2041 defer googleapi.CloseBody(res) 2042 if err := googleapi.CheckResponse(res); err != nil { 2043 return nil, err 2044 } 2045 ret := &Column{ 2046 ServerResponse: googleapi.ServerResponse{ 2047 Header: res.Header, 2048 HTTPStatusCode: res.StatusCode, 2049 }, 2050 } 2051 target := &ret 2052 if err := gensupport.DecodeResponse(target, res); err != nil { 2053 return nil, err 2054 } 2055 return ret, nil 2056 // { 2057 // "description": "Updates the name or type of an existing column. This method supports patch semantics.", 2058 // "httpMethod": "PATCH", 2059 // "id": "fusiontables.column.patch", 2060 // "parameterOrder": [ 2061 // "tableId", 2062 // "columnId" 2063 // ], 2064 // "parameters": { 2065 // "columnId": { 2066 // "description": "Name or identifier for the column that is being updated.", 2067 // "location": "path", 2068 // "required": true, 2069 // "type": "string" 2070 // }, 2071 // "tableId": { 2072 // "description": "Table for which the column is being updated.", 2073 // "location": "path", 2074 // "required": true, 2075 // "type": "string" 2076 // } 2077 // }, 2078 // "path": "tables/{tableId}/columns/{columnId}", 2079 // "request": { 2080 // "$ref": "Column" 2081 // }, 2082 // "response": { 2083 // "$ref": "Column" 2084 // }, 2085 // "scopes": [ 2086 // "https://www.googleapis.com/auth/fusiontables" 2087 // ] 2088 // } 2089 2090} 2091 2092// method id "fusiontables.column.update": 2093 2094type ColumnUpdateCall struct { 2095 s *Service 2096 tableId string 2097 columnId string 2098 column *Column 2099 urlParams_ gensupport.URLParams 2100 ctx_ context.Context 2101 header_ http.Header 2102} 2103 2104// Update: Updates the name or type of an existing column. 2105func (r *ColumnService) Update(tableId string, columnId string, column *Column) *ColumnUpdateCall { 2106 c := &ColumnUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2107 c.tableId = tableId 2108 c.columnId = columnId 2109 c.column = column 2110 return c 2111} 2112 2113// Fields allows partial responses to be retrieved. See 2114// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2115// for more information. 2116func (c *ColumnUpdateCall) Fields(s ...googleapi.Field) *ColumnUpdateCall { 2117 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2118 return c 2119} 2120 2121// Context sets the context to be used in this call's Do method. Any 2122// pending HTTP request will be aborted if the provided context is 2123// canceled. 2124func (c *ColumnUpdateCall) Context(ctx context.Context) *ColumnUpdateCall { 2125 c.ctx_ = ctx 2126 return c 2127} 2128 2129// Header returns an http.Header that can be modified by the caller to 2130// add HTTP headers to the request. 2131func (c *ColumnUpdateCall) Header() http.Header { 2132 if c.header_ == nil { 2133 c.header_ = make(http.Header) 2134 } 2135 return c.header_ 2136} 2137 2138func (c *ColumnUpdateCall) doRequest(alt string) (*http.Response, error) { 2139 reqHeaders := make(http.Header) 2140 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2141 for k, v := range c.header_ { 2142 reqHeaders[k] = v 2143 } 2144 reqHeaders.Set("User-Agent", c.s.userAgent()) 2145 var body io.Reader = nil 2146 body, err := googleapi.WithoutDataWrapper.JSONReader(c.column) 2147 if err != nil { 2148 return nil, err 2149 } 2150 reqHeaders.Set("Content-Type", "application/json") 2151 c.urlParams_.Set("alt", alt) 2152 c.urlParams_.Set("prettyPrint", "false") 2153 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/columns/{columnId}") 2154 urls += "?" + c.urlParams_.Encode() 2155 req, err := http.NewRequest("PUT", urls, body) 2156 if err != nil { 2157 return nil, err 2158 } 2159 req.Header = reqHeaders 2160 googleapi.Expand(req.URL, map[string]string{ 2161 "tableId": c.tableId, 2162 "columnId": c.columnId, 2163 }) 2164 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2165} 2166 2167// Do executes the "fusiontables.column.update" call. 2168// Exactly one of *Column or error will be non-nil. Any non-2xx status 2169// code is an error. Response headers are in either 2170// *Column.ServerResponse.Header or (if a response was returned at all) 2171// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2172// check whether the returned error was because http.StatusNotModified 2173// was returned. 2174func (c *ColumnUpdateCall) Do(opts ...googleapi.CallOption) (*Column, error) { 2175 gensupport.SetOptions(c.urlParams_, opts...) 2176 res, err := c.doRequest("json") 2177 if res != nil && res.StatusCode == http.StatusNotModified { 2178 if res.Body != nil { 2179 res.Body.Close() 2180 } 2181 return nil, &googleapi.Error{ 2182 Code: res.StatusCode, 2183 Header: res.Header, 2184 } 2185 } 2186 if err != nil { 2187 return nil, err 2188 } 2189 defer googleapi.CloseBody(res) 2190 if err := googleapi.CheckResponse(res); err != nil { 2191 return nil, err 2192 } 2193 ret := &Column{ 2194 ServerResponse: googleapi.ServerResponse{ 2195 Header: res.Header, 2196 HTTPStatusCode: res.StatusCode, 2197 }, 2198 } 2199 target := &ret 2200 if err := gensupport.DecodeResponse(target, res); err != nil { 2201 return nil, err 2202 } 2203 return ret, nil 2204 // { 2205 // "description": "Updates the name or type of an existing column.", 2206 // "httpMethod": "PUT", 2207 // "id": "fusiontables.column.update", 2208 // "parameterOrder": [ 2209 // "tableId", 2210 // "columnId" 2211 // ], 2212 // "parameters": { 2213 // "columnId": { 2214 // "description": "Name or identifier for the column that is being updated.", 2215 // "location": "path", 2216 // "required": true, 2217 // "type": "string" 2218 // }, 2219 // "tableId": { 2220 // "description": "Table for which the column is being updated.", 2221 // "location": "path", 2222 // "required": true, 2223 // "type": "string" 2224 // } 2225 // }, 2226 // "path": "tables/{tableId}/columns/{columnId}", 2227 // "request": { 2228 // "$ref": "Column" 2229 // }, 2230 // "response": { 2231 // "$ref": "Column" 2232 // }, 2233 // "scopes": [ 2234 // "https://www.googleapis.com/auth/fusiontables" 2235 // ] 2236 // } 2237 2238} 2239 2240// method id "fusiontables.query.sql": 2241 2242type QuerySqlCall struct { 2243 s *Service 2244 urlParams_ gensupport.URLParams 2245 ctx_ context.Context 2246 header_ http.Header 2247} 2248 2249// Sql: Executes a Fusion Tables SQL statement, which can be any of 2250// - SELECT 2251// - INSERT 2252// - UPDATE 2253// - DELETE 2254// - SHOW 2255// - DESCRIBE 2256// - CREATE statement. 2257func (r *QueryService) Sql(sql string) *QuerySqlCall { 2258 c := &QuerySqlCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2259 c.urlParams_.Set("sql", sql) 2260 return c 2261} 2262 2263// Hdrs sets the optional parameter "hdrs": Whether column names are 2264// included in the first row. Default is true. 2265func (c *QuerySqlCall) Hdrs(hdrs bool) *QuerySqlCall { 2266 c.urlParams_.Set("hdrs", fmt.Sprint(hdrs)) 2267 return c 2268} 2269 2270// Typed sets the optional parameter "typed": Whether typed values are 2271// returned in the (JSON) response: numbers for numeric values and 2272// parsed geometries for KML values. Default is true. 2273func (c *QuerySqlCall) Typed(typed bool) *QuerySqlCall { 2274 c.urlParams_.Set("typed", fmt.Sprint(typed)) 2275 return c 2276} 2277 2278// Fields allows partial responses to be retrieved. See 2279// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2280// for more information. 2281func (c *QuerySqlCall) Fields(s ...googleapi.Field) *QuerySqlCall { 2282 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2283 return c 2284} 2285 2286// Context sets the context to be used in this call's Do and Download 2287// methods. Any pending HTTP request will be aborted if the provided 2288// context is canceled. 2289func (c *QuerySqlCall) Context(ctx context.Context) *QuerySqlCall { 2290 c.ctx_ = ctx 2291 return c 2292} 2293 2294// Header returns an http.Header that can be modified by the caller to 2295// add HTTP headers to the request. 2296func (c *QuerySqlCall) Header() http.Header { 2297 if c.header_ == nil { 2298 c.header_ = make(http.Header) 2299 } 2300 return c.header_ 2301} 2302 2303func (c *QuerySqlCall) doRequest(alt string) (*http.Response, error) { 2304 reqHeaders := make(http.Header) 2305 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2306 for k, v := range c.header_ { 2307 reqHeaders[k] = v 2308 } 2309 reqHeaders.Set("User-Agent", c.s.userAgent()) 2310 var body io.Reader = nil 2311 c.urlParams_.Set("alt", alt) 2312 c.urlParams_.Set("prettyPrint", "false") 2313 urls := googleapi.ResolveRelative(c.s.BasePath, "query") 2314 urls += "?" + c.urlParams_.Encode() 2315 req, err := http.NewRequest("POST", urls, body) 2316 if err != nil { 2317 return nil, err 2318 } 2319 req.Header = reqHeaders 2320 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2321} 2322 2323// Download fetches the API endpoint's "media" value, instead of the normal 2324// API response value. If the returned error is nil, the Response is guaranteed to 2325// have a 2xx status code. Callers must close the Response.Body as usual. 2326func (c *QuerySqlCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 2327 gensupport.SetOptions(c.urlParams_, opts...) 2328 res, err := c.doRequest("media") 2329 if err != nil { 2330 return nil, err 2331 } 2332 if err := googleapi.CheckMediaResponse(res); err != nil { 2333 res.Body.Close() 2334 return nil, err 2335 } 2336 return res, nil 2337} 2338 2339// Do executes the "fusiontables.query.sql" call. 2340// Exactly one of *Sqlresponse or error will be non-nil. Any non-2xx 2341// status code is an error. Response headers are in either 2342// *Sqlresponse.ServerResponse.Header or (if a response was returned at 2343// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2344// to check whether the returned error was because 2345// http.StatusNotModified was returned. 2346func (c *QuerySqlCall) Do(opts ...googleapi.CallOption) (*Sqlresponse, error) { 2347 gensupport.SetOptions(c.urlParams_, opts...) 2348 res, err := c.doRequest("json") 2349 if res != nil && res.StatusCode == http.StatusNotModified { 2350 if res.Body != nil { 2351 res.Body.Close() 2352 } 2353 return nil, &googleapi.Error{ 2354 Code: res.StatusCode, 2355 Header: res.Header, 2356 } 2357 } 2358 if err != nil { 2359 return nil, err 2360 } 2361 defer googleapi.CloseBody(res) 2362 if err := googleapi.CheckResponse(res); err != nil { 2363 return nil, err 2364 } 2365 ret := &Sqlresponse{ 2366 ServerResponse: googleapi.ServerResponse{ 2367 Header: res.Header, 2368 HTTPStatusCode: res.StatusCode, 2369 }, 2370 } 2371 target := &ret 2372 if err := gensupport.DecodeResponse(target, res); err != nil { 2373 return nil, err 2374 } 2375 return ret, nil 2376 // { 2377 // "description": "Executes a Fusion Tables SQL statement, which can be any of \n- SELECT\n- INSERT\n- UPDATE\n- DELETE\n- SHOW\n- DESCRIBE\n- CREATE statement.", 2378 // "httpMethod": "POST", 2379 // "id": "fusiontables.query.sql", 2380 // "parameterOrder": [ 2381 // "sql" 2382 // ], 2383 // "parameters": { 2384 // "hdrs": { 2385 // "description": "Whether column names are included in the first row. Default is true.", 2386 // "location": "query", 2387 // "type": "boolean" 2388 // }, 2389 // "sql": { 2390 // "description": "A Fusion Tables SQL statement, which can be any of \n- SELECT\n- INSERT\n- UPDATE\n- DELETE\n- SHOW\n- DESCRIBE\n- CREATE", 2391 // "location": "query", 2392 // "required": true, 2393 // "type": "string" 2394 // }, 2395 // "typed": { 2396 // "description": "Whether typed values are returned in the (JSON) response: numbers for numeric values and parsed geometries for KML values. Default is true.", 2397 // "location": "query", 2398 // "type": "boolean" 2399 // } 2400 // }, 2401 // "path": "query", 2402 // "response": { 2403 // "$ref": "Sqlresponse" 2404 // }, 2405 // "scopes": [ 2406 // "https://www.googleapis.com/auth/fusiontables", 2407 // "https://www.googleapis.com/auth/fusiontables.readonly" 2408 // ], 2409 // "supportsMediaDownload": true, 2410 // "useMediaDownloadService": true 2411 // } 2412 2413} 2414 2415// method id "fusiontables.query.sqlGet": 2416 2417type QuerySqlGetCall struct { 2418 s *Service 2419 urlParams_ gensupport.URLParams 2420 ifNoneMatch_ string 2421 ctx_ context.Context 2422 header_ http.Header 2423} 2424 2425// SqlGet: Executes a SQL statement which can be any of 2426// - SELECT 2427// - SHOW 2428// - DESCRIBE 2429func (r *QueryService) SqlGet(sql string) *QuerySqlGetCall { 2430 c := &QuerySqlGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2431 c.urlParams_.Set("sql", sql) 2432 return c 2433} 2434 2435// Hdrs sets the optional parameter "hdrs": Whether column names are 2436// included (in the first row). Default is true. 2437func (c *QuerySqlGetCall) Hdrs(hdrs bool) *QuerySqlGetCall { 2438 c.urlParams_.Set("hdrs", fmt.Sprint(hdrs)) 2439 return c 2440} 2441 2442// Typed sets the optional parameter "typed": Whether typed values are 2443// returned in the (JSON) response: numbers for numeric values and 2444// parsed geometries for KML values. Default is true. 2445func (c *QuerySqlGetCall) Typed(typed bool) *QuerySqlGetCall { 2446 c.urlParams_.Set("typed", fmt.Sprint(typed)) 2447 return c 2448} 2449 2450// Fields allows partial responses to be retrieved. See 2451// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2452// for more information. 2453func (c *QuerySqlGetCall) Fields(s ...googleapi.Field) *QuerySqlGetCall { 2454 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2455 return c 2456} 2457 2458// IfNoneMatch sets the optional parameter which makes the operation 2459// fail if the object's ETag matches the given value. This is useful for 2460// getting updates only after the object has changed since the last 2461// request. Use googleapi.IsNotModified to check whether the response 2462// error from Do is the result of In-None-Match. 2463func (c *QuerySqlGetCall) IfNoneMatch(entityTag string) *QuerySqlGetCall { 2464 c.ifNoneMatch_ = entityTag 2465 return c 2466} 2467 2468// Context sets the context to be used in this call's Do and Download 2469// methods. Any pending HTTP request will be aborted if the provided 2470// context is canceled. 2471func (c *QuerySqlGetCall) Context(ctx context.Context) *QuerySqlGetCall { 2472 c.ctx_ = ctx 2473 return c 2474} 2475 2476// Header returns an http.Header that can be modified by the caller to 2477// add HTTP headers to the request. 2478func (c *QuerySqlGetCall) Header() http.Header { 2479 if c.header_ == nil { 2480 c.header_ = make(http.Header) 2481 } 2482 return c.header_ 2483} 2484 2485func (c *QuerySqlGetCall) doRequest(alt string) (*http.Response, error) { 2486 reqHeaders := make(http.Header) 2487 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2488 for k, v := range c.header_ { 2489 reqHeaders[k] = v 2490 } 2491 reqHeaders.Set("User-Agent", c.s.userAgent()) 2492 if c.ifNoneMatch_ != "" { 2493 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2494 } 2495 var body io.Reader = nil 2496 c.urlParams_.Set("alt", alt) 2497 c.urlParams_.Set("prettyPrint", "false") 2498 urls := googleapi.ResolveRelative(c.s.BasePath, "query") 2499 urls += "?" + c.urlParams_.Encode() 2500 req, err := http.NewRequest("GET", urls, body) 2501 if err != nil { 2502 return nil, err 2503 } 2504 req.Header = reqHeaders 2505 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2506} 2507 2508// Download fetches the API endpoint's "media" value, instead of the normal 2509// API response value. If the returned error is nil, the Response is guaranteed to 2510// have a 2xx status code. Callers must close the Response.Body as usual. 2511func (c *QuerySqlGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 2512 gensupport.SetOptions(c.urlParams_, opts...) 2513 res, err := c.doRequest("media") 2514 if err != nil { 2515 return nil, err 2516 } 2517 if err := googleapi.CheckMediaResponse(res); err != nil { 2518 res.Body.Close() 2519 return nil, err 2520 } 2521 return res, nil 2522} 2523 2524// Do executes the "fusiontables.query.sqlGet" call. 2525// Exactly one of *Sqlresponse or error will be non-nil. Any non-2xx 2526// status code is an error. Response headers are in either 2527// *Sqlresponse.ServerResponse.Header or (if a response was returned at 2528// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2529// to check whether the returned error was because 2530// http.StatusNotModified was returned. 2531func (c *QuerySqlGetCall) Do(opts ...googleapi.CallOption) (*Sqlresponse, error) { 2532 gensupport.SetOptions(c.urlParams_, opts...) 2533 res, err := c.doRequest("json") 2534 if res != nil && res.StatusCode == http.StatusNotModified { 2535 if res.Body != nil { 2536 res.Body.Close() 2537 } 2538 return nil, &googleapi.Error{ 2539 Code: res.StatusCode, 2540 Header: res.Header, 2541 } 2542 } 2543 if err != nil { 2544 return nil, err 2545 } 2546 defer googleapi.CloseBody(res) 2547 if err := googleapi.CheckResponse(res); err != nil { 2548 return nil, err 2549 } 2550 ret := &Sqlresponse{ 2551 ServerResponse: googleapi.ServerResponse{ 2552 Header: res.Header, 2553 HTTPStatusCode: res.StatusCode, 2554 }, 2555 } 2556 target := &ret 2557 if err := gensupport.DecodeResponse(target, res); err != nil { 2558 return nil, err 2559 } 2560 return ret, nil 2561 // { 2562 // "description": "Executes a SQL statement which can be any of \n- SELECT\n- SHOW\n- DESCRIBE", 2563 // "httpMethod": "GET", 2564 // "id": "fusiontables.query.sqlGet", 2565 // "parameterOrder": [ 2566 // "sql" 2567 // ], 2568 // "parameters": { 2569 // "hdrs": { 2570 // "description": "Whether column names are included (in the first row). Default is true.", 2571 // "location": "query", 2572 // "type": "boolean" 2573 // }, 2574 // "sql": { 2575 // "description": "A SQL statement which can be any of \n- SELECT\n- SHOW\n- DESCRIBE", 2576 // "location": "query", 2577 // "required": true, 2578 // "type": "string" 2579 // }, 2580 // "typed": { 2581 // "description": "Whether typed values are returned in the (JSON) response: numbers for numeric values and parsed geometries for KML values. Default is true.", 2582 // "location": "query", 2583 // "type": "boolean" 2584 // } 2585 // }, 2586 // "path": "query", 2587 // "response": { 2588 // "$ref": "Sqlresponse" 2589 // }, 2590 // "scopes": [ 2591 // "https://www.googleapis.com/auth/fusiontables", 2592 // "https://www.googleapis.com/auth/fusiontables.readonly" 2593 // ], 2594 // "supportsMediaDownload": true, 2595 // "useMediaDownloadService": true 2596 // } 2597 2598} 2599 2600// method id "fusiontables.style.delete": 2601 2602type StyleDeleteCall struct { 2603 s *Service 2604 tableId string 2605 styleId int64 2606 urlParams_ gensupport.URLParams 2607 ctx_ context.Context 2608 header_ http.Header 2609} 2610 2611// Delete: Deletes a style. 2612func (r *StyleService) Delete(tableId string, styleId int64) *StyleDeleteCall { 2613 c := &StyleDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2614 c.tableId = tableId 2615 c.styleId = styleId 2616 return c 2617} 2618 2619// Fields allows partial responses to be retrieved. See 2620// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2621// for more information. 2622func (c *StyleDeleteCall) Fields(s ...googleapi.Field) *StyleDeleteCall { 2623 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2624 return c 2625} 2626 2627// Context sets the context to be used in this call's Do method. Any 2628// pending HTTP request will be aborted if the provided context is 2629// canceled. 2630func (c *StyleDeleteCall) Context(ctx context.Context) *StyleDeleteCall { 2631 c.ctx_ = ctx 2632 return c 2633} 2634 2635// Header returns an http.Header that can be modified by the caller to 2636// add HTTP headers to the request. 2637func (c *StyleDeleteCall) Header() http.Header { 2638 if c.header_ == nil { 2639 c.header_ = make(http.Header) 2640 } 2641 return c.header_ 2642} 2643 2644func (c *StyleDeleteCall) doRequest(alt string) (*http.Response, error) { 2645 reqHeaders := make(http.Header) 2646 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2647 for k, v := range c.header_ { 2648 reqHeaders[k] = v 2649 } 2650 reqHeaders.Set("User-Agent", c.s.userAgent()) 2651 var body io.Reader = nil 2652 c.urlParams_.Set("alt", alt) 2653 c.urlParams_.Set("prettyPrint", "false") 2654 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/styles/{styleId}") 2655 urls += "?" + c.urlParams_.Encode() 2656 req, err := http.NewRequest("DELETE", urls, body) 2657 if err != nil { 2658 return nil, err 2659 } 2660 req.Header = reqHeaders 2661 googleapi.Expand(req.URL, map[string]string{ 2662 "tableId": c.tableId, 2663 "styleId": strconv.FormatInt(c.styleId, 10), 2664 }) 2665 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2666} 2667 2668// Do executes the "fusiontables.style.delete" call. 2669func (c *StyleDeleteCall) Do(opts ...googleapi.CallOption) error { 2670 gensupport.SetOptions(c.urlParams_, opts...) 2671 res, err := c.doRequest("json") 2672 if err != nil { 2673 return err 2674 } 2675 defer googleapi.CloseBody(res) 2676 if err := googleapi.CheckResponse(res); err != nil { 2677 return err 2678 } 2679 return nil 2680 // { 2681 // "description": "Deletes a style.", 2682 // "httpMethod": "DELETE", 2683 // "id": "fusiontables.style.delete", 2684 // "parameterOrder": [ 2685 // "tableId", 2686 // "styleId" 2687 // ], 2688 // "parameters": { 2689 // "styleId": { 2690 // "description": "Identifier (within a table) for the style being deleted", 2691 // "format": "int32", 2692 // "location": "path", 2693 // "required": true, 2694 // "type": "integer" 2695 // }, 2696 // "tableId": { 2697 // "description": "Table from which the style is being deleted", 2698 // "location": "path", 2699 // "required": true, 2700 // "type": "string" 2701 // } 2702 // }, 2703 // "path": "tables/{tableId}/styles/{styleId}", 2704 // "scopes": [ 2705 // "https://www.googleapis.com/auth/fusiontables" 2706 // ] 2707 // } 2708 2709} 2710 2711// method id "fusiontables.style.get": 2712 2713type StyleGetCall struct { 2714 s *Service 2715 tableId string 2716 styleId int64 2717 urlParams_ gensupport.URLParams 2718 ifNoneMatch_ string 2719 ctx_ context.Context 2720 header_ http.Header 2721} 2722 2723// Get: Gets a specific style. 2724func (r *StyleService) Get(tableId string, styleId int64) *StyleGetCall { 2725 c := &StyleGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2726 c.tableId = tableId 2727 c.styleId = styleId 2728 return c 2729} 2730 2731// Fields allows partial responses to be retrieved. See 2732// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2733// for more information. 2734func (c *StyleGetCall) Fields(s ...googleapi.Field) *StyleGetCall { 2735 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2736 return c 2737} 2738 2739// IfNoneMatch sets the optional parameter which makes the operation 2740// fail if the object's ETag matches the given value. This is useful for 2741// getting updates only after the object has changed since the last 2742// request. Use googleapi.IsNotModified to check whether the response 2743// error from Do is the result of In-None-Match. 2744func (c *StyleGetCall) IfNoneMatch(entityTag string) *StyleGetCall { 2745 c.ifNoneMatch_ = entityTag 2746 return c 2747} 2748 2749// Context sets the context to be used in this call's Do method. Any 2750// pending HTTP request will be aborted if the provided context is 2751// canceled. 2752func (c *StyleGetCall) Context(ctx context.Context) *StyleGetCall { 2753 c.ctx_ = ctx 2754 return c 2755} 2756 2757// Header returns an http.Header that can be modified by the caller to 2758// add HTTP headers to the request. 2759func (c *StyleGetCall) Header() http.Header { 2760 if c.header_ == nil { 2761 c.header_ = make(http.Header) 2762 } 2763 return c.header_ 2764} 2765 2766func (c *StyleGetCall) doRequest(alt string) (*http.Response, error) { 2767 reqHeaders := make(http.Header) 2768 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2769 for k, v := range c.header_ { 2770 reqHeaders[k] = v 2771 } 2772 reqHeaders.Set("User-Agent", c.s.userAgent()) 2773 if c.ifNoneMatch_ != "" { 2774 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2775 } 2776 var body io.Reader = nil 2777 c.urlParams_.Set("alt", alt) 2778 c.urlParams_.Set("prettyPrint", "false") 2779 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/styles/{styleId}") 2780 urls += "?" + c.urlParams_.Encode() 2781 req, err := http.NewRequest("GET", urls, body) 2782 if err != nil { 2783 return nil, err 2784 } 2785 req.Header = reqHeaders 2786 googleapi.Expand(req.URL, map[string]string{ 2787 "tableId": c.tableId, 2788 "styleId": strconv.FormatInt(c.styleId, 10), 2789 }) 2790 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2791} 2792 2793// Do executes the "fusiontables.style.get" call. 2794// Exactly one of *StyleSetting or error will be non-nil. Any non-2xx 2795// status code is an error. Response headers are in either 2796// *StyleSetting.ServerResponse.Header or (if a response was returned at 2797// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2798// to check whether the returned error was because 2799// http.StatusNotModified was returned. 2800func (c *StyleGetCall) Do(opts ...googleapi.CallOption) (*StyleSetting, error) { 2801 gensupport.SetOptions(c.urlParams_, opts...) 2802 res, err := c.doRequest("json") 2803 if res != nil && res.StatusCode == http.StatusNotModified { 2804 if res.Body != nil { 2805 res.Body.Close() 2806 } 2807 return nil, &googleapi.Error{ 2808 Code: res.StatusCode, 2809 Header: res.Header, 2810 } 2811 } 2812 if err != nil { 2813 return nil, err 2814 } 2815 defer googleapi.CloseBody(res) 2816 if err := googleapi.CheckResponse(res); err != nil { 2817 return nil, err 2818 } 2819 ret := &StyleSetting{ 2820 ServerResponse: googleapi.ServerResponse{ 2821 Header: res.Header, 2822 HTTPStatusCode: res.StatusCode, 2823 }, 2824 } 2825 target := &ret 2826 if err := gensupport.DecodeResponse(target, res); err != nil { 2827 return nil, err 2828 } 2829 return ret, nil 2830 // { 2831 // "description": "Gets a specific style.", 2832 // "httpMethod": "GET", 2833 // "id": "fusiontables.style.get", 2834 // "parameterOrder": [ 2835 // "tableId", 2836 // "styleId" 2837 // ], 2838 // "parameters": { 2839 // "styleId": { 2840 // "description": "Identifier (integer) for a specific style in a table", 2841 // "format": "int32", 2842 // "location": "path", 2843 // "required": true, 2844 // "type": "integer" 2845 // }, 2846 // "tableId": { 2847 // "description": "Table to which the requested style belongs", 2848 // "location": "path", 2849 // "required": true, 2850 // "type": "string" 2851 // } 2852 // }, 2853 // "path": "tables/{tableId}/styles/{styleId}", 2854 // "response": { 2855 // "$ref": "StyleSetting" 2856 // }, 2857 // "scopes": [ 2858 // "https://www.googleapis.com/auth/fusiontables", 2859 // "https://www.googleapis.com/auth/fusiontables.readonly" 2860 // ] 2861 // } 2862 2863} 2864 2865// method id "fusiontables.style.insert": 2866 2867type StyleInsertCall struct { 2868 s *Service 2869 tableId string 2870 stylesetting *StyleSetting 2871 urlParams_ gensupport.URLParams 2872 ctx_ context.Context 2873 header_ http.Header 2874} 2875 2876// Insert: Adds a new style for the table. 2877func (r *StyleService) Insert(tableId string, stylesetting *StyleSetting) *StyleInsertCall { 2878 c := &StyleInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2879 c.tableId = tableId 2880 c.stylesetting = stylesetting 2881 return c 2882} 2883 2884// Fields allows partial responses to be retrieved. See 2885// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2886// for more information. 2887func (c *StyleInsertCall) Fields(s ...googleapi.Field) *StyleInsertCall { 2888 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2889 return c 2890} 2891 2892// Context sets the context to be used in this call's Do method. Any 2893// pending HTTP request will be aborted if the provided context is 2894// canceled. 2895func (c *StyleInsertCall) Context(ctx context.Context) *StyleInsertCall { 2896 c.ctx_ = ctx 2897 return c 2898} 2899 2900// Header returns an http.Header that can be modified by the caller to 2901// add HTTP headers to the request. 2902func (c *StyleInsertCall) Header() http.Header { 2903 if c.header_ == nil { 2904 c.header_ = make(http.Header) 2905 } 2906 return c.header_ 2907} 2908 2909func (c *StyleInsertCall) doRequest(alt string) (*http.Response, error) { 2910 reqHeaders := make(http.Header) 2911 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2912 for k, v := range c.header_ { 2913 reqHeaders[k] = v 2914 } 2915 reqHeaders.Set("User-Agent", c.s.userAgent()) 2916 var body io.Reader = nil 2917 body, err := googleapi.WithoutDataWrapper.JSONReader(c.stylesetting) 2918 if err != nil { 2919 return nil, err 2920 } 2921 reqHeaders.Set("Content-Type", "application/json") 2922 c.urlParams_.Set("alt", alt) 2923 c.urlParams_.Set("prettyPrint", "false") 2924 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/styles") 2925 urls += "?" + c.urlParams_.Encode() 2926 req, err := http.NewRequest("POST", urls, body) 2927 if err != nil { 2928 return nil, err 2929 } 2930 req.Header = reqHeaders 2931 googleapi.Expand(req.URL, map[string]string{ 2932 "tableId": c.tableId, 2933 }) 2934 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2935} 2936 2937// Do executes the "fusiontables.style.insert" call. 2938// Exactly one of *StyleSetting or error will be non-nil. Any non-2xx 2939// status code is an error. Response headers are in either 2940// *StyleSetting.ServerResponse.Header or (if a response was returned at 2941// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2942// to check whether the returned error was because 2943// http.StatusNotModified was returned. 2944func (c *StyleInsertCall) Do(opts ...googleapi.CallOption) (*StyleSetting, error) { 2945 gensupport.SetOptions(c.urlParams_, opts...) 2946 res, err := c.doRequest("json") 2947 if res != nil && res.StatusCode == http.StatusNotModified { 2948 if res.Body != nil { 2949 res.Body.Close() 2950 } 2951 return nil, &googleapi.Error{ 2952 Code: res.StatusCode, 2953 Header: res.Header, 2954 } 2955 } 2956 if err != nil { 2957 return nil, err 2958 } 2959 defer googleapi.CloseBody(res) 2960 if err := googleapi.CheckResponse(res); err != nil { 2961 return nil, err 2962 } 2963 ret := &StyleSetting{ 2964 ServerResponse: googleapi.ServerResponse{ 2965 Header: res.Header, 2966 HTTPStatusCode: res.StatusCode, 2967 }, 2968 } 2969 target := &ret 2970 if err := gensupport.DecodeResponse(target, res); err != nil { 2971 return nil, err 2972 } 2973 return ret, nil 2974 // { 2975 // "description": "Adds a new style for the table.", 2976 // "httpMethod": "POST", 2977 // "id": "fusiontables.style.insert", 2978 // "parameterOrder": [ 2979 // "tableId" 2980 // ], 2981 // "parameters": { 2982 // "tableId": { 2983 // "description": "Table for which a new style is being added", 2984 // "location": "path", 2985 // "required": true, 2986 // "type": "string" 2987 // } 2988 // }, 2989 // "path": "tables/{tableId}/styles", 2990 // "request": { 2991 // "$ref": "StyleSetting" 2992 // }, 2993 // "response": { 2994 // "$ref": "StyleSetting" 2995 // }, 2996 // "scopes": [ 2997 // "https://www.googleapis.com/auth/fusiontables" 2998 // ] 2999 // } 3000 3001} 3002 3003// method id "fusiontables.style.list": 3004 3005type StyleListCall struct { 3006 s *Service 3007 tableId string 3008 urlParams_ gensupport.URLParams 3009 ifNoneMatch_ string 3010 ctx_ context.Context 3011 header_ http.Header 3012} 3013 3014// List: Retrieves a list of styles. 3015func (r *StyleService) List(tableId string) *StyleListCall { 3016 c := &StyleListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3017 c.tableId = tableId 3018 return c 3019} 3020 3021// MaxResults sets the optional parameter "maxResults": Maximum number 3022// of styles to return. Default is 5. 3023func (c *StyleListCall) MaxResults(maxResults int64) *StyleListCall { 3024 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 3025 return c 3026} 3027 3028// PageToken sets the optional parameter "pageToken": Continuation token 3029// specifying which result page to return. 3030func (c *StyleListCall) PageToken(pageToken string) *StyleListCall { 3031 c.urlParams_.Set("pageToken", pageToken) 3032 return c 3033} 3034 3035// Fields allows partial responses to be retrieved. See 3036// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3037// for more information. 3038func (c *StyleListCall) Fields(s ...googleapi.Field) *StyleListCall { 3039 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3040 return c 3041} 3042 3043// IfNoneMatch sets the optional parameter which makes the operation 3044// fail if the object's ETag matches the given value. This is useful for 3045// getting updates only after the object has changed since the last 3046// request. Use googleapi.IsNotModified to check whether the response 3047// error from Do is the result of In-None-Match. 3048func (c *StyleListCall) IfNoneMatch(entityTag string) *StyleListCall { 3049 c.ifNoneMatch_ = entityTag 3050 return c 3051} 3052 3053// Context sets the context to be used in this call's Do method. Any 3054// pending HTTP request will be aborted if the provided context is 3055// canceled. 3056func (c *StyleListCall) Context(ctx context.Context) *StyleListCall { 3057 c.ctx_ = ctx 3058 return c 3059} 3060 3061// Header returns an http.Header that can be modified by the caller to 3062// add HTTP headers to the request. 3063func (c *StyleListCall) Header() http.Header { 3064 if c.header_ == nil { 3065 c.header_ = make(http.Header) 3066 } 3067 return c.header_ 3068} 3069 3070func (c *StyleListCall) doRequest(alt string) (*http.Response, error) { 3071 reqHeaders := make(http.Header) 3072 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3073 for k, v := range c.header_ { 3074 reqHeaders[k] = v 3075 } 3076 reqHeaders.Set("User-Agent", c.s.userAgent()) 3077 if c.ifNoneMatch_ != "" { 3078 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3079 } 3080 var body io.Reader = nil 3081 c.urlParams_.Set("alt", alt) 3082 c.urlParams_.Set("prettyPrint", "false") 3083 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/styles") 3084 urls += "?" + c.urlParams_.Encode() 3085 req, err := http.NewRequest("GET", urls, body) 3086 if err != nil { 3087 return nil, err 3088 } 3089 req.Header = reqHeaders 3090 googleapi.Expand(req.URL, map[string]string{ 3091 "tableId": c.tableId, 3092 }) 3093 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3094} 3095 3096// Do executes the "fusiontables.style.list" call. 3097// Exactly one of *StyleSettingList or error will be non-nil. Any 3098// non-2xx status code is an error. Response headers are in either 3099// *StyleSettingList.ServerResponse.Header or (if a response was 3100// returned at all) in error.(*googleapi.Error).Header. Use 3101// googleapi.IsNotModified to check whether the returned error was 3102// because http.StatusNotModified was returned. 3103func (c *StyleListCall) Do(opts ...googleapi.CallOption) (*StyleSettingList, error) { 3104 gensupport.SetOptions(c.urlParams_, opts...) 3105 res, err := c.doRequest("json") 3106 if res != nil && res.StatusCode == http.StatusNotModified { 3107 if res.Body != nil { 3108 res.Body.Close() 3109 } 3110 return nil, &googleapi.Error{ 3111 Code: res.StatusCode, 3112 Header: res.Header, 3113 } 3114 } 3115 if err != nil { 3116 return nil, err 3117 } 3118 defer googleapi.CloseBody(res) 3119 if err := googleapi.CheckResponse(res); err != nil { 3120 return nil, err 3121 } 3122 ret := &StyleSettingList{ 3123 ServerResponse: googleapi.ServerResponse{ 3124 Header: res.Header, 3125 HTTPStatusCode: res.StatusCode, 3126 }, 3127 } 3128 target := &ret 3129 if err := gensupport.DecodeResponse(target, res); err != nil { 3130 return nil, err 3131 } 3132 return ret, nil 3133 // { 3134 // "description": "Retrieves a list of styles.", 3135 // "httpMethod": "GET", 3136 // "id": "fusiontables.style.list", 3137 // "parameterOrder": [ 3138 // "tableId" 3139 // ], 3140 // "parameters": { 3141 // "maxResults": { 3142 // "description": "Maximum number of styles to return. Optional. Default is 5.", 3143 // "format": "uint32", 3144 // "location": "query", 3145 // "minimum": "0", 3146 // "type": "integer" 3147 // }, 3148 // "pageToken": { 3149 // "description": "Continuation token specifying which result page to return. Optional.", 3150 // "location": "query", 3151 // "type": "string" 3152 // }, 3153 // "tableId": { 3154 // "description": "Table whose styles are being listed", 3155 // "location": "path", 3156 // "required": true, 3157 // "type": "string" 3158 // } 3159 // }, 3160 // "path": "tables/{tableId}/styles", 3161 // "response": { 3162 // "$ref": "StyleSettingList" 3163 // }, 3164 // "scopes": [ 3165 // "https://www.googleapis.com/auth/fusiontables", 3166 // "https://www.googleapis.com/auth/fusiontables.readonly" 3167 // ] 3168 // } 3169 3170} 3171 3172// Pages invokes f for each page of results. 3173// A non-nil error returned from f will halt the iteration. 3174// The provided context supersedes any context provided to the Context method. 3175func (c *StyleListCall) Pages(ctx context.Context, f func(*StyleSettingList) error) error { 3176 c.ctx_ = ctx 3177 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3178 for { 3179 x, err := c.Do() 3180 if err != nil { 3181 return err 3182 } 3183 if err := f(x); err != nil { 3184 return err 3185 } 3186 if x.NextPageToken == "" { 3187 return nil 3188 } 3189 c.PageToken(x.NextPageToken) 3190 } 3191} 3192 3193// method id "fusiontables.style.patch": 3194 3195type StylePatchCall struct { 3196 s *Service 3197 tableId string 3198 styleId int64 3199 stylesetting *StyleSetting 3200 urlParams_ gensupport.URLParams 3201 ctx_ context.Context 3202 header_ http.Header 3203} 3204 3205// Patch: Updates an existing style. This method supports patch 3206// semantics. 3207func (r *StyleService) Patch(tableId string, styleId int64, stylesetting *StyleSetting) *StylePatchCall { 3208 c := &StylePatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3209 c.tableId = tableId 3210 c.styleId = styleId 3211 c.stylesetting = stylesetting 3212 return c 3213} 3214 3215// Fields allows partial responses to be retrieved. See 3216// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3217// for more information. 3218func (c *StylePatchCall) Fields(s ...googleapi.Field) *StylePatchCall { 3219 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3220 return c 3221} 3222 3223// Context sets the context to be used in this call's Do method. Any 3224// pending HTTP request will be aborted if the provided context is 3225// canceled. 3226func (c *StylePatchCall) Context(ctx context.Context) *StylePatchCall { 3227 c.ctx_ = ctx 3228 return c 3229} 3230 3231// Header returns an http.Header that can be modified by the caller to 3232// add HTTP headers to the request. 3233func (c *StylePatchCall) Header() http.Header { 3234 if c.header_ == nil { 3235 c.header_ = make(http.Header) 3236 } 3237 return c.header_ 3238} 3239 3240func (c *StylePatchCall) doRequest(alt string) (*http.Response, error) { 3241 reqHeaders := make(http.Header) 3242 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3243 for k, v := range c.header_ { 3244 reqHeaders[k] = v 3245 } 3246 reqHeaders.Set("User-Agent", c.s.userAgent()) 3247 var body io.Reader = nil 3248 body, err := googleapi.WithoutDataWrapper.JSONReader(c.stylesetting) 3249 if err != nil { 3250 return nil, err 3251 } 3252 reqHeaders.Set("Content-Type", "application/json") 3253 c.urlParams_.Set("alt", alt) 3254 c.urlParams_.Set("prettyPrint", "false") 3255 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/styles/{styleId}") 3256 urls += "?" + c.urlParams_.Encode() 3257 req, err := http.NewRequest("PATCH", urls, body) 3258 if err != nil { 3259 return nil, err 3260 } 3261 req.Header = reqHeaders 3262 googleapi.Expand(req.URL, map[string]string{ 3263 "tableId": c.tableId, 3264 "styleId": strconv.FormatInt(c.styleId, 10), 3265 }) 3266 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3267} 3268 3269// Do executes the "fusiontables.style.patch" call. 3270// Exactly one of *StyleSetting or error will be non-nil. Any non-2xx 3271// status code is an error. Response headers are in either 3272// *StyleSetting.ServerResponse.Header or (if a response was returned at 3273// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3274// to check whether the returned error was because 3275// http.StatusNotModified was returned. 3276func (c *StylePatchCall) Do(opts ...googleapi.CallOption) (*StyleSetting, error) { 3277 gensupport.SetOptions(c.urlParams_, opts...) 3278 res, err := c.doRequest("json") 3279 if res != nil && res.StatusCode == http.StatusNotModified { 3280 if res.Body != nil { 3281 res.Body.Close() 3282 } 3283 return nil, &googleapi.Error{ 3284 Code: res.StatusCode, 3285 Header: res.Header, 3286 } 3287 } 3288 if err != nil { 3289 return nil, err 3290 } 3291 defer googleapi.CloseBody(res) 3292 if err := googleapi.CheckResponse(res); err != nil { 3293 return nil, err 3294 } 3295 ret := &StyleSetting{ 3296 ServerResponse: googleapi.ServerResponse{ 3297 Header: res.Header, 3298 HTTPStatusCode: res.StatusCode, 3299 }, 3300 } 3301 target := &ret 3302 if err := gensupport.DecodeResponse(target, res); err != nil { 3303 return nil, err 3304 } 3305 return ret, nil 3306 // { 3307 // "description": "Updates an existing style. This method supports patch semantics.", 3308 // "httpMethod": "PATCH", 3309 // "id": "fusiontables.style.patch", 3310 // "parameterOrder": [ 3311 // "tableId", 3312 // "styleId" 3313 // ], 3314 // "parameters": { 3315 // "styleId": { 3316 // "description": "Identifier (within a table) for the style being updated.", 3317 // "format": "int32", 3318 // "location": "path", 3319 // "required": true, 3320 // "type": "integer" 3321 // }, 3322 // "tableId": { 3323 // "description": "Table whose style is being updated.", 3324 // "location": "path", 3325 // "required": true, 3326 // "type": "string" 3327 // } 3328 // }, 3329 // "path": "tables/{tableId}/styles/{styleId}", 3330 // "request": { 3331 // "$ref": "StyleSetting" 3332 // }, 3333 // "response": { 3334 // "$ref": "StyleSetting" 3335 // }, 3336 // "scopes": [ 3337 // "https://www.googleapis.com/auth/fusiontables" 3338 // ] 3339 // } 3340 3341} 3342 3343// method id "fusiontables.style.update": 3344 3345type StyleUpdateCall struct { 3346 s *Service 3347 tableId string 3348 styleId int64 3349 stylesetting *StyleSetting 3350 urlParams_ gensupport.URLParams 3351 ctx_ context.Context 3352 header_ http.Header 3353} 3354 3355// Update: Updates an existing style. 3356func (r *StyleService) Update(tableId string, styleId int64, stylesetting *StyleSetting) *StyleUpdateCall { 3357 c := &StyleUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3358 c.tableId = tableId 3359 c.styleId = styleId 3360 c.stylesetting = stylesetting 3361 return c 3362} 3363 3364// Fields allows partial responses to be retrieved. See 3365// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3366// for more information. 3367func (c *StyleUpdateCall) Fields(s ...googleapi.Field) *StyleUpdateCall { 3368 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3369 return c 3370} 3371 3372// Context sets the context to be used in this call's Do method. Any 3373// pending HTTP request will be aborted if the provided context is 3374// canceled. 3375func (c *StyleUpdateCall) Context(ctx context.Context) *StyleUpdateCall { 3376 c.ctx_ = ctx 3377 return c 3378} 3379 3380// Header returns an http.Header that can be modified by the caller to 3381// add HTTP headers to the request. 3382func (c *StyleUpdateCall) Header() http.Header { 3383 if c.header_ == nil { 3384 c.header_ = make(http.Header) 3385 } 3386 return c.header_ 3387} 3388 3389func (c *StyleUpdateCall) doRequest(alt string) (*http.Response, error) { 3390 reqHeaders := make(http.Header) 3391 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3392 for k, v := range c.header_ { 3393 reqHeaders[k] = v 3394 } 3395 reqHeaders.Set("User-Agent", c.s.userAgent()) 3396 var body io.Reader = nil 3397 body, err := googleapi.WithoutDataWrapper.JSONReader(c.stylesetting) 3398 if err != nil { 3399 return nil, err 3400 } 3401 reqHeaders.Set("Content-Type", "application/json") 3402 c.urlParams_.Set("alt", alt) 3403 c.urlParams_.Set("prettyPrint", "false") 3404 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/styles/{styleId}") 3405 urls += "?" + c.urlParams_.Encode() 3406 req, err := http.NewRequest("PUT", urls, body) 3407 if err != nil { 3408 return nil, err 3409 } 3410 req.Header = reqHeaders 3411 googleapi.Expand(req.URL, map[string]string{ 3412 "tableId": c.tableId, 3413 "styleId": strconv.FormatInt(c.styleId, 10), 3414 }) 3415 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3416} 3417 3418// Do executes the "fusiontables.style.update" call. 3419// Exactly one of *StyleSetting or error will be non-nil. Any non-2xx 3420// status code is an error. Response headers are in either 3421// *StyleSetting.ServerResponse.Header or (if a response was returned at 3422// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3423// to check whether the returned error was because 3424// http.StatusNotModified was returned. 3425func (c *StyleUpdateCall) Do(opts ...googleapi.CallOption) (*StyleSetting, error) { 3426 gensupport.SetOptions(c.urlParams_, opts...) 3427 res, err := c.doRequest("json") 3428 if res != nil && res.StatusCode == http.StatusNotModified { 3429 if res.Body != nil { 3430 res.Body.Close() 3431 } 3432 return nil, &googleapi.Error{ 3433 Code: res.StatusCode, 3434 Header: res.Header, 3435 } 3436 } 3437 if err != nil { 3438 return nil, err 3439 } 3440 defer googleapi.CloseBody(res) 3441 if err := googleapi.CheckResponse(res); err != nil { 3442 return nil, err 3443 } 3444 ret := &StyleSetting{ 3445 ServerResponse: googleapi.ServerResponse{ 3446 Header: res.Header, 3447 HTTPStatusCode: res.StatusCode, 3448 }, 3449 } 3450 target := &ret 3451 if err := gensupport.DecodeResponse(target, res); err != nil { 3452 return nil, err 3453 } 3454 return ret, nil 3455 // { 3456 // "description": "Updates an existing style.", 3457 // "httpMethod": "PUT", 3458 // "id": "fusiontables.style.update", 3459 // "parameterOrder": [ 3460 // "tableId", 3461 // "styleId" 3462 // ], 3463 // "parameters": { 3464 // "styleId": { 3465 // "description": "Identifier (within a table) for the style being updated.", 3466 // "format": "int32", 3467 // "location": "path", 3468 // "required": true, 3469 // "type": "integer" 3470 // }, 3471 // "tableId": { 3472 // "description": "Table whose style is being updated.", 3473 // "location": "path", 3474 // "required": true, 3475 // "type": "string" 3476 // } 3477 // }, 3478 // "path": "tables/{tableId}/styles/{styleId}", 3479 // "request": { 3480 // "$ref": "StyleSetting" 3481 // }, 3482 // "response": { 3483 // "$ref": "StyleSetting" 3484 // }, 3485 // "scopes": [ 3486 // "https://www.googleapis.com/auth/fusiontables" 3487 // ] 3488 // } 3489 3490} 3491 3492// method id "fusiontables.table.copy": 3493 3494type TableCopyCall struct { 3495 s *Service 3496 tableId string 3497 urlParams_ gensupport.URLParams 3498 ctx_ context.Context 3499 header_ http.Header 3500} 3501 3502// Copy: Copies a table. 3503func (r *TableService) Copy(tableId string) *TableCopyCall { 3504 c := &TableCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3505 c.tableId = tableId 3506 return c 3507} 3508 3509// CopyPresentation sets the optional parameter "copyPresentation": 3510// Whether to also copy tabs, styles, and templates. Default is false. 3511func (c *TableCopyCall) CopyPresentation(copyPresentation bool) *TableCopyCall { 3512 c.urlParams_.Set("copyPresentation", fmt.Sprint(copyPresentation)) 3513 return c 3514} 3515 3516// Fields allows partial responses to be retrieved. See 3517// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3518// for more information. 3519func (c *TableCopyCall) Fields(s ...googleapi.Field) *TableCopyCall { 3520 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3521 return c 3522} 3523 3524// Context sets the context to be used in this call's Do method. Any 3525// pending HTTP request will be aborted if the provided context is 3526// canceled. 3527func (c *TableCopyCall) Context(ctx context.Context) *TableCopyCall { 3528 c.ctx_ = ctx 3529 return c 3530} 3531 3532// Header returns an http.Header that can be modified by the caller to 3533// add HTTP headers to the request. 3534func (c *TableCopyCall) Header() http.Header { 3535 if c.header_ == nil { 3536 c.header_ = make(http.Header) 3537 } 3538 return c.header_ 3539} 3540 3541func (c *TableCopyCall) doRequest(alt string) (*http.Response, error) { 3542 reqHeaders := make(http.Header) 3543 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3544 for k, v := range c.header_ { 3545 reqHeaders[k] = v 3546 } 3547 reqHeaders.Set("User-Agent", c.s.userAgent()) 3548 var body io.Reader = nil 3549 c.urlParams_.Set("alt", alt) 3550 c.urlParams_.Set("prettyPrint", "false") 3551 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/copy") 3552 urls += "?" + c.urlParams_.Encode() 3553 req, err := http.NewRequest("POST", urls, body) 3554 if err != nil { 3555 return nil, err 3556 } 3557 req.Header = reqHeaders 3558 googleapi.Expand(req.URL, map[string]string{ 3559 "tableId": c.tableId, 3560 }) 3561 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3562} 3563 3564// Do executes the "fusiontables.table.copy" call. 3565// Exactly one of *Table or error will be non-nil. Any non-2xx status 3566// code is an error. Response headers are in either 3567// *Table.ServerResponse.Header or (if a response was returned at all) 3568// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3569// check whether the returned error was because http.StatusNotModified 3570// was returned. 3571func (c *TableCopyCall) Do(opts ...googleapi.CallOption) (*Table, error) { 3572 gensupport.SetOptions(c.urlParams_, opts...) 3573 res, err := c.doRequest("json") 3574 if res != nil && res.StatusCode == http.StatusNotModified { 3575 if res.Body != nil { 3576 res.Body.Close() 3577 } 3578 return nil, &googleapi.Error{ 3579 Code: res.StatusCode, 3580 Header: res.Header, 3581 } 3582 } 3583 if err != nil { 3584 return nil, err 3585 } 3586 defer googleapi.CloseBody(res) 3587 if err := googleapi.CheckResponse(res); err != nil { 3588 return nil, err 3589 } 3590 ret := &Table{ 3591 ServerResponse: googleapi.ServerResponse{ 3592 Header: res.Header, 3593 HTTPStatusCode: res.StatusCode, 3594 }, 3595 } 3596 target := &ret 3597 if err := gensupport.DecodeResponse(target, res); err != nil { 3598 return nil, err 3599 } 3600 return ret, nil 3601 // { 3602 // "description": "Copies a table.", 3603 // "httpMethod": "POST", 3604 // "id": "fusiontables.table.copy", 3605 // "parameterOrder": [ 3606 // "tableId" 3607 // ], 3608 // "parameters": { 3609 // "copyPresentation": { 3610 // "description": "Whether to also copy tabs, styles, and templates. Default is false.", 3611 // "location": "query", 3612 // "type": "boolean" 3613 // }, 3614 // "tableId": { 3615 // "description": "ID of the table that is being copied.", 3616 // "location": "path", 3617 // "required": true, 3618 // "type": "string" 3619 // } 3620 // }, 3621 // "path": "tables/{tableId}/copy", 3622 // "response": { 3623 // "$ref": "Table" 3624 // }, 3625 // "scopes": [ 3626 // "https://www.googleapis.com/auth/fusiontables", 3627 // "https://www.googleapis.com/auth/fusiontables.readonly" 3628 // ] 3629 // } 3630 3631} 3632 3633// method id "fusiontables.table.delete": 3634 3635type TableDeleteCall struct { 3636 s *Service 3637 tableId string 3638 urlParams_ gensupport.URLParams 3639 ctx_ context.Context 3640 header_ http.Header 3641} 3642 3643// Delete: Deletes a table. 3644func (r *TableService) Delete(tableId string) *TableDeleteCall { 3645 c := &TableDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3646 c.tableId = tableId 3647 return c 3648} 3649 3650// Fields allows partial responses to be retrieved. See 3651// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3652// for more information. 3653func (c *TableDeleteCall) Fields(s ...googleapi.Field) *TableDeleteCall { 3654 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3655 return c 3656} 3657 3658// Context sets the context to be used in this call's Do method. Any 3659// pending HTTP request will be aborted if the provided context is 3660// canceled. 3661func (c *TableDeleteCall) Context(ctx context.Context) *TableDeleteCall { 3662 c.ctx_ = ctx 3663 return c 3664} 3665 3666// Header returns an http.Header that can be modified by the caller to 3667// add HTTP headers to the request. 3668func (c *TableDeleteCall) Header() http.Header { 3669 if c.header_ == nil { 3670 c.header_ = make(http.Header) 3671 } 3672 return c.header_ 3673} 3674 3675func (c *TableDeleteCall) doRequest(alt string) (*http.Response, error) { 3676 reqHeaders := make(http.Header) 3677 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3678 for k, v := range c.header_ { 3679 reqHeaders[k] = v 3680 } 3681 reqHeaders.Set("User-Agent", c.s.userAgent()) 3682 var body io.Reader = nil 3683 c.urlParams_.Set("alt", alt) 3684 c.urlParams_.Set("prettyPrint", "false") 3685 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}") 3686 urls += "?" + c.urlParams_.Encode() 3687 req, err := http.NewRequest("DELETE", urls, body) 3688 if err != nil { 3689 return nil, err 3690 } 3691 req.Header = reqHeaders 3692 googleapi.Expand(req.URL, map[string]string{ 3693 "tableId": c.tableId, 3694 }) 3695 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3696} 3697 3698// Do executes the "fusiontables.table.delete" call. 3699func (c *TableDeleteCall) Do(opts ...googleapi.CallOption) error { 3700 gensupport.SetOptions(c.urlParams_, opts...) 3701 res, err := c.doRequest("json") 3702 if err != nil { 3703 return err 3704 } 3705 defer googleapi.CloseBody(res) 3706 if err := googleapi.CheckResponse(res); err != nil { 3707 return err 3708 } 3709 return nil 3710 // { 3711 // "description": "Deletes a table.", 3712 // "httpMethod": "DELETE", 3713 // "id": "fusiontables.table.delete", 3714 // "parameterOrder": [ 3715 // "tableId" 3716 // ], 3717 // "parameters": { 3718 // "tableId": { 3719 // "description": "ID of the table to be deleted.", 3720 // "location": "path", 3721 // "required": true, 3722 // "type": "string" 3723 // } 3724 // }, 3725 // "path": "tables/{tableId}", 3726 // "scopes": [ 3727 // "https://www.googleapis.com/auth/fusiontables" 3728 // ] 3729 // } 3730 3731} 3732 3733// method id "fusiontables.table.get": 3734 3735type TableGetCall struct { 3736 s *Service 3737 tableId string 3738 urlParams_ gensupport.URLParams 3739 ifNoneMatch_ string 3740 ctx_ context.Context 3741 header_ http.Header 3742} 3743 3744// Get: Retrieves a specific table by its ID. 3745func (r *TableService) Get(tableId string) *TableGetCall { 3746 c := &TableGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3747 c.tableId = tableId 3748 return c 3749} 3750 3751// Fields allows partial responses to be retrieved. See 3752// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3753// for more information. 3754func (c *TableGetCall) Fields(s ...googleapi.Field) *TableGetCall { 3755 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3756 return c 3757} 3758 3759// IfNoneMatch sets the optional parameter which makes the operation 3760// fail if the object's ETag matches the given value. This is useful for 3761// getting updates only after the object has changed since the last 3762// request. Use googleapi.IsNotModified to check whether the response 3763// error from Do is the result of In-None-Match. 3764func (c *TableGetCall) IfNoneMatch(entityTag string) *TableGetCall { 3765 c.ifNoneMatch_ = entityTag 3766 return c 3767} 3768 3769// Context sets the context to be used in this call's Do method. Any 3770// pending HTTP request will be aborted if the provided context is 3771// canceled. 3772func (c *TableGetCall) Context(ctx context.Context) *TableGetCall { 3773 c.ctx_ = ctx 3774 return c 3775} 3776 3777// Header returns an http.Header that can be modified by the caller to 3778// add HTTP headers to the request. 3779func (c *TableGetCall) Header() http.Header { 3780 if c.header_ == nil { 3781 c.header_ = make(http.Header) 3782 } 3783 return c.header_ 3784} 3785 3786func (c *TableGetCall) doRequest(alt string) (*http.Response, error) { 3787 reqHeaders := make(http.Header) 3788 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 3789 for k, v := range c.header_ { 3790 reqHeaders[k] = v 3791 } 3792 reqHeaders.Set("User-Agent", c.s.userAgent()) 3793 if c.ifNoneMatch_ != "" { 3794 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3795 } 3796 var body io.Reader = nil 3797 c.urlParams_.Set("alt", alt) 3798 c.urlParams_.Set("prettyPrint", "false") 3799 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}") 3800 urls += "?" + c.urlParams_.Encode() 3801 req, err := http.NewRequest("GET", urls, body) 3802 if err != nil { 3803 return nil, err 3804 } 3805 req.Header = reqHeaders 3806 googleapi.Expand(req.URL, map[string]string{ 3807 "tableId": c.tableId, 3808 }) 3809 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3810} 3811 3812// Do executes the "fusiontables.table.get" call. 3813// Exactly one of *Table or error will be non-nil. Any non-2xx status 3814// code is an error. Response headers are in either 3815// *Table.ServerResponse.Header or (if a response was returned at all) 3816// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3817// check whether the returned error was because http.StatusNotModified 3818// was returned. 3819func (c *TableGetCall) Do(opts ...googleapi.CallOption) (*Table, error) { 3820 gensupport.SetOptions(c.urlParams_, opts...) 3821 res, err := c.doRequest("json") 3822 if res != nil && res.StatusCode == http.StatusNotModified { 3823 if res.Body != nil { 3824 res.Body.Close() 3825 } 3826 return nil, &googleapi.Error{ 3827 Code: res.StatusCode, 3828 Header: res.Header, 3829 } 3830 } 3831 if err != nil { 3832 return nil, err 3833 } 3834 defer googleapi.CloseBody(res) 3835 if err := googleapi.CheckResponse(res); err != nil { 3836 return nil, err 3837 } 3838 ret := &Table{ 3839 ServerResponse: googleapi.ServerResponse{ 3840 Header: res.Header, 3841 HTTPStatusCode: res.StatusCode, 3842 }, 3843 } 3844 target := &ret 3845 if err := gensupport.DecodeResponse(target, res); err != nil { 3846 return nil, err 3847 } 3848 return ret, nil 3849 // { 3850 // "description": "Retrieves a specific table by its ID.", 3851 // "httpMethod": "GET", 3852 // "id": "fusiontables.table.get", 3853 // "parameterOrder": [ 3854 // "tableId" 3855 // ], 3856 // "parameters": { 3857 // "tableId": { 3858 // "description": "Identifier for the table being requested.", 3859 // "location": "path", 3860 // "required": true, 3861 // "type": "string" 3862 // } 3863 // }, 3864 // "path": "tables/{tableId}", 3865 // "response": { 3866 // "$ref": "Table" 3867 // }, 3868 // "scopes": [ 3869 // "https://www.googleapis.com/auth/fusiontables", 3870 // "https://www.googleapis.com/auth/fusiontables.readonly" 3871 // ] 3872 // } 3873 3874} 3875 3876// method id "fusiontables.table.importRows": 3877 3878type TableImportRowsCall struct { 3879 s *Service 3880 tableId string 3881 urlParams_ gensupport.URLParams 3882 mediaInfo_ *gensupport.MediaInfo 3883 ctx_ context.Context 3884 header_ http.Header 3885} 3886 3887// ImportRows: Imports more rows into a table. 3888func (r *TableService) ImportRows(tableId string) *TableImportRowsCall { 3889 c := &TableImportRowsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3890 c.tableId = tableId 3891 return c 3892} 3893 3894// Delimiter sets the optional parameter "delimiter": The delimiter used 3895// to separate cell values. This can only consist of a single character. 3896// Default is ,. 3897func (c *TableImportRowsCall) Delimiter(delimiter string) *TableImportRowsCall { 3898 c.urlParams_.Set("delimiter", delimiter) 3899 return c 3900} 3901 3902// Encoding sets the optional parameter "encoding": The encoding of the 3903// content. Default is UTF-8. Use auto-detect if you are unsure of the 3904// encoding. 3905func (c *TableImportRowsCall) Encoding(encoding string) *TableImportRowsCall { 3906 c.urlParams_.Set("encoding", encoding) 3907 return c 3908} 3909 3910// EndLine sets the optional parameter "endLine": The index of the line 3911// up to which data will be imported. Default is to import the entire 3912// file. If endLine is negative, it is an offset from the end of the 3913// file; the imported content will exclude the last endLine lines. 3914func (c *TableImportRowsCall) EndLine(endLine int64) *TableImportRowsCall { 3915 c.urlParams_.Set("endLine", fmt.Sprint(endLine)) 3916 return c 3917} 3918 3919// IsStrict sets the optional parameter "isStrict": Whether the imported 3920// CSV must have the same number of values for each row. If false, rows 3921// with fewer values will be padded with empty values. Default is true. 3922func (c *TableImportRowsCall) IsStrict(isStrict bool) *TableImportRowsCall { 3923 c.urlParams_.Set("isStrict", fmt.Sprint(isStrict)) 3924 return c 3925} 3926 3927// StartLine sets the optional parameter "startLine": The index of the 3928// first line from which to start importing, inclusive. Default is 0. 3929func (c *TableImportRowsCall) StartLine(startLine int64) *TableImportRowsCall { 3930 c.urlParams_.Set("startLine", fmt.Sprint(startLine)) 3931 return c 3932} 3933 3934// Media specifies the media to upload in one or more chunks. The chunk 3935// size may be controlled by supplying a MediaOption generated by 3936// googleapi.ChunkSize. The chunk size defaults to 3937// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 3938// upload request will be determined by sniffing the contents of r, 3939// unless a MediaOption generated by googleapi.ContentType is 3940// supplied. 3941// At most one of Media and ResumableMedia may be set. 3942func (c *TableImportRowsCall) Media(r io.Reader, options ...googleapi.MediaOption) *TableImportRowsCall { 3943 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 3944 return c 3945} 3946 3947// ResumableMedia specifies the media to upload in chunks and can be 3948// canceled with ctx. 3949// 3950// Deprecated: use Media instead. 3951// 3952// At most one of Media and ResumableMedia may be set. mediaType 3953// identifies the MIME media type of the upload, such as "image/png". If 3954// mediaType is "", it will be auto-detected. The provided ctx will 3955// supersede any context previously provided to the Context method. 3956func (c *TableImportRowsCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TableImportRowsCall { 3957 c.ctx_ = ctx 3958 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 3959 return c 3960} 3961 3962// ProgressUpdater provides a callback function that will be called 3963// after every chunk. It should be a low-latency function in order to 3964// not slow down the upload operation. This should only be called when 3965// using ResumableMedia (as opposed to Media). 3966func (c *TableImportRowsCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TableImportRowsCall { 3967 c.mediaInfo_.SetProgressUpdater(pu) 3968 return c 3969} 3970 3971// Fields allows partial responses to be retrieved. See 3972// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3973// for more information. 3974func (c *TableImportRowsCall) Fields(s ...googleapi.Field) *TableImportRowsCall { 3975 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3976 return c 3977} 3978 3979// Context sets the context to be used in this call's Do method. Any 3980// pending HTTP request will be aborted if the provided context is 3981// canceled. 3982// This context will supersede any context previously provided to the 3983// ResumableMedia method. 3984func (c *TableImportRowsCall) Context(ctx context.Context) *TableImportRowsCall { 3985 c.ctx_ = ctx 3986 return c 3987} 3988 3989// Header returns an http.Header that can be modified by the caller to 3990// add HTTP headers to the request. 3991func (c *TableImportRowsCall) Header() http.Header { 3992 if c.header_ == nil { 3993 c.header_ = make(http.Header) 3994 } 3995 return c.header_ 3996} 3997 3998func (c *TableImportRowsCall) doRequest(alt string) (*http.Response, error) { 3999 reqHeaders := make(http.Header) 4000 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4001 for k, v := range c.header_ { 4002 reqHeaders[k] = v 4003 } 4004 reqHeaders.Set("User-Agent", c.s.userAgent()) 4005 var body io.Reader = nil 4006 c.urlParams_.Set("alt", alt) 4007 c.urlParams_.Set("prettyPrint", "false") 4008 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/import") 4009 if c.mediaInfo_ != nil { 4010 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/fusiontables/v2/tables/{tableId}/import") 4011 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 4012 } 4013 if body == nil { 4014 body = new(bytes.Buffer) 4015 reqHeaders.Set("Content-Type", "application/json") 4016 } 4017 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 4018 defer cleanup() 4019 urls += "?" + c.urlParams_.Encode() 4020 req, err := http.NewRequest("POST", urls, body) 4021 if err != nil { 4022 return nil, err 4023 } 4024 req.Header = reqHeaders 4025 req.GetBody = getBody 4026 googleapi.Expand(req.URL, map[string]string{ 4027 "tableId": c.tableId, 4028 }) 4029 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4030} 4031 4032// Do executes the "fusiontables.table.importRows" call. 4033// Exactly one of *Import or error will be non-nil. Any non-2xx status 4034// code is an error. Response headers are in either 4035// *Import.ServerResponse.Header or (if a response was returned at all) 4036// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4037// check whether the returned error was because http.StatusNotModified 4038// was returned. 4039func (c *TableImportRowsCall) Do(opts ...googleapi.CallOption) (*Import, error) { 4040 gensupport.SetOptions(c.urlParams_, opts...) 4041 res, err := c.doRequest("json") 4042 if res != nil && res.StatusCode == http.StatusNotModified { 4043 if res.Body != nil { 4044 res.Body.Close() 4045 } 4046 return nil, &googleapi.Error{ 4047 Code: res.StatusCode, 4048 Header: res.Header, 4049 } 4050 } 4051 if err != nil { 4052 return nil, err 4053 } 4054 defer googleapi.CloseBody(res) 4055 if err := googleapi.CheckResponse(res); err != nil { 4056 return nil, err 4057 } 4058 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 4059 if rx != nil { 4060 rx.Client = c.s.client 4061 rx.UserAgent = c.s.userAgent() 4062 ctx := c.ctx_ 4063 if ctx == nil { 4064 ctx = context.TODO() 4065 } 4066 res, err = rx.Upload(ctx) 4067 if err != nil { 4068 return nil, err 4069 } 4070 defer res.Body.Close() 4071 if err := googleapi.CheckResponse(res); err != nil { 4072 return nil, err 4073 } 4074 } 4075 ret := &Import{ 4076 ServerResponse: googleapi.ServerResponse{ 4077 Header: res.Header, 4078 HTTPStatusCode: res.StatusCode, 4079 }, 4080 } 4081 target := &ret 4082 if err := gensupport.DecodeResponse(target, res); err != nil { 4083 return nil, err 4084 } 4085 return ret, nil 4086 // { 4087 // "description": "Imports more rows into a table.", 4088 // "httpMethod": "POST", 4089 // "id": "fusiontables.table.importRows", 4090 // "mediaUpload": { 4091 // "accept": [ 4092 // "application/octet-stream" 4093 // ], 4094 // "maxSize": "250MB", 4095 // "protocols": { 4096 // "resumable": { 4097 // "multipart": true, 4098 // "path": "/resumable/upload/fusiontables/v2/tables/{tableId}/import" 4099 // }, 4100 // "simple": { 4101 // "multipart": true, 4102 // "path": "/upload/fusiontables/v2/tables/{tableId}/import" 4103 // } 4104 // } 4105 // }, 4106 // "parameterOrder": [ 4107 // "tableId" 4108 // ], 4109 // "parameters": { 4110 // "delimiter": { 4111 // "description": "The delimiter used to separate cell values. This can only consist of a single character. Default is ,.", 4112 // "location": "query", 4113 // "type": "string" 4114 // }, 4115 // "encoding": { 4116 // "description": "The encoding of the content. Default is UTF-8. Use auto-detect if you are unsure of the encoding.", 4117 // "location": "query", 4118 // "type": "string" 4119 // }, 4120 // "endLine": { 4121 // "description": "The index of the line up to which data will be imported. Default is to import the entire file. If endLine is negative, it is an offset from the end of the file; the imported content will exclude the last endLine lines.", 4122 // "format": "int32", 4123 // "location": "query", 4124 // "type": "integer" 4125 // }, 4126 // "isStrict": { 4127 // "description": "Whether the imported CSV must have the same number of values for each row. If false, rows with fewer values will be padded with empty values. Default is true.", 4128 // "location": "query", 4129 // "type": "boolean" 4130 // }, 4131 // "startLine": { 4132 // "description": "The index of the first line from which to start importing, inclusive. Default is 0.", 4133 // "format": "int32", 4134 // "location": "query", 4135 // "type": "integer" 4136 // }, 4137 // "tableId": { 4138 // "description": "The table into which new rows are being imported.", 4139 // "location": "path", 4140 // "required": true, 4141 // "type": "string" 4142 // } 4143 // }, 4144 // "path": "tables/{tableId}/import", 4145 // "response": { 4146 // "$ref": "Import" 4147 // }, 4148 // "scopes": [ 4149 // "https://www.googleapis.com/auth/fusiontables" 4150 // ], 4151 // "supportsMediaUpload": true 4152 // } 4153 4154} 4155 4156// method id "fusiontables.table.importTable": 4157 4158type TableImportTableCall struct { 4159 s *Service 4160 urlParams_ gensupport.URLParams 4161 mediaInfo_ *gensupport.MediaInfo 4162 ctx_ context.Context 4163 header_ http.Header 4164} 4165 4166// ImportTable: Imports a new table. 4167func (r *TableService) ImportTable(name string) *TableImportTableCall { 4168 c := &TableImportTableCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4169 c.urlParams_.Set("name", name) 4170 return c 4171} 4172 4173// Delimiter sets the optional parameter "delimiter": The delimiter used 4174// to separate cell values. This can only consist of a single character. 4175// Default is ,. 4176func (c *TableImportTableCall) Delimiter(delimiter string) *TableImportTableCall { 4177 c.urlParams_.Set("delimiter", delimiter) 4178 return c 4179} 4180 4181// Encoding sets the optional parameter "encoding": The encoding of the 4182// content. Default is UTF-8. Use auto-detect if you are unsure of the 4183// encoding. 4184func (c *TableImportTableCall) Encoding(encoding string) *TableImportTableCall { 4185 c.urlParams_.Set("encoding", encoding) 4186 return c 4187} 4188 4189// Media specifies the media to upload in one or more chunks. The chunk 4190// size may be controlled by supplying a MediaOption generated by 4191// googleapi.ChunkSize. The chunk size defaults to 4192// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 4193// upload request will be determined by sniffing the contents of r, 4194// unless a MediaOption generated by googleapi.ContentType is 4195// supplied. 4196// At most one of Media and ResumableMedia may be set. 4197func (c *TableImportTableCall) Media(r io.Reader, options ...googleapi.MediaOption) *TableImportTableCall { 4198 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 4199 return c 4200} 4201 4202// ResumableMedia specifies the media to upload in chunks and can be 4203// canceled with ctx. 4204// 4205// Deprecated: use Media instead. 4206// 4207// At most one of Media and ResumableMedia may be set. mediaType 4208// identifies the MIME media type of the upload, such as "image/png". If 4209// mediaType is "", it will be auto-detected. The provided ctx will 4210// supersede any context previously provided to the Context method. 4211func (c *TableImportTableCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TableImportTableCall { 4212 c.ctx_ = ctx 4213 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 4214 return c 4215} 4216 4217// ProgressUpdater provides a callback function that will be called 4218// after every chunk. It should be a low-latency function in order to 4219// not slow down the upload operation. This should only be called when 4220// using ResumableMedia (as opposed to Media). 4221func (c *TableImportTableCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TableImportTableCall { 4222 c.mediaInfo_.SetProgressUpdater(pu) 4223 return c 4224} 4225 4226// Fields allows partial responses to be retrieved. See 4227// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4228// for more information. 4229func (c *TableImportTableCall) Fields(s ...googleapi.Field) *TableImportTableCall { 4230 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4231 return c 4232} 4233 4234// Context sets the context to be used in this call's Do method. Any 4235// pending HTTP request will be aborted if the provided context is 4236// canceled. 4237// This context will supersede any context previously provided to the 4238// ResumableMedia method. 4239func (c *TableImportTableCall) Context(ctx context.Context) *TableImportTableCall { 4240 c.ctx_ = ctx 4241 return c 4242} 4243 4244// Header returns an http.Header that can be modified by the caller to 4245// add HTTP headers to the request. 4246func (c *TableImportTableCall) Header() http.Header { 4247 if c.header_ == nil { 4248 c.header_ = make(http.Header) 4249 } 4250 return c.header_ 4251} 4252 4253func (c *TableImportTableCall) doRequest(alt string) (*http.Response, error) { 4254 reqHeaders := make(http.Header) 4255 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4256 for k, v := range c.header_ { 4257 reqHeaders[k] = v 4258 } 4259 reqHeaders.Set("User-Agent", c.s.userAgent()) 4260 var body io.Reader = nil 4261 c.urlParams_.Set("alt", alt) 4262 c.urlParams_.Set("prettyPrint", "false") 4263 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/import") 4264 if c.mediaInfo_ != nil { 4265 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/fusiontables/v2/tables/import") 4266 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 4267 } 4268 if body == nil { 4269 body = new(bytes.Buffer) 4270 reqHeaders.Set("Content-Type", "application/json") 4271 } 4272 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 4273 defer cleanup() 4274 urls += "?" + c.urlParams_.Encode() 4275 req, err := http.NewRequest("POST", urls, body) 4276 if err != nil { 4277 return nil, err 4278 } 4279 req.Header = reqHeaders 4280 req.GetBody = getBody 4281 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4282} 4283 4284// Do executes the "fusiontables.table.importTable" call. 4285// Exactly one of *Table or error will be non-nil. Any non-2xx status 4286// code is an error. Response headers are in either 4287// *Table.ServerResponse.Header or (if a response was returned at all) 4288// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4289// check whether the returned error was because http.StatusNotModified 4290// was returned. 4291func (c *TableImportTableCall) Do(opts ...googleapi.CallOption) (*Table, error) { 4292 gensupport.SetOptions(c.urlParams_, opts...) 4293 res, err := c.doRequest("json") 4294 if res != nil && res.StatusCode == http.StatusNotModified { 4295 if res.Body != nil { 4296 res.Body.Close() 4297 } 4298 return nil, &googleapi.Error{ 4299 Code: res.StatusCode, 4300 Header: res.Header, 4301 } 4302 } 4303 if err != nil { 4304 return nil, err 4305 } 4306 defer googleapi.CloseBody(res) 4307 if err := googleapi.CheckResponse(res); err != nil { 4308 return nil, err 4309 } 4310 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 4311 if rx != nil { 4312 rx.Client = c.s.client 4313 rx.UserAgent = c.s.userAgent() 4314 ctx := c.ctx_ 4315 if ctx == nil { 4316 ctx = context.TODO() 4317 } 4318 res, err = rx.Upload(ctx) 4319 if err != nil { 4320 return nil, err 4321 } 4322 defer res.Body.Close() 4323 if err := googleapi.CheckResponse(res); err != nil { 4324 return nil, err 4325 } 4326 } 4327 ret := &Table{ 4328 ServerResponse: googleapi.ServerResponse{ 4329 Header: res.Header, 4330 HTTPStatusCode: res.StatusCode, 4331 }, 4332 } 4333 target := &ret 4334 if err := gensupport.DecodeResponse(target, res); err != nil { 4335 return nil, err 4336 } 4337 return ret, nil 4338 // { 4339 // "description": "Imports a new table.", 4340 // "httpMethod": "POST", 4341 // "id": "fusiontables.table.importTable", 4342 // "mediaUpload": { 4343 // "accept": [ 4344 // "application/octet-stream" 4345 // ], 4346 // "maxSize": "250MB", 4347 // "protocols": { 4348 // "resumable": { 4349 // "multipart": true, 4350 // "path": "/resumable/upload/fusiontables/v2/tables/import" 4351 // }, 4352 // "simple": { 4353 // "multipart": true, 4354 // "path": "/upload/fusiontables/v2/tables/import" 4355 // } 4356 // } 4357 // }, 4358 // "parameterOrder": [ 4359 // "name" 4360 // ], 4361 // "parameters": { 4362 // "delimiter": { 4363 // "description": "The delimiter used to separate cell values. This can only consist of a single character. Default is ,.", 4364 // "location": "query", 4365 // "type": "string" 4366 // }, 4367 // "encoding": { 4368 // "description": "The encoding of the content. Default is UTF-8. Use auto-detect if you are unsure of the encoding.", 4369 // "location": "query", 4370 // "type": "string" 4371 // }, 4372 // "name": { 4373 // "description": "The name to be assigned to the new table.", 4374 // "location": "query", 4375 // "required": true, 4376 // "type": "string" 4377 // } 4378 // }, 4379 // "path": "tables/import", 4380 // "response": { 4381 // "$ref": "Table" 4382 // }, 4383 // "scopes": [ 4384 // "https://www.googleapis.com/auth/fusiontables" 4385 // ], 4386 // "supportsMediaUpload": true 4387 // } 4388 4389} 4390 4391// method id "fusiontables.table.insert": 4392 4393type TableInsertCall struct { 4394 s *Service 4395 table *Table 4396 urlParams_ gensupport.URLParams 4397 ctx_ context.Context 4398 header_ http.Header 4399} 4400 4401// Insert: Creates a new table. 4402func (r *TableService) Insert(table *Table) *TableInsertCall { 4403 c := &TableInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4404 c.table = table 4405 return c 4406} 4407 4408// Fields allows partial responses to be retrieved. See 4409// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4410// for more information. 4411func (c *TableInsertCall) Fields(s ...googleapi.Field) *TableInsertCall { 4412 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4413 return c 4414} 4415 4416// Context sets the context to be used in this call's Do method. Any 4417// pending HTTP request will be aborted if the provided context is 4418// canceled. 4419func (c *TableInsertCall) Context(ctx context.Context) *TableInsertCall { 4420 c.ctx_ = ctx 4421 return c 4422} 4423 4424// Header returns an http.Header that can be modified by the caller to 4425// add HTTP headers to the request. 4426func (c *TableInsertCall) Header() http.Header { 4427 if c.header_ == nil { 4428 c.header_ = make(http.Header) 4429 } 4430 return c.header_ 4431} 4432 4433func (c *TableInsertCall) doRequest(alt string) (*http.Response, error) { 4434 reqHeaders := make(http.Header) 4435 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4436 for k, v := range c.header_ { 4437 reqHeaders[k] = v 4438 } 4439 reqHeaders.Set("User-Agent", c.s.userAgent()) 4440 var body io.Reader = nil 4441 body, err := googleapi.WithoutDataWrapper.JSONReader(c.table) 4442 if err != nil { 4443 return nil, err 4444 } 4445 reqHeaders.Set("Content-Type", "application/json") 4446 c.urlParams_.Set("alt", alt) 4447 c.urlParams_.Set("prettyPrint", "false") 4448 urls := googleapi.ResolveRelative(c.s.BasePath, "tables") 4449 urls += "?" + c.urlParams_.Encode() 4450 req, err := http.NewRequest("POST", urls, body) 4451 if err != nil { 4452 return nil, err 4453 } 4454 req.Header = reqHeaders 4455 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4456} 4457 4458// Do executes the "fusiontables.table.insert" call. 4459// Exactly one of *Table or error will be non-nil. Any non-2xx status 4460// code is an error. Response headers are in either 4461// *Table.ServerResponse.Header or (if a response was returned at all) 4462// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4463// check whether the returned error was because http.StatusNotModified 4464// was returned. 4465func (c *TableInsertCall) Do(opts ...googleapi.CallOption) (*Table, error) { 4466 gensupport.SetOptions(c.urlParams_, opts...) 4467 res, err := c.doRequest("json") 4468 if res != nil && res.StatusCode == http.StatusNotModified { 4469 if res.Body != nil { 4470 res.Body.Close() 4471 } 4472 return nil, &googleapi.Error{ 4473 Code: res.StatusCode, 4474 Header: res.Header, 4475 } 4476 } 4477 if err != nil { 4478 return nil, err 4479 } 4480 defer googleapi.CloseBody(res) 4481 if err := googleapi.CheckResponse(res); err != nil { 4482 return nil, err 4483 } 4484 ret := &Table{ 4485 ServerResponse: googleapi.ServerResponse{ 4486 Header: res.Header, 4487 HTTPStatusCode: res.StatusCode, 4488 }, 4489 } 4490 target := &ret 4491 if err := gensupport.DecodeResponse(target, res); err != nil { 4492 return nil, err 4493 } 4494 return ret, nil 4495 // { 4496 // "description": "Creates a new table.", 4497 // "httpMethod": "POST", 4498 // "id": "fusiontables.table.insert", 4499 // "path": "tables", 4500 // "request": { 4501 // "$ref": "Table" 4502 // }, 4503 // "response": { 4504 // "$ref": "Table" 4505 // }, 4506 // "scopes": [ 4507 // "https://www.googleapis.com/auth/fusiontables" 4508 // ] 4509 // } 4510 4511} 4512 4513// method id "fusiontables.table.list": 4514 4515type TableListCall struct { 4516 s *Service 4517 urlParams_ gensupport.URLParams 4518 ifNoneMatch_ string 4519 ctx_ context.Context 4520 header_ http.Header 4521} 4522 4523// List: Retrieves a list of tables a user owns. 4524func (r *TableService) List() *TableListCall { 4525 c := &TableListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4526 return c 4527} 4528 4529// MaxResults sets the optional parameter "maxResults": Maximum number 4530// of tables to return. Default is 5. 4531func (c *TableListCall) MaxResults(maxResults int64) *TableListCall { 4532 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 4533 return c 4534} 4535 4536// PageToken sets the optional parameter "pageToken": Continuation token 4537// specifying which result page to return. 4538func (c *TableListCall) PageToken(pageToken string) *TableListCall { 4539 c.urlParams_.Set("pageToken", pageToken) 4540 return c 4541} 4542 4543// Fields allows partial responses to be retrieved. See 4544// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4545// for more information. 4546func (c *TableListCall) Fields(s ...googleapi.Field) *TableListCall { 4547 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4548 return c 4549} 4550 4551// IfNoneMatch sets the optional parameter which makes the operation 4552// fail if the object's ETag matches the given value. This is useful for 4553// getting updates only after the object has changed since the last 4554// request. Use googleapi.IsNotModified to check whether the response 4555// error from Do is the result of In-None-Match. 4556func (c *TableListCall) IfNoneMatch(entityTag string) *TableListCall { 4557 c.ifNoneMatch_ = entityTag 4558 return c 4559} 4560 4561// Context sets the context to be used in this call's Do method. Any 4562// pending HTTP request will be aborted if the provided context is 4563// canceled. 4564func (c *TableListCall) Context(ctx context.Context) *TableListCall { 4565 c.ctx_ = ctx 4566 return c 4567} 4568 4569// Header returns an http.Header that can be modified by the caller to 4570// add HTTP headers to the request. 4571func (c *TableListCall) Header() http.Header { 4572 if c.header_ == nil { 4573 c.header_ = make(http.Header) 4574 } 4575 return c.header_ 4576} 4577 4578func (c *TableListCall) doRequest(alt string) (*http.Response, error) { 4579 reqHeaders := make(http.Header) 4580 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4581 for k, v := range c.header_ { 4582 reqHeaders[k] = v 4583 } 4584 reqHeaders.Set("User-Agent", c.s.userAgent()) 4585 if c.ifNoneMatch_ != "" { 4586 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4587 } 4588 var body io.Reader = nil 4589 c.urlParams_.Set("alt", alt) 4590 c.urlParams_.Set("prettyPrint", "false") 4591 urls := googleapi.ResolveRelative(c.s.BasePath, "tables") 4592 urls += "?" + c.urlParams_.Encode() 4593 req, err := http.NewRequest("GET", urls, body) 4594 if err != nil { 4595 return nil, err 4596 } 4597 req.Header = reqHeaders 4598 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4599} 4600 4601// Do executes the "fusiontables.table.list" call. 4602// Exactly one of *TableList or error will be non-nil. Any non-2xx 4603// status code is an error. Response headers are in either 4604// *TableList.ServerResponse.Header or (if a response was returned at 4605// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4606// to check whether the returned error was because 4607// http.StatusNotModified was returned. 4608func (c *TableListCall) Do(opts ...googleapi.CallOption) (*TableList, error) { 4609 gensupport.SetOptions(c.urlParams_, opts...) 4610 res, err := c.doRequest("json") 4611 if res != nil && res.StatusCode == http.StatusNotModified { 4612 if res.Body != nil { 4613 res.Body.Close() 4614 } 4615 return nil, &googleapi.Error{ 4616 Code: res.StatusCode, 4617 Header: res.Header, 4618 } 4619 } 4620 if err != nil { 4621 return nil, err 4622 } 4623 defer googleapi.CloseBody(res) 4624 if err := googleapi.CheckResponse(res); err != nil { 4625 return nil, err 4626 } 4627 ret := &TableList{ 4628 ServerResponse: googleapi.ServerResponse{ 4629 Header: res.Header, 4630 HTTPStatusCode: res.StatusCode, 4631 }, 4632 } 4633 target := &ret 4634 if err := gensupport.DecodeResponse(target, res); err != nil { 4635 return nil, err 4636 } 4637 return ret, nil 4638 // { 4639 // "description": "Retrieves a list of tables a user owns.", 4640 // "httpMethod": "GET", 4641 // "id": "fusiontables.table.list", 4642 // "parameters": { 4643 // "maxResults": { 4644 // "description": "Maximum number of tables to return. Default is 5.", 4645 // "format": "uint32", 4646 // "location": "query", 4647 // "minimum": "0", 4648 // "type": "integer" 4649 // }, 4650 // "pageToken": { 4651 // "description": "Continuation token specifying which result page to return.", 4652 // "location": "query", 4653 // "type": "string" 4654 // } 4655 // }, 4656 // "path": "tables", 4657 // "response": { 4658 // "$ref": "TableList" 4659 // }, 4660 // "scopes": [ 4661 // "https://www.googleapis.com/auth/fusiontables", 4662 // "https://www.googleapis.com/auth/fusiontables.readonly" 4663 // ] 4664 // } 4665 4666} 4667 4668// Pages invokes f for each page of results. 4669// A non-nil error returned from f will halt the iteration. 4670// The provided context supersedes any context provided to the Context method. 4671func (c *TableListCall) Pages(ctx context.Context, f func(*TableList) error) error { 4672 c.ctx_ = ctx 4673 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4674 for { 4675 x, err := c.Do() 4676 if err != nil { 4677 return err 4678 } 4679 if err := f(x); err != nil { 4680 return err 4681 } 4682 if x.NextPageToken == "" { 4683 return nil 4684 } 4685 c.PageToken(x.NextPageToken) 4686 } 4687} 4688 4689// method id "fusiontables.table.patch": 4690 4691type TablePatchCall struct { 4692 s *Service 4693 tableId string 4694 table *Table 4695 urlParams_ gensupport.URLParams 4696 ctx_ context.Context 4697 header_ http.Header 4698} 4699 4700// Patch: Updates an existing table. Unless explicitly requested, only 4701// the name, description, and attribution will be updated. This method 4702// supports patch semantics. 4703func (r *TableService) Patch(tableId string, table *Table) *TablePatchCall { 4704 c := &TablePatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4705 c.tableId = tableId 4706 c.table = table 4707 return c 4708} 4709 4710// ReplaceViewDefinition sets the optional parameter 4711// "replaceViewDefinition": Whether the view definition is also updated. 4712// The specified view definition replaces the existing one. Only a view 4713// can be updated with a new definition. 4714func (c *TablePatchCall) ReplaceViewDefinition(replaceViewDefinition bool) *TablePatchCall { 4715 c.urlParams_.Set("replaceViewDefinition", fmt.Sprint(replaceViewDefinition)) 4716 return c 4717} 4718 4719// Fields allows partial responses to be retrieved. See 4720// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4721// for more information. 4722func (c *TablePatchCall) Fields(s ...googleapi.Field) *TablePatchCall { 4723 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4724 return c 4725} 4726 4727// Context sets the context to be used in this call's Do method. Any 4728// pending HTTP request will be aborted if the provided context is 4729// canceled. 4730func (c *TablePatchCall) Context(ctx context.Context) *TablePatchCall { 4731 c.ctx_ = ctx 4732 return c 4733} 4734 4735// Header returns an http.Header that can be modified by the caller to 4736// add HTTP headers to the request. 4737func (c *TablePatchCall) Header() http.Header { 4738 if c.header_ == nil { 4739 c.header_ = make(http.Header) 4740 } 4741 return c.header_ 4742} 4743 4744func (c *TablePatchCall) doRequest(alt string) (*http.Response, error) { 4745 reqHeaders := make(http.Header) 4746 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4747 for k, v := range c.header_ { 4748 reqHeaders[k] = v 4749 } 4750 reqHeaders.Set("User-Agent", c.s.userAgent()) 4751 var body io.Reader = nil 4752 body, err := googleapi.WithoutDataWrapper.JSONReader(c.table) 4753 if err != nil { 4754 return nil, err 4755 } 4756 reqHeaders.Set("Content-Type", "application/json") 4757 c.urlParams_.Set("alt", alt) 4758 c.urlParams_.Set("prettyPrint", "false") 4759 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}") 4760 urls += "?" + c.urlParams_.Encode() 4761 req, err := http.NewRequest("PATCH", urls, body) 4762 if err != nil { 4763 return nil, err 4764 } 4765 req.Header = reqHeaders 4766 googleapi.Expand(req.URL, map[string]string{ 4767 "tableId": c.tableId, 4768 }) 4769 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4770} 4771 4772// Do executes the "fusiontables.table.patch" call. 4773// Exactly one of *Table or error will be non-nil. Any non-2xx status 4774// code is an error. Response headers are in either 4775// *Table.ServerResponse.Header or (if a response was returned at all) 4776// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4777// check whether the returned error was because http.StatusNotModified 4778// was returned. 4779func (c *TablePatchCall) Do(opts ...googleapi.CallOption) (*Table, error) { 4780 gensupport.SetOptions(c.urlParams_, opts...) 4781 res, err := c.doRequest("json") 4782 if res != nil && res.StatusCode == http.StatusNotModified { 4783 if res.Body != nil { 4784 res.Body.Close() 4785 } 4786 return nil, &googleapi.Error{ 4787 Code: res.StatusCode, 4788 Header: res.Header, 4789 } 4790 } 4791 if err != nil { 4792 return nil, err 4793 } 4794 defer googleapi.CloseBody(res) 4795 if err := googleapi.CheckResponse(res); err != nil { 4796 return nil, err 4797 } 4798 ret := &Table{ 4799 ServerResponse: googleapi.ServerResponse{ 4800 Header: res.Header, 4801 HTTPStatusCode: res.StatusCode, 4802 }, 4803 } 4804 target := &ret 4805 if err := gensupport.DecodeResponse(target, res); err != nil { 4806 return nil, err 4807 } 4808 return ret, nil 4809 // { 4810 // "description": "Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated. This method supports patch semantics.", 4811 // "httpMethod": "PATCH", 4812 // "id": "fusiontables.table.patch", 4813 // "parameterOrder": [ 4814 // "tableId" 4815 // ], 4816 // "parameters": { 4817 // "replaceViewDefinition": { 4818 // "description": "Whether the view definition is also updated. The specified view definition replaces the existing one. Only a view can be updated with a new definition.", 4819 // "location": "query", 4820 // "type": "boolean" 4821 // }, 4822 // "tableId": { 4823 // "description": "ID of the table that is being updated.", 4824 // "location": "path", 4825 // "required": true, 4826 // "type": "string" 4827 // } 4828 // }, 4829 // "path": "tables/{tableId}", 4830 // "request": { 4831 // "$ref": "Table" 4832 // }, 4833 // "response": { 4834 // "$ref": "Table" 4835 // }, 4836 // "scopes": [ 4837 // "https://www.googleapis.com/auth/fusiontables" 4838 // ] 4839 // } 4840 4841} 4842 4843// method id "fusiontables.table.refetchSheet": 4844 4845type TableRefetchSheetCall struct { 4846 s *Service 4847 tableId string 4848 urlParams_ gensupport.URLParams 4849 ctx_ context.Context 4850 header_ http.Header 4851} 4852 4853// RefetchSheet: Replaces rows of the table with the rows of the 4854// spreadsheet that is first imported from. Current rows remain visible 4855// until all replacement rows are ready. 4856func (r *TableService) RefetchSheet(tableId string) *TableRefetchSheetCall { 4857 c := &TableRefetchSheetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4858 c.tableId = tableId 4859 return c 4860} 4861 4862// Fields allows partial responses to be retrieved. See 4863// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4864// for more information. 4865func (c *TableRefetchSheetCall) Fields(s ...googleapi.Field) *TableRefetchSheetCall { 4866 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4867 return c 4868} 4869 4870// Context sets the context to be used in this call's Do method. Any 4871// pending HTTP request will be aborted if the provided context is 4872// canceled. 4873func (c *TableRefetchSheetCall) Context(ctx context.Context) *TableRefetchSheetCall { 4874 c.ctx_ = ctx 4875 return c 4876} 4877 4878// Header returns an http.Header that can be modified by the caller to 4879// add HTTP headers to the request. 4880func (c *TableRefetchSheetCall) Header() http.Header { 4881 if c.header_ == nil { 4882 c.header_ = make(http.Header) 4883 } 4884 return c.header_ 4885} 4886 4887func (c *TableRefetchSheetCall) doRequest(alt string) (*http.Response, error) { 4888 reqHeaders := make(http.Header) 4889 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 4890 for k, v := range c.header_ { 4891 reqHeaders[k] = v 4892 } 4893 reqHeaders.Set("User-Agent", c.s.userAgent()) 4894 var body io.Reader = nil 4895 c.urlParams_.Set("alt", alt) 4896 c.urlParams_.Set("prettyPrint", "false") 4897 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/refetch") 4898 urls += "?" + c.urlParams_.Encode() 4899 req, err := http.NewRequest("POST", urls, body) 4900 if err != nil { 4901 return nil, err 4902 } 4903 req.Header = reqHeaders 4904 googleapi.Expand(req.URL, map[string]string{ 4905 "tableId": c.tableId, 4906 }) 4907 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4908} 4909 4910// Do executes the "fusiontables.table.refetchSheet" call. 4911// Exactly one of *Task or error will be non-nil. Any non-2xx status 4912// code is an error. Response headers are in either 4913// *Task.ServerResponse.Header or (if a response was returned at all) in 4914// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 4915// whether the returned error was because http.StatusNotModified was 4916// returned. 4917func (c *TableRefetchSheetCall) Do(opts ...googleapi.CallOption) (*Task, error) { 4918 gensupport.SetOptions(c.urlParams_, opts...) 4919 res, err := c.doRequest("json") 4920 if res != nil && res.StatusCode == http.StatusNotModified { 4921 if res.Body != nil { 4922 res.Body.Close() 4923 } 4924 return nil, &googleapi.Error{ 4925 Code: res.StatusCode, 4926 Header: res.Header, 4927 } 4928 } 4929 if err != nil { 4930 return nil, err 4931 } 4932 defer googleapi.CloseBody(res) 4933 if err := googleapi.CheckResponse(res); err != nil { 4934 return nil, err 4935 } 4936 ret := &Task{ 4937 ServerResponse: googleapi.ServerResponse{ 4938 Header: res.Header, 4939 HTTPStatusCode: res.StatusCode, 4940 }, 4941 } 4942 target := &ret 4943 if err := gensupport.DecodeResponse(target, res); err != nil { 4944 return nil, err 4945 } 4946 return ret, nil 4947 // { 4948 // "description": "Replaces rows of the table with the rows of the spreadsheet that is first imported from. Current rows remain visible until all replacement rows are ready.", 4949 // "httpMethod": "POST", 4950 // "id": "fusiontables.table.refetchSheet", 4951 // "parameterOrder": [ 4952 // "tableId" 4953 // ], 4954 // "parameters": { 4955 // "tableId": { 4956 // "description": "Table whose rows will be replaced from the spreadsheet.", 4957 // "location": "path", 4958 // "required": true, 4959 // "type": "string" 4960 // } 4961 // }, 4962 // "path": "tables/{tableId}/refetch", 4963 // "response": { 4964 // "$ref": "Task" 4965 // }, 4966 // "scopes": [ 4967 // "https://www.googleapis.com/auth/fusiontables" 4968 // ] 4969 // } 4970 4971} 4972 4973// method id "fusiontables.table.replaceRows": 4974 4975type TableReplaceRowsCall struct { 4976 s *Service 4977 tableId string 4978 urlParams_ gensupport.URLParams 4979 mediaInfo_ *gensupport.MediaInfo 4980 ctx_ context.Context 4981 header_ http.Header 4982} 4983 4984// ReplaceRows: Replaces rows of an existing table. Current rows remain 4985// visible until all replacement rows are ready. 4986func (r *TableService) ReplaceRows(tableId string) *TableReplaceRowsCall { 4987 c := &TableReplaceRowsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4988 c.tableId = tableId 4989 return c 4990} 4991 4992// Delimiter sets the optional parameter "delimiter": The delimiter used 4993// to separate cell values. This can only consist of a single character. 4994// Default is ,. 4995func (c *TableReplaceRowsCall) Delimiter(delimiter string) *TableReplaceRowsCall { 4996 c.urlParams_.Set("delimiter", delimiter) 4997 return c 4998} 4999 5000// Encoding sets the optional parameter "encoding": The encoding of the 5001// content. Default is UTF-8. Use 'auto-detect' if you are unsure of the 5002// encoding. 5003func (c *TableReplaceRowsCall) Encoding(encoding string) *TableReplaceRowsCall { 5004 c.urlParams_.Set("encoding", encoding) 5005 return c 5006} 5007 5008// EndLine sets the optional parameter "endLine": The index of the line 5009// up to which data will be imported. Default is to import the entire 5010// file. If endLine is negative, it is an offset from the end of the 5011// file; the imported content will exclude the last endLine lines. 5012func (c *TableReplaceRowsCall) EndLine(endLine int64) *TableReplaceRowsCall { 5013 c.urlParams_.Set("endLine", fmt.Sprint(endLine)) 5014 return c 5015} 5016 5017// IsStrict sets the optional parameter "isStrict": Whether the imported 5018// CSV must have the same number of column values for each row. If true, 5019// throws an exception if the CSV does not have the same number of 5020// columns. If false, rows with fewer column values will be padded with 5021// empty values. Default is true. 5022func (c *TableReplaceRowsCall) IsStrict(isStrict bool) *TableReplaceRowsCall { 5023 c.urlParams_.Set("isStrict", fmt.Sprint(isStrict)) 5024 return c 5025} 5026 5027// StartLine sets the optional parameter "startLine": The index of the 5028// first line from which to start importing, inclusive. Default is 0. 5029func (c *TableReplaceRowsCall) StartLine(startLine int64) *TableReplaceRowsCall { 5030 c.urlParams_.Set("startLine", fmt.Sprint(startLine)) 5031 return c 5032} 5033 5034// Media specifies the media to upload in one or more chunks. The chunk 5035// size may be controlled by supplying a MediaOption generated by 5036// googleapi.ChunkSize. The chunk size defaults to 5037// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 5038// upload request will be determined by sniffing the contents of r, 5039// unless a MediaOption generated by googleapi.ContentType is 5040// supplied. 5041// At most one of Media and ResumableMedia may be set. 5042func (c *TableReplaceRowsCall) Media(r io.Reader, options ...googleapi.MediaOption) *TableReplaceRowsCall { 5043 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 5044 return c 5045} 5046 5047// ResumableMedia specifies the media to upload in chunks and can be 5048// canceled with ctx. 5049// 5050// Deprecated: use Media instead. 5051// 5052// At most one of Media and ResumableMedia may be set. mediaType 5053// identifies the MIME media type of the upload, such as "image/png". If 5054// mediaType is "", it will be auto-detected. The provided ctx will 5055// supersede any context previously provided to the Context method. 5056func (c *TableReplaceRowsCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TableReplaceRowsCall { 5057 c.ctx_ = ctx 5058 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 5059 return c 5060} 5061 5062// ProgressUpdater provides a callback function that will be called 5063// after every chunk. It should be a low-latency function in order to 5064// not slow down the upload operation. This should only be called when 5065// using ResumableMedia (as opposed to Media). 5066func (c *TableReplaceRowsCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TableReplaceRowsCall { 5067 c.mediaInfo_.SetProgressUpdater(pu) 5068 return c 5069} 5070 5071// Fields allows partial responses to be retrieved. See 5072// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5073// for more information. 5074func (c *TableReplaceRowsCall) Fields(s ...googleapi.Field) *TableReplaceRowsCall { 5075 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5076 return c 5077} 5078 5079// Context sets the context to be used in this call's Do method. Any 5080// pending HTTP request will be aborted if the provided context is 5081// canceled. 5082// This context will supersede any context previously provided to the 5083// ResumableMedia method. 5084func (c *TableReplaceRowsCall) Context(ctx context.Context) *TableReplaceRowsCall { 5085 c.ctx_ = ctx 5086 return c 5087} 5088 5089// Header returns an http.Header that can be modified by the caller to 5090// add HTTP headers to the request. 5091func (c *TableReplaceRowsCall) Header() http.Header { 5092 if c.header_ == nil { 5093 c.header_ = make(http.Header) 5094 } 5095 return c.header_ 5096} 5097 5098func (c *TableReplaceRowsCall) doRequest(alt string) (*http.Response, error) { 5099 reqHeaders := make(http.Header) 5100 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 5101 for k, v := range c.header_ { 5102 reqHeaders[k] = v 5103 } 5104 reqHeaders.Set("User-Agent", c.s.userAgent()) 5105 var body io.Reader = nil 5106 c.urlParams_.Set("alt", alt) 5107 c.urlParams_.Set("prettyPrint", "false") 5108 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/replace") 5109 if c.mediaInfo_ != nil { 5110 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/fusiontables/v2/tables/{tableId}/replace") 5111 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 5112 } 5113 if body == nil { 5114 body = new(bytes.Buffer) 5115 reqHeaders.Set("Content-Type", "application/json") 5116 } 5117 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 5118 defer cleanup() 5119 urls += "?" + c.urlParams_.Encode() 5120 req, err := http.NewRequest("POST", urls, body) 5121 if err != nil { 5122 return nil, err 5123 } 5124 req.Header = reqHeaders 5125 req.GetBody = getBody 5126 googleapi.Expand(req.URL, map[string]string{ 5127 "tableId": c.tableId, 5128 }) 5129 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5130} 5131 5132// Do executes the "fusiontables.table.replaceRows" call. 5133// Exactly one of *Task or error will be non-nil. Any non-2xx status 5134// code is an error. Response headers are in either 5135// *Task.ServerResponse.Header or (if a response was returned at all) in 5136// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 5137// whether the returned error was because http.StatusNotModified was 5138// returned. 5139func (c *TableReplaceRowsCall) Do(opts ...googleapi.CallOption) (*Task, error) { 5140 gensupport.SetOptions(c.urlParams_, opts...) 5141 res, err := c.doRequest("json") 5142 if res != nil && res.StatusCode == http.StatusNotModified { 5143 if res.Body != nil { 5144 res.Body.Close() 5145 } 5146 return nil, &googleapi.Error{ 5147 Code: res.StatusCode, 5148 Header: res.Header, 5149 } 5150 } 5151 if err != nil { 5152 return nil, err 5153 } 5154 defer googleapi.CloseBody(res) 5155 if err := googleapi.CheckResponse(res); err != nil { 5156 return nil, err 5157 } 5158 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 5159 if rx != nil { 5160 rx.Client = c.s.client 5161 rx.UserAgent = c.s.userAgent() 5162 ctx := c.ctx_ 5163 if ctx == nil { 5164 ctx = context.TODO() 5165 } 5166 res, err = rx.Upload(ctx) 5167 if err != nil { 5168 return nil, err 5169 } 5170 defer res.Body.Close() 5171 if err := googleapi.CheckResponse(res); err != nil { 5172 return nil, err 5173 } 5174 } 5175 ret := &Task{ 5176 ServerResponse: googleapi.ServerResponse{ 5177 Header: res.Header, 5178 HTTPStatusCode: res.StatusCode, 5179 }, 5180 } 5181 target := &ret 5182 if err := gensupport.DecodeResponse(target, res); err != nil { 5183 return nil, err 5184 } 5185 return ret, nil 5186 // { 5187 // "description": "Replaces rows of an existing table. Current rows remain visible until all replacement rows are ready.", 5188 // "httpMethod": "POST", 5189 // "id": "fusiontables.table.replaceRows", 5190 // "mediaUpload": { 5191 // "accept": [ 5192 // "application/octet-stream" 5193 // ], 5194 // "maxSize": "250MB", 5195 // "protocols": { 5196 // "resumable": { 5197 // "multipart": true, 5198 // "path": "/resumable/upload/fusiontables/v2/tables/{tableId}/replace" 5199 // }, 5200 // "simple": { 5201 // "multipart": true, 5202 // "path": "/upload/fusiontables/v2/tables/{tableId}/replace" 5203 // } 5204 // } 5205 // }, 5206 // "parameterOrder": [ 5207 // "tableId" 5208 // ], 5209 // "parameters": { 5210 // "delimiter": { 5211 // "description": "The delimiter used to separate cell values. This can only consist of a single character. Default is ,.", 5212 // "location": "query", 5213 // "type": "string" 5214 // }, 5215 // "encoding": { 5216 // "description": "The encoding of the content. Default is UTF-8. Use 'auto-detect' if you are unsure of the encoding.", 5217 // "location": "query", 5218 // "type": "string" 5219 // }, 5220 // "endLine": { 5221 // "description": "The index of the line up to which data will be imported. Default is to import the entire file. If endLine is negative, it is an offset from the end of the file; the imported content will exclude the last endLine lines.", 5222 // "format": "int32", 5223 // "location": "query", 5224 // "type": "integer" 5225 // }, 5226 // "isStrict": { 5227 // "description": "Whether the imported CSV must have the same number of column values for each row. If true, throws an exception if the CSV does not have the same number of columns. If false, rows with fewer column values will be padded with empty values. Default is true.", 5228 // "location": "query", 5229 // "type": "boolean" 5230 // }, 5231 // "startLine": { 5232 // "description": "The index of the first line from which to start importing, inclusive. Default is 0.", 5233 // "format": "int32", 5234 // "location": "query", 5235 // "type": "integer" 5236 // }, 5237 // "tableId": { 5238 // "description": "Table whose rows will be replaced.", 5239 // "location": "path", 5240 // "required": true, 5241 // "type": "string" 5242 // } 5243 // }, 5244 // "path": "tables/{tableId}/replace", 5245 // "response": { 5246 // "$ref": "Task" 5247 // }, 5248 // "scopes": [ 5249 // "https://www.googleapis.com/auth/fusiontables" 5250 // ], 5251 // "supportsMediaUpload": true 5252 // } 5253 5254} 5255 5256// method id "fusiontables.table.update": 5257 5258type TableUpdateCall struct { 5259 s *Service 5260 tableId string 5261 table *Table 5262 urlParams_ gensupport.URLParams 5263 ctx_ context.Context 5264 header_ http.Header 5265} 5266 5267// Update: Updates an existing table. Unless explicitly requested, only 5268// the name, description, and attribution will be updated. 5269func (r *TableService) Update(tableId string, table *Table) *TableUpdateCall { 5270 c := &TableUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5271 c.tableId = tableId 5272 c.table = table 5273 return c 5274} 5275 5276// ReplaceViewDefinition sets the optional parameter 5277// "replaceViewDefinition": Whether the view definition is also updated. 5278// The specified view definition replaces the existing one. Only a view 5279// can be updated with a new definition. 5280func (c *TableUpdateCall) ReplaceViewDefinition(replaceViewDefinition bool) *TableUpdateCall { 5281 c.urlParams_.Set("replaceViewDefinition", fmt.Sprint(replaceViewDefinition)) 5282 return c 5283} 5284 5285// Fields allows partial responses to be retrieved. See 5286// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5287// for more information. 5288func (c *TableUpdateCall) Fields(s ...googleapi.Field) *TableUpdateCall { 5289 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5290 return c 5291} 5292 5293// Context sets the context to be used in this call's Do method. Any 5294// pending HTTP request will be aborted if the provided context is 5295// canceled. 5296func (c *TableUpdateCall) Context(ctx context.Context) *TableUpdateCall { 5297 c.ctx_ = ctx 5298 return c 5299} 5300 5301// Header returns an http.Header that can be modified by the caller to 5302// add HTTP headers to the request. 5303func (c *TableUpdateCall) Header() http.Header { 5304 if c.header_ == nil { 5305 c.header_ = make(http.Header) 5306 } 5307 return c.header_ 5308} 5309 5310func (c *TableUpdateCall) doRequest(alt string) (*http.Response, error) { 5311 reqHeaders := make(http.Header) 5312 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 5313 for k, v := range c.header_ { 5314 reqHeaders[k] = v 5315 } 5316 reqHeaders.Set("User-Agent", c.s.userAgent()) 5317 var body io.Reader = nil 5318 body, err := googleapi.WithoutDataWrapper.JSONReader(c.table) 5319 if err != nil { 5320 return nil, err 5321 } 5322 reqHeaders.Set("Content-Type", "application/json") 5323 c.urlParams_.Set("alt", alt) 5324 c.urlParams_.Set("prettyPrint", "false") 5325 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}") 5326 urls += "?" + c.urlParams_.Encode() 5327 req, err := http.NewRequest("PUT", urls, body) 5328 if err != nil { 5329 return nil, err 5330 } 5331 req.Header = reqHeaders 5332 googleapi.Expand(req.URL, map[string]string{ 5333 "tableId": c.tableId, 5334 }) 5335 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5336} 5337 5338// Do executes the "fusiontables.table.update" call. 5339// Exactly one of *Table or error will be non-nil. Any non-2xx status 5340// code is an error. Response headers are in either 5341// *Table.ServerResponse.Header or (if a response was returned at all) 5342// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5343// check whether the returned error was because http.StatusNotModified 5344// was returned. 5345func (c *TableUpdateCall) Do(opts ...googleapi.CallOption) (*Table, error) { 5346 gensupport.SetOptions(c.urlParams_, opts...) 5347 res, err := c.doRequest("json") 5348 if res != nil && res.StatusCode == http.StatusNotModified { 5349 if res.Body != nil { 5350 res.Body.Close() 5351 } 5352 return nil, &googleapi.Error{ 5353 Code: res.StatusCode, 5354 Header: res.Header, 5355 } 5356 } 5357 if err != nil { 5358 return nil, err 5359 } 5360 defer googleapi.CloseBody(res) 5361 if err := googleapi.CheckResponse(res); err != nil { 5362 return nil, err 5363 } 5364 ret := &Table{ 5365 ServerResponse: googleapi.ServerResponse{ 5366 Header: res.Header, 5367 HTTPStatusCode: res.StatusCode, 5368 }, 5369 } 5370 target := &ret 5371 if err := gensupport.DecodeResponse(target, res); err != nil { 5372 return nil, err 5373 } 5374 return ret, nil 5375 // { 5376 // "description": "Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated.", 5377 // "httpMethod": "PUT", 5378 // "id": "fusiontables.table.update", 5379 // "parameterOrder": [ 5380 // "tableId" 5381 // ], 5382 // "parameters": { 5383 // "replaceViewDefinition": { 5384 // "description": "Whether the view definition is also updated. The specified view definition replaces the existing one. Only a view can be updated with a new definition.", 5385 // "location": "query", 5386 // "type": "boolean" 5387 // }, 5388 // "tableId": { 5389 // "description": "ID of the table that is being updated.", 5390 // "location": "path", 5391 // "required": true, 5392 // "type": "string" 5393 // } 5394 // }, 5395 // "path": "tables/{tableId}", 5396 // "request": { 5397 // "$ref": "Table" 5398 // }, 5399 // "response": { 5400 // "$ref": "Table" 5401 // }, 5402 // "scopes": [ 5403 // "https://www.googleapis.com/auth/fusiontables" 5404 // ] 5405 // } 5406 5407} 5408 5409// method id "fusiontables.task.delete": 5410 5411type TaskDeleteCall struct { 5412 s *Service 5413 tableId string 5414 taskId string 5415 urlParams_ gensupport.URLParams 5416 ctx_ context.Context 5417 header_ http.Header 5418} 5419 5420// Delete: Deletes a specific task by its ID, unless that task has 5421// already started running. 5422func (r *TaskService) Delete(tableId string, taskId string) *TaskDeleteCall { 5423 c := &TaskDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5424 c.tableId = tableId 5425 c.taskId = taskId 5426 return c 5427} 5428 5429// Fields allows partial responses to be retrieved. See 5430// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5431// for more information. 5432func (c *TaskDeleteCall) Fields(s ...googleapi.Field) *TaskDeleteCall { 5433 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5434 return c 5435} 5436 5437// Context sets the context to be used in this call's Do method. Any 5438// pending HTTP request will be aborted if the provided context is 5439// canceled. 5440func (c *TaskDeleteCall) Context(ctx context.Context) *TaskDeleteCall { 5441 c.ctx_ = ctx 5442 return c 5443} 5444 5445// Header returns an http.Header that can be modified by the caller to 5446// add HTTP headers to the request. 5447func (c *TaskDeleteCall) Header() http.Header { 5448 if c.header_ == nil { 5449 c.header_ = make(http.Header) 5450 } 5451 return c.header_ 5452} 5453 5454func (c *TaskDeleteCall) doRequest(alt string) (*http.Response, error) { 5455 reqHeaders := make(http.Header) 5456 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 5457 for k, v := range c.header_ { 5458 reqHeaders[k] = v 5459 } 5460 reqHeaders.Set("User-Agent", c.s.userAgent()) 5461 var body io.Reader = nil 5462 c.urlParams_.Set("alt", alt) 5463 c.urlParams_.Set("prettyPrint", "false") 5464 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/tasks/{taskId}") 5465 urls += "?" + c.urlParams_.Encode() 5466 req, err := http.NewRequest("DELETE", urls, body) 5467 if err != nil { 5468 return nil, err 5469 } 5470 req.Header = reqHeaders 5471 googleapi.Expand(req.URL, map[string]string{ 5472 "tableId": c.tableId, 5473 "taskId": c.taskId, 5474 }) 5475 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5476} 5477 5478// Do executes the "fusiontables.task.delete" call. 5479func (c *TaskDeleteCall) Do(opts ...googleapi.CallOption) error { 5480 gensupport.SetOptions(c.urlParams_, opts...) 5481 res, err := c.doRequest("json") 5482 if err != nil { 5483 return err 5484 } 5485 defer googleapi.CloseBody(res) 5486 if err := googleapi.CheckResponse(res); err != nil { 5487 return err 5488 } 5489 return nil 5490 // { 5491 // "description": "Deletes a specific task by its ID, unless that task has already started running.", 5492 // "httpMethod": "DELETE", 5493 // "id": "fusiontables.task.delete", 5494 // "parameterOrder": [ 5495 // "tableId", 5496 // "taskId" 5497 // ], 5498 // "parameters": { 5499 // "tableId": { 5500 // "description": "Table from which the task is being deleted.", 5501 // "location": "path", 5502 // "required": true, 5503 // "type": "string" 5504 // }, 5505 // "taskId": { 5506 // "description": "The identifier of the task to delete.", 5507 // "location": "path", 5508 // "required": true, 5509 // "type": "string" 5510 // } 5511 // }, 5512 // "path": "tables/{tableId}/tasks/{taskId}", 5513 // "scopes": [ 5514 // "https://www.googleapis.com/auth/fusiontables" 5515 // ] 5516 // } 5517 5518} 5519 5520// method id "fusiontables.task.get": 5521 5522type TaskGetCall struct { 5523 s *Service 5524 tableId string 5525 taskId string 5526 urlParams_ gensupport.URLParams 5527 ifNoneMatch_ string 5528 ctx_ context.Context 5529 header_ http.Header 5530} 5531 5532// Get: Retrieves a specific task by its ID. 5533func (r *TaskService) Get(tableId string, taskId string) *TaskGetCall { 5534 c := &TaskGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5535 c.tableId = tableId 5536 c.taskId = taskId 5537 return c 5538} 5539 5540// Fields allows partial responses to be retrieved. See 5541// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5542// for more information. 5543func (c *TaskGetCall) Fields(s ...googleapi.Field) *TaskGetCall { 5544 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5545 return c 5546} 5547 5548// IfNoneMatch sets the optional parameter which makes the operation 5549// fail if the object's ETag matches the given value. This is useful for 5550// getting updates only after the object has changed since the last 5551// request. Use googleapi.IsNotModified to check whether the response 5552// error from Do is the result of In-None-Match. 5553func (c *TaskGetCall) IfNoneMatch(entityTag string) *TaskGetCall { 5554 c.ifNoneMatch_ = entityTag 5555 return c 5556} 5557 5558// Context sets the context to be used in this call's Do method. Any 5559// pending HTTP request will be aborted if the provided context is 5560// canceled. 5561func (c *TaskGetCall) Context(ctx context.Context) *TaskGetCall { 5562 c.ctx_ = ctx 5563 return c 5564} 5565 5566// Header returns an http.Header that can be modified by the caller to 5567// add HTTP headers to the request. 5568func (c *TaskGetCall) Header() http.Header { 5569 if c.header_ == nil { 5570 c.header_ = make(http.Header) 5571 } 5572 return c.header_ 5573} 5574 5575func (c *TaskGetCall) doRequest(alt string) (*http.Response, error) { 5576 reqHeaders := make(http.Header) 5577 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 5578 for k, v := range c.header_ { 5579 reqHeaders[k] = v 5580 } 5581 reqHeaders.Set("User-Agent", c.s.userAgent()) 5582 if c.ifNoneMatch_ != "" { 5583 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5584 } 5585 var body io.Reader = nil 5586 c.urlParams_.Set("alt", alt) 5587 c.urlParams_.Set("prettyPrint", "false") 5588 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/tasks/{taskId}") 5589 urls += "?" + c.urlParams_.Encode() 5590 req, err := http.NewRequest("GET", urls, body) 5591 if err != nil { 5592 return nil, err 5593 } 5594 req.Header = reqHeaders 5595 googleapi.Expand(req.URL, map[string]string{ 5596 "tableId": c.tableId, 5597 "taskId": c.taskId, 5598 }) 5599 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5600} 5601 5602// Do executes the "fusiontables.task.get" call. 5603// Exactly one of *Task or error will be non-nil. Any non-2xx status 5604// code is an error. Response headers are in either 5605// *Task.ServerResponse.Header or (if a response was returned at all) in 5606// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 5607// whether the returned error was because http.StatusNotModified was 5608// returned. 5609func (c *TaskGetCall) Do(opts ...googleapi.CallOption) (*Task, error) { 5610 gensupport.SetOptions(c.urlParams_, opts...) 5611 res, err := c.doRequest("json") 5612 if res != nil && res.StatusCode == http.StatusNotModified { 5613 if res.Body != nil { 5614 res.Body.Close() 5615 } 5616 return nil, &googleapi.Error{ 5617 Code: res.StatusCode, 5618 Header: res.Header, 5619 } 5620 } 5621 if err != nil { 5622 return nil, err 5623 } 5624 defer googleapi.CloseBody(res) 5625 if err := googleapi.CheckResponse(res); err != nil { 5626 return nil, err 5627 } 5628 ret := &Task{ 5629 ServerResponse: googleapi.ServerResponse{ 5630 Header: res.Header, 5631 HTTPStatusCode: res.StatusCode, 5632 }, 5633 } 5634 target := &ret 5635 if err := gensupport.DecodeResponse(target, res); err != nil { 5636 return nil, err 5637 } 5638 return ret, nil 5639 // { 5640 // "description": "Retrieves a specific task by its ID.", 5641 // "httpMethod": "GET", 5642 // "id": "fusiontables.task.get", 5643 // "parameterOrder": [ 5644 // "tableId", 5645 // "taskId" 5646 // ], 5647 // "parameters": { 5648 // "tableId": { 5649 // "description": "Table to which the task belongs.", 5650 // "location": "path", 5651 // "required": true, 5652 // "type": "string" 5653 // }, 5654 // "taskId": { 5655 // "description": "The identifier of the task to get.", 5656 // "location": "path", 5657 // "required": true, 5658 // "type": "string" 5659 // } 5660 // }, 5661 // "path": "tables/{tableId}/tasks/{taskId}", 5662 // "response": { 5663 // "$ref": "Task" 5664 // }, 5665 // "scopes": [ 5666 // "https://www.googleapis.com/auth/fusiontables", 5667 // "https://www.googleapis.com/auth/fusiontables.readonly" 5668 // ] 5669 // } 5670 5671} 5672 5673// method id "fusiontables.task.list": 5674 5675type TaskListCall struct { 5676 s *Service 5677 tableId string 5678 urlParams_ gensupport.URLParams 5679 ifNoneMatch_ string 5680 ctx_ context.Context 5681 header_ http.Header 5682} 5683 5684// List: Retrieves a list of tasks. 5685func (r *TaskService) List(tableId string) *TaskListCall { 5686 c := &TaskListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5687 c.tableId = tableId 5688 return c 5689} 5690 5691// MaxResults sets the optional parameter "maxResults": Maximum number 5692// of tasks to return. Default is 5. 5693func (c *TaskListCall) MaxResults(maxResults int64) *TaskListCall { 5694 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 5695 return c 5696} 5697 5698// PageToken sets the optional parameter "pageToken": Continuation token 5699// specifying which result page to return. 5700func (c *TaskListCall) PageToken(pageToken string) *TaskListCall { 5701 c.urlParams_.Set("pageToken", pageToken) 5702 return c 5703} 5704 5705// StartIndex sets the optional parameter "startIndex": Index of the 5706// first result returned in the current page. 5707func (c *TaskListCall) StartIndex(startIndex int64) *TaskListCall { 5708 c.urlParams_.Set("startIndex", fmt.Sprint(startIndex)) 5709 return c 5710} 5711 5712// Fields allows partial responses to be retrieved. See 5713// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5714// for more information. 5715func (c *TaskListCall) Fields(s ...googleapi.Field) *TaskListCall { 5716 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5717 return c 5718} 5719 5720// IfNoneMatch sets the optional parameter which makes the operation 5721// fail if the object's ETag matches the given value. This is useful for 5722// getting updates only after the object has changed since the last 5723// request. Use googleapi.IsNotModified to check whether the response 5724// error from Do is the result of In-None-Match. 5725func (c *TaskListCall) IfNoneMatch(entityTag string) *TaskListCall { 5726 c.ifNoneMatch_ = entityTag 5727 return c 5728} 5729 5730// Context sets the context to be used in this call's Do method. Any 5731// pending HTTP request will be aborted if the provided context is 5732// canceled. 5733func (c *TaskListCall) Context(ctx context.Context) *TaskListCall { 5734 c.ctx_ = ctx 5735 return c 5736} 5737 5738// Header returns an http.Header that can be modified by the caller to 5739// add HTTP headers to the request. 5740func (c *TaskListCall) Header() http.Header { 5741 if c.header_ == nil { 5742 c.header_ = make(http.Header) 5743 } 5744 return c.header_ 5745} 5746 5747func (c *TaskListCall) doRequest(alt string) (*http.Response, error) { 5748 reqHeaders := make(http.Header) 5749 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 5750 for k, v := range c.header_ { 5751 reqHeaders[k] = v 5752 } 5753 reqHeaders.Set("User-Agent", c.s.userAgent()) 5754 if c.ifNoneMatch_ != "" { 5755 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5756 } 5757 var body io.Reader = nil 5758 c.urlParams_.Set("alt", alt) 5759 c.urlParams_.Set("prettyPrint", "false") 5760 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/tasks") 5761 urls += "?" + c.urlParams_.Encode() 5762 req, err := http.NewRequest("GET", urls, body) 5763 if err != nil { 5764 return nil, err 5765 } 5766 req.Header = reqHeaders 5767 googleapi.Expand(req.URL, map[string]string{ 5768 "tableId": c.tableId, 5769 }) 5770 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5771} 5772 5773// Do executes the "fusiontables.task.list" call. 5774// Exactly one of *TaskList or error will be non-nil. Any non-2xx status 5775// code is an error. Response headers are in either 5776// *TaskList.ServerResponse.Header or (if a response was returned at 5777// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5778// to check whether the returned error was because 5779// http.StatusNotModified was returned. 5780func (c *TaskListCall) Do(opts ...googleapi.CallOption) (*TaskList, error) { 5781 gensupport.SetOptions(c.urlParams_, opts...) 5782 res, err := c.doRequest("json") 5783 if res != nil && res.StatusCode == http.StatusNotModified { 5784 if res.Body != nil { 5785 res.Body.Close() 5786 } 5787 return nil, &googleapi.Error{ 5788 Code: res.StatusCode, 5789 Header: res.Header, 5790 } 5791 } 5792 if err != nil { 5793 return nil, err 5794 } 5795 defer googleapi.CloseBody(res) 5796 if err := googleapi.CheckResponse(res); err != nil { 5797 return nil, err 5798 } 5799 ret := &TaskList{ 5800 ServerResponse: googleapi.ServerResponse{ 5801 Header: res.Header, 5802 HTTPStatusCode: res.StatusCode, 5803 }, 5804 } 5805 target := &ret 5806 if err := gensupport.DecodeResponse(target, res); err != nil { 5807 return nil, err 5808 } 5809 return ret, nil 5810 // { 5811 // "description": "Retrieves a list of tasks.", 5812 // "httpMethod": "GET", 5813 // "id": "fusiontables.task.list", 5814 // "parameterOrder": [ 5815 // "tableId" 5816 // ], 5817 // "parameters": { 5818 // "maxResults": { 5819 // "description": "Maximum number of tasks to return. Default is 5.", 5820 // "format": "uint32", 5821 // "location": "query", 5822 // "minimum": "0", 5823 // "type": "integer" 5824 // }, 5825 // "pageToken": { 5826 // "description": "Continuation token specifying which result page to return.", 5827 // "location": "query", 5828 // "type": "string" 5829 // }, 5830 // "startIndex": { 5831 // "description": "Index of the first result returned in the current page.", 5832 // "format": "uint32", 5833 // "location": "query", 5834 // "type": "integer" 5835 // }, 5836 // "tableId": { 5837 // "description": "Table whose tasks are being listed.", 5838 // "location": "path", 5839 // "required": true, 5840 // "type": "string" 5841 // } 5842 // }, 5843 // "path": "tables/{tableId}/tasks", 5844 // "response": { 5845 // "$ref": "TaskList" 5846 // }, 5847 // "scopes": [ 5848 // "https://www.googleapis.com/auth/fusiontables", 5849 // "https://www.googleapis.com/auth/fusiontables.readonly" 5850 // ] 5851 // } 5852 5853} 5854 5855// Pages invokes f for each page of results. 5856// A non-nil error returned from f will halt the iteration. 5857// The provided context supersedes any context provided to the Context method. 5858func (c *TaskListCall) Pages(ctx context.Context, f func(*TaskList) error) error { 5859 c.ctx_ = ctx 5860 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5861 for { 5862 x, err := c.Do() 5863 if err != nil { 5864 return err 5865 } 5866 if err := f(x); err != nil { 5867 return err 5868 } 5869 if x.NextPageToken == "" { 5870 return nil 5871 } 5872 c.PageToken(x.NextPageToken) 5873 } 5874} 5875 5876// method id "fusiontables.template.delete": 5877 5878type TemplateDeleteCall struct { 5879 s *Service 5880 tableId string 5881 templateId int64 5882 urlParams_ gensupport.URLParams 5883 ctx_ context.Context 5884 header_ http.Header 5885} 5886 5887// Delete: Deletes a template 5888func (r *TemplateService) Delete(tableId string, templateId int64) *TemplateDeleteCall { 5889 c := &TemplateDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5890 c.tableId = tableId 5891 c.templateId = templateId 5892 return c 5893} 5894 5895// Fields allows partial responses to be retrieved. See 5896// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5897// for more information. 5898func (c *TemplateDeleteCall) Fields(s ...googleapi.Field) *TemplateDeleteCall { 5899 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5900 return c 5901} 5902 5903// Context sets the context to be used in this call's Do method. Any 5904// pending HTTP request will be aborted if the provided context is 5905// canceled. 5906func (c *TemplateDeleteCall) Context(ctx context.Context) *TemplateDeleteCall { 5907 c.ctx_ = ctx 5908 return c 5909} 5910 5911// Header returns an http.Header that can be modified by the caller to 5912// add HTTP headers to the request. 5913func (c *TemplateDeleteCall) Header() http.Header { 5914 if c.header_ == nil { 5915 c.header_ = make(http.Header) 5916 } 5917 return c.header_ 5918} 5919 5920func (c *TemplateDeleteCall) doRequest(alt string) (*http.Response, error) { 5921 reqHeaders := make(http.Header) 5922 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 5923 for k, v := range c.header_ { 5924 reqHeaders[k] = v 5925 } 5926 reqHeaders.Set("User-Agent", c.s.userAgent()) 5927 var body io.Reader = nil 5928 c.urlParams_.Set("alt", alt) 5929 c.urlParams_.Set("prettyPrint", "false") 5930 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/templates/{templateId}") 5931 urls += "?" + c.urlParams_.Encode() 5932 req, err := http.NewRequest("DELETE", urls, body) 5933 if err != nil { 5934 return nil, err 5935 } 5936 req.Header = reqHeaders 5937 googleapi.Expand(req.URL, map[string]string{ 5938 "tableId": c.tableId, 5939 "templateId": strconv.FormatInt(c.templateId, 10), 5940 }) 5941 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5942} 5943 5944// Do executes the "fusiontables.template.delete" call. 5945func (c *TemplateDeleteCall) Do(opts ...googleapi.CallOption) error { 5946 gensupport.SetOptions(c.urlParams_, opts...) 5947 res, err := c.doRequest("json") 5948 if err != nil { 5949 return err 5950 } 5951 defer googleapi.CloseBody(res) 5952 if err := googleapi.CheckResponse(res); err != nil { 5953 return err 5954 } 5955 return nil 5956 // { 5957 // "description": "Deletes a template", 5958 // "httpMethod": "DELETE", 5959 // "id": "fusiontables.template.delete", 5960 // "parameterOrder": [ 5961 // "tableId", 5962 // "templateId" 5963 // ], 5964 // "parameters": { 5965 // "tableId": { 5966 // "description": "Table from which the template is being deleted", 5967 // "location": "path", 5968 // "required": true, 5969 // "type": "string" 5970 // }, 5971 // "templateId": { 5972 // "description": "Identifier for the template which is being deleted", 5973 // "format": "int32", 5974 // "location": "path", 5975 // "required": true, 5976 // "type": "integer" 5977 // } 5978 // }, 5979 // "path": "tables/{tableId}/templates/{templateId}", 5980 // "scopes": [ 5981 // "https://www.googleapis.com/auth/fusiontables" 5982 // ] 5983 // } 5984 5985} 5986 5987// method id "fusiontables.template.get": 5988 5989type TemplateGetCall struct { 5990 s *Service 5991 tableId string 5992 templateId int64 5993 urlParams_ gensupport.URLParams 5994 ifNoneMatch_ string 5995 ctx_ context.Context 5996 header_ http.Header 5997} 5998 5999// Get: Retrieves a specific template by its id 6000func (r *TemplateService) Get(tableId string, templateId int64) *TemplateGetCall { 6001 c := &TemplateGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6002 c.tableId = tableId 6003 c.templateId = templateId 6004 return c 6005} 6006 6007// Fields allows partial responses to be retrieved. See 6008// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6009// for more information. 6010func (c *TemplateGetCall) Fields(s ...googleapi.Field) *TemplateGetCall { 6011 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6012 return c 6013} 6014 6015// IfNoneMatch sets the optional parameter which makes the operation 6016// fail if the object's ETag matches the given value. This is useful for 6017// getting updates only after the object has changed since the last 6018// request. Use googleapi.IsNotModified to check whether the response 6019// error from Do is the result of In-None-Match. 6020func (c *TemplateGetCall) IfNoneMatch(entityTag string) *TemplateGetCall { 6021 c.ifNoneMatch_ = entityTag 6022 return c 6023} 6024 6025// Context sets the context to be used in this call's Do method. Any 6026// pending HTTP request will be aborted if the provided context is 6027// canceled. 6028func (c *TemplateGetCall) Context(ctx context.Context) *TemplateGetCall { 6029 c.ctx_ = ctx 6030 return c 6031} 6032 6033// Header returns an http.Header that can be modified by the caller to 6034// add HTTP headers to the request. 6035func (c *TemplateGetCall) Header() http.Header { 6036 if c.header_ == nil { 6037 c.header_ = make(http.Header) 6038 } 6039 return c.header_ 6040} 6041 6042func (c *TemplateGetCall) doRequest(alt string) (*http.Response, error) { 6043 reqHeaders := make(http.Header) 6044 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 6045 for k, v := range c.header_ { 6046 reqHeaders[k] = v 6047 } 6048 reqHeaders.Set("User-Agent", c.s.userAgent()) 6049 if c.ifNoneMatch_ != "" { 6050 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6051 } 6052 var body io.Reader = nil 6053 c.urlParams_.Set("alt", alt) 6054 c.urlParams_.Set("prettyPrint", "false") 6055 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/templates/{templateId}") 6056 urls += "?" + c.urlParams_.Encode() 6057 req, err := http.NewRequest("GET", urls, body) 6058 if err != nil { 6059 return nil, err 6060 } 6061 req.Header = reqHeaders 6062 googleapi.Expand(req.URL, map[string]string{ 6063 "tableId": c.tableId, 6064 "templateId": strconv.FormatInt(c.templateId, 10), 6065 }) 6066 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6067} 6068 6069// Do executes the "fusiontables.template.get" call. 6070// Exactly one of *Template or error will be non-nil. Any non-2xx status 6071// code is an error. Response headers are in either 6072// *Template.ServerResponse.Header or (if a response was returned at 6073// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6074// to check whether the returned error was because 6075// http.StatusNotModified was returned. 6076func (c *TemplateGetCall) Do(opts ...googleapi.CallOption) (*Template, error) { 6077 gensupport.SetOptions(c.urlParams_, opts...) 6078 res, err := c.doRequest("json") 6079 if res != nil && res.StatusCode == http.StatusNotModified { 6080 if res.Body != nil { 6081 res.Body.Close() 6082 } 6083 return nil, &googleapi.Error{ 6084 Code: res.StatusCode, 6085 Header: res.Header, 6086 } 6087 } 6088 if err != nil { 6089 return nil, err 6090 } 6091 defer googleapi.CloseBody(res) 6092 if err := googleapi.CheckResponse(res); err != nil { 6093 return nil, err 6094 } 6095 ret := &Template{ 6096 ServerResponse: googleapi.ServerResponse{ 6097 Header: res.Header, 6098 HTTPStatusCode: res.StatusCode, 6099 }, 6100 } 6101 target := &ret 6102 if err := gensupport.DecodeResponse(target, res); err != nil { 6103 return nil, err 6104 } 6105 return ret, nil 6106 // { 6107 // "description": "Retrieves a specific template by its id", 6108 // "httpMethod": "GET", 6109 // "id": "fusiontables.template.get", 6110 // "parameterOrder": [ 6111 // "tableId", 6112 // "templateId" 6113 // ], 6114 // "parameters": { 6115 // "tableId": { 6116 // "description": "Table to which the template belongs", 6117 // "location": "path", 6118 // "required": true, 6119 // "type": "string" 6120 // }, 6121 // "templateId": { 6122 // "description": "Identifier for the template that is being requested", 6123 // "format": "int32", 6124 // "location": "path", 6125 // "required": true, 6126 // "type": "integer" 6127 // } 6128 // }, 6129 // "path": "tables/{tableId}/templates/{templateId}", 6130 // "response": { 6131 // "$ref": "Template" 6132 // }, 6133 // "scopes": [ 6134 // "https://www.googleapis.com/auth/fusiontables", 6135 // "https://www.googleapis.com/auth/fusiontables.readonly" 6136 // ] 6137 // } 6138 6139} 6140 6141// method id "fusiontables.template.insert": 6142 6143type TemplateInsertCall struct { 6144 s *Service 6145 tableId string 6146 template *Template 6147 urlParams_ gensupport.URLParams 6148 ctx_ context.Context 6149 header_ http.Header 6150} 6151 6152// Insert: Creates a new template for the table. 6153func (r *TemplateService) Insert(tableId string, template *Template) *TemplateInsertCall { 6154 c := &TemplateInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6155 c.tableId = tableId 6156 c.template = template 6157 return c 6158} 6159 6160// Fields allows partial responses to be retrieved. See 6161// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6162// for more information. 6163func (c *TemplateInsertCall) Fields(s ...googleapi.Field) *TemplateInsertCall { 6164 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6165 return c 6166} 6167 6168// Context sets the context to be used in this call's Do method. Any 6169// pending HTTP request will be aborted if the provided context is 6170// canceled. 6171func (c *TemplateInsertCall) Context(ctx context.Context) *TemplateInsertCall { 6172 c.ctx_ = ctx 6173 return c 6174} 6175 6176// Header returns an http.Header that can be modified by the caller to 6177// add HTTP headers to the request. 6178func (c *TemplateInsertCall) Header() http.Header { 6179 if c.header_ == nil { 6180 c.header_ = make(http.Header) 6181 } 6182 return c.header_ 6183} 6184 6185func (c *TemplateInsertCall) doRequest(alt string) (*http.Response, error) { 6186 reqHeaders := make(http.Header) 6187 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 6188 for k, v := range c.header_ { 6189 reqHeaders[k] = v 6190 } 6191 reqHeaders.Set("User-Agent", c.s.userAgent()) 6192 var body io.Reader = nil 6193 body, err := googleapi.WithoutDataWrapper.JSONReader(c.template) 6194 if err != nil { 6195 return nil, err 6196 } 6197 reqHeaders.Set("Content-Type", "application/json") 6198 c.urlParams_.Set("alt", alt) 6199 c.urlParams_.Set("prettyPrint", "false") 6200 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/templates") 6201 urls += "?" + c.urlParams_.Encode() 6202 req, err := http.NewRequest("POST", urls, body) 6203 if err != nil { 6204 return nil, err 6205 } 6206 req.Header = reqHeaders 6207 googleapi.Expand(req.URL, map[string]string{ 6208 "tableId": c.tableId, 6209 }) 6210 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6211} 6212 6213// Do executes the "fusiontables.template.insert" call. 6214// Exactly one of *Template or error will be non-nil. Any non-2xx status 6215// code is an error. Response headers are in either 6216// *Template.ServerResponse.Header or (if a response was returned at 6217// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6218// to check whether the returned error was because 6219// http.StatusNotModified was returned. 6220func (c *TemplateInsertCall) Do(opts ...googleapi.CallOption) (*Template, error) { 6221 gensupport.SetOptions(c.urlParams_, opts...) 6222 res, err := c.doRequest("json") 6223 if res != nil && res.StatusCode == http.StatusNotModified { 6224 if res.Body != nil { 6225 res.Body.Close() 6226 } 6227 return nil, &googleapi.Error{ 6228 Code: res.StatusCode, 6229 Header: res.Header, 6230 } 6231 } 6232 if err != nil { 6233 return nil, err 6234 } 6235 defer googleapi.CloseBody(res) 6236 if err := googleapi.CheckResponse(res); err != nil { 6237 return nil, err 6238 } 6239 ret := &Template{ 6240 ServerResponse: googleapi.ServerResponse{ 6241 Header: res.Header, 6242 HTTPStatusCode: res.StatusCode, 6243 }, 6244 } 6245 target := &ret 6246 if err := gensupport.DecodeResponse(target, res); err != nil { 6247 return nil, err 6248 } 6249 return ret, nil 6250 // { 6251 // "description": "Creates a new template for the table.", 6252 // "httpMethod": "POST", 6253 // "id": "fusiontables.template.insert", 6254 // "parameterOrder": [ 6255 // "tableId" 6256 // ], 6257 // "parameters": { 6258 // "tableId": { 6259 // "description": "Table for which a new template is being created", 6260 // "location": "path", 6261 // "required": true, 6262 // "type": "string" 6263 // } 6264 // }, 6265 // "path": "tables/{tableId}/templates", 6266 // "request": { 6267 // "$ref": "Template" 6268 // }, 6269 // "response": { 6270 // "$ref": "Template" 6271 // }, 6272 // "scopes": [ 6273 // "https://www.googleapis.com/auth/fusiontables" 6274 // ] 6275 // } 6276 6277} 6278 6279// method id "fusiontables.template.list": 6280 6281type TemplateListCall struct { 6282 s *Service 6283 tableId string 6284 urlParams_ gensupport.URLParams 6285 ifNoneMatch_ string 6286 ctx_ context.Context 6287 header_ http.Header 6288} 6289 6290// List: Retrieves a list of templates. 6291func (r *TemplateService) List(tableId string) *TemplateListCall { 6292 c := &TemplateListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6293 c.tableId = tableId 6294 return c 6295} 6296 6297// MaxResults sets the optional parameter "maxResults": Maximum number 6298// of templates to return. Default is 5. 6299func (c *TemplateListCall) MaxResults(maxResults int64) *TemplateListCall { 6300 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 6301 return c 6302} 6303 6304// PageToken sets the optional parameter "pageToken": Continuation token 6305// specifying which results page to return. 6306func (c *TemplateListCall) PageToken(pageToken string) *TemplateListCall { 6307 c.urlParams_.Set("pageToken", pageToken) 6308 return c 6309} 6310 6311// Fields allows partial responses to be retrieved. See 6312// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6313// for more information. 6314func (c *TemplateListCall) Fields(s ...googleapi.Field) *TemplateListCall { 6315 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6316 return c 6317} 6318 6319// IfNoneMatch sets the optional parameter which makes the operation 6320// fail if the object's ETag matches the given value. This is useful for 6321// getting updates only after the object has changed since the last 6322// request. Use googleapi.IsNotModified to check whether the response 6323// error from Do is the result of In-None-Match. 6324func (c *TemplateListCall) IfNoneMatch(entityTag string) *TemplateListCall { 6325 c.ifNoneMatch_ = entityTag 6326 return c 6327} 6328 6329// Context sets the context to be used in this call's Do method. Any 6330// pending HTTP request will be aborted if the provided context is 6331// canceled. 6332func (c *TemplateListCall) Context(ctx context.Context) *TemplateListCall { 6333 c.ctx_ = ctx 6334 return c 6335} 6336 6337// Header returns an http.Header that can be modified by the caller to 6338// add HTTP headers to the request. 6339func (c *TemplateListCall) Header() http.Header { 6340 if c.header_ == nil { 6341 c.header_ = make(http.Header) 6342 } 6343 return c.header_ 6344} 6345 6346func (c *TemplateListCall) doRequest(alt string) (*http.Response, error) { 6347 reqHeaders := make(http.Header) 6348 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 6349 for k, v := range c.header_ { 6350 reqHeaders[k] = v 6351 } 6352 reqHeaders.Set("User-Agent", c.s.userAgent()) 6353 if c.ifNoneMatch_ != "" { 6354 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6355 } 6356 var body io.Reader = nil 6357 c.urlParams_.Set("alt", alt) 6358 c.urlParams_.Set("prettyPrint", "false") 6359 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/templates") 6360 urls += "?" + c.urlParams_.Encode() 6361 req, err := http.NewRequest("GET", urls, body) 6362 if err != nil { 6363 return nil, err 6364 } 6365 req.Header = reqHeaders 6366 googleapi.Expand(req.URL, map[string]string{ 6367 "tableId": c.tableId, 6368 }) 6369 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6370} 6371 6372// Do executes the "fusiontables.template.list" call. 6373// Exactly one of *TemplateList or error will be non-nil. Any non-2xx 6374// status code is an error. Response headers are in either 6375// *TemplateList.ServerResponse.Header or (if a response was returned at 6376// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6377// to check whether the returned error was because 6378// http.StatusNotModified was returned. 6379func (c *TemplateListCall) Do(opts ...googleapi.CallOption) (*TemplateList, error) { 6380 gensupport.SetOptions(c.urlParams_, opts...) 6381 res, err := c.doRequest("json") 6382 if res != nil && res.StatusCode == http.StatusNotModified { 6383 if res.Body != nil { 6384 res.Body.Close() 6385 } 6386 return nil, &googleapi.Error{ 6387 Code: res.StatusCode, 6388 Header: res.Header, 6389 } 6390 } 6391 if err != nil { 6392 return nil, err 6393 } 6394 defer googleapi.CloseBody(res) 6395 if err := googleapi.CheckResponse(res); err != nil { 6396 return nil, err 6397 } 6398 ret := &TemplateList{ 6399 ServerResponse: googleapi.ServerResponse{ 6400 Header: res.Header, 6401 HTTPStatusCode: res.StatusCode, 6402 }, 6403 } 6404 target := &ret 6405 if err := gensupport.DecodeResponse(target, res); err != nil { 6406 return nil, err 6407 } 6408 return ret, nil 6409 // { 6410 // "description": "Retrieves a list of templates.", 6411 // "httpMethod": "GET", 6412 // "id": "fusiontables.template.list", 6413 // "parameterOrder": [ 6414 // "tableId" 6415 // ], 6416 // "parameters": { 6417 // "maxResults": { 6418 // "description": "Maximum number of templates to return. Optional. Default is 5.", 6419 // "format": "uint32", 6420 // "location": "query", 6421 // "minimum": "0", 6422 // "type": "integer" 6423 // }, 6424 // "pageToken": { 6425 // "description": "Continuation token specifying which results page to return. Optional.", 6426 // "location": "query", 6427 // "type": "string" 6428 // }, 6429 // "tableId": { 6430 // "description": "Identifier for the table whose templates are being requested", 6431 // "location": "path", 6432 // "required": true, 6433 // "type": "string" 6434 // } 6435 // }, 6436 // "path": "tables/{tableId}/templates", 6437 // "response": { 6438 // "$ref": "TemplateList" 6439 // }, 6440 // "scopes": [ 6441 // "https://www.googleapis.com/auth/fusiontables", 6442 // "https://www.googleapis.com/auth/fusiontables.readonly" 6443 // ] 6444 // } 6445 6446} 6447 6448// Pages invokes f for each page of results. 6449// A non-nil error returned from f will halt the iteration. 6450// The provided context supersedes any context provided to the Context method. 6451func (c *TemplateListCall) Pages(ctx context.Context, f func(*TemplateList) error) error { 6452 c.ctx_ = ctx 6453 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6454 for { 6455 x, err := c.Do() 6456 if err != nil { 6457 return err 6458 } 6459 if err := f(x); err != nil { 6460 return err 6461 } 6462 if x.NextPageToken == "" { 6463 return nil 6464 } 6465 c.PageToken(x.NextPageToken) 6466 } 6467} 6468 6469// method id "fusiontables.template.patch": 6470 6471type TemplatePatchCall struct { 6472 s *Service 6473 tableId string 6474 templateId int64 6475 template *Template 6476 urlParams_ gensupport.URLParams 6477 ctx_ context.Context 6478 header_ http.Header 6479} 6480 6481// Patch: Updates an existing template. This method supports patch 6482// semantics. 6483func (r *TemplateService) Patch(tableId string, templateId int64, template *Template) *TemplatePatchCall { 6484 c := &TemplatePatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6485 c.tableId = tableId 6486 c.templateId = templateId 6487 c.template = template 6488 return c 6489} 6490 6491// Fields allows partial responses to be retrieved. See 6492// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6493// for more information. 6494func (c *TemplatePatchCall) Fields(s ...googleapi.Field) *TemplatePatchCall { 6495 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6496 return c 6497} 6498 6499// Context sets the context to be used in this call's Do method. Any 6500// pending HTTP request will be aborted if the provided context is 6501// canceled. 6502func (c *TemplatePatchCall) Context(ctx context.Context) *TemplatePatchCall { 6503 c.ctx_ = ctx 6504 return c 6505} 6506 6507// Header returns an http.Header that can be modified by the caller to 6508// add HTTP headers to the request. 6509func (c *TemplatePatchCall) Header() http.Header { 6510 if c.header_ == nil { 6511 c.header_ = make(http.Header) 6512 } 6513 return c.header_ 6514} 6515 6516func (c *TemplatePatchCall) doRequest(alt string) (*http.Response, error) { 6517 reqHeaders := make(http.Header) 6518 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 6519 for k, v := range c.header_ { 6520 reqHeaders[k] = v 6521 } 6522 reqHeaders.Set("User-Agent", c.s.userAgent()) 6523 var body io.Reader = nil 6524 body, err := googleapi.WithoutDataWrapper.JSONReader(c.template) 6525 if err != nil { 6526 return nil, err 6527 } 6528 reqHeaders.Set("Content-Type", "application/json") 6529 c.urlParams_.Set("alt", alt) 6530 c.urlParams_.Set("prettyPrint", "false") 6531 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/templates/{templateId}") 6532 urls += "?" + c.urlParams_.Encode() 6533 req, err := http.NewRequest("PATCH", urls, body) 6534 if err != nil { 6535 return nil, err 6536 } 6537 req.Header = reqHeaders 6538 googleapi.Expand(req.URL, map[string]string{ 6539 "tableId": c.tableId, 6540 "templateId": strconv.FormatInt(c.templateId, 10), 6541 }) 6542 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6543} 6544 6545// Do executes the "fusiontables.template.patch" call. 6546// Exactly one of *Template or error will be non-nil. Any non-2xx status 6547// code is an error. Response headers are in either 6548// *Template.ServerResponse.Header or (if a response was returned at 6549// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6550// to check whether the returned error was because 6551// http.StatusNotModified was returned. 6552func (c *TemplatePatchCall) Do(opts ...googleapi.CallOption) (*Template, error) { 6553 gensupport.SetOptions(c.urlParams_, opts...) 6554 res, err := c.doRequest("json") 6555 if res != nil && res.StatusCode == http.StatusNotModified { 6556 if res.Body != nil { 6557 res.Body.Close() 6558 } 6559 return nil, &googleapi.Error{ 6560 Code: res.StatusCode, 6561 Header: res.Header, 6562 } 6563 } 6564 if err != nil { 6565 return nil, err 6566 } 6567 defer googleapi.CloseBody(res) 6568 if err := googleapi.CheckResponse(res); err != nil { 6569 return nil, err 6570 } 6571 ret := &Template{ 6572 ServerResponse: googleapi.ServerResponse{ 6573 Header: res.Header, 6574 HTTPStatusCode: res.StatusCode, 6575 }, 6576 } 6577 target := &ret 6578 if err := gensupport.DecodeResponse(target, res); err != nil { 6579 return nil, err 6580 } 6581 return ret, nil 6582 // { 6583 // "description": "Updates an existing template. This method supports patch semantics.", 6584 // "httpMethod": "PATCH", 6585 // "id": "fusiontables.template.patch", 6586 // "parameterOrder": [ 6587 // "tableId", 6588 // "templateId" 6589 // ], 6590 // "parameters": { 6591 // "tableId": { 6592 // "description": "Table to which the updated template belongs", 6593 // "location": "path", 6594 // "required": true, 6595 // "type": "string" 6596 // }, 6597 // "templateId": { 6598 // "description": "Identifier for the template that is being updated", 6599 // "format": "int32", 6600 // "location": "path", 6601 // "required": true, 6602 // "type": "integer" 6603 // } 6604 // }, 6605 // "path": "tables/{tableId}/templates/{templateId}", 6606 // "request": { 6607 // "$ref": "Template" 6608 // }, 6609 // "response": { 6610 // "$ref": "Template" 6611 // }, 6612 // "scopes": [ 6613 // "https://www.googleapis.com/auth/fusiontables" 6614 // ] 6615 // } 6616 6617} 6618 6619// method id "fusiontables.template.update": 6620 6621type TemplateUpdateCall struct { 6622 s *Service 6623 tableId string 6624 templateId int64 6625 template *Template 6626 urlParams_ gensupport.URLParams 6627 ctx_ context.Context 6628 header_ http.Header 6629} 6630 6631// Update: Updates an existing template 6632func (r *TemplateService) Update(tableId string, templateId int64, template *Template) *TemplateUpdateCall { 6633 c := &TemplateUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6634 c.tableId = tableId 6635 c.templateId = templateId 6636 c.template = template 6637 return c 6638} 6639 6640// Fields allows partial responses to be retrieved. See 6641// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6642// for more information. 6643func (c *TemplateUpdateCall) Fields(s ...googleapi.Field) *TemplateUpdateCall { 6644 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6645 return c 6646} 6647 6648// Context sets the context to be used in this call's Do method. Any 6649// pending HTTP request will be aborted if the provided context is 6650// canceled. 6651func (c *TemplateUpdateCall) Context(ctx context.Context) *TemplateUpdateCall { 6652 c.ctx_ = ctx 6653 return c 6654} 6655 6656// Header returns an http.Header that can be modified by the caller to 6657// add HTTP headers to the request. 6658func (c *TemplateUpdateCall) Header() http.Header { 6659 if c.header_ == nil { 6660 c.header_ = make(http.Header) 6661 } 6662 return c.header_ 6663} 6664 6665func (c *TemplateUpdateCall) doRequest(alt string) (*http.Response, error) { 6666 reqHeaders := make(http.Header) 6667 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 6668 for k, v := range c.header_ { 6669 reqHeaders[k] = v 6670 } 6671 reqHeaders.Set("User-Agent", c.s.userAgent()) 6672 var body io.Reader = nil 6673 body, err := googleapi.WithoutDataWrapper.JSONReader(c.template) 6674 if err != nil { 6675 return nil, err 6676 } 6677 reqHeaders.Set("Content-Type", "application/json") 6678 c.urlParams_.Set("alt", alt) 6679 c.urlParams_.Set("prettyPrint", "false") 6680 urls := googleapi.ResolveRelative(c.s.BasePath, "tables/{tableId}/templates/{templateId}") 6681 urls += "?" + c.urlParams_.Encode() 6682 req, err := http.NewRequest("PUT", urls, body) 6683 if err != nil { 6684 return nil, err 6685 } 6686 req.Header = reqHeaders 6687 googleapi.Expand(req.URL, map[string]string{ 6688 "tableId": c.tableId, 6689 "templateId": strconv.FormatInt(c.templateId, 10), 6690 }) 6691 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6692} 6693 6694// Do executes the "fusiontables.template.update" call. 6695// Exactly one of *Template or error will be non-nil. Any non-2xx status 6696// code is an error. Response headers are in either 6697// *Template.ServerResponse.Header or (if a response was returned at 6698// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6699// to check whether the returned error was because 6700// http.StatusNotModified was returned. 6701func (c *TemplateUpdateCall) Do(opts ...googleapi.CallOption) (*Template, error) { 6702 gensupport.SetOptions(c.urlParams_, opts...) 6703 res, err := c.doRequest("json") 6704 if res != nil && res.StatusCode == http.StatusNotModified { 6705 if res.Body != nil { 6706 res.Body.Close() 6707 } 6708 return nil, &googleapi.Error{ 6709 Code: res.StatusCode, 6710 Header: res.Header, 6711 } 6712 } 6713 if err != nil { 6714 return nil, err 6715 } 6716 defer googleapi.CloseBody(res) 6717 if err := googleapi.CheckResponse(res); err != nil { 6718 return nil, err 6719 } 6720 ret := &Template{ 6721 ServerResponse: googleapi.ServerResponse{ 6722 Header: res.Header, 6723 HTTPStatusCode: res.StatusCode, 6724 }, 6725 } 6726 target := &ret 6727 if err := gensupport.DecodeResponse(target, res); err != nil { 6728 return nil, err 6729 } 6730 return ret, nil 6731 // { 6732 // "description": "Updates an existing template", 6733 // "httpMethod": "PUT", 6734 // "id": "fusiontables.template.update", 6735 // "parameterOrder": [ 6736 // "tableId", 6737 // "templateId" 6738 // ], 6739 // "parameters": { 6740 // "tableId": { 6741 // "description": "Table to which the updated template belongs", 6742 // "location": "path", 6743 // "required": true, 6744 // "type": "string" 6745 // }, 6746 // "templateId": { 6747 // "description": "Identifier for the template that is being updated", 6748 // "format": "int32", 6749 // "location": "path", 6750 // "required": true, 6751 // "type": "integer" 6752 // } 6753 // }, 6754 // "path": "tables/{tableId}/templates/{templateId}", 6755 // "request": { 6756 // "$ref": "Template" 6757 // }, 6758 // "response": { 6759 // "$ref": "Template" 6760 // }, 6761 // "scopes": [ 6762 // "https://www.googleapis.com/auth/fusiontables" 6763 // ] 6764 // } 6765 6766} 6767