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 factchecktools
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 = "factchecktools:v1alpha1"
90 const apiName = "factchecktools"
91 const apiVersion = "v1alpha1"
92 const basePath = "https://factchecktools.googleapis.com/"
93 const basePathTemplate = "https://factchecktools.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://factchecktools.mtls.googleapis.com/"
95
96
97 const (
98
99 UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email"
100 )
101
102
103 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
104 scopesOption := internaloption.WithDefaultScopes(
105 "https://www.googleapis.com/auth/userinfo.email",
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.Claims = NewClaimsService(s)
138 s.Pages = NewPagesService(s)
139 return s, nil
140 }
141
142 type Service struct {
143 client *http.Client
144 BasePath string
145 UserAgent string
146
147 Claims *ClaimsService
148
149 Pages *PagesService
150 }
151
152 func (s *Service) userAgent() string {
153 if s.UserAgent == "" {
154 return googleapi.UserAgent
155 }
156 return googleapi.UserAgent + " " + s.UserAgent
157 }
158
159 func NewClaimsService(s *Service) *ClaimsService {
160 rs := &ClaimsService{s: s}
161 return rs
162 }
163
164 type ClaimsService struct {
165 s *Service
166 }
167
168 func NewPagesService(s *Service) *PagesService {
169 rs := &PagesService{s: s}
170 return rs
171 }
172
173 type PagesService struct {
174 s *Service
175 }
176
177
178 type GoogleFactcheckingFactchecktoolsV1alpha1Claim struct {
179
180 ClaimDate string `json:"claimDate,omitempty"`
181
182
183 ClaimReview []*GoogleFactcheckingFactchecktoolsV1alpha1ClaimReview `json:"claimReview,omitempty"`
184
185
186 Claimant string `json:"claimant,omitempty"`
187
188 Text string `json:"text,omitempty"`
189
190
191
192
193
194 ForceSendFields []string `json:"-"`
195
196
197
198
199 NullFields []string `json:"-"`
200 }
201
202 func (s *GoogleFactcheckingFactchecktoolsV1alpha1Claim) MarshalJSON() ([]byte, error) {
203 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1Claim
204 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
205 }
206
207
208
209 type GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor struct {
210
211 ImageUrl string `json:"imageUrl,omitempty"`
212
213 JobTitle string `json:"jobTitle,omitempty"`
214
215
216 Name string `json:"name,omitempty"`
217
218 SameAs string `json:"sameAs,omitempty"`
219
220
221
222
223
224 ForceSendFields []string `json:"-"`
225
226
227
228
229 NullFields []string `json:"-"`
230 }
231
232 func (s *GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor) MarshalJSON() ([]byte, error) {
233 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor
234 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
235 }
236
237
238
239 type GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating struct {
240
241
242 BestRating int64 `json:"bestRating,omitempty"`
243
244 ImageUrl string `json:"imageUrl,omitempty"`
245
246
247 RatingExplanation string `json:"ratingExplanation,omitempty"`
248
249
250 RatingValue int64 `json:"ratingValue,omitempty"`
251
252
253 TextualRating string `json:"textualRating,omitempty"`
254
255
256 WorstRating int64 `json:"worstRating,omitempty"`
257
258
259
260
261
262 ForceSendFields []string `json:"-"`
263
264
265
266
267 NullFields []string `json:"-"`
268 }
269
270 func (s *GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating) MarshalJSON() ([]byte, error) {
271 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating
272 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
273 }
274
275
276
277 type GoogleFactcheckingFactchecktoolsV1alpha1ClaimReview struct {
278
279
280 LanguageCode string `json:"languageCode,omitempty"`
281
282 Publisher *GoogleFactcheckingFactchecktoolsV1alpha1Publisher `json:"publisher,omitempty"`
283
284 ReviewDate string `json:"reviewDate,omitempty"`
285
286 TextualRating string `json:"textualRating,omitempty"`
287
288 Title string `json:"title,omitempty"`
289
290 Url string `json:"url,omitempty"`
291
292
293
294
295
296 ForceSendFields []string `json:"-"`
297
298
299
300
301 NullFields []string `json:"-"`
302 }
303
304 func (s *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReview) MarshalJSON() ([]byte, error) {
305 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1ClaimReview
306 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
307 }
308
309
310
311 type GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewAuthor struct {
312
313 ImageUrl string `json:"imageUrl,omitempty"`
314
315
316 Name string `json:"name,omitempty"`
317
318
319
320
321
322 ForceSendFields []string `json:"-"`
323
324
325
326
327 NullFields []string `json:"-"`
328 }
329
330 func (s *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewAuthor) MarshalJSON() ([]byte, error) {
331 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewAuthor
332 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
333 }
334
335
336
337
338
339 type GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkup struct {
340
341
342
343 ClaimAppearances []string `json:"claimAppearances,omitempty"`
344
345 ClaimAuthor *GoogleFactcheckingFactchecktoolsV1alpha1ClaimAuthor `json:"claimAuthor,omitempty"`
346
347
348 ClaimDate string `json:"claimDate,omitempty"`
349
350
351 ClaimFirstAppearance string `json:"claimFirstAppearance,omitempty"`
352
353
354 ClaimLocation string `json:"claimLocation,omitempty"`
355
356
357 ClaimReviewed string `json:"claimReviewed,omitempty"`
358
359 Rating *GoogleFactcheckingFactchecktoolsV1alpha1ClaimRating `json:"rating,omitempty"`
360
361
362
363
364 Url string `json:"url,omitempty"`
365
366
367
368
369
370 ForceSendFields []string `json:"-"`
371
372
373
374
375 NullFields []string `json:"-"`
376 }
377
378 func (s *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkup) MarshalJSON() ([]byte, error) {
379 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkup
380 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
381 }
382
383
384
385 type GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage struct {
386
387
388
389 ClaimReviewAuthor *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewAuthor `json:"claimReviewAuthor,omitempty"`
390
391
392 ClaimReviewMarkups []*GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkup `json:"claimReviewMarkups,omitempty"`
393
394
395
396 Name string `json:"name,omitempty"`
397
398
399
400
401 PageUrl string `json:"pageUrl,omitempty"`
402
403
404
405 PublishDate string `json:"publishDate,omitempty"`
406
407
408 VersionId string `json:"versionId,omitempty"`
409
410
411 googleapi.ServerResponse `json:"-"`
412
413
414
415
416
417 ForceSendFields []string `json:"-"`
418
419
420
421
422 NullFields []string `json:"-"`
423 }
424
425 func (s *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage) MarshalJSON() ([]byte, error) {
426 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage
427 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
428 }
429
430
431
432 type GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponse struct {
433
434
435
436 NextPageToken string `json:"nextPageToken,omitempty"`
437
438 Results []*GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponseResult `json:"results,omitempty"`
439
440
441 googleapi.ServerResponse `json:"-"`
442
443
444
445
446
447 ForceSendFields []string `json:"-"`
448
449
450
451
452 NullFields []string `json:"-"`
453 }
454
455 func (s *GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponse) MarshalJSON() ([]byte, error) {
456 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponse
457 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
458 }
459
460
461
462 type GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponseResult struct {
463
464 Claim *GoogleFactcheckingFactchecktoolsV1alpha1Claim `json:"claim,omitempty"`
465
466
467
468
469
470 ForceSendFields []string `json:"-"`
471
472
473
474
475 NullFields []string `json:"-"`
476 }
477
478 func (s *GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponseResult) MarshalJSON() ([]byte, error) {
479 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponseResult
480 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
481 }
482
483
484
485 type GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse struct {
486
487 Claims []*GoogleFactcheckingFactchecktoolsV1alpha1Claim `json:"claims,omitempty"`
488
489
490
491 NextPageToken string `json:"nextPageToken,omitempty"`
492
493
494 googleapi.ServerResponse `json:"-"`
495
496
497
498
499
500 ForceSendFields []string `json:"-"`
501
502
503
504
505 NullFields []string `json:"-"`
506 }
507
508 func (s *GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse) MarshalJSON() ([]byte, error) {
509 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse
510 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
511 }
512
513
514
515 type GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse struct {
516
517 ClaimReviewMarkupPages []*GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage `json:"claimReviewMarkupPages,omitempty"`
518
519
520
521 NextPageToken string `json:"nextPageToken,omitempty"`
522
523
524 googleapi.ServerResponse `json:"-"`
525
526
527
528
529
530 ForceSendFields []string `json:"-"`
531
532
533
534
535 NullFields []string `json:"-"`
536 }
537
538 func (s *GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse) MarshalJSON() ([]byte, error) {
539 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse
540 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
541 }
542
543
544
545 type GoogleFactcheckingFactchecktoolsV1alpha1Publisher struct {
546
547 Name string `json:"name,omitempty"`
548
549
550
551 Site string `json:"site,omitempty"`
552
553
554
555
556
557 ForceSendFields []string `json:"-"`
558
559
560
561
562 NullFields []string `json:"-"`
563 }
564
565 func (s *GoogleFactcheckingFactchecktoolsV1alpha1Publisher) MarshalJSON() ([]byte, error) {
566 type NoMethod GoogleFactcheckingFactchecktoolsV1alpha1Publisher
567 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
568 }
569
570
571
572
573
574
575 type GoogleProtobufEmpty struct {
576
577 googleapi.ServerResponse `json:"-"`
578 }
579
580 type ClaimsImageSearchCall struct {
581 s *Service
582 urlParams_ gensupport.URLParams
583 ifNoneMatch_ string
584 ctx_ context.Context
585 header_ http.Header
586 }
587
588
589 func (r *ClaimsService) ImageSearch() *ClaimsImageSearchCall {
590 c := &ClaimsImageSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
591 return c
592 }
593
594
595
596
597
598
599
600
601 func (c *ClaimsImageSearchCall) ImageUri(imageUri string) *ClaimsImageSearchCall {
602 c.urlParams_.Set("imageUri", imageUri)
603 return c
604 }
605
606
607
608
609 func (c *ClaimsImageSearchCall) LanguageCode(languageCode string) *ClaimsImageSearchCall {
610 c.urlParams_.Set("languageCode", languageCode)
611 return c
612 }
613
614
615
616
617
618
619 func (c *ClaimsImageSearchCall) Offset(offset int64) *ClaimsImageSearchCall {
620 c.urlParams_.Set("offset", fmt.Sprint(offset))
621 return c
622 }
623
624
625
626 func (c *ClaimsImageSearchCall) PageSize(pageSize int64) *ClaimsImageSearchCall {
627 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
628 return c
629 }
630
631
632
633
634
635 func (c *ClaimsImageSearchCall) PageToken(pageToken string) *ClaimsImageSearchCall {
636 c.urlParams_.Set("pageToken", pageToken)
637 return c
638 }
639
640
641
642
643 func (c *ClaimsImageSearchCall) Fields(s ...googleapi.Field) *ClaimsImageSearchCall {
644 c.urlParams_.Set("fields", googleapi.CombineFields(s))
645 return c
646 }
647
648
649
650
651 func (c *ClaimsImageSearchCall) IfNoneMatch(entityTag string) *ClaimsImageSearchCall {
652 c.ifNoneMatch_ = entityTag
653 return c
654 }
655
656
657 func (c *ClaimsImageSearchCall) Context(ctx context.Context) *ClaimsImageSearchCall {
658 c.ctx_ = ctx
659 return c
660 }
661
662
663
664 func (c *ClaimsImageSearchCall) Header() http.Header {
665 if c.header_ == nil {
666 c.header_ = make(http.Header)
667 }
668 return c.header_
669 }
670
671 func (c *ClaimsImageSearchCall) doRequest(alt string) (*http.Response, error) {
672 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
673 if c.ifNoneMatch_ != "" {
674 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
675 }
676 var body io.Reader = nil
677 c.urlParams_.Set("alt", alt)
678 c.urlParams_.Set("prettyPrint", "false")
679 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/claims:imageSearch")
680 urls += "?" + c.urlParams_.Encode()
681 req, err := http.NewRequest("GET", urls, body)
682 if err != nil {
683 return nil, err
684 }
685 req.Header = reqHeaders
686 return gensupport.SendRequest(c.ctx_, c.s.client, req)
687 }
688
689
690
691
692
693
694
695 func (c *ClaimsImageSearchCall) Do(opts ...googleapi.CallOption) (*GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponse, error) {
696 gensupport.SetOptions(c.urlParams_, opts...)
697 res, err := c.doRequest("json")
698 if res != nil && res.StatusCode == http.StatusNotModified {
699 if res.Body != nil {
700 res.Body.Close()
701 }
702 return nil, gensupport.WrapError(&googleapi.Error{
703 Code: res.StatusCode,
704 Header: res.Header,
705 })
706 }
707 if err != nil {
708 return nil, err
709 }
710 defer googleapi.CloseBody(res)
711 if err := googleapi.CheckResponse(res); err != nil {
712 return nil, gensupport.WrapError(err)
713 }
714 ret := &GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponse{
715 ServerResponse: googleapi.ServerResponse{
716 Header: res.Header,
717 HTTPStatusCode: res.StatusCode,
718 },
719 }
720 target := &ret
721 if err := gensupport.DecodeResponse(target, res); err != nil {
722 return nil, err
723 }
724 return ret, nil
725 }
726
727
728
729
730 func (c *ClaimsImageSearchCall) Pages(ctx context.Context, f func(*GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimImageSearchResponse) error) error {
731 c.ctx_ = ctx
732 defer c.PageToken(c.urlParams_.Get("pageToken"))
733 for {
734 x, err := c.Do()
735 if err != nil {
736 return err
737 }
738 if err := f(x); err != nil {
739 return err
740 }
741 if x.NextPageToken == "" {
742 return nil
743 }
744 c.PageToken(x.NextPageToken)
745 }
746 }
747
748 type ClaimsSearchCall struct {
749 s *Service
750 urlParams_ gensupport.URLParams
751 ifNoneMatch_ string
752 ctx_ context.Context
753 header_ http.Header
754 }
755
756
757 func (r *ClaimsService) Search() *ClaimsSearchCall {
758 c := &ClaimsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
759 return c
760 }
761
762
763
764
765 func (c *ClaimsSearchCall) LanguageCode(languageCode string) *ClaimsSearchCall {
766 c.urlParams_.Set("languageCode", languageCode)
767 return c
768 }
769
770
771
772
773 func (c *ClaimsSearchCall) MaxAgeDays(maxAgeDays int64) *ClaimsSearchCall {
774 c.urlParams_.Set("maxAgeDays", fmt.Sprint(maxAgeDays))
775 return c
776 }
777
778
779
780
781
782
783 func (c *ClaimsSearchCall) Offset(offset int64) *ClaimsSearchCall {
784 c.urlParams_.Set("offset", fmt.Sprint(offset))
785 return c
786 }
787
788
789
790 func (c *ClaimsSearchCall) PageSize(pageSize int64) *ClaimsSearchCall {
791 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
792 return c
793 }
794
795
796
797
798
799 func (c *ClaimsSearchCall) PageToken(pageToken string) *ClaimsSearchCall {
800 c.urlParams_.Set("pageToken", pageToken)
801 return c
802 }
803
804
805
806 func (c *ClaimsSearchCall) Query(query string) *ClaimsSearchCall {
807 c.urlParams_.Set("query", query)
808 return c
809 }
810
811
812
813
814 func (c *ClaimsSearchCall) ReviewPublisherSiteFilter(reviewPublisherSiteFilter string) *ClaimsSearchCall {
815 c.urlParams_.Set("reviewPublisherSiteFilter", reviewPublisherSiteFilter)
816 return c
817 }
818
819
820
821
822 func (c *ClaimsSearchCall) Fields(s ...googleapi.Field) *ClaimsSearchCall {
823 c.urlParams_.Set("fields", googleapi.CombineFields(s))
824 return c
825 }
826
827
828
829
830 func (c *ClaimsSearchCall) IfNoneMatch(entityTag string) *ClaimsSearchCall {
831 c.ifNoneMatch_ = entityTag
832 return c
833 }
834
835
836 func (c *ClaimsSearchCall) Context(ctx context.Context) *ClaimsSearchCall {
837 c.ctx_ = ctx
838 return c
839 }
840
841
842
843 func (c *ClaimsSearchCall) Header() http.Header {
844 if c.header_ == nil {
845 c.header_ = make(http.Header)
846 }
847 return c.header_
848 }
849
850 func (c *ClaimsSearchCall) doRequest(alt string) (*http.Response, error) {
851 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
852 if c.ifNoneMatch_ != "" {
853 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
854 }
855 var body io.Reader = nil
856 c.urlParams_.Set("alt", alt)
857 c.urlParams_.Set("prettyPrint", "false")
858 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/claims:search")
859 urls += "?" + c.urlParams_.Encode()
860 req, err := http.NewRequest("GET", urls, body)
861 if err != nil {
862 return nil, err
863 }
864 req.Header = reqHeaders
865 return gensupport.SendRequest(c.ctx_, c.s.client, req)
866 }
867
868
869
870
871
872
873
874 func (c *ClaimsSearchCall) Do(opts ...googleapi.CallOption) (*GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse, error) {
875 gensupport.SetOptions(c.urlParams_, opts...)
876 res, err := c.doRequest("json")
877 if res != nil && res.StatusCode == http.StatusNotModified {
878 if res.Body != nil {
879 res.Body.Close()
880 }
881 return nil, gensupport.WrapError(&googleapi.Error{
882 Code: res.StatusCode,
883 Header: res.Header,
884 })
885 }
886 if err != nil {
887 return nil, err
888 }
889 defer googleapi.CloseBody(res)
890 if err := googleapi.CheckResponse(res); err != nil {
891 return nil, gensupport.WrapError(err)
892 }
893 ret := &GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse{
894 ServerResponse: googleapi.ServerResponse{
895 Header: res.Header,
896 HTTPStatusCode: res.StatusCode,
897 },
898 }
899 target := &ret
900 if err := gensupport.DecodeResponse(target, res); err != nil {
901 return nil, err
902 }
903 return ret, nil
904 }
905
906
907
908
909 func (c *ClaimsSearchCall) Pages(ctx context.Context, f func(*GoogleFactcheckingFactchecktoolsV1alpha1FactCheckedClaimSearchResponse) error) error {
910 c.ctx_ = ctx
911 defer c.PageToken(c.urlParams_.Get("pageToken"))
912 for {
913 x, err := c.Do()
914 if err != nil {
915 return err
916 }
917 if err := f(x); err != nil {
918 return err
919 }
920 if x.NextPageToken == "" {
921 return nil
922 }
923 c.PageToken(x.NextPageToken)
924 }
925 }
926
927 type PagesCreateCall struct {
928 s *Service
929 googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage
930 urlParams_ gensupport.URLParams
931 ctx_ context.Context
932 header_ http.Header
933 }
934
935
936 func (r *PagesService) Create(googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage) *PagesCreateCall {
937 c := &PagesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
938 c.googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage = googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage
939 return c
940 }
941
942
943
944
945 func (c *PagesCreateCall) Fields(s ...googleapi.Field) *PagesCreateCall {
946 c.urlParams_.Set("fields", googleapi.CombineFields(s))
947 return c
948 }
949
950
951 func (c *PagesCreateCall) Context(ctx context.Context) *PagesCreateCall {
952 c.ctx_ = ctx
953 return c
954 }
955
956
957
958 func (c *PagesCreateCall) Header() http.Header {
959 if c.header_ == nil {
960 c.header_ = make(http.Header)
961 }
962 return c.header_
963 }
964
965 func (c *PagesCreateCall) doRequest(alt string) (*http.Response, error) {
966 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
967 var body io.Reader = nil
968 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage)
969 if err != nil {
970 return nil, err
971 }
972 c.urlParams_.Set("alt", alt)
973 c.urlParams_.Set("prettyPrint", "false")
974 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/pages")
975 urls += "?" + c.urlParams_.Encode()
976 req, err := http.NewRequest("POST", urls, body)
977 if err != nil {
978 return nil, err
979 }
980 req.Header = reqHeaders
981 return gensupport.SendRequest(c.ctx_, c.s.client, req)
982 }
983
984
985
986
987
988
989
990 func (c *PagesCreateCall) Do(opts ...googleapi.CallOption) (*GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage, error) {
991 gensupport.SetOptions(c.urlParams_, opts...)
992 res, err := c.doRequest("json")
993 if res != nil && res.StatusCode == http.StatusNotModified {
994 if res.Body != nil {
995 res.Body.Close()
996 }
997 return nil, gensupport.WrapError(&googleapi.Error{
998 Code: res.StatusCode,
999 Header: res.Header,
1000 })
1001 }
1002 if err != nil {
1003 return nil, err
1004 }
1005 defer googleapi.CloseBody(res)
1006 if err := googleapi.CheckResponse(res); err != nil {
1007 return nil, gensupport.WrapError(err)
1008 }
1009 ret := &GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage{
1010 ServerResponse: googleapi.ServerResponse{
1011 Header: res.Header,
1012 HTTPStatusCode: res.StatusCode,
1013 },
1014 }
1015 target := &ret
1016 if err := gensupport.DecodeResponse(target, res); err != nil {
1017 return nil, err
1018 }
1019 return ret, nil
1020 }
1021
1022 type PagesDeleteCall struct {
1023 s *Service
1024 name string
1025 urlParams_ gensupport.URLParams
1026 ctx_ context.Context
1027 header_ http.Header
1028 }
1029
1030
1031
1032
1033
1034 func (r *PagesService) Delete(name string) *PagesDeleteCall {
1035 c := &PagesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1036 c.name = name
1037 return c
1038 }
1039
1040
1041
1042
1043 func (c *PagesDeleteCall) Fields(s ...googleapi.Field) *PagesDeleteCall {
1044 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1045 return c
1046 }
1047
1048
1049 func (c *PagesDeleteCall) Context(ctx context.Context) *PagesDeleteCall {
1050 c.ctx_ = ctx
1051 return c
1052 }
1053
1054
1055
1056 func (c *PagesDeleteCall) Header() http.Header {
1057 if c.header_ == nil {
1058 c.header_ = make(http.Header)
1059 }
1060 return c.header_
1061 }
1062
1063 func (c *PagesDeleteCall) doRequest(alt string) (*http.Response, error) {
1064 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1065 var body io.Reader = nil
1066 c.urlParams_.Set("alt", alt)
1067 c.urlParams_.Set("prettyPrint", "false")
1068 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
1069 urls += "?" + c.urlParams_.Encode()
1070 req, err := http.NewRequest("DELETE", urls, body)
1071 if err != nil {
1072 return nil, err
1073 }
1074 req.Header = reqHeaders
1075 googleapi.Expand(req.URL, map[string]string{
1076 "name": c.name,
1077 })
1078 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1079 }
1080
1081
1082
1083
1084
1085
1086
1087 func (c *PagesDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
1088 gensupport.SetOptions(c.urlParams_, opts...)
1089 res, err := c.doRequest("json")
1090 if res != nil && res.StatusCode == http.StatusNotModified {
1091 if res.Body != nil {
1092 res.Body.Close()
1093 }
1094 return nil, gensupport.WrapError(&googleapi.Error{
1095 Code: res.StatusCode,
1096 Header: res.Header,
1097 })
1098 }
1099 if err != nil {
1100 return nil, err
1101 }
1102 defer googleapi.CloseBody(res)
1103 if err := googleapi.CheckResponse(res); err != nil {
1104 return nil, gensupport.WrapError(err)
1105 }
1106 ret := &GoogleProtobufEmpty{
1107 ServerResponse: googleapi.ServerResponse{
1108 Header: res.Header,
1109 HTTPStatusCode: res.StatusCode,
1110 },
1111 }
1112 target := &ret
1113 if err := gensupport.DecodeResponse(target, res); err != nil {
1114 return nil, err
1115 }
1116 return ret, nil
1117 }
1118
1119 type PagesGetCall struct {
1120 s *Service
1121 name string
1122 urlParams_ gensupport.URLParams
1123 ifNoneMatch_ string
1124 ctx_ context.Context
1125 header_ http.Header
1126 }
1127
1128
1129
1130
1131 func (r *PagesService) Get(name string) *PagesGetCall {
1132 c := &PagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1133 c.name = name
1134 return c
1135 }
1136
1137
1138
1139
1140 func (c *PagesGetCall) Fields(s ...googleapi.Field) *PagesGetCall {
1141 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1142 return c
1143 }
1144
1145
1146
1147
1148 func (c *PagesGetCall) IfNoneMatch(entityTag string) *PagesGetCall {
1149 c.ifNoneMatch_ = entityTag
1150 return c
1151 }
1152
1153
1154 func (c *PagesGetCall) Context(ctx context.Context) *PagesGetCall {
1155 c.ctx_ = ctx
1156 return c
1157 }
1158
1159
1160
1161 func (c *PagesGetCall) Header() http.Header {
1162 if c.header_ == nil {
1163 c.header_ = make(http.Header)
1164 }
1165 return c.header_
1166 }
1167
1168 func (c *PagesGetCall) doRequest(alt string) (*http.Response, error) {
1169 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1170 if c.ifNoneMatch_ != "" {
1171 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1172 }
1173 var body io.Reader = nil
1174 c.urlParams_.Set("alt", alt)
1175 c.urlParams_.Set("prettyPrint", "false")
1176 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
1177 urls += "?" + c.urlParams_.Encode()
1178 req, err := http.NewRequest("GET", urls, body)
1179 if err != nil {
1180 return nil, err
1181 }
1182 req.Header = reqHeaders
1183 googleapi.Expand(req.URL, map[string]string{
1184 "name": c.name,
1185 })
1186 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1187 }
1188
1189
1190
1191
1192
1193
1194
1195 func (c *PagesGetCall) Do(opts ...googleapi.CallOption) (*GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage, error) {
1196 gensupport.SetOptions(c.urlParams_, opts...)
1197 res, err := c.doRequest("json")
1198 if res != nil && res.StatusCode == http.StatusNotModified {
1199 if res.Body != nil {
1200 res.Body.Close()
1201 }
1202 return nil, gensupport.WrapError(&googleapi.Error{
1203 Code: res.StatusCode,
1204 Header: res.Header,
1205 })
1206 }
1207 if err != nil {
1208 return nil, err
1209 }
1210 defer googleapi.CloseBody(res)
1211 if err := googleapi.CheckResponse(res); err != nil {
1212 return nil, gensupport.WrapError(err)
1213 }
1214 ret := &GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage{
1215 ServerResponse: googleapi.ServerResponse{
1216 Header: res.Header,
1217 HTTPStatusCode: res.StatusCode,
1218 },
1219 }
1220 target := &ret
1221 if err := gensupport.DecodeResponse(target, res); err != nil {
1222 return nil, err
1223 }
1224 return ret, nil
1225 }
1226
1227 type PagesListCall struct {
1228 s *Service
1229 urlParams_ gensupport.URLParams
1230 ifNoneMatch_ string
1231 ctx_ context.Context
1232 header_ http.Header
1233 }
1234
1235
1236
1237 func (r *PagesService) List() *PagesListCall {
1238 c := &PagesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1239 return c
1240 }
1241
1242
1243
1244
1245
1246
1247 func (c *PagesListCall) Offset(offset int64) *PagesListCall {
1248 c.urlParams_.Set("offset", fmt.Sprint(offset))
1249 return c
1250 }
1251
1252
1253
1254
1255 func (c *PagesListCall) Organization(organization string) *PagesListCall {
1256 c.urlParams_.Set("organization", organization)
1257 return c
1258 }
1259
1260
1261
1262
1263 func (c *PagesListCall) PageSize(pageSize int64) *PagesListCall {
1264 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1265 return c
1266 }
1267
1268
1269
1270
1271
1272 func (c *PagesListCall) PageToken(pageToken string) *PagesListCall {
1273 c.urlParams_.Set("pageToken", pageToken)
1274 return c
1275 }
1276
1277
1278
1279
1280
1281 func (c *PagesListCall) Url(url string) *PagesListCall {
1282 c.urlParams_.Set("url", url)
1283 return c
1284 }
1285
1286
1287
1288
1289 func (c *PagesListCall) Fields(s ...googleapi.Field) *PagesListCall {
1290 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1291 return c
1292 }
1293
1294
1295
1296
1297 func (c *PagesListCall) IfNoneMatch(entityTag string) *PagesListCall {
1298 c.ifNoneMatch_ = entityTag
1299 return c
1300 }
1301
1302
1303 func (c *PagesListCall) Context(ctx context.Context) *PagesListCall {
1304 c.ctx_ = ctx
1305 return c
1306 }
1307
1308
1309
1310 func (c *PagesListCall) Header() http.Header {
1311 if c.header_ == nil {
1312 c.header_ = make(http.Header)
1313 }
1314 return c.header_
1315 }
1316
1317 func (c *PagesListCall) doRequest(alt string) (*http.Response, error) {
1318 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1319 if c.ifNoneMatch_ != "" {
1320 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1321 }
1322 var body io.Reader = nil
1323 c.urlParams_.Set("alt", alt)
1324 c.urlParams_.Set("prettyPrint", "false")
1325 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/pages")
1326 urls += "?" + c.urlParams_.Encode()
1327 req, err := http.NewRequest("GET", urls, body)
1328 if err != nil {
1329 return nil, err
1330 }
1331 req.Header = reqHeaders
1332 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1333 }
1334
1335
1336
1337
1338
1339
1340
1341 func (c *PagesListCall) Do(opts ...googleapi.CallOption) (*GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse, error) {
1342 gensupport.SetOptions(c.urlParams_, opts...)
1343 res, err := c.doRequest("json")
1344 if res != nil && res.StatusCode == http.StatusNotModified {
1345 if res.Body != nil {
1346 res.Body.Close()
1347 }
1348 return nil, gensupport.WrapError(&googleapi.Error{
1349 Code: res.StatusCode,
1350 Header: res.Header,
1351 })
1352 }
1353 if err != nil {
1354 return nil, err
1355 }
1356 defer googleapi.CloseBody(res)
1357 if err := googleapi.CheckResponse(res); err != nil {
1358 return nil, gensupport.WrapError(err)
1359 }
1360 ret := &GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse{
1361 ServerResponse: googleapi.ServerResponse{
1362 Header: res.Header,
1363 HTTPStatusCode: res.StatusCode,
1364 },
1365 }
1366 target := &ret
1367 if err := gensupport.DecodeResponse(target, res); err != nil {
1368 return nil, err
1369 }
1370 return ret, nil
1371 }
1372
1373
1374
1375
1376 func (c *PagesListCall) Pages(ctx context.Context, f func(*GoogleFactcheckingFactchecktoolsV1alpha1ListClaimReviewMarkupPagesResponse) error) error {
1377 c.ctx_ = ctx
1378 defer c.PageToken(c.urlParams_.Get("pageToken"))
1379 for {
1380 x, err := c.Do()
1381 if err != nil {
1382 return err
1383 }
1384 if err := f(x); err != nil {
1385 return err
1386 }
1387 if x.NextPageToken == "" {
1388 return nil
1389 }
1390 c.PageToken(x.NextPageToken)
1391 }
1392 }
1393
1394 type PagesUpdateCall struct {
1395 s *Service
1396 name string
1397 googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage
1398 urlParams_ gensupport.URLParams
1399 ctx_ context.Context
1400 header_ http.Header
1401 }
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411 func (r *PagesService) Update(name string, googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage *GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage) *PagesUpdateCall {
1412 c := &PagesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1413 c.name = name
1414 c.googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage = googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage
1415 return c
1416 }
1417
1418
1419
1420
1421 func (c *PagesUpdateCall) Fields(s ...googleapi.Field) *PagesUpdateCall {
1422 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1423 return c
1424 }
1425
1426
1427 func (c *PagesUpdateCall) Context(ctx context.Context) *PagesUpdateCall {
1428 c.ctx_ = ctx
1429 return c
1430 }
1431
1432
1433
1434 func (c *PagesUpdateCall) Header() http.Header {
1435 if c.header_ == nil {
1436 c.header_ = make(http.Header)
1437 }
1438 return c.header_
1439 }
1440
1441 func (c *PagesUpdateCall) doRequest(alt string) (*http.Response, error) {
1442 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1443 var body io.Reader = nil
1444 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlefactcheckingfactchecktoolsv1alpha1claimreviewmarkuppage)
1445 if err != nil {
1446 return nil, err
1447 }
1448 c.urlParams_.Set("alt", alt)
1449 c.urlParams_.Set("prettyPrint", "false")
1450 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
1451 urls += "?" + c.urlParams_.Encode()
1452 req, err := http.NewRequest("PUT", urls, body)
1453 if err != nil {
1454 return nil, err
1455 }
1456 req.Header = reqHeaders
1457 googleapi.Expand(req.URL, map[string]string{
1458 "name": c.name,
1459 })
1460 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1461 }
1462
1463
1464
1465
1466
1467
1468
1469 func (c *PagesUpdateCall) Do(opts ...googleapi.CallOption) (*GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage, error) {
1470 gensupport.SetOptions(c.urlParams_, opts...)
1471 res, err := c.doRequest("json")
1472 if res != nil && res.StatusCode == http.StatusNotModified {
1473 if res.Body != nil {
1474 res.Body.Close()
1475 }
1476 return nil, gensupport.WrapError(&googleapi.Error{
1477 Code: res.StatusCode,
1478 Header: res.Header,
1479 })
1480 }
1481 if err != nil {
1482 return nil, err
1483 }
1484 defer googleapi.CloseBody(res)
1485 if err := googleapi.CheckResponse(res); err != nil {
1486 return nil, gensupport.WrapError(err)
1487 }
1488 ret := &GoogleFactcheckingFactchecktoolsV1alpha1ClaimReviewMarkupPage{
1489 ServerResponse: googleapi.ServerResponse{
1490 Header: res.Header,
1491 HTTPStatusCode: res.StatusCode,
1492 },
1493 }
1494 target := &ret
1495 if err := gensupport.DecodeResponse(target, res); err != nil {
1496 return nil, err
1497 }
1498 return ret, nil
1499 }
1500
View as plain text