1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 package keep
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
79
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
102 const (
103
104 KeepScope = "https://www.googleapis.com/auth/keep"
105
106
107 KeepReadonlyScope = "https://www.googleapis.com/auth/keep.readonly"
108 )
109
110
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
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
137
138
139
140
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
154 UserAgent string
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
199 type Attachment struct {
200
201
202 MimeType []string `json:"mimeType,omitempty"`
203
204 Name string `json:"name,omitempty"`
205
206
207 googleapi.ServerResponse `json:"-"`
208
209
210
211
212
213 ForceSendFields []string `json:"-"`
214
215
216
217
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
227
228
229 type BatchCreatePermissionsRequest struct {
230
231 Requests []*CreatePermissionRequest `json:"requests,omitempty"`
232
233
234
235
236
237 ForceSendFields []string `json:"-"`
238
239
240
241
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
251
252 type BatchCreatePermissionsResponse struct {
253
254 Permissions []*Permission `json:"permissions,omitempty"`
255
256
257 googleapi.ServerResponse `json:"-"`
258
259
260
261
262
263 ForceSendFields []string `json:"-"`
264
265
266
267
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
277
278
279
280
281 type BatchDeletePermissionsRequest struct {
282
283
284 Names []string `json:"names,omitempty"`
285
286
287
288
289
290 ForceSendFields []string `json:"-"`
291
292
293
294
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
304 type CreatePermissionRequest struct {
305
306
307 Parent string `json:"parent,omitempty"`
308
309
310 Permission *Permission `json:"permission,omitempty"`
311
312
313
314
315
316 ForceSendFields []string `json:"-"`
317
318
319
320
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
330
331
332
333 type Empty struct {
334
335 googleapi.ServerResponse `json:"-"`
336 }
337
338
339 type Family struct {
340 }
341
342
343 type Group struct {
344
345 Email string `json:"email,omitempty"`
346
347
348
349
350
351 ForceSendFields []string `json:"-"`
352
353
354
355
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
365 type ListContent struct {
366
367
368 ListItems []*ListItem `json:"listItems,omitempty"`
369
370
371
372
373
374 ForceSendFields []string `json:"-"`
375
376
377
378
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
388 type ListItem struct {
389
390 Checked bool `json:"checked,omitempty"`
391
392
393 ChildListItems []*ListItem `json:"childListItems,omitempty"`
394
395 Text *TextContent `json:"text,omitempty"`
396
397
398
399
400
401 ForceSendFields []string `json:"-"`
402
403
404
405
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
415 type ListNotesResponse struct {
416
417 NextPageToken string `json:"nextPageToken,omitempty"`
418
419 Notes []*Note `json:"notes,omitempty"`
420
421
422 googleapi.ServerResponse `json:"-"`
423
424
425
426
427
428 ForceSendFields []string `json:"-"`
429
430
431
432
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
442 type Note struct {
443
444 Attachments []*Attachment `json:"attachments,omitempty"`
445
446 Body *Section `json:"body,omitempty"`
447
448 CreateTime string `json:"createTime,omitempty"`
449
450
451 Name string `json:"name,omitempty"`
452
453
454 Permissions []*Permission `json:"permissions,omitempty"`
455
456 Title string `json:"title,omitempty"`
457
458
459
460 TrashTime string `json:"trashTime,omitempty"`
461
462
463 Trashed bool `json:"trashed,omitempty"`
464
465 UpdateTime string `json:"updateTime,omitempty"`
466
467
468 googleapi.ServerResponse `json:"-"`
469
470
471
472
473
474 ForceSendFields []string `json:"-"`
475
476
477
478
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
488
489 type Permission struct {
490
491
492
493 Deleted bool `json:"deleted,omitempty"`
494
495
496
497
498 Email string `json:"email,omitempty"`
499
500 Family *Family `json:"family,omitempty"`
501
502 Group *Group `json:"group,omitempty"`
503
504 Name string `json:"name,omitempty"`
505
506
507
508
509
510
511
512
513
514 Role string `json:"role,omitempty"`
515
516 User *User `json:"user,omitempty"`
517
518
519
520
521
522 ForceSendFields []string `json:"-"`
523
524
525
526
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
536 type Section struct {
537
538 List *ListContent `json:"list,omitempty"`
539
540
541 Text *TextContent `json:"text,omitempty"`
542
543
544
545
546
547 ForceSendFields []string `json:"-"`
548
549
550
551
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
561 type TextContent struct {
562
563
564 Text string `json:"text,omitempty"`
565
566
567
568
569
570 ForceSendFields []string `json:"-"`
571
572
573
574
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
584 type User struct {
585
586 Email string `json:"email,omitempty"`
587
588
589
590
591
592 ForceSendFields []string `json:"-"`
593
594
595
596
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
615
616
617
618
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
626
627
628
629 func (c *MediaDownloadCall) MimeType(mimeType string) *MediaDownloadCall {
630 c.urlParams_.Set("mimeType", mimeType)
631 return c
632 }
633
634
635
636
637 func (c *MediaDownloadCall) Fields(s ...googleapi.Field) *MediaDownloadCall {
638 c.urlParams_.Set("fields", googleapi.CombineFields(s))
639 return c
640 }
641
642
643
644
645 func (c *MediaDownloadCall) IfNoneMatch(entityTag string) *MediaDownloadCall {
646 c.ifNoneMatch_ = entityTag
647 return c
648 }
649
650
651 func (c *MediaDownloadCall) Context(ctx context.Context) *MediaDownloadCall {
652 c.ctx_ = ctx
653 return c
654 }
655
656
657
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
687
688
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
703
704
705
706
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
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
755
756
757 func (c *NotesCreateCall) Fields(s ...googleapi.Field) *NotesCreateCall {
758 c.urlParams_.Set("fields", googleapi.CombineFields(s))
759 return c
760 }
761
762
763 func (c *NotesCreateCall) Context(ctx context.Context) *NotesCreateCall {
764 c.ctx_ = ctx
765 return c
766 }
767
768
769
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
797
798
799
800
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
842
843
844
845
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
853
854
855 func (c *NotesDeleteCall) Fields(s ...googleapi.Field) *NotesDeleteCall {
856 c.urlParams_.Set("fields", googleapi.CombineFields(s))
857 return c
858 }
859
860
861 func (c *NotesDeleteCall) Context(ctx context.Context) *NotesDeleteCall {
862 c.ctx_ = ctx
863 return c
864 }
865
866
867
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
894
895
896
897
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
940
941
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
949
950
951 func (c *NotesGetCall) Fields(s ...googleapi.Field) *NotesGetCall {
952 c.urlParams_.Set("fields", googleapi.CombineFields(s))
953 return c
954 }
955
956
957
958
959 func (c *NotesGetCall) IfNoneMatch(entityTag string) *NotesGetCall {
960 c.ifNoneMatch_ = entityTag
961 return c
962 }
963
964
965 func (c *NotesGetCall) Context(ctx context.Context) *NotesGetCall {
966 c.ctx_ = ctx
967 return c
968 }
969
970
971
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
1001
1002
1003
1004
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
1046
1047
1048
1049
1050
1051
1052
1053
1054 func (r *NotesService) List() *NotesListCall {
1055 c := &NotesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1056 return c
1057 }
1058
1059
1060
1061
1062
1063 func (c *NotesListCall) Filter(filter string) *NotesListCall {
1064 c.urlParams_.Set("filter", filter)
1065 return c
1066 }
1067
1068
1069
1070 func (c *NotesListCall) PageSize(pageSize int64) *NotesListCall {
1071 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1072 return c
1073 }
1074
1075
1076
1077 func (c *NotesListCall) PageToken(pageToken string) *NotesListCall {
1078 c.urlParams_.Set("pageToken", pageToken)
1079 return c
1080 }
1081
1082
1083
1084
1085 func (c *NotesListCall) Fields(s ...googleapi.Field) *NotesListCall {
1086 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1087 return c
1088 }
1089
1090
1091
1092
1093 func (c *NotesListCall) IfNoneMatch(entityTag string) *NotesListCall {
1094 c.ifNoneMatch_ = entityTag
1095 return c
1096 }
1097
1098
1099 func (c *NotesListCall) Context(ctx context.Context) *NotesListCall {
1100 c.ctx_ = ctx
1101 return c
1102 }
1103
1104
1105
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
1132
1133
1134
1135
1136
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
1170
1171
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
1200
1201
1202
1203
1204
1205
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
1214
1215
1216 func (c *NotesPermissionsBatchCreateCall) Fields(s ...googleapi.Field) *NotesPermissionsBatchCreateCall {
1217 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1218 return c
1219 }
1220
1221
1222 func (c *NotesPermissionsBatchCreateCall) Context(ctx context.Context) *NotesPermissionsBatchCreateCall {
1223 c.ctx_ = ctx
1224 return c
1225 }
1226
1227
1228
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
1259
1260
1261
1262
1263
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
1306
1307
1308
1309
1310
1311
1312
1313
1314
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
1323
1324
1325 func (c *NotesPermissionsBatchDeleteCall) Fields(s ...googleapi.Field) *NotesPermissionsBatchDeleteCall {
1326 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1327 return c
1328 }
1329
1330
1331 func (c *NotesPermissionsBatchDeleteCall) Context(ctx context.Context) *NotesPermissionsBatchDeleteCall {
1332 c.ctx_ = ctx
1333 return c
1334 }
1335
1336
1337
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
1368
1369
1370
1371
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