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.
 
 
 

2502 regels
75 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package tasks provides access to the Tasks API.
  6. //
  7. // For product documentation, see: https://developers.google.com/google-apps/tasks/firstapp
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/tasks/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // tasksService, err := tasks.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // tasksService, err := tasks.NewService(ctx, option.WithScopes(tasks.TasksReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // tasksService, err := tasks.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // tasksService, err := tasks.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package tasks // import "google.golang.org/api/tasks/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "tasks:v1"
  71. const apiName = "tasks"
  72. const apiVersion = "v1"
  73. const basePath = "https://www.googleapis.com/tasks/v1/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // Create, edit, organize, and delete all your tasks
  77. TasksScope = "https://www.googleapis.com/auth/tasks"
  78. // View your tasks
  79. TasksReadonlyScope = "https://www.googleapis.com/auth/tasks.readonly"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/tasks",
  85. "https://www.googleapis.com/auth/tasks.readonly",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Tasklists = NewTasklistsService(s)
  113. s.Tasks = NewTasksService(s)
  114. return s, nil
  115. }
  116. type Service struct {
  117. client *http.Client
  118. BasePath string // API endpoint base URL
  119. UserAgent string // optional additional User-Agent fragment
  120. Tasklists *TasklistsService
  121. Tasks *TasksService
  122. }
  123. func (s *Service) userAgent() string {
  124. if s.UserAgent == "" {
  125. return googleapi.UserAgent
  126. }
  127. return googleapi.UserAgent + " " + s.UserAgent
  128. }
  129. func NewTasklistsService(s *Service) *TasklistsService {
  130. rs := &TasklistsService{s: s}
  131. return rs
  132. }
  133. type TasklistsService struct {
  134. s *Service
  135. }
  136. func NewTasksService(s *Service) *TasksService {
  137. rs := &TasksService{s: s}
  138. return rs
  139. }
  140. type TasksService struct {
  141. s *Service
  142. }
  143. type Task struct {
  144. // Completed: Completion date of the task (as a RFC 3339 timestamp).
  145. // This field is omitted if the task has not been completed.
  146. Completed *string `json:"completed,omitempty"`
  147. // Deleted: Flag indicating whether the task has been deleted. The
  148. // default if False.
  149. Deleted bool `json:"deleted,omitempty"`
  150. // Due: Due date of the task (as a RFC 3339 timestamp). Optional.
  151. Due string `json:"due,omitempty"`
  152. // Etag: ETag of the resource.
  153. Etag string `json:"etag,omitempty"`
  154. // Hidden: Flag indicating whether the task is hidden. This is the case
  155. // if the task had been marked completed when the task list was last
  156. // cleared. The default is False. This field is read-only.
  157. Hidden bool `json:"hidden,omitempty"`
  158. // Id: Task identifier.
  159. Id string `json:"id,omitempty"`
  160. // Kind: Type of the resource. This is always "tasks#task".
  161. Kind string `json:"kind,omitempty"`
  162. // Links: Collection of links. This collection is read-only.
  163. Links []*TaskLinks `json:"links,omitempty"`
  164. // Notes: Notes describing the task. Optional.
  165. Notes string `json:"notes,omitempty"`
  166. // Parent: Parent task identifier. This field is omitted if it is a
  167. // top-level task. This field is read-only. Use the "move" method to
  168. // move the task under a different parent or to the top level.
  169. Parent string `json:"parent,omitempty"`
  170. // Position: String indicating the position of the task among its
  171. // sibling tasks under the same parent task or at the top level. If this
  172. // string is greater than another task's corresponding position string
  173. // according to lexicographical ordering, the task is positioned after
  174. // the other task under the same parent task (or at the top level). This
  175. // field is read-only. Use the "move" method to move the task to another
  176. // position.
  177. Position string `json:"position,omitempty"`
  178. // SelfLink: URL pointing to this task. Used to retrieve, update, or
  179. // delete this task.
  180. SelfLink string `json:"selfLink,omitempty"`
  181. // Status: Status of the task. This is either "needsAction" or
  182. // "completed".
  183. Status string `json:"status,omitempty"`
  184. // Title: Title of the task.
  185. Title string `json:"title,omitempty"`
  186. // Updated: Last modification time of the task (as a RFC 3339
  187. // timestamp).
  188. Updated string `json:"updated,omitempty"`
  189. // ServerResponse contains the HTTP response code and headers from the
  190. // server.
  191. googleapi.ServerResponse `json:"-"`
  192. // ForceSendFields is a list of field names (e.g. "Completed") to
  193. // unconditionally include in API requests. By default, fields with
  194. // empty values are omitted from API requests. However, any non-pointer,
  195. // non-interface field appearing in ForceSendFields will be sent to the
  196. // server regardless of whether the field is empty or not. This may be
  197. // used to include empty fields in Patch requests.
  198. ForceSendFields []string `json:"-"`
  199. // NullFields is a list of field names (e.g. "Completed") to include in
  200. // API requests with the JSON null value. By default, fields with empty
  201. // values are omitted from API requests. However, any field with an
  202. // empty value appearing in NullFields will be sent to the server as
  203. // null. It is an error if a field in this list has a non-empty value.
  204. // This may be used to include null fields in Patch requests.
  205. NullFields []string `json:"-"`
  206. }
  207. func (s *Task) MarshalJSON() ([]byte, error) {
  208. type NoMethod Task
  209. raw := NoMethod(*s)
  210. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  211. }
  212. type TaskLinks struct {
  213. // Description: The description. In HTML speak: Everything between <a>
  214. // and </a>.
  215. Description string `json:"description,omitempty"`
  216. // Link: The URL.
  217. Link string `json:"link,omitempty"`
  218. // Type: Type of the link, e.g. "email".
  219. Type string `json:"type,omitempty"`
  220. // ForceSendFields is a list of field names (e.g. "Description") to
  221. // unconditionally include in API requests. By default, fields with
  222. // empty values are omitted from API requests. However, any non-pointer,
  223. // non-interface field appearing in ForceSendFields will be sent to the
  224. // server regardless of whether the field is empty or not. This may be
  225. // used to include empty fields in Patch requests.
  226. ForceSendFields []string `json:"-"`
  227. // NullFields is a list of field names (e.g. "Description") to include
  228. // in API requests with the JSON null value. By default, fields with
  229. // empty values are omitted from API requests. However, any field with
  230. // an empty value appearing in NullFields will be sent to the server as
  231. // null. It is an error if a field in this list has a non-empty value.
  232. // This may be used to include null fields in Patch requests.
  233. NullFields []string `json:"-"`
  234. }
  235. func (s *TaskLinks) MarshalJSON() ([]byte, error) {
  236. type NoMethod TaskLinks
  237. raw := NoMethod(*s)
  238. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  239. }
  240. type TaskList struct {
  241. // Etag: ETag of the resource.
  242. Etag string `json:"etag,omitempty"`
  243. // Id: Task list identifier.
  244. Id string `json:"id,omitempty"`
  245. // Kind: Type of the resource. This is always "tasks#taskList".
  246. Kind string `json:"kind,omitempty"`
  247. // SelfLink: URL pointing to this task list. Used to retrieve, update,
  248. // or delete this task list.
  249. SelfLink string `json:"selfLink,omitempty"`
  250. // Title: Title of the task list.
  251. Title string `json:"title,omitempty"`
  252. // Updated: Last modification time of the task list (as a RFC 3339
  253. // timestamp).
  254. Updated string `json:"updated,omitempty"`
  255. // ServerResponse contains the HTTP response code and headers from the
  256. // server.
  257. googleapi.ServerResponse `json:"-"`
  258. // ForceSendFields is a list of field names (e.g. "Etag") to
  259. // unconditionally include in API requests. By default, fields with
  260. // empty values are omitted from API requests. However, any non-pointer,
  261. // non-interface field appearing in ForceSendFields will be sent to the
  262. // server regardless of whether the field is empty or not. This may be
  263. // used to include empty fields in Patch requests.
  264. ForceSendFields []string `json:"-"`
  265. // NullFields is a list of field names (e.g. "Etag") to include in API
  266. // requests with the JSON null value. By default, fields with empty
  267. // values are omitted from API requests. However, any field with an
  268. // empty value appearing in NullFields will be sent to the server as
  269. // null. It is an error if a field in this list has a non-empty value.
  270. // This may be used to include null fields in Patch requests.
  271. NullFields []string `json:"-"`
  272. }
  273. func (s *TaskList) MarshalJSON() ([]byte, error) {
  274. type NoMethod TaskList
  275. raw := NoMethod(*s)
  276. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  277. }
  278. type TaskLists struct {
  279. // Etag: ETag of the resource.
  280. Etag string `json:"etag,omitempty"`
  281. // Items: Collection of task lists.
  282. Items []*TaskList `json:"items,omitempty"`
  283. // Kind: Type of the resource. This is always "tasks#taskLists".
  284. Kind string `json:"kind,omitempty"`
  285. // NextPageToken: Token that can be used to request the next page of
  286. // this result.
  287. NextPageToken string `json:"nextPageToken,omitempty"`
  288. // ServerResponse contains the HTTP response code and headers from the
  289. // server.
  290. googleapi.ServerResponse `json:"-"`
  291. // ForceSendFields is a list of field names (e.g. "Etag") to
  292. // unconditionally include in API requests. By default, fields with
  293. // empty values are omitted from API requests. However, any non-pointer,
  294. // non-interface field appearing in ForceSendFields will be sent to the
  295. // server regardless of whether the field is empty or not. This may be
  296. // used to include empty fields in Patch requests.
  297. ForceSendFields []string `json:"-"`
  298. // NullFields is a list of field names (e.g. "Etag") to include in API
  299. // requests with the JSON null value. By default, fields with empty
  300. // values are omitted from API requests. However, any field with an
  301. // empty value appearing in NullFields will be sent to the server as
  302. // null. It is an error if a field in this list has a non-empty value.
  303. // This may be used to include null fields in Patch requests.
  304. NullFields []string `json:"-"`
  305. }
  306. func (s *TaskLists) MarshalJSON() ([]byte, error) {
  307. type NoMethod TaskLists
  308. raw := NoMethod(*s)
  309. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  310. }
  311. type Tasks struct {
  312. // Etag: ETag of the resource.
  313. Etag string `json:"etag,omitempty"`
  314. // Items: Collection of tasks.
  315. Items []*Task `json:"items,omitempty"`
  316. // Kind: Type of the resource. This is always "tasks#tasks".
  317. Kind string `json:"kind,omitempty"`
  318. // NextPageToken: Token used to access the next page of this result.
  319. NextPageToken string `json:"nextPageToken,omitempty"`
  320. // ServerResponse contains the HTTP response code and headers from the
  321. // server.
  322. googleapi.ServerResponse `json:"-"`
  323. // ForceSendFields is a list of field names (e.g. "Etag") to
  324. // unconditionally include in API requests. By default, fields with
  325. // empty values are omitted from API requests. However, any non-pointer,
  326. // non-interface field appearing in ForceSendFields will be sent to the
  327. // server regardless of whether the field is empty or not. This may be
  328. // used to include empty fields in Patch requests.
  329. ForceSendFields []string `json:"-"`
  330. // NullFields is a list of field names (e.g. "Etag") to include in API
  331. // requests with the JSON null value. By default, fields with empty
  332. // values are omitted from API requests. However, any field with an
  333. // empty value appearing in NullFields will be sent to the server as
  334. // null. It is an error if a field in this list has a non-empty value.
  335. // This may be used to include null fields in Patch requests.
  336. NullFields []string `json:"-"`
  337. }
  338. func (s *Tasks) MarshalJSON() ([]byte, error) {
  339. type NoMethod Tasks
  340. raw := NoMethod(*s)
  341. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  342. }
  343. // method id "tasks.tasklists.delete":
  344. type TasklistsDeleteCall struct {
  345. s *Service
  346. tasklistid string
  347. urlParams_ gensupport.URLParams
  348. ctx_ context.Context
  349. header_ http.Header
  350. }
  351. // Delete: Deletes the authenticated user's specified task list.
  352. func (r *TasklistsService) Delete(tasklistid string) *TasklistsDeleteCall {
  353. c := &TasklistsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  354. c.tasklistid = tasklistid
  355. return c
  356. }
  357. // Fields allows partial responses to be retrieved. See
  358. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  359. // for more information.
  360. func (c *TasklistsDeleteCall) Fields(s ...googleapi.Field) *TasklistsDeleteCall {
  361. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  362. return c
  363. }
  364. // Context sets the context to be used in this call's Do method. Any
  365. // pending HTTP request will be aborted if the provided context is
  366. // canceled.
  367. func (c *TasklistsDeleteCall) Context(ctx context.Context) *TasklistsDeleteCall {
  368. c.ctx_ = ctx
  369. return c
  370. }
  371. // Header returns an http.Header that can be modified by the caller to
  372. // add HTTP headers to the request.
  373. func (c *TasklistsDeleteCall) Header() http.Header {
  374. if c.header_ == nil {
  375. c.header_ = make(http.Header)
  376. }
  377. return c.header_
  378. }
  379. func (c *TasklistsDeleteCall) doRequest(alt string) (*http.Response, error) {
  380. reqHeaders := make(http.Header)
  381. for k, v := range c.header_ {
  382. reqHeaders[k] = v
  383. }
  384. reqHeaders.Set("User-Agent", c.s.userAgent())
  385. var body io.Reader = nil
  386. c.urlParams_.Set("alt", alt)
  387. c.urlParams_.Set("prettyPrint", "false")
  388. urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists/{tasklist}")
  389. urls += "?" + c.urlParams_.Encode()
  390. req, err := http.NewRequest("DELETE", urls, body)
  391. if err != nil {
  392. return nil, err
  393. }
  394. req.Header = reqHeaders
  395. googleapi.Expand(req.URL, map[string]string{
  396. "tasklist": c.tasklistid,
  397. })
  398. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  399. }
  400. // Do executes the "tasks.tasklists.delete" call.
  401. func (c *TasklistsDeleteCall) Do(opts ...googleapi.CallOption) error {
  402. gensupport.SetOptions(c.urlParams_, opts...)
  403. res, err := c.doRequest("json")
  404. if err != nil {
  405. return err
  406. }
  407. defer googleapi.CloseBody(res)
  408. if err := googleapi.CheckResponse(res); err != nil {
  409. return err
  410. }
  411. return nil
  412. // {
  413. // "description": "Deletes the authenticated user's specified task list.",
  414. // "httpMethod": "DELETE",
  415. // "id": "tasks.tasklists.delete",
  416. // "parameterOrder": [
  417. // "tasklist"
  418. // ],
  419. // "parameters": {
  420. // "tasklist": {
  421. // "description": "Task list identifier.",
  422. // "location": "path",
  423. // "required": true,
  424. // "type": "string"
  425. // }
  426. // },
  427. // "path": "users/@me/lists/{tasklist}",
  428. // "scopes": [
  429. // "https://www.googleapis.com/auth/tasks"
  430. // ]
  431. // }
  432. }
  433. // method id "tasks.tasklists.get":
  434. type TasklistsGetCall struct {
  435. s *Service
  436. tasklistid string
  437. urlParams_ gensupport.URLParams
  438. ifNoneMatch_ string
  439. ctx_ context.Context
  440. header_ http.Header
  441. }
  442. // Get: Returns the authenticated user's specified task list.
  443. func (r *TasklistsService) Get(tasklistid string) *TasklistsGetCall {
  444. c := &TasklistsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  445. c.tasklistid = tasklistid
  446. return c
  447. }
  448. // Fields allows partial responses to be retrieved. See
  449. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  450. // for more information.
  451. func (c *TasklistsGetCall) Fields(s ...googleapi.Field) *TasklistsGetCall {
  452. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  453. return c
  454. }
  455. // IfNoneMatch sets the optional parameter which makes the operation
  456. // fail if the object's ETag matches the given value. This is useful for
  457. // getting updates only after the object has changed since the last
  458. // request. Use googleapi.IsNotModified to check whether the response
  459. // error from Do is the result of In-None-Match.
  460. func (c *TasklistsGetCall) IfNoneMatch(entityTag string) *TasklistsGetCall {
  461. c.ifNoneMatch_ = entityTag
  462. return c
  463. }
  464. // Context sets the context to be used in this call's Do method. Any
  465. // pending HTTP request will be aborted if the provided context is
  466. // canceled.
  467. func (c *TasklistsGetCall) Context(ctx context.Context) *TasklistsGetCall {
  468. c.ctx_ = ctx
  469. return c
  470. }
  471. // Header returns an http.Header that can be modified by the caller to
  472. // add HTTP headers to the request.
  473. func (c *TasklistsGetCall) Header() http.Header {
  474. if c.header_ == nil {
  475. c.header_ = make(http.Header)
  476. }
  477. return c.header_
  478. }
  479. func (c *TasklistsGetCall) doRequest(alt string) (*http.Response, error) {
  480. reqHeaders := make(http.Header)
  481. for k, v := range c.header_ {
  482. reqHeaders[k] = v
  483. }
  484. reqHeaders.Set("User-Agent", c.s.userAgent())
  485. if c.ifNoneMatch_ != "" {
  486. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  487. }
  488. var body io.Reader = nil
  489. c.urlParams_.Set("alt", alt)
  490. c.urlParams_.Set("prettyPrint", "false")
  491. urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists/{tasklist}")
  492. urls += "?" + c.urlParams_.Encode()
  493. req, err := http.NewRequest("GET", urls, body)
  494. if err != nil {
  495. return nil, err
  496. }
  497. req.Header = reqHeaders
  498. googleapi.Expand(req.URL, map[string]string{
  499. "tasklist": c.tasklistid,
  500. })
  501. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  502. }
  503. // Do executes the "tasks.tasklists.get" call.
  504. // Exactly one of *TaskList or error will be non-nil. Any non-2xx status
  505. // code is an error. Response headers are in either
  506. // *TaskList.ServerResponse.Header or (if a response was returned at
  507. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  508. // to check whether the returned error was because
  509. // http.StatusNotModified was returned.
  510. func (c *TasklistsGetCall) Do(opts ...googleapi.CallOption) (*TaskList, error) {
  511. gensupport.SetOptions(c.urlParams_, opts...)
  512. res, err := c.doRequest("json")
  513. if res != nil && res.StatusCode == http.StatusNotModified {
  514. if res.Body != nil {
  515. res.Body.Close()
  516. }
  517. return nil, &googleapi.Error{
  518. Code: res.StatusCode,
  519. Header: res.Header,
  520. }
  521. }
  522. if err != nil {
  523. return nil, err
  524. }
  525. defer googleapi.CloseBody(res)
  526. if err := googleapi.CheckResponse(res); err != nil {
  527. return nil, err
  528. }
  529. ret := &TaskList{
  530. ServerResponse: googleapi.ServerResponse{
  531. Header: res.Header,
  532. HTTPStatusCode: res.StatusCode,
  533. },
  534. }
  535. target := &ret
  536. if err := gensupport.DecodeResponse(target, res); err != nil {
  537. return nil, err
  538. }
  539. return ret, nil
  540. // {
  541. // "description": "Returns the authenticated user's specified task list.",
  542. // "httpMethod": "GET",
  543. // "id": "tasks.tasklists.get",
  544. // "parameterOrder": [
  545. // "tasklist"
  546. // ],
  547. // "parameters": {
  548. // "tasklist": {
  549. // "description": "Task list identifier.",
  550. // "location": "path",
  551. // "required": true,
  552. // "type": "string"
  553. // }
  554. // },
  555. // "path": "users/@me/lists/{tasklist}",
  556. // "response": {
  557. // "$ref": "TaskList"
  558. // },
  559. // "scopes": [
  560. // "https://www.googleapis.com/auth/tasks",
  561. // "https://www.googleapis.com/auth/tasks.readonly"
  562. // ]
  563. // }
  564. }
  565. // method id "tasks.tasklists.insert":
  566. type TasklistsInsertCall struct {
  567. s *Service
  568. tasklist *TaskList
  569. urlParams_ gensupport.URLParams
  570. ctx_ context.Context
  571. header_ http.Header
  572. }
  573. // Insert: Creates a new task list and adds it to the authenticated
  574. // user's task lists.
  575. func (r *TasklistsService) Insert(tasklist *TaskList) *TasklistsInsertCall {
  576. c := &TasklistsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  577. c.tasklist = tasklist
  578. return c
  579. }
  580. // Fields allows partial responses to be retrieved. See
  581. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  582. // for more information.
  583. func (c *TasklistsInsertCall) Fields(s ...googleapi.Field) *TasklistsInsertCall {
  584. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  585. return c
  586. }
  587. // Context sets the context to be used in this call's Do method. Any
  588. // pending HTTP request will be aborted if the provided context is
  589. // canceled.
  590. func (c *TasklistsInsertCall) Context(ctx context.Context) *TasklistsInsertCall {
  591. c.ctx_ = ctx
  592. return c
  593. }
  594. // Header returns an http.Header that can be modified by the caller to
  595. // add HTTP headers to the request.
  596. func (c *TasklistsInsertCall) Header() http.Header {
  597. if c.header_ == nil {
  598. c.header_ = make(http.Header)
  599. }
  600. return c.header_
  601. }
  602. func (c *TasklistsInsertCall) doRequest(alt string) (*http.Response, error) {
  603. reqHeaders := make(http.Header)
  604. for k, v := range c.header_ {
  605. reqHeaders[k] = v
  606. }
  607. reqHeaders.Set("User-Agent", c.s.userAgent())
  608. var body io.Reader = nil
  609. body, err := googleapi.WithoutDataWrapper.JSONReader(c.tasklist)
  610. if err != nil {
  611. return nil, err
  612. }
  613. reqHeaders.Set("Content-Type", "application/json")
  614. c.urlParams_.Set("alt", alt)
  615. c.urlParams_.Set("prettyPrint", "false")
  616. urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists")
  617. urls += "?" + c.urlParams_.Encode()
  618. req, err := http.NewRequest("POST", urls, body)
  619. if err != nil {
  620. return nil, err
  621. }
  622. req.Header = reqHeaders
  623. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  624. }
  625. // Do executes the "tasks.tasklists.insert" call.
  626. // Exactly one of *TaskList or error will be non-nil. Any non-2xx status
  627. // code is an error. Response headers are in either
  628. // *TaskList.ServerResponse.Header or (if a response was returned at
  629. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  630. // to check whether the returned error was because
  631. // http.StatusNotModified was returned.
  632. func (c *TasklistsInsertCall) Do(opts ...googleapi.CallOption) (*TaskList, error) {
  633. gensupport.SetOptions(c.urlParams_, opts...)
  634. res, err := c.doRequest("json")
  635. if res != nil && res.StatusCode == http.StatusNotModified {
  636. if res.Body != nil {
  637. res.Body.Close()
  638. }
  639. return nil, &googleapi.Error{
  640. Code: res.StatusCode,
  641. Header: res.Header,
  642. }
  643. }
  644. if err != nil {
  645. return nil, err
  646. }
  647. defer googleapi.CloseBody(res)
  648. if err := googleapi.CheckResponse(res); err != nil {
  649. return nil, err
  650. }
  651. ret := &TaskList{
  652. ServerResponse: googleapi.ServerResponse{
  653. Header: res.Header,
  654. HTTPStatusCode: res.StatusCode,
  655. },
  656. }
  657. target := &ret
  658. if err := gensupport.DecodeResponse(target, res); err != nil {
  659. return nil, err
  660. }
  661. return ret, nil
  662. // {
  663. // "description": "Creates a new task list and adds it to the authenticated user's task lists.",
  664. // "httpMethod": "POST",
  665. // "id": "tasks.tasklists.insert",
  666. // "path": "users/@me/lists",
  667. // "request": {
  668. // "$ref": "TaskList"
  669. // },
  670. // "response": {
  671. // "$ref": "TaskList"
  672. // },
  673. // "scopes": [
  674. // "https://www.googleapis.com/auth/tasks"
  675. // ]
  676. // }
  677. }
  678. // method id "tasks.tasklists.list":
  679. type TasklistsListCall struct {
  680. s *Service
  681. urlParams_ gensupport.URLParams
  682. ifNoneMatch_ string
  683. ctx_ context.Context
  684. header_ http.Header
  685. }
  686. // List: Returns all the authenticated user's task lists.
  687. func (r *TasklistsService) List() *TasklistsListCall {
  688. c := &TasklistsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  689. return c
  690. }
  691. // MaxResults sets the optional parameter "maxResults": Maximum number
  692. // of task lists returned on one page. The default is 20 (max allowed:
  693. // 100).
  694. func (c *TasklistsListCall) MaxResults(maxResults int64) *TasklistsListCall {
  695. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  696. return c
  697. }
  698. // PageToken sets the optional parameter "pageToken": Token specifying
  699. // the result page to return.
  700. func (c *TasklistsListCall) PageToken(pageToken string) *TasklistsListCall {
  701. c.urlParams_.Set("pageToken", pageToken)
  702. return c
  703. }
  704. // Fields allows partial responses to be retrieved. See
  705. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  706. // for more information.
  707. func (c *TasklistsListCall) Fields(s ...googleapi.Field) *TasklistsListCall {
  708. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  709. return c
  710. }
  711. // IfNoneMatch sets the optional parameter which makes the operation
  712. // fail if the object's ETag matches the given value. This is useful for
  713. // getting updates only after the object has changed since the last
  714. // request. Use googleapi.IsNotModified to check whether the response
  715. // error from Do is the result of In-None-Match.
  716. func (c *TasklistsListCall) IfNoneMatch(entityTag string) *TasklistsListCall {
  717. c.ifNoneMatch_ = entityTag
  718. return c
  719. }
  720. // Context sets the context to be used in this call's Do method. Any
  721. // pending HTTP request will be aborted if the provided context is
  722. // canceled.
  723. func (c *TasklistsListCall) Context(ctx context.Context) *TasklistsListCall {
  724. c.ctx_ = ctx
  725. return c
  726. }
  727. // Header returns an http.Header that can be modified by the caller to
  728. // add HTTP headers to the request.
  729. func (c *TasklistsListCall) Header() http.Header {
  730. if c.header_ == nil {
  731. c.header_ = make(http.Header)
  732. }
  733. return c.header_
  734. }
  735. func (c *TasklistsListCall) doRequest(alt string) (*http.Response, error) {
  736. reqHeaders := make(http.Header)
  737. for k, v := range c.header_ {
  738. reqHeaders[k] = v
  739. }
  740. reqHeaders.Set("User-Agent", c.s.userAgent())
  741. if c.ifNoneMatch_ != "" {
  742. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  743. }
  744. var body io.Reader = nil
  745. c.urlParams_.Set("alt", alt)
  746. c.urlParams_.Set("prettyPrint", "false")
  747. urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists")
  748. urls += "?" + c.urlParams_.Encode()
  749. req, err := http.NewRequest("GET", urls, body)
  750. if err != nil {
  751. return nil, err
  752. }
  753. req.Header = reqHeaders
  754. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  755. }
  756. // Do executes the "tasks.tasklists.list" call.
  757. // Exactly one of *TaskLists or error will be non-nil. Any non-2xx
  758. // status code is an error. Response headers are in either
  759. // *TaskLists.ServerResponse.Header or (if a response was returned at
  760. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  761. // to check whether the returned error was because
  762. // http.StatusNotModified was returned.
  763. func (c *TasklistsListCall) Do(opts ...googleapi.CallOption) (*TaskLists, error) {
  764. gensupport.SetOptions(c.urlParams_, opts...)
  765. res, err := c.doRequest("json")
  766. if res != nil && res.StatusCode == http.StatusNotModified {
  767. if res.Body != nil {
  768. res.Body.Close()
  769. }
  770. return nil, &googleapi.Error{
  771. Code: res.StatusCode,
  772. Header: res.Header,
  773. }
  774. }
  775. if err != nil {
  776. return nil, err
  777. }
  778. defer googleapi.CloseBody(res)
  779. if err := googleapi.CheckResponse(res); err != nil {
  780. return nil, err
  781. }
  782. ret := &TaskLists{
  783. ServerResponse: googleapi.ServerResponse{
  784. Header: res.Header,
  785. HTTPStatusCode: res.StatusCode,
  786. },
  787. }
  788. target := &ret
  789. if err := gensupport.DecodeResponse(target, res); err != nil {
  790. return nil, err
  791. }
  792. return ret, nil
  793. // {
  794. // "description": "Returns all the authenticated user's task lists.",
  795. // "httpMethod": "GET",
  796. // "id": "tasks.tasklists.list",
  797. // "parameters": {
  798. // "maxResults": {
  799. // "description": "Maximum number of task lists returned on one page. Optional. The default is 20 (max allowed: 100).",
  800. // "format": "int64",
  801. // "location": "query",
  802. // "type": "string"
  803. // },
  804. // "pageToken": {
  805. // "description": "Token specifying the result page to return. Optional.",
  806. // "location": "query",
  807. // "type": "string"
  808. // }
  809. // },
  810. // "path": "users/@me/lists",
  811. // "response": {
  812. // "$ref": "TaskLists"
  813. // },
  814. // "scopes": [
  815. // "https://www.googleapis.com/auth/tasks",
  816. // "https://www.googleapis.com/auth/tasks.readonly"
  817. // ]
  818. // }
  819. }
  820. // Pages invokes f for each page of results.
  821. // A non-nil error returned from f will halt the iteration.
  822. // The provided context supersedes any context provided to the Context method.
  823. func (c *TasklistsListCall) Pages(ctx context.Context, f func(*TaskLists) error) error {
  824. c.ctx_ = ctx
  825. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  826. for {
  827. x, err := c.Do()
  828. if err != nil {
  829. return err
  830. }
  831. if err := f(x); err != nil {
  832. return err
  833. }
  834. if x.NextPageToken == "" {
  835. return nil
  836. }
  837. c.PageToken(x.NextPageToken)
  838. }
  839. }
  840. // method id "tasks.tasklists.patch":
  841. type TasklistsPatchCall struct {
  842. s *Service
  843. tasklistid string
  844. tasklist *TaskList
  845. urlParams_ gensupport.URLParams
  846. ctx_ context.Context
  847. header_ http.Header
  848. }
  849. // Patch: Updates the authenticated user's specified task list. This
  850. // method supports patch semantics.
  851. func (r *TasklistsService) Patch(tasklistid string, tasklist *TaskList) *TasklistsPatchCall {
  852. c := &TasklistsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  853. c.tasklistid = tasklistid
  854. c.tasklist = tasklist
  855. return c
  856. }
  857. // Fields allows partial responses to be retrieved. See
  858. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  859. // for more information.
  860. func (c *TasklistsPatchCall) Fields(s ...googleapi.Field) *TasklistsPatchCall {
  861. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  862. return c
  863. }
  864. // Context sets the context to be used in this call's Do method. Any
  865. // pending HTTP request will be aborted if the provided context is
  866. // canceled.
  867. func (c *TasklistsPatchCall) Context(ctx context.Context) *TasklistsPatchCall {
  868. c.ctx_ = ctx
  869. return c
  870. }
  871. // Header returns an http.Header that can be modified by the caller to
  872. // add HTTP headers to the request.
  873. func (c *TasklistsPatchCall) Header() http.Header {
  874. if c.header_ == nil {
  875. c.header_ = make(http.Header)
  876. }
  877. return c.header_
  878. }
  879. func (c *TasklistsPatchCall) doRequest(alt string) (*http.Response, error) {
  880. reqHeaders := make(http.Header)
  881. for k, v := range c.header_ {
  882. reqHeaders[k] = v
  883. }
  884. reqHeaders.Set("User-Agent", c.s.userAgent())
  885. var body io.Reader = nil
  886. body, err := googleapi.WithoutDataWrapper.JSONReader(c.tasklist)
  887. if err != nil {
  888. return nil, err
  889. }
  890. reqHeaders.Set("Content-Type", "application/json")
  891. c.urlParams_.Set("alt", alt)
  892. c.urlParams_.Set("prettyPrint", "false")
  893. urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists/{tasklist}")
  894. urls += "?" + c.urlParams_.Encode()
  895. req, err := http.NewRequest("PATCH", urls, body)
  896. if err != nil {
  897. return nil, err
  898. }
  899. req.Header = reqHeaders
  900. googleapi.Expand(req.URL, map[string]string{
  901. "tasklist": c.tasklistid,
  902. })
  903. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  904. }
  905. // Do executes the "tasks.tasklists.patch" call.
  906. // Exactly one of *TaskList or error will be non-nil. Any non-2xx status
  907. // code is an error. Response headers are in either
  908. // *TaskList.ServerResponse.Header or (if a response was returned at
  909. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  910. // to check whether the returned error was because
  911. // http.StatusNotModified was returned.
  912. func (c *TasklistsPatchCall) Do(opts ...googleapi.CallOption) (*TaskList, error) {
  913. gensupport.SetOptions(c.urlParams_, opts...)
  914. res, err := c.doRequest("json")
  915. if res != nil && res.StatusCode == http.StatusNotModified {
  916. if res.Body != nil {
  917. res.Body.Close()
  918. }
  919. return nil, &googleapi.Error{
  920. Code: res.StatusCode,
  921. Header: res.Header,
  922. }
  923. }
  924. if err != nil {
  925. return nil, err
  926. }
  927. defer googleapi.CloseBody(res)
  928. if err := googleapi.CheckResponse(res); err != nil {
  929. return nil, err
  930. }
  931. ret := &TaskList{
  932. ServerResponse: googleapi.ServerResponse{
  933. Header: res.Header,
  934. HTTPStatusCode: res.StatusCode,
  935. },
  936. }
  937. target := &ret
  938. if err := gensupport.DecodeResponse(target, res); err != nil {
  939. return nil, err
  940. }
  941. return ret, nil
  942. // {
  943. // "description": "Updates the authenticated user's specified task list. This method supports patch semantics.",
  944. // "httpMethod": "PATCH",
  945. // "id": "tasks.tasklists.patch",
  946. // "parameterOrder": [
  947. // "tasklist"
  948. // ],
  949. // "parameters": {
  950. // "tasklist": {
  951. // "description": "Task list identifier.",
  952. // "location": "path",
  953. // "required": true,
  954. // "type": "string"
  955. // }
  956. // },
  957. // "path": "users/@me/lists/{tasklist}",
  958. // "request": {
  959. // "$ref": "TaskList"
  960. // },
  961. // "response": {
  962. // "$ref": "TaskList"
  963. // },
  964. // "scopes": [
  965. // "https://www.googleapis.com/auth/tasks"
  966. // ]
  967. // }
  968. }
  969. // method id "tasks.tasklists.update":
  970. type TasklistsUpdateCall struct {
  971. s *Service
  972. tasklistid string
  973. tasklist *TaskList
  974. urlParams_ gensupport.URLParams
  975. ctx_ context.Context
  976. header_ http.Header
  977. }
  978. // Update: Updates the authenticated user's specified task list.
  979. func (r *TasklistsService) Update(tasklistid string, tasklist *TaskList) *TasklistsUpdateCall {
  980. c := &TasklistsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  981. c.tasklistid = tasklistid
  982. c.tasklist = tasklist
  983. return c
  984. }
  985. // Fields allows partial responses to be retrieved. See
  986. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  987. // for more information.
  988. func (c *TasklistsUpdateCall) Fields(s ...googleapi.Field) *TasklistsUpdateCall {
  989. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  990. return c
  991. }
  992. // Context sets the context to be used in this call's Do method. Any
  993. // pending HTTP request will be aborted if the provided context is
  994. // canceled.
  995. func (c *TasklistsUpdateCall) Context(ctx context.Context) *TasklistsUpdateCall {
  996. c.ctx_ = ctx
  997. return c
  998. }
  999. // Header returns an http.Header that can be modified by the caller to
  1000. // add HTTP headers to the request.
  1001. func (c *TasklistsUpdateCall) Header() http.Header {
  1002. if c.header_ == nil {
  1003. c.header_ = make(http.Header)
  1004. }
  1005. return c.header_
  1006. }
  1007. func (c *TasklistsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1008. reqHeaders := make(http.Header)
  1009. for k, v := range c.header_ {
  1010. reqHeaders[k] = v
  1011. }
  1012. reqHeaders.Set("User-Agent", c.s.userAgent())
  1013. var body io.Reader = nil
  1014. body, err := googleapi.WithoutDataWrapper.JSONReader(c.tasklist)
  1015. if err != nil {
  1016. return nil, err
  1017. }
  1018. reqHeaders.Set("Content-Type", "application/json")
  1019. c.urlParams_.Set("alt", alt)
  1020. c.urlParams_.Set("prettyPrint", "false")
  1021. urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists/{tasklist}")
  1022. urls += "?" + c.urlParams_.Encode()
  1023. req, err := http.NewRequest("PUT", urls, body)
  1024. if err != nil {
  1025. return nil, err
  1026. }
  1027. req.Header = reqHeaders
  1028. googleapi.Expand(req.URL, map[string]string{
  1029. "tasklist": c.tasklistid,
  1030. })
  1031. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1032. }
  1033. // Do executes the "tasks.tasklists.update" call.
  1034. // Exactly one of *TaskList or error will be non-nil. Any non-2xx status
  1035. // code is an error. Response headers are in either
  1036. // *TaskList.ServerResponse.Header or (if a response was returned at
  1037. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1038. // to check whether the returned error was because
  1039. // http.StatusNotModified was returned.
  1040. func (c *TasklistsUpdateCall) Do(opts ...googleapi.CallOption) (*TaskList, error) {
  1041. gensupport.SetOptions(c.urlParams_, opts...)
  1042. res, err := c.doRequest("json")
  1043. if res != nil && res.StatusCode == http.StatusNotModified {
  1044. if res.Body != nil {
  1045. res.Body.Close()
  1046. }
  1047. return nil, &googleapi.Error{
  1048. Code: res.StatusCode,
  1049. Header: res.Header,
  1050. }
  1051. }
  1052. if err != nil {
  1053. return nil, err
  1054. }
  1055. defer googleapi.CloseBody(res)
  1056. if err := googleapi.CheckResponse(res); err != nil {
  1057. return nil, err
  1058. }
  1059. ret := &TaskList{
  1060. ServerResponse: googleapi.ServerResponse{
  1061. Header: res.Header,
  1062. HTTPStatusCode: res.StatusCode,
  1063. },
  1064. }
  1065. target := &ret
  1066. if err := gensupport.DecodeResponse(target, res); err != nil {
  1067. return nil, err
  1068. }
  1069. return ret, nil
  1070. // {
  1071. // "description": "Updates the authenticated user's specified task list.",
  1072. // "httpMethod": "PUT",
  1073. // "id": "tasks.tasklists.update",
  1074. // "parameterOrder": [
  1075. // "tasklist"
  1076. // ],
  1077. // "parameters": {
  1078. // "tasklist": {
  1079. // "description": "Task list identifier.",
  1080. // "location": "path",
  1081. // "required": true,
  1082. // "type": "string"
  1083. // }
  1084. // },
  1085. // "path": "users/@me/lists/{tasklist}",
  1086. // "request": {
  1087. // "$ref": "TaskList"
  1088. // },
  1089. // "response": {
  1090. // "$ref": "TaskList"
  1091. // },
  1092. // "scopes": [
  1093. // "https://www.googleapis.com/auth/tasks"
  1094. // ]
  1095. // }
  1096. }
  1097. // method id "tasks.tasks.clear":
  1098. type TasksClearCall struct {
  1099. s *Service
  1100. tasklistid string
  1101. urlParams_ gensupport.URLParams
  1102. ctx_ context.Context
  1103. header_ http.Header
  1104. }
  1105. // Clear: Clears all completed tasks from the specified task list. The
  1106. // affected tasks will be marked as 'hidden' and no longer be returned
  1107. // by default when retrieving all tasks for a task list.
  1108. func (r *TasksService) Clear(tasklistid string) *TasksClearCall {
  1109. c := &TasksClearCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1110. c.tasklistid = tasklistid
  1111. return c
  1112. }
  1113. // Fields allows partial responses to be retrieved. See
  1114. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1115. // for more information.
  1116. func (c *TasksClearCall) Fields(s ...googleapi.Field) *TasksClearCall {
  1117. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1118. return c
  1119. }
  1120. // Context sets the context to be used in this call's Do method. Any
  1121. // pending HTTP request will be aborted if the provided context is
  1122. // canceled.
  1123. func (c *TasksClearCall) Context(ctx context.Context) *TasksClearCall {
  1124. c.ctx_ = ctx
  1125. return c
  1126. }
  1127. // Header returns an http.Header that can be modified by the caller to
  1128. // add HTTP headers to the request.
  1129. func (c *TasksClearCall) Header() http.Header {
  1130. if c.header_ == nil {
  1131. c.header_ = make(http.Header)
  1132. }
  1133. return c.header_
  1134. }
  1135. func (c *TasksClearCall) doRequest(alt string) (*http.Response, error) {
  1136. reqHeaders := make(http.Header)
  1137. for k, v := range c.header_ {
  1138. reqHeaders[k] = v
  1139. }
  1140. reqHeaders.Set("User-Agent", c.s.userAgent())
  1141. var body io.Reader = nil
  1142. c.urlParams_.Set("alt", alt)
  1143. c.urlParams_.Set("prettyPrint", "false")
  1144. urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/clear")
  1145. urls += "?" + c.urlParams_.Encode()
  1146. req, err := http.NewRequest("POST", urls, body)
  1147. if err != nil {
  1148. return nil, err
  1149. }
  1150. req.Header = reqHeaders
  1151. googleapi.Expand(req.URL, map[string]string{
  1152. "tasklist": c.tasklistid,
  1153. })
  1154. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1155. }
  1156. // Do executes the "tasks.tasks.clear" call.
  1157. func (c *TasksClearCall) Do(opts ...googleapi.CallOption) error {
  1158. gensupport.SetOptions(c.urlParams_, opts...)
  1159. res, err := c.doRequest("json")
  1160. if err != nil {
  1161. return err
  1162. }
  1163. defer googleapi.CloseBody(res)
  1164. if err := googleapi.CheckResponse(res); err != nil {
  1165. return err
  1166. }
  1167. return nil
  1168. // {
  1169. // "description": "Clears all completed tasks from the specified task list. The affected tasks will be marked as 'hidden' and no longer be returned by default when retrieving all tasks for a task list.",
  1170. // "httpMethod": "POST",
  1171. // "id": "tasks.tasks.clear",
  1172. // "parameterOrder": [
  1173. // "tasklist"
  1174. // ],
  1175. // "parameters": {
  1176. // "tasklist": {
  1177. // "description": "Task list identifier.",
  1178. // "location": "path",
  1179. // "required": true,
  1180. // "type": "string"
  1181. // }
  1182. // },
  1183. // "path": "lists/{tasklist}/clear",
  1184. // "scopes": [
  1185. // "https://www.googleapis.com/auth/tasks"
  1186. // ]
  1187. // }
  1188. }
  1189. // method id "tasks.tasks.delete":
  1190. type TasksDeleteCall struct {
  1191. s *Service
  1192. tasklistid string
  1193. taskid string
  1194. urlParams_ gensupport.URLParams
  1195. ctx_ context.Context
  1196. header_ http.Header
  1197. }
  1198. // Delete: Deletes the specified task from the task list.
  1199. func (r *TasksService) Delete(tasklistid string, taskid string) *TasksDeleteCall {
  1200. c := &TasksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1201. c.tasklistid = tasklistid
  1202. c.taskid = taskid
  1203. return c
  1204. }
  1205. // Fields allows partial responses to be retrieved. See
  1206. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1207. // for more information.
  1208. func (c *TasksDeleteCall) Fields(s ...googleapi.Field) *TasksDeleteCall {
  1209. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1210. return c
  1211. }
  1212. // Context sets the context to be used in this call's Do method. Any
  1213. // pending HTTP request will be aborted if the provided context is
  1214. // canceled.
  1215. func (c *TasksDeleteCall) Context(ctx context.Context) *TasksDeleteCall {
  1216. c.ctx_ = ctx
  1217. return c
  1218. }
  1219. // Header returns an http.Header that can be modified by the caller to
  1220. // add HTTP headers to the request.
  1221. func (c *TasksDeleteCall) Header() http.Header {
  1222. if c.header_ == nil {
  1223. c.header_ = make(http.Header)
  1224. }
  1225. return c.header_
  1226. }
  1227. func (c *TasksDeleteCall) doRequest(alt string) (*http.Response, error) {
  1228. reqHeaders := make(http.Header)
  1229. for k, v := range c.header_ {
  1230. reqHeaders[k] = v
  1231. }
  1232. reqHeaders.Set("User-Agent", c.s.userAgent())
  1233. var body io.Reader = nil
  1234. c.urlParams_.Set("alt", alt)
  1235. c.urlParams_.Set("prettyPrint", "false")
  1236. urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}")
  1237. urls += "?" + c.urlParams_.Encode()
  1238. req, err := http.NewRequest("DELETE", urls, body)
  1239. if err != nil {
  1240. return nil, err
  1241. }
  1242. req.Header = reqHeaders
  1243. googleapi.Expand(req.URL, map[string]string{
  1244. "tasklist": c.tasklistid,
  1245. "task": c.taskid,
  1246. })
  1247. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1248. }
  1249. // Do executes the "tasks.tasks.delete" call.
  1250. func (c *TasksDeleteCall) Do(opts ...googleapi.CallOption) error {
  1251. gensupport.SetOptions(c.urlParams_, opts...)
  1252. res, err := c.doRequest("json")
  1253. if err != nil {
  1254. return err
  1255. }
  1256. defer googleapi.CloseBody(res)
  1257. if err := googleapi.CheckResponse(res); err != nil {
  1258. return err
  1259. }
  1260. return nil
  1261. // {
  1262. // "description": "Deletes the specified task from the task list.",
  1263. // "httpMethod": "DELETE",
  1264. // "id": "tasks.tasks.delete",
  1265. // "parameterOrder": [
  1266. // "tasklist",
  1267. // "task"
  1268. // ],
  1269. // "parameters": {
  1270. // "task": {
  1271. // "description": "Task identifier.",
  1272. // "location": "path",
  1273. // "required": true,
  1274. // "type": "string"
  1275. // },
  1276. // "tasklist": {
  1277. // "description": "Task list identifier.",
  1278. // "location": "path",
  1279. // "required": true,
  1280. // "type": "string"
  1281. // }
  1282. // },
  1283. // "path": "lists/{tasklist}/tasks/{task}",
  1284. // "scopes": [
  1285. // "https://www.googleapis.com/auth/tasks"
  1286. // ]
  1287. // }
  1288. }
  1289. // method id "tasks.tasks.get":
  1290. type TasksGetCall struct {
  1291. s *Service
  1292. tasklistid string
  1293. taskid string
  1294. urlParams_ gensupport.URLParams
  1295. ifNoneMatch_ string
  1296. ctx_ context.Context
  1297. header_ http.Header
  1298. }
  1299. // Get: Returns the specified task.
  1300. func (r *TasksService) Get(tasklistid string, taskid string) *TasksGetCall {
  1301. c := &TasksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1302. c.tasklistid = tasklistid
  1303. c.taskid = taskid
  1304. return c
  1305. }
  1306. // Fields allows partial responses to be retrieved. See
  1307. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1308. // for more information.
  1309. func (c *TasksGetCall) Fields(s ...googleapi.Field) *TasksGetCall {
  1310. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1311. return c
  1312. }
  1313. // IfNoneMatch sets the optional parameter which makes the operation
  1314. // fail if the object's ETag matches the given value. This is useful for
  1315. // getting updates only after the object has changed since the last
  1316. // request. Use googleapi.IsNotModified to check whether the response
  1317. // error from Do is the result of In-None-Match.
  1318. func (c *TasksGetCall) IfNoneMatch(entityTag string) *TasksGetCall {
  1319. c.ifNoneMatch_ = entityTag
  1320. return c
  1321. }
  1322. // Context sets the context to be used in this call's Do method. Any
  1323. // pending HTTP request will be aborted if the provided context is
  1324. // canceled.
  1325. func (c *TasksGetCall) Context(ctx context.Context) *TasksGetCall {
  1326. c.ctx_ = ctx
  1327. return c
  1328. }
  1329. // Header returns an http.Header that can be modified by the caller to
  1330. // add HTTP headers to the request.
  1331. func (c *TasksGetCall) Header() http.Header {
  1332. if c.header_ == nil {
  1333. c.header_ = make(http.Header)
  1334. }
  1335. return c.header_
  1336. }
  1337. func (c *TasksGetCall) doRequest(alt string) (*http.Response, error) {
  1338. reqHeaders := make(http.Header)
  1339. for k, v := range c.header_ {
  1340. reqHeaders[k] = v
  1341. }
  1342. reqHeaders.Set("User-Agent", c.s.userAgent())
  1343. if c.ifNoneMatch_ != "" {
  1344. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1345. }
  1346. var body io.Reader = nil
  1347. c.urlParams_.Set("alt", alt)
  1348. c.urlParams_.Set("prettyPrint", "false")
  1349. urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}")
  1350. urls += "?" + c.urlParams_.Encode()
  1351. req, err := http.NewRequest("GET", urls, body)
  1352. if err != nil {
  1353. return nil, err
  1354. }
  1355. req.Header = reqHeaders
  1356. googleapi.Expand(req.URL, map[string]string{
  1357. "tasklist": c.tasklistid,
  1358. "task": c.taskid,
  1359. })
  1360. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1361. }
  1362. // Do executes the "tasks.tasks.get" call.
  1363. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  1364. // code is an error. Response headers are in either
  1365. // *Task.ServerResponse.Header or (if a response was returned at all) in
  1366. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1367. // whether the returned error was because http.StatusNotModified was
  1368. // returned.
  1369. func (c *TasksGetCall) Do(opts ...googleapi.CallOption) (*Task, 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 := &Task{
  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": "Returns the specified task.",
  1401. // "httpMethod": "GET",
  1402. // "id": "tasks.tasks.get",
  1403. // "parameterOrder": [
  1404. // "tasklist",
  1405. // "task"
  1406. // ],
  1407. // "parameters": {
  1408. // "task": {
  1409. // "description": "Task identifier.",
  1410. // "location": "path",
  1411. // "required": true,
  1412. // "type": "string"
  1413. // },
  1414. // "tasklist": {
  1415. // "description": "Task list identifier.",
  1416. // "location": "path",
  1417. // "required": true,
  1418. // "type": "string"
  1419. // }
  1420. // },
  1421. // "path": "lists/{tasklist}/tasks/{task}",
  1422. // "response": {
  1423. // "$ref": "Task"
  1424. // },
  1425. // "scopes": [
  1426. // "https://www.googleapis.com/auth/tasks",
  1427. // "https://www.googleapis.com/auth/tasks.readonly"
  1428. // ]
  1429. // }
  1430. }
  1431. // method id "tasks.tasks.insert":
  1432. type TasksInsertCall struct {
  1433. s *Service
  1434. tasklistid string
  1435. task *Task
  1436. urlParams_ gensupport.URLParams
  1437. ctx_ context.Context
  1438. header_ http.Header
  1439. }
  1440. // Insert: Creates a new task on the specified task list.
  1441. func (r *TasksService) Insert(tasklistid string, task *Task) *TasksInsertCall {
  1442. c := &TasksInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1443. c.tasklistid = tasklistid
  1444. c.task = task
  1445. return c
  1446. }
  1447. // Parent sets the optional parameter "parent": Parent task identifier.
  1448. // If the task is created at the top level, this parameter is omitted.
  1449. func (c *TasksInsertCall) Parent(parent string) *TasksInsertCall {
  1450. c.urlParams_.Set("parent", parent)
  1451. return c
  1452. }
  1453. // Previous sets the optional parameter "previous": Previous sibling
  1454. // task identifier. If the task is created at the first position among
  1455. // its siblings, this parameter is omitted.
  1456. func (c *TasksInsertCall) Previous(previous string) *TasksInsertCall {
  1457. c.urlParams_.Set("previous", previous)
  1458. return c
  1459. }
  1460. // Fields allows partial responses to be retrieved. See
  1461. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1462. // for more information.
  1463. func (c *TasksInsertCall) Fields(s ...googleapi.Field) *TasksInsertCall {
  1464. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1465. return c
  1466. }
  1467. // Context sets the context to be used in this call's Do method. Any
  1468. // pending HTTP request will be aborted if the provided context is
  1469. // canceled.
  1470. func (c *TasksInsertCall) Context(ctx context.Context) *TasksInsertCall {
  1471. c.ctx_ = ctx
  1472. return c
  1473. }
  1474. // Header returns an http.Header that can be modified by the caller to
  1475. // add HTTP headers to the request.
  1476. func (c *TasksInsertCall) Header() http.Header {
  1477. if c.header_ == nil {
  1478. c.header_ = make(http.Header)
  1479. }
  1480. return c.header_
  1481. }
  1482. func (c *TasksInsertCall) doRequest(alt string) (*http.Response, error) {
  1483. reqHeaders := make(http.Header)
  1484. for k, v := range c.header_ {
  1485. reqHeaders[k] = v
  1486. }
  1487. reqHeaders.Set("User-Agent", c.s.userAgent())
  1488. var body io.Reader = nil
  1489. body, err := googleapi.WithoutDataWrapper.JSONReader(c.task)
  1490. if err != nil {
  1491. return nil, err
  1492. }
  1493. reqHeaders.Set("Content-Type", "application/json")
  1494. c.urlParams_.Set("alt", alt)
  1495. c.urlParams_.Set("prettyPrint", "false")
  1496. urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks")
  1497. urls += "?" + c.urlParams_.Encode()
  1498. req, err := http.NewRequest("POST", urls, body)
  1499. if err != nil {
  1500. return nil, err
  1501. }
  1502. req.Header = reqHeaders
  1503. googleapi.Expand(req.URL, map[string]string{
  1504. "tasklist": c.tasklistid,
  1505. })
  1506. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1507. }
  1508. // Do executes the "tasks.tasks.insert" call.
  1509. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  1510. // code is an error. Response headers are in either
  1511. // *Task.ServerResponse.Header or (if a response was returned at all) in
  1512. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1513. // whether the returned error was because http.StatusNotModified was
  1514. // returned.
  1515. func (c *TasksInsertCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  1516. gensupport.SetOptions(c.urlParams_, opts...)
  1517. res, err := c.doRequest("json")
  1518. if res != nil && res.StatusCode == http.StatusNotModified {
  1519. if res.Body != nil {
  1520. res.Body.Close()
  1521. }
  1522. return nil, &googleapi.Error{
  1523. Code: res.StatusCode,
  1524. Header: res.Header,
  1525. }
  1526. }
  1527. if err != nil {
  1528. return nil, err
  1529. }
  1530. defer googleapi.CloseBody(res)
  1531. if err := googleapi.CheckResponse(res); err != nil {
  1532. return nil, err
  1533. }
  1534. ret := &Task{
  1535. ServerResponse: googleapi.ServerResponse{
  1536. Header: res.Header,
  1537. HTTPStatusCode: res.StatusCode,
  1538. },
  1539. }
  1540. target := &ret
  1541. if err := gensupport.DecodeResponse(target, res); err != nil {
  1542. return nil, err
  1543. }
  1544. return ret, nil
  1545. // {
  1546. // "description": "Creates a new task on the specified task list.",
  1547. // "httpMethod": "POST",
  1548. // "id": "tasks.tasks.insert",
  1549. // "parameterOrder": [
  1550. // "tasklist"
  1551. // ],
  1552. // "parameters": {
  1553. // "parent": {
  1554. // "description": "Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional.",
  1555. // "location": "query",
  1556. // "type": "string"
  1557. // },
  1558. // "previous": {
  1559. // "description": "Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional.",
  1560. // "location": "query",
  1561. // "type": "string"
  1562. // },
  1563. // "tasklist": {
  1564. // "description": "Task list identifier.",
  1565. // "location": "path",
  1566. // "required": true,
  1567. // "type": "string"
  1568. // }
  1569. // },
  1570. // "path": "lists/{tasklist}/tasks",
  1571. // "request": {
  1572. // "$ref": "Task"
  1573. // },
  1574. // "response": {
  1575. // "$ref": "Task"
  1576. // },
  1577. // "scopes": [
  1578. // "https://www.googleapis.com/auth/tasks"
  1579. // ]
  1580. // }
  1581. }
  1582. // method id "tasks.tasks.list":
  1583. type TasksListCall struct {
  1584. s *Service
  1585. tasklistid string
  1586. urlParams_ gensupport.URLParams
  1587. ifNoneMatch_ string
  1588. ctx_ context.Context
  1589. header_ http.Header
  1590. }
  1591. // List: Returns all tasks in the specified task list.
  1592. func (r *TasksService) List(tasklistid string) *TasksListCall {
  1593. c := &TasksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1594. c.tasklistid = tasklistid
  1595. return c
  1596. }
  1597. // CompletedMax sets the optional parameter "completedMax": Upper bound
  1598. // for a task's completion date (as a RFC 3339 timestamp) to filter by.
  1599. // The default is not to filter by completion date.
  1600. func (c *TasksListCall) CompletedMax(completedMax string) *TasksListCall {
  1601. c.urlParams_.Set("completedMax", completedMax)
  1602. return c
  1603. }
  1604. // CompletedMin sets the optional parameter "completedMin": Lower bound
  1605. // for a task's completion date (as a RFC 3339 timestamp) to filter by.
  1606. // The default is not to filter by completion date.
  1607. func (c *TasksListCall) CompletedMin(completedMin string) *TasksListCall {
  1608. c.urlParams_.Set("completedMin", completedMin)
  1609. return c
  1610. }
  1611. // DueMax sets the optional parameter "dueMax": Upper bound for a task's
  1612. // due date (as a RFC 3339 timestamp) to filter by. The default is not
  1613. // to filter by due date.
  1614. func (c *TasksListCall) DueMax(dueMax string) *TasksListCall {
  1615. c.urlParams_.Set("dueMax", dueMax)
  1616. return c
  1617. }
  1618. // DueMin sets the optional parameter "dueMin": Lower bound for a task's
  1619. // due date (as a RFC 3339 timestamp) to filter by. The default is not
  1620. // to filter by due date.
  1621. func (c *TasksListCall) DueMin(dueMin string) *TasksListCall {
  1622. c.urlParams_.Set("dueMin", dueMin)
  1623. return c
  1624. }
  1625. // MaxResults sets the optional parameter "maxResults": Maximum number
  1626. // of task lists returned on one page. The default is 20 (max allowed:
  1627. // 100).
  1628. func (c *TasksListCall) MaxResults(maxResults int64) *TasksListCall {
  1629. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1630. return c
  1631. }
  1632. // PageToken sets the optional parameter "pageToken": Token specifying
  1633. // the result page to return.
  1634. func (c *TasksListCall) PageToken(pageToken string) *TasksListCall {
  1635. c.urlParams_.Set("pageToken", pageToken)
  1636. return c
  1637. }
  1638. // ShowCompleted sets the optional parameter "showCompleted": Flag
  1639. // indicating whether completed tasks are returned in the result. The
  1640. // default is True.
  1641. func (c *TasksListCall) ShowCompleted(showCompleted bool) *TasksListCall {
  1642. c.urlParams_.Set("showCompleted", fmt.Sprint(showCompleted))
  1643. return c
  1644. }
  1645. // ShowDeleted sets the optional parameter "showDeleted": Flag
  1646. // indicating whether deleted tasks are returned in the result. The
  1647. // default is False.
  1648. func (c *TasksListCall) ShowDeleted(showDeleted bool) *TasksListCall {
  1649. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  1650. return c
  1651. }
  1652. // ShowHidden sets the optional parameter "showHidden": Flag indicating
  1653. // whether hidden tasks are returned in the result. The default is
  1654. // False.
  1655. func (c *TasksListCall) ShowHidden(showHidden bool) *TasksListCall {
  1656. c.urlParams_.Set("showHidden", fmt.Sprint(showHidden))
  1657. return c
  1658. }
  1659. // UpdatedMin sets the optional parameter "updatedMin": Lower bound for
  1660. // a task's last modification time (as a RFC 3339 timestamp) to filter
  1661. // by. The default is not to filter by last modification time.
  1662. func (c *TasksListCall) UpdatedMin(updatedMin string) *TasksListCall {
  1663. c.urlParams_.Set("updatedMin", updatedMin)
  1664. return c
  1665. }
  1666. // Fields allows partial responses to be retrieved. See
  1667. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1668. // for more information.
  1669. func (c *TasksListCall) Fields(s ...googleapi.Field) *TasksListCall {
  1670. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1671. return c
  1672. }
  1673. // IfNoneMatch sets the optional parameter which makes the operation
  1674. // fail if the object's ETag matches the given value. This is useful for
  1675. // getting updates only after the object has changed since the last
  1676. // request. Use googleapi.IsNotModified to check whether the response
  1677. // error from Do is the result of In-None-Match.
  1678. func (c *TasksListCall) IfNoneMatch(entityTag string) *TasksListCall {
  1679. c.ifNoneMatch_ = entityTag
  1680. return c
  1681. }
  1682. // Context sets the context to be used in this call's Do method. Any
  1683. // pending HTTP request will be aborted if the provided context is
  1684. // canceled.
  1685. func (c *TasksListCall) Context(ctx context.Context) *TasksListCall {
  1686. c.ctx_ = ctx
  1687. return c
  1688. }
  1689. // Header returns an http.Header that can be modified by the caller to
  1690. // add HTTP headers to the request.
  1691. func (c *TasksListCall) Header() http.Header {
  1692. if c.header_ == nil {
  1693. c.header_ = make(http.Header)
  1694. }
  1695. return c.header_
  1696. }
  1697. func (c *TasksListCall) doRequest(alt string) (*http.Response, error) {
  1698. reqHeaders := make(http.Header)
  1699. for k, v := range c.header_ {
  1700. reqHeaders[k] = v
  1701. }
  1702. reqHeaders.Set("User-Agent", c.s.userAgent())
  1703. if c.ifNoneMatch_ != "" {
  1704. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1705. }
  1706. var body io.Reader = nil
  1707. c.urlParams_.Set("alt", alt)
  1708. c.urlParams_.Set("prettyPrint", "false")
  1709. urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks")
  1710. urls += "?" + c.urlParams_.Encode()
  1711. req, err := http.NewRequest("GET", urls, body)
  1712. if err != nil {
  1713. return nil, err
  1714. }
  1715. req.Header = reqHeaders
  1716. googleapi.Expand(req.URL, map[string]string{
  1717. "tasklist": c.tasklistid,
  1718. })
  1719. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1720. }
  1721. // Do executes the "tasks.tasks.list" call.
  1722. // Exactly one of *Tasks or error will be non-nil. Any non-2xx status
  1723. // code is an error. Response headers are in either
  1724. // *Tasks.ServerResponse.Header or (if a response was returned at all)
  1725. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1726. // check whether the returned error was because http.StatusNotModified
  1727. // was returned.
  1728. func (c *TasksListCall) Do(opts ...googleapi.CallOption) (*Tasks, error) {
  1729. gensupport.SetOptions(c.urlParams_, opts...)
  1730. res, err := c.doRequest("json")
  1731. if res != nil && res.StatusCode == http.StatusNotModified {
  1732. if res.Body != nil {
  1733. res.Body.Close()
  1734. }
  1735. return nil, &googleapi.Error{
  1736. Code: res.StatusCode,
  1737. Header: res.Header,
  1738. }
  1739. }
  1740. if err != nil {
  1741. return nil, err
  1742. }
  1743. defer googleapi.CloseBody(res)
  1744. if err := googleapi.CheckResponse(res); err != nil {
  1745. return nil, err
  1746. }
  1747. ret := &Tasks{
  1748. ServerResponse: googleapi.ServerResponse{
  1749. Header: res.Header,
  1750. HTTPStatusCode: res.StatusCode,
  1751. },
  1752. }
  1753. target := &ret
  1754. if err := gensupport.DecodeResponse(target, res); err != nil {
  1755. return nil, err
  1756. }
  1757. return ret, nil
  1758. // {
  1759. // "description": "Returns all tasks in the specified task list.",
  1760. // "httpMethod": "GET",
  1761. // "id": "tasks.tasks.list",
  1762. // "parameterOrder": [
  1763. // "tasklist"
  1764. // ],
  1765. // "parameters": {
  1766. // "completedMax": {
  1767. // "description": "Upper bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.",
  1768. // "location": "query",
  1769. // "type": "string"
  1770. // },
  1771. // "completedMin": {
  1772. // "description": "Lower bound for a task's completion date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by completion date.",
  1773. // "location": "query",
  1774. // "type": "string"
  1775. // },
  1776. // "dueMax": {
  1777. // "description": "Upper bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.",
  1778. // "location": "query",
  1779. // "type": "string"
  1780. // },
  1781. // "dueMin": {
  1782. // "description": "Lower bound for a task's due date (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by due date.",
  1783. // "location": "query",
  1784. // "type": "string"
  1785. // },
  1786. // "maxResults": {
  1787. // "description": "Maximum number of task lists returned on one page. Optional. The default is 20 (max allowed: 100).",
  1788. // "format": "int64",
  1789. // "location": "query",
  1790. // "type": "string"
  1791. // },
  1792. // "pageToken": {
  1793. // "description": "Token specifying the result page to return. Optional.",
  1794. // "location": "query",
  1795. // "type": "string"
  1796. // },
  1797. // "showCompleted": {
  1798. // "description": "Flag indicating whether completed tasks are returned in the result. Optional. The default is True.",
  1799. // "location": "query",
  1800. // "type": "boolean"
  1801. // },
  1802. // "showDeleted": {
  1803. // "description": "Flag indicating whether deleted tasks are returned in the result. Optional. The default is False.",
  1804. // "location": "query",
  1805. // "type": "boolean"
  1806. // },
  1807. // "showHidden": {
  1808. // "description": "Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.",
  1809. // "location": "query",
  1810. // "type": "boolean"
  1811. // },
  1812. // "tasklist": {
  1813. // "description": "Task list identifier.",
  1814. // "location": "path",
  1815. // "required": true,
  1816. // "type": "string"
  1817. // },
  1818. // "updatedMin": {
  1819. // "description": "Lower bound for a task's last modification time (as a RFC 3339 timestamp) to filter by. Optional. The default is not to filter by last modification time.",
  1820. // "location": "query",
  1821. // "type": "string"
  1822. // }
  1823. // },
  1824. // "path": "lists/{tasklist}/tasks",
  1825. // "response": {
  1826. // "$ref": "Tasks"
  1827. // },
  1828. // "scopes": [
  1829. // "https://www.googleapis.com/auth/tasks",
  1830. // "https://www.googleapis.com/auth/tasks.readonly"
  1831. // ]
  1832. // }
  1833. }
  1834. // Pages invokes f for each page of results.
  1835. // A non-nil error returned from f will halt the iteration.
  1836. // The provided context supersedes any context provided to the Context method.
  1837. func (c *TasksListCall) Pages(ctx context.Context, f func(*Tasks) error) error {
  1838. c.ctx_ = ctx
  1839. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1840. for {
  1841. x, err := c.Do()
  1842. if err != nil {
  1843. return err
  1844. }
  1845. if err := f(x); err != nil {
  1846. return err
  1847. }
  1848. if x.NextPageToken == "" {
  1849. return nil
  1850. }
  1851. c.PageToken(x.NextPageToken)
  1852. }
  1853. }
  1854. // method id "tasks.tasks.move":
  1855. type TasksMoveCall struct {
  1856. s *Service
  1857. tasklistid string
  1858. taskid string
  1859. urlParams_ gensupport.URLParams
  1860. ctx_ context.Context
  1861. header_ http.Header
  1862. }
  1863. // Move: Moves the specified task to another position in the task list.
  1864. // This can include putting it as a child task under a new parent and/or
  1865. // move it to a different position among its sibling tasks.
  1866. func (r *TasksService) Move(tasklistid string, taskid string) *TasksMoveCall {
  1867. c := &TasksMoveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1868. c.tasklistid = tasklistid
  1869. c.taskid = taskid
  1870. return c
  1871. }
  1872. // Parent sets the optional parameter "parent": New parent task
  1873. // identifier. If the task is moved to the top level, this parameter is
  1874. // omitted.
  1875. func (c *TasksMoveCall) Parent(parent string) *TasksMoveCall {
  1876. c.urlParams_.Set("parent", parent)
  1877. return c
  1878. }
  1879. // Previous sets the optional parameter "previous": New previous sibling
  1880. // task identifier. If the task is moved to the first position among its
  1881. // siblings, this parameter is omitted.
  1882. func (c *TasksMoveCall) Previous(previous string) *TasksMoveCall {
  1883. c.urlParams_.Set("previous", previous)
  1884. return c
  1885. }
  1886. // Fields allows partial responses to be retrieved. See
  1887. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1888. // for more information.
  1889. func (c *TasksMoveCall) Fields(s ...googleapi.Field) *TasksMoveCall {
  1890. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1891. return c
  1892. }
  1893. // Context sets the context to be used in this call's Do method. Any
  1894. // pending HTTP request will be aborted if the provided context is
  1895. // canceled.
  1896. func (c *TasksMoveCall) Context(ctx context.Context) *TasksMoveCall {
  1897. c.ctx_ = ctx
  1898. return c
  1899. }
  1900. // Header returns an http.Header that can be modified by the caller to
  1901. // add HTTP headers to the request.
  1902. func (c *TasksMoveCall) Header() http.Header {
  1903. if c.header_ == nil {
  1904. c.header_ = make(http.Header)
  1905. }
  1906. return c.header_
  1907. }
  1908. func (c *TasksMoveCall) doRequest(alt string) (*http.Response, error) {
  1909. reqHeaders := make(http.Header)
  1910. for k, v := range c.header_ {
  1911. reqHeaders[k] = v
  1912. }
  1913. reqHeaders.Set("User-Agent", c.s.userAgent())
  1914. var body io.Reader = nil
  1915. c.urlParams_.Set("alt", alt)
  1916. c.urlParams_.Set("prettyPrint", "false")
  1917. urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}/move")
  1918. urls += "?" + c.urlParams_.Encode()
  1919. req, err := http.NewRequest("POST", urls, body)
  1920. if err != nil {
  1921. return nil, err
  1922. }
  1923. req.Header = reqHeaders
  1924. googleapi.Expand(req.URL, map[string]string{
  1925. "tasklist": c.tasklistid,
  1926. "task": c.taskid,
  1927. })
  1928. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1929. }
  1930. // Do executes the "tasks.tasks.move" call.
  1931. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  1932. // code is an error. Response headers are in either
  1933. // *Task.ServerResponse.Header or (if a response was returned at all) in
  1934. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1935. // whether the returned error was because http.StatusNotModified was
  1936. // returned.
  1937. func (c *TasksMoveCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  1938. gensupport.SetOptions(c.urlParams_, opts...)
  1939. res, err := c.doRequest("json")
  1940. if res != nil && res.StatusCode == http.StatusNotModified {
  1941. if res.Body != nil {
  1942. res.Body.Close()
  1943. }
  1944. return nil, &googleapi.Error{
  1945. Code: res.StatusCode,
  1946. Header: res.Header,
  1947. }
  1948. }
  1949. if err != nil {
  1950. return nil, err
  1951. }
  1952. defer googleapi.CloseBody(res)
  1953. if err := googleapi.CheckResponse(res); err != nil {
  1954. return nil, err
  1955. }
  1956. ret := &Task{
  1957. ServerResponse: googleapi.ServerResponse{
  1958. Header: res.Header,
  1959. HTTPStatusCode: res.StatusCode,
  1960. },
  1961. }
  1962. target := &ret
  1963. if err := gensupport.DecodeResponse(target, res); err != nil {
  1964. return nil, err
  1965. }
  1966. return ret, nil
  1967. // {
  1968. // "description": "Moves the specified task to another position in the task list. This can include putting it as a child task under a new parent and/or move it to a different position among its sibling tasks.",
  1969. // "httpMethod": "POST",
  1970. // "id": "tasks.tasks.move",
  1971. // "parameterOrder": [
  1972. // "tasklist",
  1973. // "task"
  1974. // ],
  1975. // "parameters": {
  1976. // "parent": {
  1977. // "description": "New parent task identifier. If the task is moved to the top level, this parameter is omitted. Optional.",
  1978. // "location": "query",
  1979. // "type": "string"
  1980. // },
  1981. // "previous": {
  1982. // "description": "New previous sibling task identifier. If the task is moved to the first position among its siblings, this parameter is omitted. Optional.",
  1983. // "location": "query",
  1984. // "type": "string"
  1985. // },
  1986. // "task": {
  1987. // "description": "Task identifier.",
  1988. // "location": "path",
  1989. // "required": true,
  1990. // "type": "string"
  1991. // },
  1992. // "tasklist": {
  1993. // "description": "Task list identifier.",
  1994. // "location": "path",
  1995. // "required": true,
  1996. // "type": "string"
  1997. // }
  1998. // },
  1999. // "path": "lists/{tasklist}/tasks/{task}/move",
  2000. // "response": {
  2001. // "$ref": "Task"
  2002. // },
  2003. // "scopes": [
  2004. // "https://www.googleapis.com/auth/tasks"
  2005. // ]
  2006. // }
  2007. }
  2008. // method id "tasks.tasks.patch":
  2009. type TasksPatchCall struct {
  2010. s *Service
  2011. tasklistid string
  2012. taskid string
  2013. task *Task
  2014. urlParams_ gensupport.URLParams
  2015. ctx_ context.Context
  2016. header_ http.Header
  2017. }
  2018. // Patch: Updates the specified task. This method supports patch
  2019. // semantics.
  2020. func (r *TasksService) Patch(tasklistid string, taskid string, task *Task) *TasksPatchCall {
  2021. c := &TasksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2022. c.tasklistid = tasklistid
  2023. c.taskid = taskid
  2024. c.task = task
  2025. return c
  2026. }
  2027. // Fields allows partial responses to be retrieved. See
  2028. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2029. // for more information.
  2030. func (c *TasksPatchCall) Fields(s ...googleapi.Field) *TasksPatchCall {
  2031. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2032. return c
  2033. }
  2034. // Context sets the context to be used in this call's Do method. Any
  2035. // pending HTTP request will be aborted if the provided context is
  2036. // canceled.
  2037. func (c *TasksPatchCall) Context(ctx context.Context) *TasksPatchCall {
  2038. c.ctx_ = ctx
  2039. return c
  2040. }
  2041. // Header returns an http.Header that can be modified by the caller to
  2042. // add HTTP headers to the request.
  2043. func (c *TasksPatchCall) Header() http.Header {
  2044. if c.header_ == nil {
  2045. c.header_ = make(http.Header)
  2046. }
  2047. return c.header_
  2048. }
  2049. func (c *TasksPatchCall) doRequest(alt string) (*http.Response, error) {
  2050. reqHeaders := make(http.Header)
  2051. for k, v := range c.header_ {
  2052. reqHeaders[k] = v
  2053. }
  2054. reqHeaders.Set("User-Agent", c.s.userAgent())
  2055. var body io.Reader = nil
  2056. body, err := googleapi.WithoutDataWrapper.JSONReader(c.task)
  2057. if err != nil {
  2058. return nil, err
  2059. }
  2060. reqHeaders.Set("Content-Type", "application/json")
  2061. c.urlParams_.Set("alt", alt)
  2062. c.urlParams_.Set("prettyPrint", "false")
  2063. urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}")
  2064. urls += "?" + c.urlParams_.Encode()
  2065. req, err := http.NewRequest("PATCH", urls, body)
  2066. if err != nil {
  2067. return nil, err
  2068. }
  2069. req.Header = reqHeaders
  2070. googleapi.Expand(req.URL, map[string]string{
  2071. "tasklist": c.tasklistid,
  2072. "task": c.taskid,
  2073. })
  2074. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2075. }
  2076. // Do executes the "tasks.tasks.patch" call.
  2077. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  2078. // code is an error. Response headers are in either
  2079. // *Task.ServerResponse.Header or (if a response was returned at all) in
  2080. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2081. // whether the returned error was because http.StatusNotModified was
  2082. // returned.
  2083. func (c *TasksPatchCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  2084. gensupport.SetOptions(c.urlParams_, opts...)
  2085. res, err := c.doRequest("json")
  2086. if res != nil && res.StatusCode == http.StatusNotModified {
  2087. if res.Body != nil {
  2088. res.Body.Close()
  2089. }
  2090. return nil, &googleapi.Error{
  2091. Code: res.StatusCode,
  2092. Header: res.Header,
  2093. }
  2094. }
  2095. if err != nil {
  2096. return nil, err
  2097. }
  2098. defer googleapi.CloseBody(res)
  2099. if err := googleapi.CheckResponse(res); err != nil {
  2100. return nil, err
  2101. }
  2102. ret := &Task{
  2103. ServerResponse: googleapi.ServerResponse{
  2104. Header: res.Header,
  2105. HTTPStatusCode: res.StatusCode,
  2106. },
  2107. }
  2108. target := &ret
  2109. if err := gensupport.DecodeResponse(target, res); err != nil {
  2110. return nil, err
  2111. }
  2112. return ret, nil
  2113. // {
  2114. // "description": "Updates the specified task. This method supports patch semantics.",
  2115. // "httpMethod": "PATCH",
  2116. // "id": "tasks.tasks.patch",
  2117. // "parameterOrder": [
  2118. // "tasklist",
  2119. // "task"
  2120. // ],
  2121. // "parameters": {
  2122. // "task": {
  2123. // "description": "Task identifier.",
  2124. // "location": "path",
  2125. // "required": true,
  2126. // "type": "string"
  2127. // },
  2128. // "tasklist": {
  2129. // "description": "Task list identifier.",
  2130. // "location": "path",
  2131. // "required": true,
  2132. // "type": "string"
  2133. // }
  2134. // },
  2135. // "path": "lists/{tasklist}/tasks/{task}",
  2136. // "request": {
  2137. // "$ref": "Task"
  2138. // },
  2139. // "response": {
  2140. // "$ref": "Task"
  2141. // },
  2142. // "scopes": [
  2143. // "https://www.googleapis.com/auth/tasks"
  2144. // ]
  2145. // }
  2146. }
  2147. // method id "tasks.tasks.update":
  2148. type TasksUpdateCall struct {
  2149. s *Service
  2150. tasklistid string
  2151. taskid string
  2152. task *Task
  2153. urlParams_ gensupport.URLParams
  2154. ctx_ context.Context
  2155. header_ http.Header
  2156. }
  2157. // Update: Updates the specified task.
  2158. func (r *TasksService) Update(tasklistid string, taskid string, task *Task) *TasksUpdateCall {
  2159. c := &TasksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2160. c.tasklistid = tasklistid
  2161. c.taskid = taskid
  2162. c.task = task
  2163. return c
  2164. }
  2165. // Fields allows partial responses to be retrieved. See
  2166. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2167. // for more information.
  2168. func (c *TasksUpdateCall) Fields(s ...googleapi.Field) *TasksUpdateCall {
  2169. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2170. return c
  2171. }
  2172. // Context sets the context to be used in this call's Do method. Any
  2173. // pending HTTP request will be aborted if the provided context is
  2174. // canceled.
  2175. func (c *TasksUpdateCall) Context(ctx context.Context) *TasksUpdateCall {
  2176. c.ctx_ = ctx
  2177. return c
  2178. }
  2179. // Header returns an http.Header that can be modified by the caller to
  2180. // add HTTP headers to the request.
  2181. func (c *TasksUpdateCall) Header() http.Header {
  2182. if c.header_ == nil {
  2183. c.header_ = make(http.Header)
  2184. }
  2185. return c.header_
  2186. }
  2187. func (c *TasksUpdateCall) doRequest(alt string) (*http.Response, error) {
  2188. reqHeaders := make(http.Header)
  2189. for k, v := range c.header_ {
  2190. reqHeaders[k] = v
  2191. }
  2192. reqHeaders.Set("User-Agent", c.s.userAgent())
  2193. var body io.Reader = nil
  2194. body, err := googleapi.WithoutDataWrapper.JSONReader(c.task)
  2195. if err != nil {
  2196. return nil, err
  2197. }
  2198. reqHeaders.Set("Content-Type", "application/json")
  2199. c.urlParams_.Set("alt", alt)
  2200. c.urlParams_.Set("prettyPrint", "false")
  2201. urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}")
  2202. urls += "?" + c.urlParams_.Encode()
  2203. req, err := http.NewRequest("PUT", urls, body)
  2204. if err != nil {
  2205. return nil, err
  2206. }
  2207. req.Header = reqHeaders
  2208. googleapi.Expand(req.URL, map[string]string{
  2209. "tasklist": c.tasklistid,
  2210. "task": c.taskid,
  2211. })
  2212. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2213. }
  2214. // Do executes the "tasks.tasks.update" call.
  2215. // Exactly one of *Task or error will be non-nil. Any non-2xx status
  2216. // code is an error. Response headers are in either
  2217. // *Task.ServerResponse.Header or (if a response was returned at all) in
  2218. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2219. // whether the returned error was because http.StatusNotModified was
  2220. // returned.
  2221. func (c *TasksUpdateCall) Do(opts ...googleapi.CallOption) (*Task, error) {
  2222. gensupport.SetOptions(c.urlParams_, opts...)
  2223. res, err := c.doRequest("json")
  2224. if res != nil && res.StatusCode == http.StatusNotModified {
  2225. if res.Body != nil {
  2226. res.Body.Close()
  2227. }
  2228. return nil, &googleapi.Error{
  2229. Code: res.StatusCode,
  2230. Header: res.Header,
  2231. }
  2232. }
  2233. if err != nil {
  2234. return nil, err
  2235. }
  2236. defer googleapi.CloseBody(res)
  2237. if err := googleapi.CheckResponse(res); err != nil {
  2238. return nil, err
  2239. }
  2240. ret := &Task{
  2241. ServerResponse: googleapi.ServerResponse{
  2242. Header: res.Header,
  2243. HTTPStatusCode: res.StatusCode,
  2244. },
  2245. }
  2246. target := &ret
  2247. if err := gensupport.DecodeResponse(target, res); err != nil {
  2248. return nil, err
  2249. }
  2250. return ret, nil
  2251. // {
  2252. // "description": "Updates the specified task.",
  2253. // "httpMethod": "PUT",
  2254. // "id": "tasks.tasks.update",
  2255. // "parameterOrder": [
  2256. // "tasklist",
  2257. // "task"
  2258. // ],
  2259. // "parameters": {
  2260. // "task": {
  2261. // "description": "Task identifier.",
  2262. // "location": "path",
  2263. // "required": true,
  2264. // "type": "string"
  2265. // },
  2266. // "tasklist": {
  2267. // "description": "Task list identifier.",
  2268. // "location": "path",
  2269. // "required": true,
  2270. // "type": "string"
  2271. // }
  2272. // },
  2273. // "path": "lists/{tasklist}/tasks/{task}",
  2274. // "request": {
  2275. // "$ref": "Task"
  2276. // },
  2277. // "response": {
  2278. // "$ref": "Task"
  2279. // },
  2280. // "scopes": [
  2281. // "https://www.googleapis.com/auth/tasks"
  2282. // ]
  2283. // }
  2284. }