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 package blogger
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71 )
72
73
74
75 var _ = bytes.NewBuffer
76 var _ = strconv.Itoa
77 var _ = fmt.Sprintf
78 var _ = json.NewDecoder
79 var _ = io.Copy
80 var _ = url.Parse
81 var _ = gensupport.MarshalJSON
82 var _ = googleapi.Version
83 var _ = errors.New
84 var _ = strings.Replace
85 var _ = context.Canceled
86 var _ = internaloption.WithDefaultEndpoint
87 var _ = internal.Version
88
89 const apiId = "blogger:v2"
90 const apiName = "blogger"
91 const apiVersion = "v2"
92 const basePath = "https://blogger.googleapis.com/"
93 const basePathTemplate = "https://blogger.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://blogger.mtls.googleapis.com/"
95
96
97 const (
98
99 BloggerScope = "https://www.googleapis.com/auth/blogger"
100 )
101
102
103 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
104 scopesOption := internaloption.WithDefaultScopes(
105 "https://www.googleapis.com/auth/blogger",
106 )
107
108 opts = append([]option.ClientOption{scopesOption}, opts...)
109 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
110 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
111 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
112 opts = append(opts, internaloption.EnableNewAuthLibrary())
113 client, endpoint, err := htransport.NewClient(ctx, opts...)
114 if err != nil {
115 return nil, err
116 }
117 s, err := New(client)
118 if err != nil {
119 return nil, err
120 }
121 if endpoint != "" {
122 s.BasePath = endpoint
123 }
124 return s, nil
125 }
126
127
128
129
130
131
132 func New(client *http.Client) (*Service, error) {
133 if client == nil {
134 return nil, errors.New("client is nil")
135 }
136 s := &Service{client: client, BasePath: basePath}
137 s.Blogs = NewBlogsService(s)
138 s.Comments = NewCommentsService(s)
139 s.Pages = NewPagesService(s)
140 s.Posts = NewPostsService(s)
141 s.Users = NewUsersService(s)
142 return s, nil
143 }
144
145 type Service struct {
146 client *http.Client
147 BasePath string
148 UserAgent string
149
150 Blogs *BlogsService
151
152 Comments *CommentsService
153
154 Pages *PagesService
155
156 Posts *PostsService
157
158 Users *UsersService
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 NewBlogsService(s *Service) *BlogsService {
169 rs := &BlogsService{s: s}
170 return rs
171 }
172
173 type BlogsService struct {
174 s *Service
175 }
176
177 func NewCommentsService(s *Service) *CommentsService {
178 rs := &CommentsService{s: s}
179 return rs
180 }
181
182 type CommentsService struct {
183 s *Service
184 }
185
186 func NewPagesService(s *Service) *PagesService {
187 rs := &PagesService{s: s}
188 return rs
189 }
190
191 type PagesService struct {
192 s *Service
193 }
194
195 func NewPostsService(s *Service) *PostsService {
196 rs := &PostsService{s: s}
197 return rs
198 }
199
200 type PostsService struct {
201 s *Service
202 }
203
204 func NewUsersService(s *Service) *UsersService {
205 rs := &UsersService{s: s}
206 return rs
207 }
208
209 type UsersService struct {
210 s *Service
211 }
212
213 type Blog struct {
214
215 CustomMetaData string `json:"customMetaData,omitempty"`
216
217
218 Description string `json:"description,omitempty"`
219
220 Id string `json:"id,omitempty"`
221
222 Kind string `json:"kind,omitempty"`
223
224 Locale *BlogLocale `json:"locale,omitempty"`
225
226 Name string `json:"name,omitempty"`
227
228 Pages *BlogPages `json:"pages,omitempty"`
229
230 Posts *BlogPosts `json:"posts,omitempty"`
231
232 Published string `json:"published,omitempty"`
233
234 SelfLink string `json:"selfLink,omitempty"`
235
236
237
238
239
240 Status string `json:"status,omitempty"`
241
242 Updated string `json:"updated,omitempty"`
243
244 Url string `json:"url,omitempty"`
245
246
247 googleapi.ServerResponse `json:"-"`
248
249
250
251
252
253 ForceSendFields []string `json:"-"`
254
255
256
257
258 NullFields []string `json:"-"`
259 }
260
261 func (s *Blog) MarshalJSON() ([]byte, error) {
262 type NoMethod Blog
263 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
264 }
265
266
267 type BlogLocale struct {
268
269 Country string `json:"country,omitempty"`
270
271 Language string `json:"language,omitempty"`
272
273 Variant string `json:"variant,omitempty"`
274
275
276
277
278
279 ForceSendFields []string `json:"-"`
280
281
282
283
284 NullFields []string `json:"-"`
285 }
286
287 func (s *BlogLocale) MarshalJSON() ([]byte, error) {
288 type NoMethod BlogLocale
289 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
290 }
291
292
293 type BlogPages struct {
294
295 SelfLink string `json:"selfLink,omitempty"`
296
297 TotalItems int64 `json:"totalItems,omitempty"`
298
299
300
301
302
303 ForceSendFields []string `json:"-"`
304
305
306
307
308 NullFields []string `json:"-"`
309 }
310
311 func (s *BlogPages) MarshalJSON() ([]byte, error) {
312 type NoMethod BlogPages
313 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
314 }
315
316
317 type BlogPosts struct {
318
319 Items []*Post `json:"items,omitempty"`
320
321 SelfLink string `json:"selfLink,omitempty"`
322
323 TotalItems int64 `json:"totalItems,omitempty"`
324
325
326
327
328
329 ForceSendFields []string `json:"-"`
330
331
332
333
334 NullFields []string `json:"-"`
335 }
336
337 func (s *BlogPosts) MarshalJSON() ([]byte, error) {
338 type NoMethod BlogPosts
339 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
340 }
341
342 type BlogList struct {
343
344 BlogUserInfos []*BlogUserInfo `json:"blogUserInfos,omitempty"`
345
346 Items []*Blog `json:"items,omitempty"`
347
348 Kind string `json:"kind,omitempty"`
349
350
351 googleapi.ServerResponse `json:"-"`
352
353
354
355
356
357 ForceSendFields []string `json:"-"`
358
359
360
361
362 NullFields []string `json:"-"`
363 }
364
365 func (s *BlogList) MarshalJSON() ([]byte, error) {
366 type NoMethod BlogList
367 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
368 }
369
370 type BlogPerUserInfo struct {
371
372 BlogId string `json:"blogId,omitempty"`
373
374 HasAdminAccess bool `json:"hasAdminAccess,omitempty"`
375
376 Kind string `json:"kind,omitempty"`
377
378
379 PhotosAlbumKey string `json:"photosAlbumKey,omitempty"`
380
381
382
383
384
385
386
387
388 Role string `json:"role,omitempty"`
389
390 UserId string `json:"userId,omitempty"`
391
392
393
394
395
396 ForceSendFields []string `json:"-"`
397
398
399
400
401 NullFields []string `json:"-"`
402 }
403
404 func (s *BlogPerUserInfo) MarshalJSON() ([]byte, error) {
405 type NoMethod BlogPerUserInfo
406 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
407 }
408
409 type BlogUserInfo struct {
410
411 Blog *Blog `json:"blog,omitempty"`
412
413 BlogUserInfo *BlogPerUserInfo `json:"blog_user_info,omitempty"`
414
415 Kind string `json:"kind,omitempty"`
416
417
418
419
420
421 ForceSendFields []string `json:"-"`
422
423
424
425
426 NullFields []string `json:"-"`
427 }
428
429 func (s *BlogUserInfo) MarshalJSON() ([]byte, error) {
430 type NoMethod BlogUserInfo
431 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
432 }
433
434 type Comment struct {
435
436 Author *CommentAuthor `json:"author,omitempty"`
437
438 Blog *CommentBlog `json:"blog,omitempty"`
439
440 Content string `json:"content,omitempty"`
441
442 Id string `json:"id,omitempty"`
443
444 InReplyTo *CommentInReplyTo `json:"inReplyTo,omitempty"`
445
446 Kind string `json:"kind,omitempty"`
447
448 Post *CommentPost `json:"post,omitempty"`
449
450 Published string `json:"published,omitempty"`
451
452 SelfLink string `json:"selfLink,omitempty"`
453
454
455
456
457
458
459
460 Status string `json:"status,omitempty"`
461
462 Updated string `json:"updated,omitempty"`
463
464
465 googleapi.ServerResponse `json:"-"`
466
467
468
469
470
471 ForceSendFields []string `json:"-"`
472
473
474
475
476 NullFields []string `json:"-"`
477 }
478
479 func (s *Comment) MarshalJSON() ([]byte, error) {
480 type NoMethod Comment
481 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
482 }
483
484
485 type CommentAuthor struct {
486
487 DisplayName string `json:"displayName,omitempty"`
488
489 Id string `json:"id,omitempty"`
490
491 Image *CommentAuthorImage `json:"image,omitempty"`
492
493 Url string `json:"url,omitempty"`
494
495
496
497
498
499 ForceSendFields []string `json:"-"`
500
501
502
503
504 NullFields []string `json:"-"`
505 }
506
507 func (s *CommentAuthor) MarshalJSON() ([]byte, error) {
508 type NoMethod CommentAuthor
509 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
510 }
511
512
513 type CommentAuthorImage struct {
514
515 Url string `json:"url,omitempty"`
516
517
518
519
520
521 ForceSendFields []string `json:"-"`
522
523
524
525
526 NullFields []string `json:"-"`
527 }
528
529 func (s *CommentAuthorImage) MarshalJSON() ([]byte, error) {
530 type NoMethod CommentAuthorImage
531 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
532 }
533
534
535 type CommentBlog struct {
536
537 Id string `json:"id,omitempty"`
538
539
540
541
542
543 ForceSendFields []string `json:"-"`
544
545
546
547
548 NullFields []string `json:"-"`
549 }
550
551 func (s *CommentBlog) MarshalJSON() ([]byte, error) {
552 type NoMethod CommentBlog
553 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
554 }
555
556
557 type CommentInReplyTo struct {
558
559 Id string `json:"id,omitempty"`
560
561
562
563
564
565 ForceSendFields []string `json:"-"`
566
567
568
569
570 NullFields []string `json:"-"`
571 }
572
573 func (s *CommentInReplyTo) MarshalJSON() ([]byte, error) {
574 type NoMethod CommentInReplyTo
575 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
576 }
577
578
579 type CommentPost struct {
580
581 Id string `json:"id,omitempty"`
582
583
584
585
586
587 ForceSendFields []string `json:"-"`
588
589
590
591
592 NullFields []string `json:"-"`
593 }
594
595 func (s *CommentPost) MarshalJSON() ([]byte, error) {
596 type NoMethod CommentPost
597 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
598 }
599
600 type CommentList struct {
601
602 Etag string `json:"etag,omitempty"`
603
604 Items []*Comment `json:"items,omitempty"`
605
606 Kind string `json:"kind,omitempty"`
607
608 NextPageToken string `json:"nextPageToken,omitempty"`
609
610 PrevPageToken string `json:"prevPageToken,omitempty"`
611
612
613 googleapi.ServerResponse `json:"-"`
614
615
616
617
618
619 ForceSendFields []string `json:"-"`
620
621
622
623
624 NullFields []string `json:"-"`
625 }
626
627 func (s *CommentList) MarshalJSON() ([]byte, error) {
628 type NoMethod CommentList
629 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
630 }
631
632 type Page struct {
633
634 Author *PageAuthor `json:"author,omitempty"`
635
636 Blog *PageBlog `json:"blog,omitempty"`
637
638 Content string `json:"content,omitempty"`
639
640 Etag string `json:"etag,omitempty"`
641
642 Id string `json:"id,omitempty"`
643
644 Kind string `json:"kind,omitempty"`
645
646 Published string `json:"published,omitempty"`
647
648 SelfLink string `json:"selfLink,omitempty"`
649
650
651
652
653
654
655 Status string `json:"status,omitempty"`
656
657
658 Title string `json:"title,omitempty"`
659
660 Trashed string `json:"trashed,omitempty"`
661
662 Updated string `json:"updated,omitempty"`
663
664 Url string `json:"url,omitempty"`
665
666
667 googleapi.ServerResponse `json:"-"`
668
669
670
671
672
673 ForceSendFields []string `json:"-"`
674
675
676
677
678 NullFields []string `json:"-"`
679 }
680
681 func (s *Page) MarshalJSON() ([]byte, error) {
682 type NoMethod Page
683 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
684 }
685
686
687 type PageAuthor struct {
688
689 DisplayName string `json:"displayName,omitempty"`
690
691 Id string `json:"id,omitempty"`
692
693 Image *PageAuthorImage `json:"image,omitempty"`
694
695 Url string `json:"url,omitempty"`
696
697
698
699
700
701 ForceSendFields []string `json:"-"`
702
703
704
705
706 NullFields []string `json:"-"`
707 }
708
709 func (s *PageAuthor) MarshalJSON() ([]byte, error) {
710 type NoMethod PageAuthor
711 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
712 }
713
714
715 type PageAuthorImage struct {
716
717 Url string `json:"url,omitempty"`
718
719
720
721
722
723 ForceSendFields []string `json:"-"`
724
725
726
727
728 NullFields []string `json:"-"`
729 }
730
731 func (s *PageAuthorImage) MarshalJSON() ([]byte, error) {
732 type NoMethod PageAuthorImage
733 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
734 }
735
736
737 type PageBlog struct {
738
739 Id string `json:"id,omitempty"`
740
741
742
743
744
745 ForceSendFields []string `json:"-"`
746
747
748
749
750 NullFields []string `json:"-"`
751 }
752
753 func (s *PageBlog) MarshalJSON() ([]byte, error) {
754 type NoMethod PageBlog
755 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
756 }
757
758 type PageList struct {
759
760 Etag string `json:"etag,omitempty"`
761
762 Items []*Page `json:"items,omitempty"`
763
764 Kind string `json:"kind,omitempty"`
765
766 NextPageToken string `json:"nextPageToken,omitempty"`
767
768
769 googleapi.ServerResponse `json:"-"`
770
771
772
773
774
775 ForceSendFields []string `json:"-"`
776
777
778
779
780 NullFields []string `json:"-"`
781 }
782
783 func (s *PageList) MarshalJSON() ([]byte, error) {
784 type NoMethod PageList
785 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
786 }
787
788 type Post struct {
789
790 Author *PostAuthor `json:"author,omitempty"`
791
792 Blog *PostBlog `json:"blog,omitempty"`
793
794 Content string `json:"content,omitempty"`
795
796 CustomMetaData string `json:"customMetaData,omitempty"`
797
798 Etag string `json:"etag,omitempty"`
799
800 Id string `json:"id,omitempty"`
801
802 Images []*PostImages `json:"images,omitempty"`
803
804 Kind string `json:"kind,omitempty"`
805
806 Labels []string `json:"labels,omitempty"`
807
808 Location *PostLocation `json:"location,omitempty"`
809
810 Published string `json:"published,omitempty"`
811
812
813
814
815
816
817
818 ReaderComments string `json:"readerComments,omitempty"`
819
820 Replies *PostReplies `json:"replies,omitempty"`
821
822 SelfLink string `json:"selfLink,omitempty"`
823
824
825
826
827
828
829
830 Status string `json:"status,omitempty"`
831
832 Title string `json:"title,omitempty"`
833
834 TitleLink string `json:"titleLink,omitempty"`
835
836 Trashed string `json:"trashed,omitempty"`
837
838 Updated string `json:"updated,omitempty"`
839
840 Url string `json:"url,omitempty"`
841
842
843 googleapi.ServerResponse `json:"-"`
844
845
846
847
848
849 ForceSendFields []string `json:"-"`
850
851
852
853
854 NullFields []string `json:"-"`
855 }
856
857 func (s *Post) MarshalJSON() ([]byte, error) {
858 type NoMethod Post
859 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
860 }
861
862
863 type PostAuthor struct {
864
865 DisplayName string `json:"displayName,omitempty"`
866
867 Id string `json:"id,omitempty"`
868
869 Image *PostAuthorImage `json:"image,omitempty"`
870
871 Url string `json:"url,omitempty"`
872
873
874
875
876
877 ForceSendFields []string `json:"-"`
878
879
880
881
882 NullFields []string `json:"-"`
883 }
884
885 func (s *PostAuthor) MarshalJSON() ([]byte, error) {
886 type NoMethod PostAuthor
887 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
888 }
889
890
891 type PostAuthorImage struct {
892
893 Url string `json:"url,omitempty"`
894
895
896
897
898
899 ForceSendFields []string `json:"-"`
900
901
902
903
904 NullFields []string `json:"-"`
905 }
906
907 func (s *PostAuthorImage) MarshalJSON() ([]byte, error) {
908 type NoMethod PostAuthorImage
909 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
910 }
911
912
913 type PostBlog struct {
914
915 Id string `json:"id,omitempty"`
916
917
918
919
920
921 ForceSendFields []string `json:"-"`
922
923
924
925
926 NullFields []string `json:"-"`
927 }
928
929 func (s *PostBlog) MarshalJSON() ([]byte, error) {
930 type NoMethod PostBlog
931 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
932 }
933
934 type PostImages struct {
935 Url string `json:"url,omitempty"`
936
937
938
939
940
941 ForceSendFields []string `json:"-"`
942
943
944
945
946 NullFields []string `json:"-"`
947 }
948
949 func (s *PostImages) MarshalJSON() ([]byte, error) {
950 type NoMethod PostImages
951 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
952 }
953
954
955 type PostLocation struct {
956
957 Lat float64 `json:"lat,omitempty"`
958
959 Lng float64 `json:"lng,omitempty"`
960
961 Name string `json:"name,omitempty"`
962
963 Span string `json:"span,omitempty"`
964
965
966
967
968
969 ForceSendFields []string `json:"-"`
970
971
972
973
974 NullFields []string `json:"-"`
975 }
976
977 func (s *PostLocation) MarshalJSON() ([]byte, error) {
978 type NoMethod PostLocation
979 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
980 }
981
982 func (s *PostLocation) UnmarshalJSON(data []byte) error {
983 type NoMethod PostLocation
984 var s1 struct {
985 Lat gensupport.JSONFloat64 `json:"lat"`
986 Lng gensupport.JSONFloat64 `json:"lng"`
987 *NoMethod
988 }
989 s1.NoMethod = (*NoMethod)(s)
990 if err := json.Unmarshal(data, &s1); err != nil {
991 return err
992 }
993 s.Lat = float64(s1.Lat)
994 s.Lng = float64(s1.Lng)
995 return nil
996 }
997
998
999 type PostReplies struct {
1000
1001 Items []*Comment `json:"items,omitempty"`
1002
1003 SelfLink string `json:"selfLink,omitempty"`
1004
1005 TotalItems int64 `json:"totalItems,omitempty,string"`
1006
1007
1008
1009
1010
1011 ForceSendFields []string `json:"-"`
1012
1013
1014
1015
1016 NullFields []string `json:"-"`
1017 }
1018
1019 func (s *PostReplies) MarshalJSON() ([]byte, error) {
1020 type NoMethod PostReplies
1021 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1022 }
1023
1024 type PostList struct {
1025
1026 Etag string `json:"etag,omitempty"`
1027
1028 Items []*Post `json:"items,omitempty"`
1029
1030 Kind string `json:"kind,omitempty"`
1031
1032 NextPageToken string `json:"nextPageToken,omitempty"`
1033
1034 PrevPageToken string `json:"prevPageToken,omitempty"`
1035
1036
1037 googleapi.ServerResponse `json:"-"`
1038
1039
1040
1041
1042
1043 ForceSendFields []string `json:"-"`
1044
1045
1046
1047
1048 NullFields []string `json:"-"`
1049 }
1050
1051 func (s *PostList) MarshalJSON() ([]byte, error) {
1052 type NoMethod PostList
1053 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1054 }
1055
1056 type User struct {
1057
1058 About string `json:"about,omitempty"`
1059
1060 Blogs *UserBlogs `json:"blogs,omitempty"`
1061
1062
1063 Created string `json:"created,omitempty"`
1064
1065 DisplayName string `json:"displayName,omitempty"`
1066
1067 Id string `json:"id,omitempty"`
1068
1069 Kind string `json:"kind,omitempty"`
1070
1071 Locale *UserLocale `json:"locale,omitempty"`
1072
1073 SelfLink string `json:"selfLink,omitempty"`
1074
1075 Url string `json:"url,omitempty"`
1076
1077
1078 googleapi.ServerResponse `json:"-"`
1079
1080
1081
1082
1083
1084 ForceSendFields []string `json:"-"`
1085
1086
1087
1088
1089 NullFields []string `json:"-"`
1090 }
1091
1092 func (s *User) MarshalJSON() ([]byte, error) {
1093 type NoMethod User
1094 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1095 }
1096
1097
1098 type UserBlogs struct {
1099
1100 SelfLink string `json:"selfLink,omitempty"`
1101
1102
1103
1104
1105
1106 ForceSendFields []string `json:"-"`
1107
1108
1109
1110
1111 NullFields []string `json:"-"`
1112 }
1113
1114 func (s *UserBlogs) MarshalJSON() ([]byte, error) {
1115 type NoMethod UserBlogs
1116 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1117 }
1118
1119
1120 type UserLocale struct {
1121
1122 Country string `json:"country,omitempty"`
1123
1124 Language string `json:"language,omitempty"`
1125
1126 Variant string `json:"variant,omitempty"`
1127
1128
1129
1130
1131
1132 ForceSendFields []string `json:"-"`
1133
1134
1135
1136
1137 NullFields []string `json:"-"`
1138 }
1139
1140 func (s *UserLocale) MarshalJSON() ([]byte, error) {
1141 type NoMethod UserLocale
1142 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1143 }
1144
1145 type BlogsGetCall struct {
1146 s *Service
1147 blogId string
1148 urlParams_ gensupport.URLParams
1149 ifNoneMatch_ string
1150 ctx_ context.Context
1151 header_ http.Header
1152 }
1153
1154
1155
1156
1157 func (r *BlogsService) Get(blogId string) *BlogsGetCall {
1158 c := &BlogsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1159 c.blogId = blogId
1160 return c
1161 }
1162
1163
1164
1165
1166 func (c *BlogsGetCall) Fields(s ...googleapi.Field) *BlogsGetCall {
1167 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1168 return c
1169 }
1170
1171
1172
1173
1174 func (c *BlogsGetCall) IfNoneMatch(entityTag string) *BlogsGetCall {
1175 c.ifNoneMatch_ = entityTag
1176 return c
1177 }
1178
1179
1180 func (c *BlogsGetCall) Context(ctx context.Context) *BlogsGetCall {
1181 c.ctx_ = ctx
1182 return c
1183 }
1184
1185
1186
1187 func (c *BlogsGetCall) Header() http.Header {
1188 if c.header_ == nil {
1189 c.header_ = make(http.Header)
1190 }
1191 return c.header_
1192 }
1193
1194 func (c *BlogsGetCall) doRequest(alt string) (*http.Response, error) {
1195 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1196 if c.ifNoneMatch_ != "" {
1197 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1198 }
1199 var body io.Reader = nil
1200 c.urlParams_.Set("alt", alt)
1201 c.urlParams_.Set("prettyPrint", "false")
1202 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/blogs/{blogId}")
1203 urls += "?" + c.urlParams_.Encode()
1204 req, err := http.NewRequest("GET", urls, body)
1205 if err != nil {
1206 return nil, err
1207 }
1208 req.Header = reqHeaders
1209 googleapi.Expand(req.URL, map[string]string{
1210 "blogId": c.blogId,
1211 })
1212 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1213 }
1214
1215
1216
1217
1218
1219
1220 func (c *BlogsGetCall) Do(opts ...googleapi.CallOption) (*Blog, error) {
1221 gensupport.SetOptions(c.urlParams_, opts...)
1222 res, err := c.doRequest("json")
1223 if res != nil && res.StatusCode == http.StatusNotModified {
1224 if res.Body != nil {
1225 res.Body.Close()
1226 }
1227 return nil, gensupport.WrapError(&googleapi.Error{
1228 Code: res.StatusCode,
1229 Header: res.Header,
1230 })
1231 }
1232 if err != nil {
1233 return nil, err
1234 }
1235 defer googleapi.CloseBody(res)
1236 if err := googleapi.CheckResponse(res); err != nil {
1237 return nil, gensupport.WrapError(err)
1238 }
1239 ret := &Blog{
1240 ServerResponse: googleapi.ServerResponse{
1241 Header: res.Header,
1242 HTTPStatusCode: res.StatusCode,
1243 },
1244 }
1245 target := &ret
1246 if err := gensupport.DecodeResponse(target, res); err != nil {
1247 return nil, err
1248 }
1249 return ret, nil
1250 }
1251
1252 type BlogsListCall struct {
1253 s *Service
1254 userId string
1255 urlParams_ gensupport.URLParams
1256 ifNoneMatch_ string
1257 ctx_ context.Context
1258 header_ http.Header
1259 }
1260
1261
1262
1263
1264 func (r *BlogsService) List(userId string) *BlogsListCall {
1265 c := &BlogsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1266 c.userId = userId
1267 return c
1268 }
1269
1270
1271
1272
1273 func (c *BlogsListCall) Fields(s ...googleapi.Field) *BlogsListCall {
1274 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1275 return c
1276 }
1277
1278
1279
1280
1281 func (c *BlogsListCall) IfNoneMatch(entityTag string) *BlogsListCall {
1282 c.ifNoneMatch_ = entityTag
1283 return c
1284 }
1285
1286
1287 func (c *BlogsListCall) Context(ctx context.Context) *BlogsListCall {
1288 c.ctx_ = ctx
1289 return c
1290 }
1291
1292
1293
1294 func (c *BlogsListCall) Header() http.Header {
1295 if c.header_ == nil {
1296 c.header_ = make(http.Header)
1297 }
1298 return c.header_
1299 }
1300
1301 func (c *BlogsListCall) doRequest(alt string) (*http.Response, error) {
1302 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1303 if c.ifNoneMatch_ != "" {
1304 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1305 }
1306 var body io.Reader = nil
1307 c.urlParams_.Set("alt", alt)
1308 c.urlParams_.Set("prettyPrint", "false")
1309 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/users/{userId}/blogs")
1310 urls += "?" + c.urlParams_.Encode()
1311 req, err := http.NewRequest("GET", urls, body)
1312 if err != nil {
1313 return nil, err
1314 }
1315 req.Header = reqHeaders
1316 googleapi.Expand(req.URL, map[string]string{
1317 "userId": c.userId,
1318 })
1319 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1320 }
1321
1322
1323
1324
1325
1326
1327 func (c *BlogsListCall) Do(opts ...googleapi.CallOption) (*BlogList, error) {
1328 gensupport.SetOptions(c.urlParams_, opts...)
1329 res, err := c.doRequest("json")
1330 if res != nil && res.StatusCode == http.StatusNotModified {
1331 if res.Body != nil {
1332 res.Body.Close()
1333 }
1334 return nil, gensupport.WrapError(&googleapi.Error{
1335 Code: res.StatusCode,
1336 Header: res.Header,
1337 })
1338 }
1339 if err != nil {
1340 return nil, err
1341 }
1342 defer googleapi.CloseBody(res)
1343 if err := googleapi.CheckResponse(res); err != nil {
1344 return nil, gensupport.WrapError(err)
1345 }
1346 ret := &BlogList{
1347 ServerResponse: googleapi.ServerResponse{
1348 Header: res.Header,
1349 HTTPStatusCode: res.StatusCode,
1350 },
1351 }
1352 target := &ret
1353 if err := gensupport.DecodeResponse(target, res); err != nil {
1354 return nil, err
1355 }
1356 return ret, nil
1357 }
1358
1359 type CommentsGetCall struct {
1360 s *Service
1361 blogId string
1362 postId string
1363 commentId string
1364 urlParams_ gensupport.URLParams
1365 ifNoneMatch_ string
1366 ctx_ context.Context
1367 header_ http.Header
1368 }
1369
1370
1371
1372
1373
1374
1375 func (r *CommentsService) Get(blogId string, postId string, commentId string) *CommentsGetCall {
1376 c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1377 c.blogId = blogId
1378 c.postId = postId
1379 c.commentId = commentId
1380 return c
1381 }
1382
1383
1384
1385
1386 func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall {
1387 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1388 return c
1389 }
1390
1391
1392
1393
1394 func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall {
1395 c.ifNoneMatch_ = entityTag
1396 return c
1397 }
1398
1399
1400 func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall {
1401 c.ctx_ = ctx
1402 return c
1403 }
1404
1405
1406
1407 func (c *CommentsGetCall) Header() http.Header {
1408 if c.header_ == nil {
1409 c.header_ = make(http.Header)
1410 }
1411 return c.header_
1412 }
1413
1414 func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
1415 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1416 if c.ifNoneMatch_ != "" {
1417 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1418 }
1419 var body io.Reader = nil
1420 c.urlParams_.Set("alt", alt)
1421 c.urlParams_.Set("prettyPrint", "false")
1422 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/blogs/{blogId}/posts/{postId}/comments/{commentId}")
1423 urls += "?" + c.urlParams_.Encode()
1424 req, err := http.NewRequest("GET", urls, body)
1425 if err != nil {
1426 return nil, err
1427 }
1428 req.Header = reqHeaders
1429 googleapi.Expand(req.URL, map[string]string{
1430 "blogId": c.blogId,
1431 "postId": c.postId,
1432 "commentId": c.commentId,
1433 })
1434 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1435 }
1436
1437
1438
1439
1440
1441
1442 func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
1443 gensupport.SetOptions(c.urlParams_, opts...)
1444 res, err := c.doRequest("json")
1445 if res != nil && res.StatusCode == http.StatusNotModified {
1446 if res.Body != nil {
1447 res.Body.Close()
1448 }
1449 return nil, gensupport.WrapError(&googleapi.Error{
1450 Code: res.StatusCode,
1451 Header: res.Header,
1452 })
1453 }
1454 if err != nil {
1455 return nil, err
1456 }
1457 defer googleapi.CloseBody(res)
1458 if err := googleapi.CheckResponse(res); err != nil {
1459 return nil, gensupport.WrapError(err)
1460 }
1461 ret := &Comment{
1462 ServerResponse: googleapi.ServerResponse{
1463 Header: res.Header,
1464 HTTPStatusCode: res.StatusCode,
1465 },
1466 }
1467 target := &ret
1468 if err := gensupport.DecodeResponse(target, res); err != nil {
1469 return nil, err
1470 }
1471 return ret, nil
1472 }
1473
1474 type CommentsListCall struct {
1475 s *Service
1476 blogId string
1477 postId string
1478 urlParams_ gensupport.URLParams
1479 ifNoneMatch_ string
1480 ctx_ context.Context
1481 header_ http.Header
1482 }
1483
1484
1485
1486
1487
1488 func (r *CommentsService) List(blogId string, postId string) *CommentsListCall {
1489 c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1490 c.blogId = blogId
1491 c.postId = postId
1492 return c
1493 }
1494
1495
1496 func (c *CommentsListCall) FetchBodies(fetchBodies bool) *CommentsListCall {
1497 c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
1498 return c
1499 }
1500
1501
1502 func (c *CommentsListCall) MaxResults(maxResults int64) *CommentsListCall {
1503 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1504 return c
1505 }
1506
1507
1508 func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall {
1509 c.urlParams_.Set("pageToken", pageToken)
1510 return c
1511 }
1512
1513
1514 func (c *CommentsListCall) StartDate(startDate string) *CommentsListCall {
1515 c.urlParams_.Set("startDate", startDate)
1516 return c
1517 }
1518
1519
1520
1521
1522 func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall {
1523 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1524 return c
1525 }
1526
1527
1528
1529
1530 func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall {
1531 c.ifNoneMatch_ = entityTag
1532 return c
1533 }
1534
1535
1536 func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall {
1537 c.ctx_ = ctx
1538 return c
1539 }
1540
1541
1542
1543 func (c *CommentsListCall) Header() http.Header {
1544 if c.header_ == nil {
1545 c.header_ = make(http.Header)
1546 }
1547 return c.header_
1548 }
1549
1550 func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
1551 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1552 if c.ifNoneMatch_ != "" {
1553 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1554 }
1555 var body io.Reader = nil
1556 c.urlParams_.Set("alt", alt)
1557 c.urlParams_.Set("prettyPrint", "false")
1558 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/blogs/{blogId}/posts/{postId}/comments")
1559 urls += "?" + c.urlParams_.Encode()
1560 req, err := http.NewRequest("GET", urls, body)
1561 if err != nil {
1562 return nil, err
1563 }
1564 req.Header = reqHeaders
1565 googleapi.Expand(req.URL, map[string]string{
1566 "blogId": c.blogId,
1567 "postId": c.postId,
1568 })
1569 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1570 }
1571
1572
1573
1574
1575
1576
1577 func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
1578 gensupport.SetOptions(c.urlParams_, opts...)
1579 res, err := c.doRequest("json")
1580 if res != nil && res.StatusCode == http.StatusNotModified {
1581 if res.Body != nil {
1582 res.Body.Close()
1583 }
1584 return nil, gensupport.WrapError(&googleapi.Error{
1585 Code: res.StatusCode,
1586 Header: res.Header,
1587 })
1588 }
1589 if err != nil {
1590 return nil, err
1591 }
1592 defer googleapi.CloseBody(res)
1593 if err := googleapi.CheckResponse(res); err != nil {
1594 return nil, gensupport.WrapError(err)
1595 }
1596 ret := &CommentList{
1597 ServerResponse: googleapi.ServerResponse{
1598 Header: res.Header,
1599 HTTPStatusCode: res.StatusCode,
1600 },
1601 }
1602 target := &ret
1603 if err := gensupport.DecodeResponse(target, res); err != nil {
1604 return nil, err
1605 }
1606 return ret, nil
1607 }
1608
1609
1610
1611
1612 func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error {
1613 c.ctx_ = ctx
1614 defer c.PageToken(c.urlParams_.Get("pageToken"))
1615 for {
1616 x, err := c.Do()
1617 if err != nil {
1618 return err
1619 }
1620 if err := f(x); err != nil {
1621 return err
1622 }
1623 if x.NextPageToken == "" {
1624 return nil
1625 }
1626 c.PageToken(x.NextPageToken)
1627 }
1628 }
1629
1630 type PagesGetCall struct {
1631 s *Service
1632 blogId string
1633 pageId string
1634 urlParams_ gensupport.URLParams
1635 ifNoneMatch_ string
1636 ctx_ context.Context
1637 header_ http.Header
1638 }
1639
1640
1641
1642
1643
1644 func (r *PagesService) Get(blogId string, pageId string) *PagesGetCall {
1645 c := &PagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1646 c.blogId = blogId
1647 c.pageId = pageId
1648 return c
1649 }
1650
1651
1652
1653
1654 func (c *PagesGetCall) Fields(s ...googleapi.Field) *PagesGetCall {
1655 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1656 return c
1657 }
1658
1659
1660
1661
1662 func (c *PagesGetCall) IfNoneMatch(entityTag string) *PagesGetCall {
1663 c.ifNoneMatch_ = entityTag
1664 return c
1665 }
1666
1667
1668 func (c *PagesGetCall) Context(ctx context.Context) *PagesGetCall {
1669 c.ctx_ = ctx
1670 return c
1671 }
1672
1673
1674
1675 func (c *PagesGetCall) Header() http.Header {
1676 if c.header_ == nil {
1677 c.header_ = make(http.Header)
1678 }
1679 return c.header_
1680 }
1681
1682 func (c *PagesGetCall) doRequest(alt string) (*http.Response, error) {
1683 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1684 if c.ifNoneMatch_ != "" {
1685 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1686 }
1687 var body io.Reader = nil
1688 c.urlParams_.Set("alt", alt)
1689 c.urlParams_.Set("prettyPrint", "false")
1690 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/blogs/{blogId}/pages/{pageId}")
1691 urls += "?" + c.urlParams_.Encode()
1692 req, err := http.NewRequest("GET", urls, body)
1693 if err != nil {
1694 return nil, err
1695 }
1696 req.Header = reqHeaders
1697 googleapi.Expand(req.URL, map[string]string{
1698 "blogId": c.blogId,
1699 "pageId": c.pageId,
1700 })
1701 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1702 }
1703
1704
1705
1706
1707
1708
1709 func (c *PagesGetCall) Do(opts ...googleapi.CallOption) (*Page, error) {
1710 gensupport.SetOptions(c.urlParams_, opts...)
1711 res, err := c.doRequest("json")
1712 if res != nil && res.StatusCode == http.StatusNotModified {
1713 if res.Body != nil {
1714 res.Body.Close()
1715 }
1716 return nil, gensupport.WrapError(&googleapi.Error{
1717 Code: res.StatusCode,
1718 Header: res.Header,
1719 })
1720 }
1721 if err != nil {
1722 return nil, err
1723 }
1724 defer googleapi.CloseBody(res)
1725 if err := googleapi.CheckResponse(res); err != nil {
1726 return nil, gensupport.WrapError(err)
1727 }
1728 ret := &Page{
1729 ServerResponse: googleapi.ServerResponse{
1730 Header: res.Header,
1731 HTTPStatusCode: res.StatusCode,
1732 },
1733 }
1734 target := &ret
1735 if err := gensupport.DecodeResponse(target, res); err != nil {
1736 return nil, err
1737 }
1738 return ret, nil
1739 }
1740
1741 type PagesListCall struct {
1742 s *Service
1743 blogId string
1744 urlParams_ gensupport.URLParams
1745 ifNoneMatch_ string
1746 ctx_ context.Context
1747 header_ http.Header
1748 }
1749
1750
1751
1752
1753 func (r *PagesService) List(blogId string) *PagesListCall {
1754 c := &PagesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1755 c.blogId = blogId
1756 return c
1757 }
1758
1759
1760 func (c *PagesListCall) FetchBodies(fetchBodies bool) *PagesListCall {
1761 c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
1762 return c
1763 }
1764
1765
1766
1767
1768 func (c *PagesListCall) Fields(s ...googleapi.Field) *PagesListCall {
1769 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1770 return c
1771 }
1772
1773
1774
1775
1776 func (c *PagesListCall) IfNoneMatch(entityTag string) *PagesListCall {
1777 c.ifNoneMatch_ = entityTag
1778 return c
1779 }
1780
1781
1782 func (c *PagesListCall) Context(ctx context.Context) *PagesListCall {
1783 c.ctx_ = ctx
1784 return c
1785 }
1786
1787
1788
1789 func (c *PagesListCall) Header() http.Header {
1790 if c.header_ == nil {
1791 c.header_ = make(http.Header)
1792 }
1793 return c.header_
1794 }
1795
1796 func (c *PagesListCall) doRequest(alt string) (*http.Response, error) {
1797 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1798 if c.ifNoneMatch_ != "" {
1799 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1800 }
1801 var body io.Reader = nil
1802 c.urlParams_.Set("alt", alt)
1803 c.urlParams_.Set("prettyPrint", "false")
1804 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/blogs/{blogId}/pages")
1805 urls += "?" + c.urlParams_.Encode()
1806 req, err := http.NewRequest("GET", urls, body)
1807 if err != nil {
1808 return nil, err
1809 }
1810 req.Header = reqHeaders
1811 googleapi.Expand(req.URL, map[string]string{
1812 "blogId": c.blogId,
1813 })
1814 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1815 }
1816
1817
1818
1819
1820
1821
1822 func (c *PagesListCall) Do(opts ...googleapi.CallOption) (*PageList, error) {
1823 gensupport.SetOptions(c.urlParams_, opts...)
1824 res, err := c.doRequest("json")
1825 if res != nil && res.StatusCode == http.StatusNotModified {
1826 if res.Body != nil {
1827 res.Body.Close()
1828 }
1829 return nil, gensupport.WrapError(&googleapi.Error{
1830 Code: res.StatusCode,
1831 Header: res.Header,
1832 })
1833 }
1834 if err != nil {
1835 return nil, err
1836 }
1837 defer googleapi.CloseBody(res)
1838 if err := googleapi.CheckResponse(res); err != nil {
1839 return nil, gensupport.WrapError(err)
1840 }
1841 ret := &PageList{
1842 ServerResponse: googleapi.ServerResponse{
1843 Header: res.Header,
1844 HTTPStatusCode: res.StatusCode,
1845 },
1846 }
1847 target := &ret
1848 if err := gensupport.DecodeResponse(target, res); err != nil {
1849 return nil, err
1850 }
1851 return ret, nil
1852 }
1853
1854 type PostsGetCall struct {
1855 s *Service
1856 blogId string
1857 postId string
1858 urlParams_ gensupport.URLParams
1859 ifNoneMatch_ string
1860 ctx_ context.Context
1861 header_ http.Header
1862 }
1863
1864
1865
1866
1867
1868 func (r *PostsService) Get(blogId string, postId string) *PostsGetCall {
1869 c := &PostsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1870 c.blogId = blogId
1871 c.postId = postId
1872 return c
1873 }
1874
1875
1876
1877
1878 func (c *PostsGetCall) Fields(s ...googleapi.Field) *PostsGetCall {
1879 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1880 return c
1881 }
1882
1883
1884
1885
1886 func (c *PostsGetCall) IfNoneMatch(entityTag string) *PostsGetCall {
1887 c.ifNoneMatch_ = entityTag
1888 return c
1889 }
1890
1891
1892 func (c *PostsGetCall) Context(ctx context.Context) *PostsGetCall {
1893 c.ctx_ = ctx
1894 return c
1895 }
1896
1897
1898
1899 func (c *PostsGetCall) Header() http.Header {
1900 if c.header_ == nil {
1901 c.header_ = make(http.Header)
1902 }
1903 return c.header_
1904 }
1905
1906 func (c *PostsGetCall) doRequest(alt string) (*http.Response, error) {
1907 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1908 if c.ifNoneMatch_ != "" {
1909 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1910 }
1911 var body io.Reader = nil
1912 c.urlParams_.Set("alt", alt)
1913 c.urlParams_.Set("prettyPrint", "false")
1914 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/blogs/{blogId}/posts/{postId}")
1915 urls += "?" + c.urlParams_.Encode()
1916 req, err := http.NewRequest("GET", urls, body)
1917 if err != nil {
1918 return nil, err
1919 }
1920 req.Header = reqHeaders
1921 googleapi.Expand(req.URL, map[string]string{
1922 "blogId": c.blogId,
1923 "postId": c.postId,
1924 })
1925 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1926 }
1927
1928
1929
1930
1931
1932
1933 func (c *PostsGetCall) Do(opts ...googleapi.CallOption) (*Post, error) {
1934 gensupport.SetOptions(c.urlParams_, opts...)
1935 res, err := c.doRequest("json")
1936 if res != nil && res.StatusCode == http.StatusNotModified {
1937 if res.Body != nil {
1938 res.Body.Close()
1939 }
1940 return nil, gensupport.WrapError(&googleapi.Error{
1941 Code: res.StatusCode,
1942 Header: res.Header,
1943 })
1944 }
1945 if err != nil {
1946 return nil, err
1947 }
1948 defer googleapi.CloseBody(res)
1949 if err := googleapi.CheckResponse(res); err != nil {
1950 return nil, gensupport.WrapError(err)
1951 }
1952 ret := &Post{
1953 ServerResponse: googleapi.ServerResponse{
1954 Header: res.Header,
1955 HTTPStatusCode: res.StatusCode,
1956 },
1957 }
1958 target := &ret
1959 if err := gensupport.DecodeResponse(target, res); err != nil {
1960 return nil, err
1961 }
1962 return ret, nil
1963 }
1964
1965 type PostsListCall struct {
1966 s *Service
1967 blogId string
1968 urlParams_ gensupport.URLParams
1969 ifNoneMatch_ string
1970 ctx_ context.Context
1971 header_ http.Header
1972 }
1973
1974
1975
1976
1977 func (r *PostsService) List(blogId string) *PostsListCall {
1978 c := &PostsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1979 c.blogId = blogId
1980 return c
1981 }
1982
1983
1984 func (c *PostsListCall) FetchBodies(fetchBodies bool) *PostsListCall {
1985 c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
1986 return c
1987 }
1988
1989
1990 func (c *PostsListCall) MaxResults(maxResults int64) *PostsListCall {
1991 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
1992 return c
1993 }
1994
1995
1996 func (c *PostsListCall) PageToken(pageToken string) *PostsListCall {
1997 c.urlParams_.Set("pageToken", pageToken)
1998 return c
1999 }
2000
2001
2002 func (c *PostsListCall) StartDate(startDate string) *PostsListCall {
2003 c.urlParams_.Set("startDate", startDate)
2004 return c
2005 }
2006
2007
2008
2009
2010 func (c *PostsListCall) Fields(s ...googleapi.Field) *PostsListCall {
2011 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2012 return c
2013 }
2014
2015
2016
2017
2018 func (c *PostsListCall) IfNoneMatch(entityTag string) *PostsListCall {
2019 c.ifNoneMatch_ = entityTag
2020 return c
2021 }
2022
2023
2024 func (c *PostsListCall) Context(ctx context.Context) *PostsListCall {
2025 c.ctx_ = ctx
2026 return c
2027 }
2028
2029
2030
2031 func (c *PostsListCall) Header() http.Header {
2032 if c.header_ == nil {
2033 c.header_ = make(http.Header)
2034 }
2035 return c.header_
2036 }
2037
2038 func (c *PostsListCall) doRequest(alt string) (*http.Response, error) {
2039 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2040 if c.ifNoneMatch_ != "" {
2041 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2042 }
2043 var body io.Reader = nil
2044 c.urlParams_.Set("alt", alt)
2045 c.urlParams_.Set("prettyPrint", "false")
2046 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/blogs/{blogId}/posts")
2047 urls += "?" + c.urlParams_.Encode()
2048 req, err := http.NewRequest("GET", urls, body)
2049 if err != nil {
2050 return nil, err
2051 }
2052 req.Header = reqHeaders
2053 googleapi.Expand(req.URL, map[string]string{
2054 "blogId": c.blogId,
2055 })
2056 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2057 }
2058
2059
2060
2061
2062
2063
2064 func (c *PostsListCall) Do(opts ...googleapi.CallOption) (*PostList, error) {
2065 gensupport.SetOptions(c.urlParams_, opts...)
2066 res, err := c.doRequest("json")
2067 if res != nil && res.StatusCode == http.StatusNotModified {
2068 if res.Body != nil {
2069 res.Body.Close()
2070 }
2071 return nil, gensupport.WrapError(&googleapi.Error{
2072 Code: res.StatusCode,
2073 Header: res.Header,
2074 })
2075 }
2076 if err != nil {
2077 return nil, err
2078 }
2079 defer googleapi.CloseBody(res)
2080 if err := googleapi.CheckResponse(res); err != nil {
2081 return nil, gensupport.WrapError(err)
2082 }
2083 ret := &PostList{
2084 ServerResponse: googleapi.ServerResponse{
2085 Header: res.Header,
2086 HTTPStatusCode: res.StatusCode,
2087 },
2088 }
2089 target := &ret
2090 if err := gensupport.DecodeResponse(target, res); err != nil {
2091 return nil, err
2092 }
2093 return ret, nil
2094 }
2095
2096
2097
2098
2099 func (c *PostsListCall) Pages(ctx context.Context, f func(*PostList) error) error {
2100 c.ctx_ = ctx
2101 defer c.PageToken(c.urlParams_.Get("pageToken"))
2102 for {
2103 x, err := c.Do()
2104 if err != nil {
2105 return err
2106 }
2107 if err := f(x); err != nil {
2108 return err
2109 }
2110 if x.NextPageToken == "" {
2111 return nil
2112 }
2113 c.PageToken(x.NextPageToken)
2114 }
2115 }
2116
2117 type UsersGetCall struct {
2118 s *Service
2119 userId string
2120 urlParams_ gensupport.URLParams
2121 ifNoneMatch_ string
2122 ctx_ context.Context
2123 header_ http.Header
2124 }
2125
2126
2127
2128
2129 func (r *UsersService) Get(userId string) *UsersGetCall {
2130 c := &UsersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2131 c.userId = userId
2132 return c
2133 }
2134
2135
2136
2137
2138 func (c *UsersGetCall) Fields(s ...googleapi.Field) *UsersGetCall {
2139 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2140 return c
2141 }
2142
2143
2144
2145
2146 func (c *UsersGetCall) IfNoneMatch(entityTag string) *UsersGetCall {
2147 c.ifNoneMatch_ = entityTag
2148 return c
2149 }
2150
2151
2152 func (c *UsersGetCall) Context(ctx context.Context) *UsersGetCall {
2153 c.ctx_ = ctx
2154 return c
2155 }
2156
2157
2158
2159 func (c *UsersGetCall) Header() http.Header {
2160 if c.header_ == nil {
2161 c.header_ = make(http.Header)
2162 }
2163 return c.header_
2164 }
2165
2166 func (c *UsersGetCall) doRequest(alt string) (*http.Response, error) {
2167 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2168 if c.ifNoneMatch_ != "" {
2169 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2170 }
2171 var body io.Reader = nil
2172 c.urlParams_.Set("alt", alt)
2173 c.urlParams_.Set("prettyPrint", "false")
2174 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/users/{userId}")
2175 urls += "?" + c.urlParams_.Encode()
2176 req, err := http.NewRequest("GET", urls, body)
2177 if err != nil {
2178 return nil, err
2179 }
2180 req.Header = reqHeaders
2181 googleapi.Expand(req.URL, map[string]string{
2182 "userId": c.userId,
2183 })
2184 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2185 }
2186
2187
2188
2189
2190
2191
2192 func (c *UsersGetCall) Do(opts ...googleapi.CallOption) (*User, error) {
2193 gensupport.SetOptions(c.urlParams_, opts...)
2194 res, err := c.doRequest("json")
2195 if res != nil && res.StatusCode == http.StatusNotModified {
2196 if res.Body != nil {
2197 res.Body.Close()
2198 }
2199 return nil, gensupport.WrapError(&googleapi.Error{
2200 Code: res.StatusCode,
2201 Header: res.Header,
2202 })
2203 }
2204 if err != nil {
2205 return nil, err
2206 }
2207 defer googleapi.CloseBody(res)
2208 if err := googleapi.CheckResponse(res); err != nil {
2209 return nil, gensupport.WrapError(err)
2210 }
2211 ret := &User{
2212 ServerResponse: googleapi.ServerResponse{
2213 Header: res.Header,
2214 HTTPStatusCode: res.StatusCode,
2215 },
2216 }
2217 target := &ret
2218 if err := gensupport.DecodeResponse(target, res); err != nil {
2219 return nil, err
2220 }
2221 return ret, nil
2222 }
2223
View as plain text