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.
 
 
 

2384 lines
72 KiB

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