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

6253 line
194 KiB

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