Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

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