tasks-gen.go 65 KB

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