...

Source file src/google.golang.org/api/tasks/v1/tasks-gen.go

Documentation: google.golang.org/api/tasks/v1

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

View as plain text