...

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

Documentation: google.golang.org/api/keep/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 keep provides access to the Google Keep API.
     8  //
     9  // For product documentation, see: https://developers.google.com/keep/api
    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/keep/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	keepService, err := keep.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  //	keepService, err := keep.NewService(ctx, option.WithScopes(keep.KeepReadonlyScope))
    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  //	keepService, err := keep.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  //	keepService, err := keep.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package keep // import "google.golang.org/api/keep/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 = "keep:v1"
    95  const apiName = "keep"
    96  const apiVersion = "v1"
    97  const basePath = "https://keep.googleapis.com/"
    98  const basePathTemplate = "https://keep.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://keep.mtls.googleapis.com/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// See, edit, create and permanently delete all your Google Keep data
   104  	KeepScope = "https://www.googleapis.com/auth/keep"
   105  
   106  	// View all your Google Keep data
   107  	KeepReadonlyScope = "https://www.googleapis.com/auth/keep.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/keep",
   114  		"https://www.googleapis.com/auth/keep.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.Media = NewMediaService(s)
   147  	s.Notes = NewNotesService(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  	Media *MediaService
   157  
   158  	Notes *NotesService
   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 NewMediaService(s *Service) *MediaService {
   169  	rs := &MediaService{s: s}
   170  	return rs
   171  }
   172  
   173  type MediaService struct {
   174  	s *Service
   175  }
   176  
   177  func NewNotesService(s *Service) *NotesService {
   178  	rs := &NotesService{s: s}
   179  	rs.Permissions = NewNotesPermissionsService(s)
   180  	return rs
   181  }
   182  
   183  type NotesService struct {
   184  	s *Service
   185  
   186  	Permissions *NotesPermissionsService
   187  }
   188  
   189  func NewNotesPermissionsService(s *Service) *NotesPermissionsService {
   190  	rs := &NotesPermissionsService{s: s}
   191  	return rs
   192  }
   193  
   194  type NotesPermissionsService struct {
   195  	s *Service
   196  }
   197  
   198  // Attachment: An attachment to a note.
   199  type Attachment struct {
   200  	// MimeType: The MIME types (IANA media types) in which the attachment is
   201  	// available.
   202  	MimeType []string `json:"mimeType,omitempty"`
   203  	// Name: The resource name;
   204  	Name string `json:"name,omitempty"`
   205  
   206  	// ServerResponse contains the HTTP response code and headers from the server.
   207  	googleapi.ServerResponse `json:"-"`
   208  	// ForceSendFields is a list of field names (e.g. "MimeType") to
   209  	// unconditionally include in API requests. By default, fields with empty or
   210  	// default values are omitted from API requests. See
   211  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   212  	// details.
   213  	ForceSendFields []string `json:"-"`
   214  	// NullFields is a list of field names (e.g. "MimeType") to include in API
   215  	// requests with the JSON null value. By default, fields with empty values are
   216  	// omitted from API requests. See
   217  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   218  	NullFields []string `json:"-"`
   219  }
   220  
   221  func (s *Attachment) MarshalJSON() ([]byte, error) {
   222  	type NoMethod Attachment
   223  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   224  }
   225  
   226  // BatchCreatePermissionsRequest: The request to add one or more permissions on
   227  // the note. Currently, only the `WRITER` role may be specified. If adding a
   228  // permission fails, then the entire request fails and no changes are made.
   229  type BatchCreatePermissionsRequest struct {
   230  	// Requests: The request message specifying the resources to create.
   231  	Requests []*CreatePermissionRequest `json:"requests,omitempty"`
   232  	// ForceSendFields is a list of field names (e.g. "Requests") to
   233  	// unconditionally include in API requests. By default, fields with empty or
   234  	// default values are omitted from API requests. See
   235  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   236  	// details.
   237  	ForceSendFields []string `json:"-"`
   238  	// NullFields is a list of field names (e.g. "Requests") to include in API
   239  	// requests with the JSON null value. By default, fields with empty values are
   240  	// omitted from API requests. See
   241  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   242  	NullFields []string `json:"-"`
   243  }
   244  
   245  func (s *BatchCreatePermissionsRequest) MarshalJSON() ([]byte, error) {
   246  	type NoMethod BatchCreatePermissionsRequest
   247  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   248  }
   249  
   250  // BatchCreatePermissionsResponse: The response for creating permissions on a
   251  // note.
   252  type BatchCreatePermissionsResponse struct {
   253  	// Permissions: Permissions created.
   254  	Permissions []*Permission `json:"permissions,omitempty"`
   255  
   256  	// ServerResponse contains the HTTP response code and headers from the server.
   257  	googleapi.ServerResponse `json:"-"`
   258  	// ForceSendFields is a list of field names (e.g. "Permissions") to
   259  	// unconditionally include in API requests. By default, fields with empty or
   260  	// default values are omitted from API requests. See
   261  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   262  	// details.
   263  	ForceSendFields []string `json:"-"`
   264  	// NullFields is a list of field names (e.g. "Permissions") to include in API
   265  	// requests with the JSON null value. By default, fields with empty values are
   266  	// omitted from API requests. See
   267  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   268  	NullFields []string `json:"-"`
   269  }
   270  
   271  func (s *BatchCreatePermissionsResponse) MarshalJSON() ([]byte, error) {
   272  	type NoMethod BatchCreatePermissionsResponse
   273  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   274  }
   275  
   276  // BatchDeletePermissionsRequest: The request to remove one or more permissions
   277  // from a note. A permission with the `OWNER` role can't be removed. If
   278  // removing a permission fails, then the entire request fails and no changes
   279  // are made. Returns a 400 bad request error if a specified permission does not
   280  // exist on the note.
   281  type BatchDeletePermissionsRequest struct {
   282  	// Names: Required. The names of the permissions to delete. Format:
   283  	// `notes/{note}/permissions/{permission}`
   284  	Names []string `json:"names,omitempty"`
   285  	// ForceSendFields is a list of field names (e.g. "Names") to unconditionally
   286  	// include in API requests. By default, fields with empty or default values are
   287  	// omitted from API requests. See
   288  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   289  	// details.
   290  	ForceSendFields []string `json:"-"`
   291  	// NullFields is a list of field names (e.g. "Names") to include in API
   292  	// requests with the JSON null value. By default, fields with empty values are
   293  	// omitted from API requests. See
   294  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   295  	NullFields []string `json:"-"`
   296  }
   297  
   298  func (s *BatchDeletePermissionsRequest) MarshalJSON() ([]byte, error) {
   299  	type NoMethod BatchDeletePermissionsRequest
   300  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   301  }
   302  
   303  // CreatePermissionRequest: The request to add a single permission on the note.
   304  type CreatePermissionRequest struct {
   305  	// Parent: Required. The parent note where this permission will be created.
   306  	// Format: `notes/{note}`
   307  	Parent string `json:"parent,omitempty"`
   308  	// Permission: Required. The permission to create. One of Permission.email,
   309  	// User.email or Group.email must be supplied.
   310  	Permission *Permission `json:"permission,omitempty"`
   311  	// ForceSendFields is a list of field names (e.g. "Parent") to unconditionally
   312  	// include in API requests. By default, fields with empty or default values are
   313  	// omitted from API requests. See
   314  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   315  	// details.
   316  	ForceSendFields []string `json:"-"`
   317  	// NullFields is a list of field names (e.g. "Parent") to include in API
   318  	// requests with the JSON null value. By default, fields with empty values are
   319  	// omitted from API requests. See
   320  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   321  	NullFields []string `json:"-"`
   322  }
   323  
   324  func (s *CreatePermissionRequest) MarshalJSON() ([]byte, error) {
   325  	type NoMethod CreatePermissionRequest
   326  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   327  }
   328  
   329  // Empty: A generic empty message that you can re-use to avoid defining
   330  // duplicated empty messages in your APIs. A typical example is to use it as
   331  // the request or the response type of an API method. For instance: service Foo
   332  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   333  type Empty struct {
   334  	// ServerResponse contains the HTTP response code and headers from the server.
   335  	googleapi.ServerResponse `json:"-"`
   336  }
   337  
   338  // Family: Describes a single Google Family.
   339  type Family struct {
   340  }
   341  
   342  // Group: Describes a single Group.
   343  type Group struct {
   344  	// Email: The group email.
   345  	Email string `json:"email,omitempty"`
   346  	// ForceSendFields is a list of field names (e.g. "Email") to unconditionally
   347  	// include in API requests. By default, fields with empty or default values are
   348  	// omitted from API requests. See
   349  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   350  	// details.
   351  	ForceSendFields []string `json:"-"`
   352  	// NullFields is a list of field names (e.g. "Email") to include in API
   353  	// requests with the JSON null value. By default, fields with empty values are
   354  	// omitted from API requests. See
   355  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   356  	NullFields []string `json:"-"`
   357  }
   358  
   359  func (s *Group) MarshalJSON() ([]byte, error) {
   360  	type NoMethod Group
   361  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   362  }
   363  
   364  // ListContent: The list of items for a single list note.
   365  type ListContent struct {
   366  	// ListItems: The items in the list. The number of items must be less than
   367  	// 1,000.
   368  	ListItems []*ListItem `json:"listItems,omitempty"`
   369  	// ForceSendFields is a list of field names (e.g. "ListItems") to
   370  	// unconditionally include in API requests. By default, fields with empty or
   371  	// default values are omitted from API requests. See
   372  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   373  	// details.
   374  	ForceSendFields []string `json:"-"`
   375  	// NullFields is a list of field names (e.g. "ListItems") to include in API
   376  	// requests with the JSON null value. By default, fields with empty values are
   377  	// omitted from API requests. See
   378  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   379  	NullFields []string `json:"-"`
   380  }
   381  
   382  func (s *ListContent) MarshalJSON() ([]byte, error) {
   383  	type NoMethod ListContent
   384  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   385  }
   386  
   387  // ListItem: A single list item in a note's list.
   388  type ListItem struct {
   389  	// Checked: Whether this item has been checked off or not.
   390  	Checked bool `json:"checked,omitempty"`
   391  	// ChildListItems: If set, list of list items nested under this list item. Only
   392  	// one level of nesting is allowed.
   393  	ChildListItems []*ListItem `json:"childListItems,omitempty"`
   394  	// Text: The text of this item. Length must be less than 1,000 characters.
   395  	Text *TextContent `json:"text,omitempty"`
   396  	// ForceSendFields is a list of field names (e.g. "Checked") to unconditionally
   397  	// include in API requests. By default, fields with empty or default values are
   398  	// omitted from API requests. See
   399  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   400  	// details.
   401  	ForceSendFields []string `json:"-"`
   402  	// NullFields is a list of field names (e.g. "Checked") to include in API
   403  	// requests with the JSON null value. By default, fields with empty values are
   404  	// omitted from API requests. See
   405  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   406  	NullFields []string `json:"-"`
   407  }
   408  
   409  func (s *ListItem) MarshalJSON() ([]byte, error) {
   410  	type NoMethod ListItem
   411  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   412  }
   413  
   414  // ListNotesResponse: The response when listing a page of notes.
   415  type ListNotesResponse struct {
   416  	// NextPageToken: Next page's `page_token` field.
   417  	NextPageToken string `json:"nextPageToken,omitempty"`
   418  	// Notes: A page of notes.
   419  	Notes []*Note `json:"notes,omitempty"`
   420  
   421  	// ServerResponse contains the HTTP response code and headers from the server.
   422  	googleapi.ServerResponse `json:"-"`
   423  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   424  	// unconditionally include in API requests. By default, fields with empty or
   425  	// default values are omitted from API requests. See
   426  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   427  	// details.
   428  	ForceSendFields []string `json:"-"`
   429  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   430  	// requests with the JSON null value. By default, fields with empty values are
   431  	// omitted from API requests. See
   432  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   433  	NullFields []string `json:"-"`
   434  }
   435  
   436  func (s *ListNotesResponse) MarshalJSON() ([]byte, error) {
   437  	type NoMethod ListNotesResponse
   438  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   439  }
   440  
   441  // Note: A single note.
   442  type Note struct {
   443  	// Attachments: Output only. The attachments attached to this note.
   444  	Attachments []*Attachment `json:"attachments,omitempty"`
   445  	// Body: The body of the note.
   446  	Body *Section `json:"body,omitempty"`
   447  	// CreateTime: Output only. When this note was created.
   448  	CreateTime string `json:"createTime,omitempty"`
   449  	// Name: Output only. The resource name of this note. See general note on
   450  	// identifiers in KeepService.
   451  	Name string `json:"name,omitempty"`
   452  	// Permissions: Output only. The list of permissions set on the note. Contains
   453  	// at least one entry for the note owner.
   454  	Permissions []*Permission `json:"permissions,omitempty"`
   455  	// Title: The title of the note. Length must be less than 1,000 characters.
   456  	Title string `json:"title,omitempty"`
   457  	// TrashTime: Output only. When this note was trashed. If `trashed`, the note
   458  	// is eventually deleted. If the note is not trashed, this field is not set
   459  	// (and the trashed field is `false`).
   460  	TrashTime string `json:"trashTime,omitempty"`
   461  	// Trashed: Output only. `true` if this note has been trashed. If trashed, the
   462  	// note is eventually deleted.
   463  	Trashed bool `json:"trashed,omitempty"`
   464  	// UpdateTime: Output only. When this note was last modified.
   465  	UpdateTime string `json:"updateTime,omitempty"`
   466  
   467  	// ServerResponse contains the HTTP response code and headers from the server.
   468  	googleapi.ServerResponse `json:"-"`
   469  	// ForceSendFields is a list of field names (e.g. "Attachments") to
   470  	// unconditionally include in API requests. By default, fields with empty or
   471  	// default values are omitted from API requests. See
   472  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   473  	// details.
   474  	ForceSendFields []string `json:"-"`
   475  	// NullFields is a list of field names (e.g. "Attachments") to include in API
   476  	// requests with the JSON null value. By default, fields with empty values are
   477  	// omitted from API requests. See
   478  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   479  	NullFields []string `json:"-"`
   480  }
   481  
   482  func (s *Note) MarshalJSON() ([]byte, error) {
   483  	type NoMethod Note
   484  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   485  }
   486  
   487  // Permission: A single permission on the note. Associates a `member` with a
   488  // `role`.
   489  type Permission struct {
   490  	// Deleted: Output only. Whether this member has been deleted. If the member is
   491  	// recovered, this value is set to false and the recovered member retains the
   492  	// role on the note.
   493  	Deleted bool `json:"deleted,omitempty"`
   494  	// Email: The email associated with the member. If set on create, the `email`
   495  	// field in the `User` or `Group` message must either be empty or match this
   496  	// field. On read, may be unset if the member does not have an associated
   497  	// email.
   498  	Email string `json:"email,omitempty"`
   499  	// Family: Output only. The Google Family to which this role applies.
   500  	Family *Family `json:"family,omitempty"`
   501  	// Group: Output only. The group to which this role applies.
   502  	Group *Group `json:"group,omitempty"`
   503  	// Name: Output only. The resource name.
   504  	Name string `json:"name,omitempty"`
   505  	// Role: The role granted by this permission. The role determines the
   506  	// entity’s ability to read, write, and share notes.
   507  	//
   508  	// Possible values:
   509  	//   "ROLE_UNSPECIFIED" - An undefined role.
   510  	//   "OWNER" - A role granting full access. This role cannot be added or
   511  	// removed. Defined by the creator of the note.
   512  	//   "WRITER" - A role granting the ability to contribute content and modify
   513  	// note permissions.
   514  	Role string `json:"role,omitempty"`
   515  	// User: Output only. The user to whom this role applies.
   516  	User *User `json:"user,omitempty"`
   517  	// ForceSendFields is a list of field names (e.g. "Deleted") to unconditionally
   518  	// include in API requests. By default, fields with empty or default values are
   519  	// omitted from API requests. See
   520  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   521  	// details.
   522  	ForceSendFields []string `json:"-"`
   523  	// NullFields is a list of field names (e.g. "Deleted") to include in API
   524  	// requests with the JSON null value. By default, fields with empty values are
   525  	// omitted from API requests. See
   526  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   527  	NullFields []string `json:"-"`
   528  }
   529  
   530  func (s *Permission) MarshalJSON() ([]byte, error) {
   531  	type NoMethod Permission
   532  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   533  }
   534  
   535  // Section: The content of the note.
   536  type Section struct {
   537  	// List: Used if this section's content is a list.
   538  	List *ListContent `json:"list,omitempty"`
   539  	// Text: Used if this section's content is a block of text. The length of the
   540  	// text content must be less than 20,000 characters.
   541  	Text *TextContent `json:"text,omitempty"`
   542  	// ForceSendFields is a list of field names (e.g. "List") to unconditionally
   543  	// include in API requests. By default, fields with empty or default values are
   544  	// omitted from API requests. See
   545  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   546  	// details.
   547  	ForceSendFields []string `json:"-"`
   548  	// NullFields is a list of field names (e.g. "List") to include in API requests
   549  	// with the JSON null value. By default, fields with empty values are omitted
   550  	// from API requests. See
   551  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   552  	NullFields []string `json:"-"`
   553  }
   554  
   555  func (s *Section) MarshalJSON() ([]byte, error) {
   556  	type NoMethod Section
   557  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   558  }
   559  
   560  // TextContent: The block of text for a single text section or list item.
   561  type TextContent struct {
   562  	// Text: The text of the note. The limits on this vary with the specific field
   563  	// using this type.
   564  	Text string `json:"text,omitempty"`
   565  	// ForceSendFields is a list of field names (e.g. "Text") to unconditionally
   566  	// include in API requests. By default, fields with empty or default values are
   567  	// omitted from API requests. See
   568  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   569  	// details.
   570  	ForceSendFields []string `json:"-"`
   571  	// NullFields is a list of field names (e.g. "Text") to include in API requests
   572  	// with the JSON null value. By default, fields with empty values are omitted
   573  	// from API requests. See
   574  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   575  	NullFields []string `json:"-"`
   576  }
   577  
   578  func (s *TextContent) MarshalJSON() ([]byte, error) {
   579  	type NoMethod TextContent
   580  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   581  }
   582  
   583  // User: Describes a single user.
   584  type User struct {
   585  	// Email: The user's email.
   586  	Email string `json:"email,omitempty"`
   587  	// ForceSendFields is a list of field names (e.g. "Email") to unconditionally
   588  	// include in API requests. By default, fields with empty or default values are
   589  	// omitted from API requests. See
   590  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   591  	// details.
   592  	ForceSendFields []string `json:"-"`
   593  	// NullFields is a list of field names (e.g. "Email") to include in API
   594  	// requests with the JSON null value. By default, fields with empty values are
   595  	// omitted from API requests. See
   596  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   597  	NullFields []string `json:"-"`
   598  }
   599  
   600  func (s *User) MarshalJSON() ([]byte, error) {
   601  	type NoMethod User
   602  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   603  }
   604  
   605  type MediaDownloadCall struct {
   606  	s            *Service
   607  	name         string
   608  	urlParams_   gensupport.URLParams
   609  	ifNoneMatch_ string
   610  	ctx_         context.Context
   611  	header_      http.Header
   612  }
   613  
   614  // Download: Gets an attachment. To download attachment media via REST requires
   615  // the alt=media query parameter. Returns a 400 bad request error if attachment
   616  // media is not available in the requested MIME type.
   617  //
   618  // - name: The name of the attachment.
   619  func (r *MediaService) Download(name string) *MediaDownloadCall {
   620  	c := &MediaDownloadCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   621  	c.name = name
   622  	return c
   623  }
   624  
   625  // MimeType sets the optional parameter "mimeType": The IANA MIME type format
   626  // requested. The requested MIME type must be one specified in the
   627  // attachment.mime_type. Required when downloading attachment media and ignored
   628  // otherwise.
   629  func (c *MediaDownloadCall) MimeType(mimeType string) *MediaDownloadCall {
   630  	c.urlParams_.Set("mimeType", mimeType)
   631  	return c
   632  }
   633  
   634  // Fields allows partial responses to be retrieved. See
   635  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   636  // details.
   637  func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall {
   638  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   639  	return c
   640  }
   641  
   642  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   643  // object's ETag matches the given value. This is useful for getting updates
   644  // only after the object has changed since the last request.
   645  func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall {
   646  	c.ifNoneMatch_ = entityTag
   647  	return c
   648  }
   649  
   650  // Context sets the context to be used in this call's Do and Download methods.
   651  func (c *MediaDownloadCall) Context(ctx context.Context) *MediaDownloadCall {
   652  	c.ctx_ = ctx
   653  	return c
   654  }
   655  
   656  // Header returns a http.Header that can be modified by the caller to add
   657  // headers to the request.
   658  func (c *MediaDownloadCall) Header() http.Header {
   659  	if c.header_ == nil {
   660  		c.header_ = make(http.Header)
   661  	}
   662  	return c.header_
   663  }
   664  
   665  func (c *MediaDownloadCall) doRequest(alt string) (*http.Response, error) {
   666  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   667  	if c.ifNoneMatch_ != "" {
   668  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   669  	}
   670  	var body io.Reader = nil
   671  	c.urlParams_.Set("alt", alt)
   672  	c.urlParams_.Set("prettyPrint", "false")
   673  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   674  	urls += "?" + c.urlParams_.Encode()
   675  	req, err := http.NewRequest("GET", urls, body)
   676  	if err != nil {
   677  		return nil, err
   678  	}
   679  	req.Header = reqHeaders
   680  	googleapi.Expand(req.URL, map[string]string{
   681  		"name": c.name,
   682  	})
   683  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   684  }
   685  
   686  // Download fetches the API endpoint's "media" value, instead of the normal
   687  // API response value. If the returned error is nil, the Response is guaranteed to
   688  // have a 2xx status code. Callers must close the Response.Body as usual.
   689  func (c *MediaDownloadCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
   690  	gensupport.SetOptions(c.urlParams_, opts...)
   691  	res, err := c.doRequest("media")
   692  	if err != nil {
   693  		return nil, err
   694  	}
   695  	if err := googleapi.CheckResponse(res); err != nil {
   696  		res.Body.Close()
   697  		return nil, gensupport.WrapError(err)
   698  	}
   699  	return res, nil
   700  }
   701  
   702  // Do executes the "keep.media.download" call.
   703  // Any non-2xx status code is an error. Response headers are in either
   704  // *Attachment.ServerResponse.Header or (if a response was returned at all) in
   705  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   706  // whether the returned error was because http.StatusNotModified was returned.
   707  func (c *MediaDownloadCall) Do(opts ...googleapi.CallOption) (*Attachment, error) {
   708  	gensupport.SetOptions(c.urlParams_, opts...)
   709  	res, err := c.doRequest("json")
   710  	if res != nil && res.StatusCode == http.StatusNotModified {
   711  		if res.Body != nil {
   712  			res.Body.Close()
   713  		}
   714  		return nil, gensupport.WrapError(&googleapi.Error{
   715  			Code:   res.StatusCode,
   716  			Header: res.Header,
   717  		})
   718  	}
   719  	if err != nil {
   720  		return nil, err
   721  	}
   722  	defer googleapi.CloseBody(res)
   723  	if err := googleapi.CheckResponse(res); err != nil {
   724  		return nil, gensupport.WrapError(err)
   725  	}
   726  	ret := &Attachment{
   727  		ServerResponse: googleapi.ServerResponse{
   728  			Header:         res.Header,
   729  			HTTPStatusCode: res.StatusCode,
   730  		},
   731  	}
   732  	target := &ret
   733  	if err := gensupport.DecodeResponse(target, res); err != nil {
   734  		return nil, err
   735  	}
   736  	return ret, nil
   737  }
   738  
   739  type NotesCreateCall struct {
   740  	s          *Service
   741  	note       *Note
   742  	urlParams_ gensupport.URLParams
   743  	ctx_       context.Context
   744  	header_    http.Header
   745  }
   746  
   747  // Create: Creates a new note.
   748  func (r *NotesService) Create(note *Note) *NotesCreateCall {
   749  	c := &NotesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   750  	c.note = note
   751  	return c
   752  }
   753  
   754  // Fields allows partial responses to be retrieved. See
   755  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   756  // details.
   757  func (c *NotesCreateCall) Fields(s ...googleapi.Field) *NotesCreateCall {
   758  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   759  	return c
   760  }
   761  
   762  // Context sets the context to be used in this call's Do method.
   763  func (c *NotesCreateCall) Context(ctx context.Context) *NotesCreateCall {
   764  	c.ctx_ = ctx
   765  	return c
   766  }
   767  
   768  // Header returns a http.Header that can be modified by the caller to add
   769  // headers to the request.
   770  func (c *NotesCreateCall) Header() http.Header {
   771  	if c.header_ == nil {
   772  		c.header_ = make(http.Header)
   773  	}
   774  	return c.header_
   775  }
   776  
   777  func (c *NotesCreateCall) doRequest(alt string) (*http.Response, error) {
   778  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   779  	var body io.Reader = nil
   780  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.note)
   781  	if err != nil {
   782  		return nil, err
   783  	}
   784  	c.urlParams_.Set("alt", alt)
   785  	c.urlParams_.Set("prettyPrint", "false")
   786  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/notes")
   787  	urls += "?" + c.urlParams_.Encode()
   788  	req, err := http.NewRequest("POST", urls, body)
   789  	if err != nil {
   790  		return nil, err
   791  	}
   792  	req.Header = reqHeaders
   793  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   794  }
   795  
   796  // Do executes the "keep.notes.create" call.
   797  // Any non-2xx status code is an error. Response headers are in either
   798  // *Note.ServerResponse.Header or (if a response was returned at all) in
   799  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   800  // whether the returned error was because http.StatusNotModified was returned.
   801  func (c *NotesCreateCall) Do(opts ...googleapi.CallOption) (*Note, error) {
   802  	gensupport.SetOptions(c.urlParams_, opts...)
   803  	res, err := c.doRequest("json")
   804  	if res != nil && res.StatusCode == http.StatusNotModified {
   805  		if res.Body != nil {
   806  			res.Body.Close()
   807  		}
   808  		return nil, gensupport.WrapError(&googleapi.Error{
   809  			Code:   res.StatusCode,
   810  			Header: res.Header,
   811  		})
   812  	}
   813  	if err != nil {
   814  		return nil, err
   815  	}
   816  	defer googleapi.CloseBody(res)
   817  	if err := googleapi.CheckResponse(res); err != nil {
   818  		return nil, gensupport.WrapError(err)
   819  	}
   820  	ret := &Note{
   821  		ServerResponse: googleapi.ServerResponse{
   822  			Header:         res.Header,
   823  			HTTPStatusCode: res.StatusCode,
   824  		},
   825  	}
   826  	target := &ret
   827  	if err := gensupport.DecodeResponse(target, res); err != nil {
   828  		return nil, err
   829  	}
   830  	return ret, nil
   831  }
   832  
   833  type NotesDeleteCall struct {
   834  	s          *Service
   835  	name       string
   836  	urlParams_ gensupport.URLParams
   837  	ctx_       context.Context
   838  	header_    http.Header
   839  }
   840  
   841  // Delete: Deletes a note. Caller must have the `OWNER` role on the note to
   842  // delete. Deleting a note removes the resource immediately and cannot be
   843  // undone. Any collaborators will lose access to the note.
   844  //
   845  // - name: Name of the note to delete.
   846  func (r *NotesService) Delete(name string) *NotesDeleteCall {
   847  	c := &NotesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   848  	c.name = name
   849  	return c
   850  }
   851  
   852  // Fields allows partial responses to be retrieved. See
   853  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   854  // details.
   855  func (c *NotesDeleteCall) Fields(s ...googleapi.Field) *NotesDeleteCall {
   856  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   857  	return c
   858  }
   859  
   860  // Context sets the context to be used in this call's Do method.
   861  func (c *NotesDeleteCall) Context(ctx context.Context) *NotesDeleteCall {
   862  	c.ctx_ = ctx
   863  	return c
   864  }
   865  
   866  // Header returns a http.Header that can be modified by the caller to add
   867  // headers to the request.
   868  func (c *NotesDeleteCall) Header() http.Header {
   869  	if c.header_ == nil {
   870  		c.header_ = make(http.Header)
   871  	}
   872  	return c.header_
   873  }
   874  
   875  func (c *NotesDeleteCall) doRequest(alt string) (*http.Response, error) {
   876  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   877  	var body io.Reader = nil
   878  	c.urlParams_.Set("alt", alt)
   879  	c.urlParams_.Set("prettyPrint", "false")
   880  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   881  	urls += "?" + c.urlParams_.Encode()
   882  	req, err := http.NewRequest("DELETE", urls, body)
   883  	if err != nil {
   884  		return nil, err
   885  	}
   886  	req.Header = reqHeaders
   887  	googleapi.Expand(req.URL, map[string]string{
   888  		"name": c.name,
   889  	})
   890  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   891  }
   892  
   893  // Do executes the "keep.notes.delete" call.
   894  // Any non-2xx status code is an error. Response headers are in either
   895  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   896  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   897  // whether the returned error was because http.StatusNotModified was returned.
   898  func (c *NotesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   899  	gensupport.SetOptions(c.urlParams_, opts...)
   900  	res, err := c.doRequest("json")
   901  	if res != nil && res.StatusCode == http.StatusNotModified {
   902  		if res.Body != nil {
   903  			res.Body.Close()
   904  		}
   905  		return nil, gensupport.WrapError(&googleapi.Error{
   906  			Code:   res.StatusCode,
   907  			Header: res.Header,
   908  		})
   909  	}
   910  	if err != nil {
   911  		return nil, err
   912  	}
   913  	defer googleapi.CloseBody(res)
   914  	if err := googleapi.CheckResponse(res); err != nil {
   915  		return nil, gensupport.WrapError(err)
   916  	}
   917  	ret := &Empty{
   918  		ServerResponse: googleapi.ServerResponse{
   919  			Header:         res.Header,
   920  			HTTPStatusCode: res.StatusCode,
   921  		},
   922  	}
   923  	target := &ret
   924  	if err := gensupport.DecodeResponse(target, res); err != nil {
   925  		return nil, err
   926  	}
   927  	return ret, nil
   928  }
   929  
   930  type NotesGetCall struct {
   931  	s            *Service
   932  	name         string
   933  	urlParams_   gensupport.URLParams
   934  	ifNoneMatch_ string
   935  	ctx_         context.Context
   936  	header_      http.Header
   937  }
   938  
   939  // Get: Gets a note.
   940  //
   941  // - name: Name of the resource.
   942  func (r *NotesService) Get(name string) *NotesGetCall {
   943  	c := &NotesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   944  	c.name = name
   945  	return c
   946  }
   947  
   948  // Fields allows partial responses to be retrieved. See
   949  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   950  // details.
   951  func (c *NotesGetCall) Fields(s ...googleapi.Field) *NotesGetCall {
   952  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   953  	return c
   954  }
   955  
   956  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   957  // object's ETag matches the given value. This is useful for getting updates
   958  // only after the object has changed since the last request.
   959  func (c *NotesGetCall) IfNoneMatch(entityTag string) *NotesGetCall {
   960  	c.ifNoneMatch_ = entityTag
   961  	return c
   962  }
   963  
   964  // Context sets the context to be used in this call's Do method.
   965  func (c *NotesGetCall) Context(ctx context.Context) *NotesGetCall {
   966  	c.ctx_ = ctx
   967  	return c
   968  }
   969  
   970  // Header returns a http.Header that can be modified by the caller to add
   971  // headers to the request.
   972  func (c *NotesGetCall) Header() http.Header {
   973  	if c.header_ == nil {
   974  		c.header_ = make(http.Header)
   975  	}
   976  	return c.header_
   977  }
   978  
   979  func (c *NotesGetCall) doRequest(alt string) (*http.Response, error) {
   980  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   981  	if c.ifNoneMatch_ != "" {
   982  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   983  	}
   984  	var body io.Reader = nil
   985  	c.urlParams_.Set("alt", alt)
   986  	c.urlParams_.Set("prettyPrint", "false")
   987  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   988  	urls += "?" + c.urlParams_.Encode()
   989  	req, err := http.NewRequest("GET", urls, body)
   990  	if err != nil {
   991  		return nil, err
   992  	}
   993  	req.Header = reqHeaders
   994  	googleapi.Expand(req.URL, map[string]string{
   995  		"name": c.name,
   996  	})
   997  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   998  }
   999  
  1000  // Do executes the "keep.notes.get" call.
  1001  // Any non-2xx status code is an error. Response headers are in either
  1002  // *Note.ServerResponse.Header or (if a response was returned at all) in
  1003  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1004  // whether the returned error was because http.StatusNotModified was returned.
  1005  func (c *NotesGetCall) Do(opts ...googleapi.CallOption) (*Note, error) {
  1006  	gensupport.SetOptions(c.urlParams_, opts...)
  1007  	res, err := c.doRequest("json")
  1008  	if res != nil && res.StatusCode == http.StatusNotModified {
  1009  		if res.Body != nil {
  1010  			res.Body.Close()
  1011  		}
  1012  		return nil, gensupport.WrapError(&googleapi.Error{
  1013  			Code:   res.StatusCode,
  1014  			Header: res.Header,
  1015  		})
  1016  	}
  1017  	if err != nil {
  1018  		return nil, err
  1019  	}
  1020  	defer googleapi.CloseBody(res)
  1021  	if err := googleapi.CheckResponse(res); err != nil {
  1022  		return nil, gensupport.WrapError(err)
  1023  	}
  1024  	ret := &Note{
  1025  		ServerResponse: googleapi.ServerResponse{
  1026  			Header:         res.Header,
  1027  			HTTPStatusCode: res.StatusCode,
  1028  		},
  1029  	}
  1030  	target := &ret
  1031  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1032  		return nil, err
  1033  	}
  1034  	return ret, nil
  1035  }
  1036  
  1037  type NotesListCall struct {
  1038  	s            *Service
  1039  	urlParams_   gensupport.URLParams
  1040  	ifNoneMatch_ string
  1041  	ctx_         context.Context
  1042  	header_      http.Header
  1043  }
  1044  
  1045  // List: Lists notes. Every list call returns a page of results with
  1046  // `page_size` as the upper bound of returned items. A `page_size` of zero
  1047  // allows the server to choose the upper bound. The ListNotesResponse contains
  1048  // at most `page_size` entries. If there are more things left to list, it
  1049  // provides a `next_page_token` value. (Page tokens are opaque values.) To get
  1050  // the next page of results, copy the result's `next_page_token` into the next
  1051  // request's `page_token`. Repeat until the `next_page_token` returned with a
  1052  // page of results is empty. ListNotes return consistent results in the face of
  1053  // concurrent changes, or signals that it cannot with an ABORTED error.
  1054  func (r *NotesService) List() *NotesListCall {
  1055  	c := &NotesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1056  	return c
  1057  }
  1058  
  1059  // Filter sets the optional parameter "filter": Filter for list results. If no
  1060  // filter is supplied, the `trashed` filter is applied by default. Valid fields
  1061  // to filter by are: `create_time`, `update_time`, `trash_time`, and `trashed`.
  1062  // Filter syntax follows the Google AIP filtering spec (https://aip.dev/160).
  1063  func (c *NotesListCall) Filter(filter string) *NotesListCall {
  1064  	c.urlParams_.Set("filter", filter)
  1065  	return c
  1066  }
  1067  
  1068  // PageSize sets the optional parameter "pageSize": The maximum number of
  1069  // results to return.
  1070  func (c *NotesListCall) PageSize(pageSize int64) *NotesListCall {
  1071  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1072  	return c
  1073  }
  1074  
  1075  // PageToken sets the optional parameter "pageToken": The previous page's
  1076  // `next_page_token` field.
  1077  func (c *NotesListCall) PageToken(pageToken string) *NotesListCall {
  1078  	c.urlParams_.Set("pageToken", pageToken)
  1079  	return c
  1080  }
  1081  
  1082  // Fields allows partial responses to be retrieved. See
  1083  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1084  // details.
  1085  func (c *NotesListCall) Fields(s ...googleapi.Field) *NotesListCall {
  1086  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1087  	return c
  1088  }
  1089  
  1090  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1091  // object's ETag matches the given value. This is useful for getting updates
  1092  // only after the object has changed since the last request.
  1093  func (c *NotesListCall) IfNoneMatch(entityTag string) *NotesListCall {
  1094  	c.ifNoneMatch_ = entityTag
  1095  	return c
  1096  }
  1097  
  1098  // Context sets the context to be used in this call's Do method.
  1099  func (c *NotesListCall) Context(ctx context.Context) *NotesListCall {
  1100  	c.ctx_ = ctx
  1101  	return c
  1102  }
  1103  
  1104  // Header returns a http.Header that can be modified by the caller to add
  1105  // headers to the request.
  1106  func (c *NotesListCall) Header() http.Header {
  1107  	if c.header_ == nil {
  1108  		c.header_ = make(http.Header)
  1109  	}
  1110  	return c.header_
  1111  }
  1112  
  1113  func (c *NotesListCall) doRequest(alt string) (*http.Response, error) {
  1114  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1115  	if c.ifNoneMatch_ != "" {
  1116  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1117  	}
  1118  	var body io.Reader = nil
  1119  	c.urlParams_.Set("alt", alt)
  1120  	c.urlParams_.Set("prettyPrint", "false")
  1121  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/notes")
  1122  	urls += "?" + c.urlParams_.Encode()
  1123  	req, err := http.NewRequest("GET", urls, body)
  1124  	if err != nil {
  1125  		return nil, err
  1126  	}
  1127  	req.Header = reqHeaders
  1128  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1129  }
  1130  
  1131  // Do executes the "keep.notes.list" call.
  1132  // Any non-2xx status code is an error. Response headers are in either
  1133  // *ListNotesResponse.ServerResponse.Header or (if a response was returned at
  1134  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1135  // check whether the returned error was because http.StatusNotModified was
  1136  // returned.
  1137  func (c *NotesListCall) Do(opts ...googleapi.CallOption) (*ListNotesResponse, error) {
  1138  	gensupport.SetOptions(c.urlParams_, opts...)
  1139  	res, err := c.doRequest("json")
  1140  	if res != nil && res.StatusCode == http.StatusNotModified {
  1141  		if res.Body != nil {
  1142  			res.Body.Close()
  1143  		}
  1144  		return nil, gensupport.WrapError(&googleapi.Error{
  1145  			Code:   res.StatusCode,
  1146  			Header: res.Header,
  1147  		})
  1148  	}
  1149  	if err != nil {
  1150  		return nil, err
  1151  	}
  1152  	defer googleapi.CloseBody(res)
  1153  	if err := googleapi.CheckResponse(res); err != nil {
  1154  		return nil, gensupport.WrapError(err)
  1155  	}
  1156  	ret := &ListNotesResponse{
  1157  		ServerResponse: googleapi.ServerResponse{
  1158  			Header:         res.Header,
  1159  			HTTPStatusCode: res.StatusCode,
  1160  		},
  1161  	}
  1162  	target := &ret
  1163  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1164  		return nil, err
  1165  	}
  1166  	return ret, nil
  1167  }
  1168  
  1169  // Pages invokes f for each page of results.
  1170  // A non-nil error returned from f will halt the iteration.
  1171  // The provided context supersedes any context provided to the Context method.
  1172  func (c *NotesListCall) Pages(ctx context.Context, f func(*ListNotesResponse) error) error {
  1173  	c.ctx_ = ctx
  1174  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1175  	for {
  1176  		x, err := c.Do()
  1177  		if err != nil {
  1178  			return err
  1179  		}
  1180  		if err := f(x); err != nil {
  1181  			return err
  1182  		}
  1183  		if x.NextPageToken == "" {
  1184  			return nil
  1185  		}
  1186  		c.PageToken(x.NextPageToken)
  1187  	}
  1188  }
  1189  
  1190  type NotesPermissionsBatchCreateCall struct {
  1191  	s                             *Service
  1192  	parent                        string
  1193  	batchcreatepermissionsrequest *BatchCreatePermissionsRequest
  1194  	urlParams_                    gensupport.URLParams
  1195  	ctx_                          context.Context
  1196  	header_                       http.Header
  1197  }
  1198  
  1199  // BatchCreate: Creates one or more permissions on the note. Only permissions
  1200  // with the `WRITER` role may be created. If adding any permission fails, then
  1201  // the entire request fails and no changes are made.
  1202  //
  1203  //   - parent: The parent resource shared by all Permissions being created.
  1204  //     Format: `notes/{note}` If this is set, the parent field in the
  1205  //     CreatePermission messages must either be empty or match this field.
  1206  func (r *NotesPermissionsService) BatchCreate(parent string, batchcreatepermissionsrequest *BatchCreatePermissionsRequest) *NotesPermissionsBatchCreateCall {
  1207  	c := &NotesPermissionsBatchCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1208  	c.parent = parent
  1209  	c.batchcreatepermissionsrequest = batchcreatepermissionsrequest
  1210  	return c
  1211  }
  1212  
  1213  // Fields allows partial responses to be retrieved. See
  1214  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1215  // details.
  1216  func (c *NotesPermissionsBatchCreateCall) Fields(s ...googleapi.Field) *NotesPermissionsBatchCreateCall {
  1217  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1218  	return c
  1219  }
  1220  
  1221  // Context sets the context to be used in this call's Do method.
  1222  func (c *NotesPermissionsBatchCreateCall) Context(ctx context.Context) *NotesPermissionsBatchCreateCall {
  1223  	c.ctx_ = ctx
  1224  	return c
  1225  }
  1226  
  1227  // Header returns a http.Header that can be modified by the caller to add
  1228  // headers to the request.
  1229  func (c *NotesPermissionsBatchCreateCall) Header() http.Header {
  1230  	if c.header_ == nil {
  1231  		c.header_ = make(http.Header)
  1232  	}
  1233  	return c.header_
  1234  }
  1235  
  1236  func (c *NotesPermissionsBatchCreateCall) doRequest(alt string) (*http.Response, error) {
  1237  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1238  	var body io.Reader = nil
  1239  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchcreatepermissionsrequest)
  1240  	if err != nil {
  1241  		return nil, err
  1242  	}
  1243  	c.urlParams_.Set("alt", alt)
  1244  	c.urlParams_.Set("prettyPrint", "false")
  1245  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/permissions:batchCreate")
  1246  	urls += "?" + c.urlParams_.Encode()
  1247  	req, err := http.NewRequest("POST", urls, body)
  1248  	if err != nil {
  1249  		return nil, err
  1250  	}
  1251  	req.Header = reqHeaders
  1252  	googleapi.Expand(req.URL, map[string]string{
  1253  		"parent": c.parent,
  1254  	})
  1255  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1256  }
  1257  
  1258  // Do executes the "keep.notes.permissions.batchCreate" call.
  1259  // Any non-2xx status code is an error. Response headers are in either
  1260  // *BatchCreatePermissionsResponse.ServerResponse.Header or (if a response was
  1261  // returned at all) in error.(*googleapi.Error).Header. Use
  1262  // googleapi.IsNotModified to check whether the returned error was because
  1263  // http.StatusNotModified was returned.
  1264  func (c *NotesPermissionsBatchCreateCall) Do(opts ...googleapi.CallOption) (*BatchCreatePermissionsResponse, error) {
  1265  	gensupport.SetOptions(c.urlParams_, opts...)
  1266  	res, err := c.doRequest("json")
  1267  	if res != nil && res.StatusCode == http.StatusNotModified {
  1268  		if res.Body != nil {
  1269  			res.Body.Close()
  1270  		}
  1271  		return nil, gensupport.WrapError(&googleapi.Error{
  1272  			Code:   res.StatusCode,
  1273  			Header: res.Header,
  1274  		})
  1275  	}
  1276  	if err != nil {
  1277  		return nil, err
  1278  	}
  1279  	defer googleapi.CloseBody(res)
  1280  	if err := googleapi.CheckResponse(res); err != nil {
  1281  		return nil, gensupport.WrapError(err)
  1282  	}
  1283  	ret := &BatchCreatePermissionsResponse{
  1284  		ServerResponse: googleapi.ServerResponse{
  1285  			Header:         res.Header,
  1286  			HTTPStatusCode: res.StatusCode,
  1287  		},
  1288  	}
  1289  	target := &ret
  1290  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1291  		return nil, err
  1292  	}
  1293  	return ret, nil
  1294  }
  1295  
  1296  type NotesPermissionsBatchDeleteCall struct {
  1297  	s                             *Service
  1298  	parent                        string
  1299  	batchdeletepermissionsrequest *BatchDeletePermissionsRequest
  1300  	urlParams_                    gensupport.URLParams
  1301  	ctx_                          context.Context
  1302  	header_                       http.Header
  1303  }
  1304  
  1305  // BatchDelete: Deletes one or more permissions on the note. The specified
  1306  // entities will immediately lose access. A permission with the `OWNER` role
  1307  // can't be removed. If removing a permission fails, then the entire request
  1308  // fails and no changes are made. Returns a 400 bad request error if a
  1309  // specified permission does not exist on the note.
  1310  //
  1311  //   - parent: The parent resource shared by all permissions being deleted.
  1312  //     Format: `notes/{note}` If this is set, the parent of all of the
  1313  //     permissions specified in the DeletePermissionRequest messages must match
  1314  //     this field.
  1315  func (r *NotesPermissionsService) BatchDelete(parent string, batchdeletepermissionsrequest *BatchDeletePermissionsRequest) *NotesPermissionsBatchDeleteCall {
  1316  	c := &NotesPermissionsBatchDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1317  	c.parent = parent
  1318  	c.batchdeletepermissionsrequest = batchdeletepermissionsrequest
  1319  	return c
  1320  }
  1321  
  1322  // Fields allows partial responses to be retrieved. See
  1323  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1324  // details.
  1325  func (c *NotesPermissionsBatchDeleteCall) Fields(s ...googleapi.Field) *NotesPermissionsBatchDeleteCall {
  1326  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1327  	return c
  1328  }
  1329  
  1330  // Context sets the context to be used in this call's Do method.
  1331  func (c *NotesPermissionsBatchDeleteCall) Context(ctx context.Context) *NotesPermissionsBatchDeleteCall {
  1332  	c.ctx_ = ctx
  1333  	return c
  1334  }
  1335  
  1336  // Header returns a http.Header that can be modified by the caller to add
  1337  // headers to the request.
  1338  func (c *NotesPermissionsBatchDeleteCall) Header() http.Header {
  1339  	if c.header_ == nil {
  1340  		c.header_ = make(http.Header)
  1341  	}
  1342  	return c.header_
  1343  }
  1344  
  1345  func (c *NotesPermissionsBatchDeleteCall) doRequest(alt string) (*http.Response, error) {
  1346  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1347  	var body io.Reader = nil
  1348  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchdeletepermissionsrequest)
  1349  	if err != nil {
  1350  		return nil, err
  1351  	}
  1352  	c.urlParams_.Set("alt", alt)
  1353  	c.urlParams_.Set("prettyPrint", "false")
  1354  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/permissions:batchDelete")
  1355  	urls += "?" + c.urlParams_.Encode()
  1356  	req, err := http.NewRequest("POST", urls, body)
  1357  	if err != nil {
  1358  		return nil, err
  1359  	}
  1360  	req.Header = reqHeaders
  1361  	googleapi.Expand(req.URL, map[string]string{
  1362  		"parent": c.parent,
  1363  	})
  1364  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1365  }
  1366  
  1367  // Do executes the "keep.notes.permissions.batchDelete" call.
  1368  // Any non-2xx status code is an error. Response headers are in either
  1369  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1370  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1371  // whether the returned error was because http.StatusNotModified was returned.
  1372  func (c *NotesPermissionsBatchDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1373  	gensupport.SetOptions(c.urlParams_, opts...)
  1374  	res, err := c.doRequest("json")
  1375  	if res != nil && res.StatusCode == http.StatusNotModified {
  1376  		if res.Body != nil {
  1377  			res.Body.Close()
  1378  		}
  1379  		return nil, gensupport.WrapError(&googleapi.Error{
  1380  			Code:   res.StatusCode,
  1381  			Header: res.Header,
  1382  		})
  1383  	}
  1384  	if err != nil {
  1385  		return nil, err
  1386  	}
  1387  	defer googleapi.CloseBody(res)
  1388  	if err := googleapi.CheckResponse(res); err != nil {
  1389  		return nil, gensupport.WrapError(err)
  1390  	}
  1391  	ret := &Empty{
  1392  		ServerResponse: googleapi.ServerResponse{
  1393  			Header:         res.Header,
  1394  			HTTPStatusCode: res.StatusCode,
  1395  		},
  1396  	}
  1397  	target := &ret
  1398  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1399  		return nil, err
  1400  	}
  1401  	return ret, nil
  1402  }
  1403  

View as plain text