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.
 
 
 

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