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

6065 lines
190 KiB

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