|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501 |
- // Copyright 2019 Google LLC.
- // Use of this source code is governed by a BSD-style
- // license that can be found in the LICENSE file.
-
- // Code generated file. DO NOT EDIT.
-
- // Package tasks provides access to the Tasks API.
- //
- // For product documentation, see: https://developers.google.com/google-apps/tasks/firstapp
- //
- // Creating a client
- //
- // Usage example:
- //
- // import "google.golang.org/api/tasks/v1"
- // ...
- // ctx := context.Background()
- // tasksService, err := tasks.NewService(ctx)
- //
- // In this example, Google Application Default Credentials are used for authentication.
- //
- // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
- //
- // Other authentication options
- //
- // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
- //
- // tasksService, err := tasks.NewService(ctx, option.WithScopes(tasks.TasksReadonlyScope))
- //
- // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
- //
- // tasksService, err := tasks.NewService(ctx, option.WithAPIKey("AIza..."))
- //
- // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
- //
- // config := &oauth2.Config{...}
- // // ...
- // token, err := config.Exchange(ctx, ...)
- // tasksService, err := tasks.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
- //
- // See https://godoc.org/google.golang.org/api/option/ for details on options.
- package tasks // import "google.golang.org/api/tasks/v1"
-
- import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
-
- gensupport "google.golang.org/api/gensupport"
- googleapi "google.golang.org/api/googleapi"
- option "google.golang.org/api/option"
- htransport "google.golang.org/api/transport/http"
- )
-
- // Always reference these packages, just in case the auto-generated code
- // below doesn't.
- var _ = bytes.NewBuffer
- var _ = strconv.Itoa
- var _ = fmt.Sprintf
- var _ = json.NewDecoder
- var _ = io.Copy
- var _ = url.Parse
- var _ = gensupport.MarshalJSON
- var _ = googleapi.Version
- var _ = errors.New
- var _ = strings.Replace
- var _ = context.Canceled
-
- const apiId = "tasks:v1"
- const apiName = "tasks"
- const apiVersion = "v1"
- const basePath = "https://www.googleapis.com/tasks/v1/"
-
- // OAuth2 scopes used by this API.
- const (
- // Create, edit, organize, and delete all your tasks
- TasksScope = "https://www.googleapis.com/auth/tasks"
-
- // View your tasks
- TasksReadonlyScope = "https://www.googleapis.com/auth/tasks.readonly"
- )
-
- // NewService creates a new Service.
- func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
- scopesOption := option.WithScopes(
- "https://www.googleapis.com/auth/tasks",
- "https://www.googleapis.com/auth/tasks.readonly",
- )
- // NOTE: prepend, so we don't override user-specified scopes.
- opts = append([]option.ClientOption{scopesOption}, opts...)
- client, endpoint, err := htransport.NewClient(ctx, opts...)
- if err != nil {
- return nil, err
- }
- s, err := New(client)
- if err != nil {
- return nil, err
- }
- if endpoint != "" {
- s.BasePath = endpoint
- }
- return s, nil
- }
-
- // New creates a new Service. It uses the provided http.Client for requests.
- //
- // Deprecated: please use NewService instead.
- // To provide a custom HTTP client, use option.WithHTTPClient.
- // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
- func New(client *http.Client) (*Service, error) {
- if client == nil {
- return nil, errors.New("client is nil")
- }
- s := &Service{client: client, BasePath: basePath}
- s.Tasklists = NewTasklistsService(s)
- s.Tasks = NewTasksService(s)
- return s, nil
- }
-
- type Service struct {
- client *http.Client
- BasePath string // API endpoint base URL
- UserAgent string // optional additional User-Agent fragment
-
- Tasklists *TasklistsService
-
- Tasks *TasksService
- }
-
- func (s *Service) userAgent() string {
- if s.UserAgent == "" {
- return googleapi.UserAgent
- }
- return googleapi.UserAgent + " " + s.UserAgent
- }
-
- func NewTasklistsService(s *Service) *TasklistsService {
- rs := &TasklistsService{s: s}
- return rs
- }
-
- type TasklistsService struct {
- s *Service
- }
-
- func NewTasksService(s *Service) *TasksService {
- rs := &TasksService{s: s}
- return rs
- }
-
- type TasksService struct {
- s *Service
- }
-
- type Task struct {
- // Completed: Completion date of the task (as a RFC 3339 timestamp).
- // This field is omitted if the task has not been completed.
- Completed *string `json:"completed,omitempty"`
-
- // Deleted: Flag indicating whether the task has been deleted. The
- // default if False.
- Deleted bool `json:"deleted,omitempty"`
-
- // Due: Due date of the task (as a RFC 3339 timestamp). Optional.
- Due string `json:"due,omitempty"`
-
- // Etag: ETag of the resource.
- Etag string `json:"etag,omitempty"`
-
- // Hidden: Flag indicating whether the task is hidden. This is the case
- // if the task had been marked completed when the task list was last
- // cleared. The default is False. This field is read-only.
- Hidden bool `json:"hidden,omitempty"`
-
- // Id: Task identifier.
- Id string `json:"id,omitempty"`
-
- // Kind: Type of the resource. This is always "tasks#task".
- Kind string `json:"kind,omitempty"`
-
- // Links: Collection of links. This collection is read-only.
- Links []*TaskLinks `json:"links,omitempty"`
-
- // Notes: Notes describing the task. Optional.
- Notes string `json:"notes,omitempty"`
-
- // Parent: Parent task identifier. This field is omitted if it is a
- // top-level task. This field is read-only. Use the "move" method to
- // move the task under a different parent or to the top level.
- Parent string `json:"parent,omitempty"`
-
- // Position: String indicating the position of the task among its
- // sibling tasks under the same parent task or at the top level. If this
- // string is greater than another task's corresponding position string
- // according to lexicographical ordering, the task is positioned after
- // the other task under the same parent task (or at the top level). This
- // field is read-only. Use the "move" method to move the task to another
- // position.
- Position string `json:"position,omitempty"`
-
- // SelfLink: URL pointing to this task. Used to retrieve, update, or
- // delete this task.
- SelfLink string `json:"selfLink,omitempty"`
-
- // Status: Status of the task. This is either "needsAction" or
- // "completed".
- Status string `json:"status,omitempty"`
-
- // Title: Title of the task.
- Title string `json:"title,omitempty"`
-
- // Updated: Last modification time of the task (as a RFC 3339
- // timestamp).
- Updated string `json:"updated,omitempty"`
-
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
-
- // ForceSendFields is a list of field names (e.g. "Completed") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
-
- // NullFields is a list of field names (e.g. "Completed") to include in
- // API requests with the JSON null value. By default, fields with empty
- // values are omitted from API requests. However, any field with an
- // empty value appearing in NullFields will be sent to the server as
- // null. It is an error if a field in this list has a non-empty value.
- // This may be used to include null fields in Patch requests.
- NullFields []string `json:"-"`
- }
-
- func (s *Task) MarshalJSON() ([]byte, error) {
- type NoMethod Task
- raw := NoMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
- }
-
- type TaskLinks struct {
- // Description: The description. In HTML speak: Everything between <a>
- // and </a>.
- Description string `json:"description,omitempty"`
-
- // Link: The URL.
- Link string `json:"link,omitempty"`
-
- // Type: Type of the link, e.g. "email".
- Type string `json:"type,omitempty"`
-
- // ForceSendFields is a list of field names (e.g. "Description") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
-
- // NullFields is a list of field names (e.g. "Description") to include
- // in API requests with the JSON null value. By default, fields with
- // empty values are omitted from API requests. However, any field with
- // an empty value appearing in NullFields will be sent to the server as
- // null. It is an error if a field in this list has a non-empty value.
- // This may be used to include null fields in Patch requests.
- NullFields []string `json:"-"`
- }
-
- func (s *TaskLinks) MarshalJSON() ([]byte, error) {
- type NoMethod TaskLinks
- raw := NoMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
- }
-
- type TaskList struct {
- // Etag: ETag of the resource.
- Etag string `json:"etag,omitempty"`
-
- // Id: Task list identifier.
- Id string `json:"id,omitempty"`
-
- // Kind: Type of the resource. This is always "tasks#taskList".
- Kind string `json:"kind,omitempty"`
-
- // SelfLink: URL pointing to this task list. Used to retrieve, update,
- // or delete this task list.
- SelfLink string `json:"selfLink,omitempty"`
-
- // Title: Title of the task list.
- Title string `json:"title,omitempty"`
-
- // Updated: Last modification time of the task list (as a RFC 3339
- // timestamp).
- Updated string `json:"updated,omitempty"`
-
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
-
- // ForceSendFields is a list of field names (e.g. "Etag") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
-
- // NullFields is a list of field names (e.g. "Etag") to include in API
- // requests with the JSON null value. By default, fields with empty
- // values are omitted from API requests. However, any field with an
- // empty value appearing in NullFields will be sent to the server as
- // null. It is an error if a field in this list has a non-empty value.
- // This may be used to include null fields in Patch requests.
- NullFields []string `json:"-"`
- }
-
- func (s *TaskList) MarshalJSON() ([]byte, error) {
- type NoMethod TaskList
- raw := NoMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
- }
-
- type TaskLists struct {
- // Etag: ETag of the resource.
- Etag string `json:"etag,omitempty"`
-
- // Items: Collection of task lists.
- Items []*TaskList `json:"items,omitempty"`
-
- // Kind: Type of the resource. This is always "tasks#taskLists".
- Kind string `json:"kind,omitempty"`
-
- // NextPageToken: Token that can be used to request the next page of
- // this result.
- NextPageToken string `json:"nextPageToken,omitempty"`
-
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
-
- // ForceSendFields is a list of field names (e.g. "Etag") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
-
- // NullFields is a list of field names (e.g. "Etag") to include in API
- // requests with the JSON null value. By default, fields with empty
- // values are omitted from API requests. However, any field with an
- // empty value appearing in NullFields will be sent to the server as
- // null. It is an error if a field in this list has a non-empty value.
- // This may be used to include null fields in Patch requests.
- NullFields []string `json:"-"`
- }
-
- func (s *TaskLists) MarshalJSON() ([]byte, error) {
- type NoMethod TaskLists
- raw := NoMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
- }
-
- type Tasks struct {
- // Etag: ETag of the resource.
- Etag string `json:"etag,omitempty"`
-
- // Items: Collection of tasks.
- Items []*Task `json:"items,omitempty"`
-
- // Kind: Type of the resource. This is always "tasks#tasks".
- Kind string `json:"kind,omitempty"`
-
- // NextPageToken: Token used to access the next page of this result.
- NextPageToken string `json:"nextPageToken,omitempty"`
-
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
-
- // ForceSendFields is a list of field names (e.g. "Etag") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
-
- // NullFields is a list of field names (e.g. "Etag") to include in API
- // requests with the JSON null value. By default, fields with empty
- // values are omitted from API requests. However, any field with an
- // empty value appearing in NullFields will be sent to the server as
- // null. It is an error if a field in this list has a non-empty value.
- // This may be used to include null fields in Patch requests.
- NullFields []string `json:"-"`
- }
-
- func (s *Tasks) MarshalJSON() ([]byte, error) {
- type NoMethod Tasks
- raw := NoMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
- }
-
- // method id "tasks.tasklists.delete":
-
- type TasklistsDeleteCall struct {
- s *Service
- tasklistid string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Delete: Deletes the authenticated user's specified task list.
- func (r *TasklistsService) Delete(tasklistid string) *TasklistsDeleteCall {
- c := &TasklistsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasklistsDeleteCall) Fields(s ...googleapi.Field) *TasklistsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasklistsDeleteCall) Context(ctx context.Context) *TasklistsDeleteCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasklistsDeleteCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasklistsDeleteCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists/{tasklist}")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("DELETE", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasklists.delete" call.
- func (c *TasklistsDeleteCall) Do(opts ...googleapi.CallOption) error {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if err != nil {
- return err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return err
- }
- return nil
- // {
- // "description": "Deletes the authenticated user's specified task list.",
- // "httpMethod": "DELETE",
- // "id": "tasks.tasklists.delete",
- // "parameterOrder": [
- // "tasklist"
- // ],
- // "parameters": {
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "users/@me/lists/{tasklist}",
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasklists.get":
-
- type TasklistsGetCall struct {
- s *Service
- tasklistid string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- header_ http.Header
- }
-
- // Get: Returns the authenticated user's specified task list.
- func (r *TasklistsService) Get(tasklistid string) *TasklistsGetCall {
- c := &TasklistsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasklistsGetCall) Fields(s ...googleapi.Field) *TasklistsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TasklistsGetCall) IfNoneMatch(entityTag string) *TasklistsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasklistsGetCall) Context(ctx context.Context) *TasklistsGetCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasklistsGetCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasklistsGetCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists/{tasklist}")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("GET", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasklists.get" call.
- // Exactly one of *TaskList or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *TaskList.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TasklistsGetCall) Do(opts ...googleapi.CallOption) (*TaskList, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TaskList{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Returns the authenticated user's specified task list.",
- // "httpMethod": "GET",
- // "id": "tasks.tasklists.get",
- // "parameterOrder": [
- // "tasklist"
- // ],
- // "parameters": {
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "users/@me/lists/{tasklist}",
- // "response": {
- // "$ref": "TaskList"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks",
- // "https://www.googleapis.com/auth/tasks.readonly"
- // ]
- // }
-
- }
-
- // method id "tasks.tasklists.insert":
-
- type TasklistsInsertCall struct {
- s *Service
- tasklist *TaskList
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Insert: Creates a new task list and adds it to the authenticated
- // user's task lists.
- func (r *TasklistsService) Insert(tasklist *TaskList) *TasklistsInsertCall {
- c := &TasklistsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklist = tasklist
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasklistsInsertCall) Fields(s ...googleapi.Field) *TasklistsInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasklistsInsertCall) Context(ctx context.Context) *TasklistsInsertCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasklistsInsertCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasklistsInsertCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.tasklist)
- if err != nil {
- return nil, err
- }
- reqHeaders.Set("Content-Type", "application/json")
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("POST", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasklists.insert" call.
- // Exactly one of *TaskList or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *TaskList.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TasklistsInsertCall) Do(opts ...googleapi.CallOption) (*TaskList, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TaskList{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a new task list and adds it to the authenticated user's task lists.",
- // "httpMethod": "POST",
- // "id": "tasks.tasklists.insert",
- // "path": "users/@me/lists",
- // "request": {
- // "$ref": "TaskList"
- // },
- // "response": {
- // "$ref": "TaskList"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasklists.list":
-
- type TasklistsListCall struct {
- s *Service
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- header_ http.Header
- }
-
- // List: Returns all the authenticated user's task lists.
- func (r *TasklistsService) List() *TasklistsListCall {
- c := &TasklistsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- return c
- }
-
- // MaxResults sets the optional parameter "maxResults": Maximum number
- // of task lists returned on one page. The default is 20 (max allowed:
- // 100).
- func (c *TasklistsListCall) MaxResults(maxResults int64) *TasklistsListCall {
- c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
- return c
- }
-
- // PageToken sets the optional parameter "pageToken": Token specifying
- // the result page to return.
- func (c *TasklistsListCall) PageToken(pageToken string) *TasklistsListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasklistsListCall) Fields(s ...googleapi.Field) *TasklistsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TasklistsListCall) IfNoneMatch(entityTag string) *TasklistsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasklistsListCall) Context(ctx context.Context) *TasklistsListCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasklistsListCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasklistsListCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("GET", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasklists.list" call.
- // Exactly one of *TaskLists or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *TaskLists.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TasklistsListCall) Do(opts ...googleapi.CallOption) (*TaskLists, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TaskLists{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Returns all the authenticated user's task lists.",
- // "httpMethod": "GET",
- // "id": "tasks.tasklists.list",
- // "parameters": {
- // "maxResults": {
- // "description": "Maximum number of task lists returned on one page. Optional. The default is 20 (max allowed: 100).",
- // "format": "int64",
- // "location": "query",
- // "type": "string"
- // },
- // "pageToken": {
- // "description": "Token specifying the result page to return. Optional.",
- // "location": "query",
- // "type": "string"
- // }
- // },
- // "path": "users/@me/lists",
- // "response": {
- // "$ref": "TaskLists"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks",
- // "https://www.googleapis.com/auth/tasks.readonly"
- // ]
- // }
-
- }
-
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *TasklistsListCall) Pages(ctx context.Context, f func(*TaskLists) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
-
- // method id "tasks.tasklists.patch":
-
- type TasklistsPatchCall struct {
- s *Service
- tasklistid string
- tasklist *TaskList
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Patch: Updates the authenticated user's specified task list. This
- // method supports patch semantics.
- func (r *TasklistsService) Patch(tasklistid string, tasklist *TaskList) *TasklistsPatchCall {
- c := &TasklistsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- c.tasklist = tasklist
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasklistsPatchCall) Fields(s ...googleapi.Field) *TasklistsPatchCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasklistsPatchCall) Context(ctx context.Context) *TasklistsPatchCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasklistsPatchCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasklistsPatchCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.tasklist)
- if err != nil {
- return nil, err
- }
- reqHeaders.Set("Content-Type", "application/json")
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists/{tasklist}")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("PATCH", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasklists.patch" call.
- // Exactly one of *TaskList or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *TaskList.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TasklistsPatchCall) Do(opts ...googleapi.CallOption) (*TaskList, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TaskList{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates the authenticated user's specified task list. This method supports patch semantics.",
- // "httpMethod": "PATCH",
- // "id": "tasks.tasklists.patch",
- // "parameterOrder": [
- // "tasklist"
- // ],
- // "parameters": {
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "users/@me/lists/{tasklist}",
- // "request": {
- // "$ref": "TaskList"
- // },
- // "response": {
- // "$ref": "TaskList"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasklists.update":
-
- type TasklistsUpdateCall struct {
- s *Service
- tasklistid string
- tasklist *TaskList
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Update: Updates the authenticated user's specified task list.
- func (r *TasklistsService) Update(tasklistid string, tasklist *TaskList) *TasklistsUpdateCall {
- c := &TasklistsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- c.tasklist = tasklist
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasklistsUpdateCall) Fields(s ...googleapi.Field) *TasklistsUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasklistsUpdateCall) Context(ctx context.Context) *TasklistsUpdateCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasklistsUpdateCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasklistsUpdateCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.tasklist)
- if err != nil {
- return nil, err
- }
- reqHeaders.Set("Content-Type", "application/json")
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "users/@me/lists/{tasklist}")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("PUT", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasklists.update" call.
- // Exactly one of *TaskList or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *TaskList.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TasklistsUpdateCall) Do(opts ...googleapi.CallOption) (*TaskList, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TaskList{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates the authenticated user's specified task list.",
- // "httpMethod": "PUT",
- // "id": "tasks.tasklists.update",
- // "parameterOrder": [
- // "tasklist"
- // ],
- // "parameters": {
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "users/@me/lists/{tasklist}",
- // "request": {
- // "$ref": "TaskList"
- // },
- // "response": {
- // "$ref": "TaskList"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasks.clear":
-
- type TasksClearCall struct {
- s *Service
- tasklistid string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Clear: 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.
- func (r *TasksService) Clear(tasklistid string) *TasksClearCall {
- c := &TasksClearCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasksClearCall) Fields(s ...googleapi.Field) *TasksClearCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasksClearCall) Context(ctx context.Context) *TasksClearCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasksClearCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasksClearCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/clear")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("POST", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasks.clear" call.
- func (c *TasksClearCall) Do(opts ...googleapi.CallOption) error {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if err != nil {
- return err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return err
- }
- return nil
- // {
- // "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.",
- // "httpMethod": "POST",
- // "id": "tasks.tasks.clear",
- // "parameterOrder": [
- // "tasklist"
- // ],
- // "parameters": {
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "lists/{tasklist}/clear",
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasks.delete":
-
- type TasksDeleteCall struct {
- s *Service
- tasklistid string
- taskid string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Delete: Deletes the specified task from the task list.
- func (r *TasksService) Delete(tasklistid string, taskid string) *TasksDeleteCall {
- c := &TasksDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- c.taskid = taskid
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasksDeleteCall) Fields(s ...googleapi.Field) *TasksDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasksDeleteCall) Context(ctx context.Context) *TasksDeleteCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasksDeleteCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasksDeleteCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("DELETE", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- "task": c.taskid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasks.delete" call.
- func (c *TasksDeleteCall) Do(opts ...googleapi.CallOption) error {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if err != nil {
- return err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return err
- }
- return nil
- // {
- // "description": "Deletes the specified task from the task list.",
- // "httpMethod": "DELETE",
- // "id": "tasks.tasks.delete",
- // "parameterOrder": [
- // "tasklist",
- // "task"
- // ],
- // "parameters": {
- // "task": {
- // "description": "Task identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "lists/{tasklist}/tasks/{task}",
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasks.get":
-
- type TasksGetCall struct {
- s *Service
- tasklistid string
- taskid string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- header_ http.Header
- }
-
- // Get: Returns the specified task.
- func (r *TasksService) Get(tasklistid string, taskid string) *TasksGetCall {
- c := &TasksGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- c.taskid = taskid
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasksGetCall) Fields(s ...googleapi.Field) *TasksGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TasksGetCall) IfNoneMatch(entityTag string) *TasksGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasksGetCall) Context(ctx context.Context) *TasksGetCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasksGetCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasksGetCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("GET", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- "task": c.taskid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasks.get" call.
- // Exactly one of *Task or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Task.ServerResponse.Header or (if a response was returned at all) in
- // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
- // whether the returned error was because http.StatusNotModified was
- // returned.
- func (c *TasksGetCall) Do(opts ...googleapi.CallOption) (*Task, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Task{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Returns the specified task.",
- // "httpMethod": "GET",
- // "id": "tasks.tasks.get",
- // "parameterOrder": [
- // "tasklist",
- // "task"
- // ],
- // "parameters": {
- // "task": {
- // "description": "Task identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "lists/{tasklist}/tasks/{task}",
- // "response": {
- // "$ref": "Task"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks",
- // "https://www.googleapis.com/auth/tasks.readonly"
- // ]
- // }
-
- }
-
- // method id "tasks.tasks.insert":
-
- type TasksInsertCall struct {
- s *Service
- tasklistid string
- task *Task
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Insert: Creates a new task on the specified task list.
- func (r *TasksService) Insert(tasklistid string, task *Task) *TasksInsertCall {
- c := &TasksInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- c.task = task
- return c
- }
-
- // Parent sets the optional parameter "parent": Parent task identifier.
- // If the task is created at the top level, this parameter is omitted.
- func (c *TasksInsertCall) Parent(parent string) *TasksInsertCall {
- c.urlParams_.Set("parent", parent)
- return c
- }
-
- // Previous sets the optional parameter "previous": Previous sibling
- // task identifier. If the task is created at the first position among
- // its siblings, this parameter is omitted.
- func (c *TasksInsertCall) Previous(previous string) *TasksInsertCall {
- c.urlParams_.Set("previous", previous)
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasksInsertCall) Fields(s ...googleapi.Field) *TasksInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasksInsertCall) Context(ctx context.Context) *TasksInsertCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasksInsertCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasksInsertCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.task)
- if err != nil {
- return nil, err
- }
- reqHeaders.Set("Content-Type", "application/json")
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("POST", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasks.insert" call.
- // Exactly one of *Task or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Task.ServerResponse.Header or (if a response was returned at all) in
- // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
- // whether the returned error was because http.StatusNotModified was
- // returned.
- func (c *TasksInsertCall) Do(opts ...googleapi.CallOption) (*Task, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Task{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a new task on the specified task list.",
- // "httpMethod": "POST",
- // "id": "tasks.tasks.insert",
- // "parameterOrder": [
- // "tasklist"
- // ],
- // "parameters": {
- // "parent": {
- // "description": "Parent task identifier. If the task is created at the top level, this parameter is omitted. Optional.",
- // "location": "query",
- // "type": "string"
- // },
- // "previous": {
- // "description": "Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted. Optional.",
- // "location": "query",
- // "type": "string"
- // },
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "lists/{tasklist}/tasks",
- // "request": {
- // "$ref": "Task"
- // },
- // "response": {
- // "$ref": "Task"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasks.list":
-
- type TasksListCall struct {
- s *Service
- tasklistid string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- header_ http.Header
- }
-
- // List: Returns all tasks in the specified task list.
- func (r *TasksService) List(tasklistid string) *TasksListCall {
- c := &TasksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- return c
- }
-
- // CompletedMax sets the optional parameter "completedMax": Upper bound
- // for a task's completion date (as a RFC 3339 timestamp) to filter by.
- // The default is not to filter by completion date.
- func (c *TasksListCall) CompletedMax(completedMax string) *TasksListCall {
- c.urlParams_.Set("completedMax", completedMax)
- return c
- }
-
- // CompletedMin sets the optional parameter "completedMin": Lower bound
- // for a task's completion date (as a RFC 3339 timestamp) to filter by.
- // The default is not to filter by completion date.
- func (c *TasksListCall) CompletedMin(completedMin string) *TasksListCall {
- c.urlParams_.Set("completedMin", completedMin)
- return c
- }
-
- // DueMax sets the optional parameter "dueMax": Upper bound for a task's
- // due date (as a RFC 3339 timestamp) to filter by. The default is not
- // to filter by due date.
- func (c *TasksListCall) DueMax(dueMax string) *TasksListCall {
- c.urlParams_.Set("dueMax", dueMax)
- return c
- }
-
- // DueMin sets the optional parameter "dueMin": Lower bound for a task's
- // due date (as a RFC 3339 timestamp) to filter by. The default is not
- // to filter by due date.
- func (c *TasksListCall) DueMin(dueMin string) *TasksListCall {
- c.urlParams_.Set("dueMin", dueMin)
- return c
- }
-
- // MaxResults sets the optional parameter "maxResults": Maximum number
- // of task lists returned on one page. The default is 20 (max allowed:
- // 100).
- func (c *TasksListCall) MaxResults(maxResults int64) *TasksListCall {
- c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
- return c
- }
-
- // PageToken sets the optional parameter "pageToken": Token specifying
- // the result page to return.
- func (c *TasksListCall) PageToken(pageToken string) *TasksListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
-
- // ShowCompleted sets the optional parameter "showCompleted": Flag
- // indicating whether completed tasks are returned in the result. The
- // default is True.
- func (c *TasksListCall) ShowCompleted(showCompleted bool) *TasksListCall {
- c.urlParams_.Set("showCompleted", fmt.Sprint(showCompleted))
- return c
- }
-
- // ShowDeleted sets the optional parameter "showDeleted": Flag
- // indicating whether deleted tasks are returned in the result. The
- // default is False.
- func (c *TasksListCall) ShowDeleted(showDeleted bool) *TasksListCall {
- c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
- return c
- }
-
- // ShowHidden sets the optional parameter "showHidden": Flag indicating
- // whether hidden tasks are returned in the result. The default is
- // False.
- func (c *TasksListCall) ShowHidden(showHidden bool) *TasksListCall {
- c.urlParams_.Set("showHidden", fmt.Sprint(showHidden))
- return c
- }
-
- // UpdatedMin sets the optional parameter "updatedMin": Lower bound for
- // a task's last modification time (as a RFC 3339 timestamp) to filter
- // by. The default is not to filter by last modification time.
- func (c *TasksListCall) UpdatedMin(updatedMin string) *TasksListCall {
- c.urlParams_.Set("updatedMin", updatedMin)
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasksListCall) Fields(s ...googleapi.Field) *TasksListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TasksListCall) IfNoneMatch(entityTag string) *TasksListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasksListCall) Context(ctx context.Context) *TasksListCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasksListCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasksListCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
- }
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("GET", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasks.list" call.
- // Exactly one of *Tasks or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Tasks.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *TasksListCall) Do(opts ...googleapi.CallOption) (*Tasks, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Tasks{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Returns all tasks in the specified task list.",
- // "httpMethod": "GET",
- // "id": "tasks.tasks.list",
- // "parameterOrder": [
- // "tasklist"
- // ],
- // "parameters": {
- // "completedMax": {
- // "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.",
- // "location": "query",
- // "type": "string"
- // },
- // "completedMin": {
- // "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.",
- // "location": "query",
- // "type": "string"
- // },
- // "dueMax": {
- // "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.",
- // "location": "query",
- // "type": "string"
- // },
- // "dueMin": {
- // "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.",
- // "location": "query",
- // "type": "string"
- // },
- // "maxResults": {
- // "description": "Maximum number of task lists returned on one page. Optional. The default is 20 (max allowed: 100).",
- // "format": "int64",
- // "location": "query",
- // "type": "string"
- // },
- // "pageToken": {
- // "description": "Token specifying the result page to return. Optional.",
- // "location": "query",
- // "type": "string"
- // },
- // "showCompleted": {
- // "description": "Flag indicating whether completed tasks are returned in the result. Optional. The default is True.",
- // "location": "query",
- // "type": "boolean"
- // },
- // "showDeleted": {
- // "description": "Flag indicating whether deleted tasks are returned in the result. Optional. The default is False.",
- // "location": "query",
- // "type": "boolean"
- // },
- // "showHidden": {
- // "description": "Flag indicating whether hidden tasks are returned in the result. Optional. The default is False.",
- // "location": "query",
- // "type": "boolean"
- // },
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "updatedMin": {
- // "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.",
- // "location": "query",
- // "type": "string"
- // }
- // },
- // "path": "lists/{tasklist}/tasks",
- // "response": {
- // "$ref": "Tasks"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks",
- // "https://www.googleapis.com/auth/tasks.readonly"
- // ]
- // }
-
- }
-
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *TasksListCall) Pages(ctx context.Context, f func(*Tasks) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
-
- // method id "tasks.tasks.move":
-
- type TasksMoveCall struct {
- s *Service
- tasklistid string
- taskid string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Move: 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.
- func (r *TasksService) Move(tasklistid string, taskid string) *TasksMoveCall {
- c := &TasksMoveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- c.taskid = taskid
- return c
- }
-
- // Parent sets the optional parameter "parent": New parent task
- // identifier. If the task is moved to the top level, this parameter is
- // omitted.
- func (c *TasksMoveCall) Parent(parent string) *TasksMoveCall {
- c.urlParams_.Set("parent", parent)
- return c
- }
-
- // Previous sets the optional parameter "previous": New previous sibling
- // task identifier. If the task is moved to the first position among its
- // siblings, this parameter is omitted.
- func (c *TasksMoveCall) Previous(previous string) *TasksMoveCall {
- c.urlParams_.Set("previous", previous)
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasksMoveCall) Fields(s ...googleapi.Field) *TasksMoveCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasksMoveCall) Context(ctx context.Context) *TasksMoveCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasksMoveCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasksMoveCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}/move")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("POST", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- "task": c.taskid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasks.move" call.
- // Exactly one of *Task or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Task.ServerResponse.Header or (if a response was returned at all) in
- // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
- // whether the returned error was because http.StatusNotModified was
- // returned.
- func (c *TasksMoveCall) Do(opts ...googleapi.CallOption) (*Task, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Task{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "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.",
- // "httpMethod": "POST",
- // "id": "tasks.tasks.move",
- // "parameterOrder": [
- // "tasklist",
- // "task"
- // ],
- // "parameters": {
- // "parent": {
- // "description": "New parent task identifier. If the task is moved to the top level, this parameter is omitted. Optional.",
- // "location": "query",
- // "type": "string"
- // },
- // "previous": {
- // "description": "New previous sibling task identifier. If the task is moved to the first position among its siblings, this parameter is omitted. Optional.",
- // "location": "query",
- // "type": "string"
- // },
- // "task": {
- // "description": "Task identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "lists/{tasklist}/tasks/{task}/move",
- // "response": {
- // "$ref": "Task"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasks.patch":
-
- type TasksPatchCall struct {
- s *Service
- tasklistid string
- taskid string
- task *Task
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Patch: Updates the specified task. This method supports patch
- // semantics.
- func (r *TasksService) Patch(tasklistid string, taskid string, task *Task) *TasksPatchCall {
- c := &TasksPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- c.taskid = taskid
- c.task = task
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasksPatchCall) Fields(s ...googleapi.Field) *TasksPatchCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasksPatchCall) Context(ctx context.Context) *TasksPatchCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasksPatchCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasksPatchCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.task)
- if err != nil {
- return nil, err
- }
- reqHeaders.Set("Content-Type", "application/json")
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("PATCH", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- "task": c.taskid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasks.patch" call.
- // Exactly one of *Task or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Task.ServerResponse.Header or (if a response was returned at all) in
- // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
- // whether the returned error was because http.StatusNotModified was
- // returned.
- func (c *TasksPatchCall) Do(opts ...googleapi.CallOption) (*Task, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Task{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates the specified task. This method supports patch semantics.",
- // "httpMethod": "PATCH",
- // "id": "tasks.tasks.patch",
- // "parameterOrder": [
- // "tasklist",
- // "task"
- // ],
- // "parameters": {
- // "task": {
- // "description": "Task identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "lists/{tasklist}/tasks/{task}",
- // "request": {
- // "$ref": "Task"
- // },
- // "response": {
- // "$ref": "Task"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
-
- // method id "tasks.tasks.update":
-
- type TasksUpdateCall struct {
- s *Service
- tasklistid string
- taskid string
- task *Task
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- header_ http.Header
- }
-
- // Update: Updates the specified task.
- func (r *TasksService) Update(tasklistid string, taskid string, task *Task) *TasksUpdateCall {
- c := &TasksUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.tasklistid = tasklistid
- c.taskid = taskid
- c.task = task
- return c
- }
-
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TasksUpdateCall) Fields(s ...googleapi.Field) *TasksUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
-
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TasksUpdateCall) Context(ctx context.Context) *TasksUpdateCall {
- c.ctx_ = ctx
- return c
- }
-
- // Header returns an http.Header that can be modified by the caller to
- // add HTTP headers to the request.
- func (c *TasksUpdateCall) Header() http.Header {
- if c.header_ == nil {
- c.header_ = make(http.Header)
- }
- return c.header_
- }
-
- func (c *TasksUpdateCall) doRequest(alt string) (*http.Response, error) {
- reqHeaders := make(http.Header)
- for k, v := range c.header_ {
- reqHeaders[k] = v
- }
- reqHeaders.Set("User-Agent", c.s.userAgent())
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.task)
- if err != nil {
- return nil, err
- }
- reqHeaders.Set("Content-Type", "application/json")
- c.urlParams_.Set("alt", alt)
- c.urlParams_.Set("prettyPrint", "false")
- urls := googleapi.ResolveRelative(c.s.BasePath, "lists/{tasklist}/tasks/{task}")
- urls += "?" + c.urlParams_.Encode()
- req, err := http.NewRequest("PUT", urls, body)
- if err != nil {
- return nil, err
- }
- req.Header = reqHeaders
- googleapi.Expand(req.URL, map[string]string{
- "tasklist": c.tasklistid,
- "task": c.taskid,
- })
- return gensupport.SendRequest(c.ctx_, c.s.client, req)
- }
-
- // Do executes the "tasks.tasks.update" call.
- // Exactly one of *Task or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Task.ServerResponse.Header or (if a response was returned at all) in
- // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
- // whether the returned error was because http.StatusNotModified was
- // returned.
- func (c *TasksUpdateCall) Do(opts ...googleapi.CallOption) (*Task, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Task{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- target := &ret
- if err := gensupport.DecodeResponse(target, res); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates the specified task.",
- // "httpMethod": "PUT",
- // "id": "tasks.tasks.update",
- // "parameterOrder": [
- // "tasklist",
- // "task"
- // ],
- // "parameters": {
- // "task": {
- // "description": "Task identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "tasklist": {
- // "description": "Task list identifier.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "lists/{tasklist}/tasks/{task}",
- // "request": {
- // "$ref": "Task"
- // },
- // "response": {
- // "$ref": "Task"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/tasks"
- // ]
- // }
-
- }
|