1 package imagesearch
2
3
4
5
6
7
8
9 import (
10 "encoding/json"
11 "github.com/Azure/go-autorest/autorest"
12 )
13
14
15 const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/imagesearch"
16
17
18 type AggregateOffer struct {
19
20 Offers *[]BasicOffer `json:"offers,omitempty"`
21
22 Seller *Organization `json:"seller,omitempty"`
23
24 Price *float64 `json:"price,omitempty"`
25
26 PriceCurrency Currency `json:"priceCurrency,omitempty"`
27
28 Availability ItemAvailability `json:"availability,omitempty"`
29
30 AggregateRating *AggregateRating `json:"aggregateRating,omitempty"`
31
32 LastUpdated *string `json:"lastUpdated,omitempty"`
33
34 Name *string `json:"name,omitempty"`
35
36 URL *string `json:"url,omitempty"`
37
38 Image *ImageObject `json:"image,omitempty"`
39
40 Description *string `json:"description,omitempty"`
41
42 AlternateName *string `json:"alternateName,omitempty"`
43
44 BingID *string `json:"bingId,omitempty"`
45
46 ReadLink *string `json:"readLink,omitempty"`
47
48 WebSearchURL *string `json:"webSearchUrl,omitempty"`
49
50 ID *string `json:"id,omitempty"`
51
52 Type TypeBasicResponseBase `json:"_type,omitempty"`
53 }
54
55
56 func (ao AggregateOffer) MarshalJSON() ([]byte, error) {
57 ao.Type = TypeAggregateOffer
58 objectMap := make(map[string]interface{})
59 if ao.Type != "" {
60 objectMap["_type"] = ao.Type
61 }
62 return json.Marshal(objectMap)
63 }
64
65
66 func (ao AggregateOffer) AsOrganization() (*Organization, bool) {
67 return nil, false
68 }
69
70
71 func (ao AggregateOffer) AsOffer() (*Offer, bool) {
72 return nil, false
73 }
74
75
76 func (ao AggregateOffer) AsBasicOffer() (BasicOffer, bool) {
77 return &ao, true
78 }
79
80
81 func (ao AggregateOffer) AsAggregateOffer() (*AggregateOffer, bool) {
82 return &ao, true
83 }
84
85
86 func (ao AggregateOffer) AsImageObject() (*ImageObject, bool) {
87 return nil, false
88 }
89
90
91 func (ao AggregateOffer) AsImages() (*Images, bool) {
92 return nil, false
93 }
94
95
96 func (ao AggregateOffer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
97 return nil, false
98 }
99
100
101 func (ao AggregateOffer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
102 return nil, false
103 }
104
105
106 func (ao AggregateOffer) AsAnswer() (*Answer, bool) {
107 return nil, false
108 }
109
110
111 func (ao AggregateOffer) AsBasicAnswer() (BasicAnswer, bool) {
112 return nil, false
113 }
114
115
116 func (ao AggregateOffer) AsMediaObject() (*MediaObject, bool) {
117 return nil, false
118 }
119
120
121 func (ao AggregateOffer) AsBasicMediaObject() (BasicMediaObject, bool) {
122 return nil, false
123 }
124
125
126 func (ao AggregateOffer) AsResponse() (*Response, bool) {
127 return nil, false
128 }
129
130
131 func (ao AggregateOffer) AsBasicResponse() (BasicResponse, bool) {
132 return &ao, true
133 }
134
135
136 func (ao AggregateOffer) AsThing() (*Thing, bool) {
137 return nil, false
138 }
139
140
141 func (ao AggregateOffer) AsBasicThing() (BasicThing, bool) {
142 return &ao, true
143 }
144
145
146 func (ao AggregateOffer) AsCreativeWork() (*CreativeWork, bool) {
147 return nil, false
148 }
149
150
151 func (ao AggregateOffer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
152 return nil, false
153 }
154
155
156 func (ao AggregateOffer) AsIdentifiable() (*Identifiable, bool) {
157 return nil, false
158 }
159
160
161 func (ao AggregateOffer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
162 return &ao, true
163 }
164
165
166 func (ao AggregateOffer) AsErrorResponse() (*ErrorResponse, bool) {
167 return nil, false
168 }
169
170
171 func (ao AggregateOffer) AsImageGallery() (*ImageGallery, bool) {
172 return nil, false
173 }
174
175
176 func (ao AggregateOffer) AsRecipe() (*Recipe, bool) {
177 return nil, false
178 }
179
180
181 func (ao AggregateOffer) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
182 return nil, false
183 }
184
185
186 func (ao AggregateOffer) AsRecognizedEntity() (*RecognizedEntity, bool) {
187 return nil, false
188 }
189
190
191 func (ao AggregateOffer) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
192 return nil, false
193 }
194
195
196 func (ao AggregateOffer) AsImageInsights() (*ImageInsights, bool) {
197 return nil, false
198 }
199
200
201 func (ao AggregateOffer) AsTrendingImages() (*TrendingImages, bool) {
202 return nil, false
203 }
204
205
206 func (ao AggregateOffer) AsWebPage() (*WebPage, bool) {
207 return nil, false
208 }
209
210
211 func (ao AggregateOffer) AsBasicWebPage() (BasicWebPage, bool) {
212 return nil, false
213 }
214
215
216 func (ao AggregateOffer) AsPerson() (*Person, bool) {
217 return nil, false
218 }
219
220
221 func (ao AggregateOffer) AsIntangible() (*Intangible, bool) {
222 return nil, false
223 }
224
225
226 func (ao AggregateOffer) AsBasicIntangible() (BasicIntangible, bool) {
227 return nil, false
228 }
229
230
231 func (ao AggregateOffer) AsCollectionPage() (*CollectionPage, bool) {
232 return nil, false
233 }
234
235
236 func (ao AggregateOffer) AsBasicCollectionPage() (BasicCollectionPage, bool) {
237 return nil, false
238 }
239
240
241 func (ao AggregateOffer) AsStructuredValue() (*StructuredValue, bool) {
242 return nil, false
243 }
244
245
246 func (ao AggregateOffer) AsBasicStructuredValue() (BasicStructuredValue, bool) {
247 return nil, false
248 }
249
250
251 func (ao AggregateOffer) AsResponseBase() (*ResponseBase, bool) {
252 return nil, false
253 }
254
255
256 func (ao AggregateOffer) AsBasicResponseBase() (BasicResponseBase, bool) {
257 return &ao, true
258 }
259
260
261 func (ao *AggregateOffer) UnmarshalJSON(body []byte) error {
262 var m map[string]*json.RawMessage
263 err := json.Unmarshal(body, &m)
264 if err != nil {
265 return err
266 }
267 for k, v := range m {
268 switch k {
269 case "offers":
270 if v != nil {
271 offers, err := unmarshalBasicOfferArray(*v)
272 if err != nil {
273 return err
274 }
275 ao.Offers = &offers
276 }
277 case "seller":
278 if v != nil {
279 var seller Organization
280 err = json.Unmarshal(*v, &seller)
281 if err != nil {
282 return err
283 }
284 ao.Seller = &seller
285 }
286 case "price":
287 if v != nil {
288 var price float64
289 err = json.Unmarshal(*v, &price)
290 if err != nil {
291 return err
292 }
293 ao.Price = &price
294 }
295 case "priceCurrency":
296 if v != nil {
297 var priceCurrency Currency
298 err = json.Unmarshal(*v, &priceCurrency)
299 if err != nil {
300 return err
301 }
302 ao.PriceCurrency = priceCurrency
303 }
304 case "availability":
305 if v != nil {
306 var availability ItemAvailability
307 err = json.Unmarshal(*v, &availability)
308 if err != nil {
309 return err
310 }
311 ao.Availability = availability
312 }
313 case "aggregateRating":
314 if v != nil {
315 var aggregateRating AggregateRating
316 err = json.Unmarshal(*v, &aggregateRating)
317 if err != nil {
318 return err
319 }
320 ao.AggregateRating = &aggregateRating
321 }
322 case "lastUpdated":
323 if v != nil {
324 var lastUpdated string
325 err = json.Unmarshal(*v, &lastUpdated)
326 if err != nil {
327 return err
328 }
329 ao.LastUpdated = &lastUpdated
330 }
331 case "name":
332 if v != nil {
333 var name string
334 err = json.Unmarshal(*v, &name)
335 if err != nil {
336 return err
337 }
338 ao.Name = &name
339 }
340 case "url":
341 if v != nil {
342 var URL string
343 err = json.Unmarshal(*v, &URL)
344 if err != nil {
345 return err
346 }
347 ao.URL = &URL
348 }
349 case "image":
350 if v != nil {
351 var imageVar ImageObject
352 err = json.Unmarshal(*v, &imageVar)
353 if err != nil {
354 return err
355 }
356 ao.Image = &imageVar
357 }
358 case "description":
359 if v != nil {
360 var description string
361 err = json.Unmarshal(*v, &description)
362 if err != nil {
363 return err
364 }
365 ao.Description = &description
366 }
367 case "alternateName":
368 if v != nil {
369 var alternateName string
370 err = json.Unmarshal(*v, &alternateName)
371 if err != nil {
372 return err
373 }
374 ao.AlternateName = &alternateName
375 }
376 case "bingId":
377 if v != nil {
378 var bingID string
379 err = json.Unmarshal(*v, &bingID)
380 if err != nil {
381 return err
382 }
383 ao.BingID = &bingID
384 }
385 case "readLink":
386 if v != nil {
387 var readLink string
388 err = json.Unmarshal(*v, &readLink)
389 if err != nil {
390 return err
391 }
392 ao.ReadLink = &readLink
393 }
394 case "webSearchUrl":
395 if v != nil {
396 var webSearchURL string
397 err = json.Unmarshal(*v, &webSearchURL)
398 if err != nil {
399 return err
400 }
401 ao.WebSearchURL = &webSearchURL
402 }
403 case "id":
404 if v != nil {
405 var ID string
406 err = json.Unmarshal(*v, &ID)
407 if err != nil {
408 return err
409 }
410 ao.ID = &ID
411 }
412 case "_type":
413 if v != nil {
414 var typeVar TypeBasicResponseBase
415 err = json.Unmarshal(*v, &typeVar)
416 if err != nil {
417 return err
418 }
419 ao.Type = typeVar
420 }
421 }
422 }
423
424 return nil
425 }
426
427
428 type AggregateRating struct {
429
430 ReviewCount *int32 `json:"reviewCount,omitempty"`
431
432 RatingValue *float64 `json:"ratingValue,omitempty"`
433
434 BestRating *float64 `json:"bestRating,omitempty"`
435
436 Text *string `json:"text,omitempty"`
437
438 Type Type `json:"_type,omitempty"`
439 }
440
441
442 func (ar AggregateRating) MarshalJSON() ([]byte, error) {
443 ar.Type = TypeAggregateRating
444 objectMap := make(map[string]interface{})
445 if ar.RatingValue != nil {
446 objectMap["ratingValue"] = ar.RatingValue
447 }
448 if ar.Type != "" {
449 objectMap["_type"] = ar.Type
450 }
451 return json.Marshal(objectMap)
452 }
453
454
455 func (ar AggregateRating) AsAggregateRating() (*AggregateRating, bool) {
456 return &ar, true
457 }
458
459
460 func (ar AggregateRating) AsRating() (*Rating, bool) {
461 return nil, false
462 }
463
464
465 func (ar AggregateRating) AsBasicRating() (BasicRating, bool) {
466 return &ar, true
467 }
468
469
470 func (ar AggregateRating) AsPropertiesItem() (*PropertiesItem, bool) {
471 return nil, false
472 }
473
474
475 func (ar AggregateRating) AsBasicPropertiesItem() (BasicPropertiesItem, bool) {
476 return &ar, true
477 }
478
479
480 type BasicAnswer interface {
481 AsImages() (*Images, bool)
482 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
483 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
484 AsAnswer() (*Answer, bool)
485 }
486
487
488 type Answer struct {
489
490 ReadLink *string `json:"readLink,omitempty"`
491
492 WebSearchURL *string `json:"webSearchUrl,omitempty"`
493
494 ID *string `json:"id,omitempty"`
495
496 Type TypeBasicResponseBase `json:"_type,omitempty"`
497 }
498
499 func unmarshalBasicAnswer(body []byte) (BasicAnswer, error) {
500 var m map[string]interface{}
501 err := json.Unmarshal(body, &m)
502 if err != nil {
503 return nil, err
504 }
505
506 switch m["_type"] {
507 case string(TypeImages):
508 var i Images
509 err := json.Unmarshal(body, &i)
510 return i, err
511 case string(TypeSearchResultsAnswer):
512 var sra SearchResultsAnswer
513 err := json.Unmarshal(body, &sra)
514 return sra, err
515 default:
516 var a Answer
517 err := json.Unmarshal(body, &a)
518 return a, err
519 }
520 }
521 func unmarshalBasicAnswerArray(body []byte) ([]BasicAnswer, error) {
522 var rawMessages []*json.RawMessage
523 err := json.Unmarshal(body, &rawMessages)
524 if err != nil {
525 return nil, err
526 }
527
528 aArray := make([]BasicAnswer, len(rawMessages))
529
530 for index, rawMessage := range rawMessages {
531 a, err := unmarshalBasicAnswer(*rawMessage)
532 if err != nil {
533 return nil, err
534 }
535 aArray[index] = a
536 }
537 return aArray, nil
538 }
539
540
541 func (a Answer) MarshalJSON() ([]byte, error) {
542 a.Type = TypeAnswer
543 objectMap := make(map[string]interface{})
544 if a.Type != "" {
545 objectMap["_type"] = a.Type
546 }
547 return json.Marshal(objectMap)
548 }
549
550
551 func (a Answer) AsOrganization() (*Organization, bool) {
552 return nil, false
553 }
554
555
556 func (a Answer) AsOffer() (*Offer, bool) {
557 return nil, false
558 }
559
560
561 func (a Answer) AsBasicOffer() (BasicOffer, bool) {
562 return nil, false
563 }
564
565
566 func (a Answer) AsAggregateOffer() (*AggregateOffer, bool) {
567 return nil, false
568 }
569
570
571 func (a Answer) AsImageObject() (*ImageObject, bool) {
572 return nil, false
573 }
574
575
576 func (a Answer) AsImages() (*Images, bool) {
577 return nil, false
578 }
579
580
581 func (a Answer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
582 return nil, false
583 }
584
585
586 func (a Answer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
587 return nil, false
588 }
589
590
591 func (a Answer) AsAnswer() (*Answer, bool) {
592 return &a, true
593 }
594
595
596 func (a Answer) AsBasicAnswer() (BasicAnswer, bool) {
597 return &a, true
598 }
599
600
601 func (a Answer) AsMediaObject() (*MediaObject, bool) {
602 return nil, false
603 }
604
605
606 func (a Answer) AsBasicMediaObject() (BasicMediaObject, bool) {
607 return nil, false
608 }
609
610
611 func (a Answer) AsResponse() (*Response, bool) {
612 return nil, false
613 }
614
615
616 func (a Answer) AsBasicResponse() (BasicResponse, bool) {
617 return &a, true
618 }
619
620
621 func (a Answer) AsThing() (*Thing, bool) {
622 return nil, false
623 }
624
625
626 func (a Answer) AsBasicThing() (BasicThing, bool) {
627 return nil, false
628 }
629
630
631 func (a Answer) AsCreativeWork() (*CreativeWork, bool) {
632 return nil, false
633 }
634
635
636 func (a Answer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
637 return nil, false
638 }
639
640
641 func (a Answer) AsIdentifiable() (*Identifiable, bool) {
642 return nil, false
643 }
644
645
646 func (a Answer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
647 return &a, true
648 }
649
650
651 func (a Answer) AsErrorResponse() (*ErrorResponse, bool) {
652 return nil, false
653 }
654
655
656 func (a Answer) AsImageGallery() (*ImageGallery, bool) {
657 return nil, false
658 }
659
660
661 func (a Answer) AsRecipe() (*Recipe, bool) {
662 return nil, false
663 }
664
665
666 func (a Answer) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
667 return nil, false
668 }
669
670
671 func (a Answer) AsRecognizedEntity() (*RecognizedEntity, bool) {
672 return nil, false
673 }
674
675
676 func (a Answer) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
677 return nil, false
678 }
679
680
681 func (a Answer) AsImageInsights() (*ImageInsights, bool) {
682 return nil, false
683 }
684
685
686 func (a Answer) AsTrendingImages() (*TrendingImages, bool) {
687 return nil, false
688 }
689
690
691 func (a Answer) AsWebPage() (*WebPage, bool) {
692 return nil, false
693 }
694
695
696 func (a Answer) AsBasicWebPage() (BasicWebPage, bool) {
697 return nil, false
698 }
699
700
701 func (a Answer) AsPerson() (*Person, bool) {
702 return nil, false
703 }
704
705
706 func (a Answer) AsIntangible() (*Intangible, bool) {
707 return nil, false
708 }
709
710
711 func (a Answer) AsBasicIntangible() (BasicIntangible, bool) {
712 return nil, false
713 }
714
715
716 func (a Answer) AsCollectionPage() (*CollectionPage, bool) {
717 return nil, false
718 }
719
720
721 func (a Answer) AsBasicCollectionPage() (BasicCollectionPage, bool) {
722 return nil, false
723 }
724
725
726 func (a Answer) AsStructuredValue() (*StructuredValue, bool) {
727 return nil, false
728 }
729
730
731 func (a Answer) AsBasicStructuredValue() (BasicStructuredValue, bool) {
732 return nil, false
733 }
734
735
736 func (a Answer) AsResponseBase() (*ResponseBase, bool) {
737 return nil, false
738 }
739
740
741 func (a Answer) AsBasicResponseBase() (BasicResponseBase, bool) {
742 return &a, true
743 }
744
745
746 type BasicCollectionPage interface {
747 AsImageGallery() (*ImageGallery, bool)
748 AsCollectionPage() (*CollectionPage, bool)
749 }
750
751
752 type CollectionPage struct {
753
754 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
755
756 Provider *[]BasicThing `json:"provider,omitempty"`
757
758 DatePublished *string `json:"datePublished,omitempty"`
759
760 Text *string `json:"text,omitempty"`
761
762 Name *string `json:"name,omitempty"`
763
764 URL *string `json:"url,omitempty"`
765
766 Image *ImageObject `json:"image,omitempty"`
767
768 Description *string `json:"description,omitempty"`
769
770 AlternateName *string `json:"alternateName,omitempty"`
771
772 BingID *string `json:"bingId,omitempty"`
773
774 ReadLink *string `json:"readLink,omitempty"`
775
776 WebSearchURL *string `json:"webSearchUrl,omitempty"`
777
778 ID *string `json:"id,omitempty"`
779
780 Type TypeBasicResponseBase `json:"_type,omitempty"`
781 }
782
783 func unmarshalBasicCollectionPage(body []byte) (BasicCollectionPage, error) {
784 var m map[string]interface{}
785 err := json.Unmarshal(body, &m)
786 if err != nil {
787 return nil, err
788 }
789
790 switch m["_type"] {
791 case string(TypeImageGallery):
792 var ig ImageGallery
793 err := json.Unmarshal(body, &ig)
794 return ig, err
795 default:
796 var cp CollectionPage
797 err := json.Unmarshal(body, &cp)
798 return cp, err
799 }
800 }
801 func unmarshalBasicCollectionPageArray(body []byte) ([]BasicCollectionPage, error) {
802 var rawMessages []*json.RawMessage
803 err := json.Unmarshal(body, &rawMessages)
804 if err != nil {
805 return nil, err
806 }
807
808 cpArray := make([]BasicCollectionPage, len(rawMessages))
809
810 for index, rawMessage := range rawMessages {
811 cp, err := unmarshalBasicCollectionPage(*rawMessage)
812 if err != nil {
813 return nil, err
814 }
815 cpArray[index] = cp
816 }
817 return cpArray, nil
818 }
819
820
821 func (cp CollectionPage) MarshalJSON() ([]byte, error) {
822 cp.Type = TypeCollectionPage
823 objectMap := make(map[string]interface{})
824 if cp.Type != "" {
825 objectMap["_type"] = cp.Type
826 }
827 return json.Marshal(objectMap)
828 }
829
830
831 func (cp CollectionPage) AsOrganization() (*Organization, bool) {
832 return nil, false
833 }
834
835
836 func (cp CollectionPage) AsOffer() (*Offer, bool) {
837 return nil, false
838 }
839
840
841 func (cp CollectionPage) AsBasicOffer() (BasicOffer, bool) {
842 return nil, false
843 }
844
845
846 func (cp CollectionPage) AsAggregateOffer() (*AggregateOffer, bool) {
847 return nil, false
848 }
849
850
851 func (cp CollectionPage) AsImageObject() (*ImageObject, bool) {
852 return nil, false
853 }
854
855
856 func (cp CollectionPage) AsImages() (*Images, bool) {
857 return nil, false
858 }
859
860
861 func (cp CollectionPage) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
862 return nil, false
863 }
864
865
866 func (cp CollectionPage) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
867 return nil, false
868 }
869
870
871 func (cp CollectionPage) AsAnswer() (*Answer, bool) {
872 return nil, false
873 }
874
875
876 func (cp CollectionPage) AsBasicAnswer() (BasicAnswer, bool) {
877 return nil, false
878 }
879
880
881 func (cp CollectionPage) AsMediaObject() (*MediaObject, bool) {
882 return nil, false
883 }
884
885
886 func (cp CollectionPage) AsBasicMediaObject() (BasicMediaObject, bool) {
887 return nil, false
888 }
889
890
891 func (cp CollectionPage) AsResponse() (*Response, bool) {
892 return nil, false
893 }
894
895
896 func (cp CollectionPage) AsBasicResponse() (BasicResponse, bool) {
897 return &cp, true
898 }
899
900
901 func (cp CollectionPage) AsThing() (*Thing, bool) {
902 return nil, false
903 }
904
905
906 func (cp CollectionPage) AsBasicThing() (BasicThing, bool) {
907 return &cp, true
908 }
909
910
911 func (cp CollectionPage) AsCreativeWork() (*CreativeWork, bool) {
912 return nil, false
913 }
914
915
916 func (cp CollectionPage) AsBasicCreativeWork() (BasicCreativeWork, bool) {
917 return &cp, true
918 }
919
920
921 func (cp CollectionPage) AsIdentifiable() (*Identifiable, bool) {
922 return nil, false
923 }
924
925
926 func (cp CollectionPage) AsBasicIdentifiable() (BasicIdentifiable, bool) {
927 return &cp, true
928 }
929
930
931 func (cp CollectionPage) AsErrorResponse() (*ErrorResponse, bool) {
932 return nil, false
933 }
934
935
936 func (cp CollectionPage) AsImageGallery() (*ImageGallery, bool) {
937 return nil, false
938 }
939
940
941 func (cp CollectionPage) AsRecipe() (*Recipe, bool) {
942 return nil, false
943 }
944
945
946 func (cp CollectionPage) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
947 return nil, false
948 }
949
950
951 func (cp CollectionPage) AsRecognizedEntity() (*RecognizedEntity, bool) {
952 return nil, false
953 }
954
955
956 func (cp CollectionPage) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
957 return nil, false
958 }
959
960
961 func (cp CollectionPage) AsImageInsights() (*ImageInsights, bool) {
962 return nil, false
963 }
964
965
966 func (cp CollectionPage) AsTrendingImages() (*TrendingImages, bool) {
967 return nil, false
968 }
969
970
971 func (cp CollectionPage) AsWebPage() (*WebPage, bool) {
972 return nil, false
973 }
974
975
976 func (cp CollectionPage) AsBasicWebPage() (BasicWebPage, bool) {
977 return &cp, true
978 }
979
980
981 func (cp CollectionPage) AsPerson() (*Person, bool) {
982 return nil, false
983 }
984
985
986 func (cp CollectionPage) AsIntangible() (*Intangible, bool) {
987 return nil, false
988 }
989
990
991 func (cp CollectionPage) AsBasicIntangible() (BasicIntangible, bool) {
992 return nil, false
993 }
994
995
996 func (cp CollectionPage) AsCollectionPage() (*CollectionPage, bool) {
997 return &cp, true
998 }
999
1000
1001 func (cp CollectionPage) AsBasicCollectionPage() (BasicCollectionPage, bool) {
1002 return &cp, true
1003 }
1004
1005
1006 func (cp CollectionPage) AsStructuredValue() (*StructuredValue, bool) {
1007 return nil, false
1008 }
1009
1010
1011 func (cp CollectionPage) AsBasicStructuredValue() (BasicStructuredValue, bool) {
1012 return nil, false
1013 }
1014
1015
1016 func (cp CollectionPage) AsResponseBase() (*ResponseBase, bool) {
1017 return nil, false
1018 }
1019
1020
1021 func (cp CollectionPage) AsBasicResponseBase() (BasicResponseBase, bool) {
1022 return &cp, true
1023 }
1024
1025
1026 func (cp *CollectionPage) UnmarshalJSON(body []byte) error {
1027 var m map[string]*json.RawMessage
1028 err := json.Unmarshal(body, &m)
1029 if err != nil {
1030 return err
1031 }
1032 for k, v := range m {
1033 switch k {
1034 case "thumbnailUrl":
1035 if v != nil {
1036 var thumbnailURL string
1037 err = json.Unmarshal(*v, &thumbnailURL)
1038 if err != nil {
1039 return err
1040 }
1041 cp.ThumbnailURL = &thumbnailURL
1042 }
1043 case "provider":
1044 if v != nil {
1045 provider, err := unmarshalBasicThingArray(*v)
1046 if err != nil {
1047 return err
1048 }
1049 cp.Provider = &provider
1050 }
1051 case "datePublished":
1052 if v != nil {
1053 var datePublished string
1054 err = json.Unmarshal(*v, &datePublished)
1055 if err != nil {
1056 return err
1057 }
1058 cp.DatePublished = &datePublished
1059 }
1060 case "text":
1061 if v != nil {
1062 var textVar string
1063 err = json.Unmarshal(*v, &textVar)
1064 if err != nil {
1065 return err
1066 }
1067 cp.Text = &textVar
1068 }
1069 case "name":
1070 if v != nil {
1071 var name string
1072 err = json.Unmarshal(*v, &name)
1073 if err != nil {
1074 return err
1075 }
1076 cp.Name = &name
1077 }
1078 case "url":
1079 if v != nil {
1080 var URL string
1081 err = json.Unmarshal(*v, &URL)
1082 if err != nil {
1083 return err
1084 }
1085 cp.URL = &URL
1086 }
1087 case "image":
1088 if v != nil {
1089 var imageVar ImageObject
1090 err = json.Unmarshal(*v, &imageVar)
1091 if err != nil {
1092 return err
1093 }
1094 cp.Image = &imageVar
1095 }
1096 case "description":
1097 if v != nil {
1098 var description string
1099 err = json.Unmarshal(*v, &description)
1100 if err != nil {
1101 return err
1102 }
1103 cp.Description = &description
1104 }
1105 case "alternateName":
1106 if v != nil {
1107 var alternateName string
1108 err = json.Unmarshal(*v, &alternateName)
1109 if err != nil {
1110 return err
1111 }
1112 cp.AlternateName = &alternateName
1113 }
1114 case "bingId":
1115 if v != nil {
1116 var bingID string
1117 err = json.Unmarshal(*v, &bingID)
1118 if err != nil {
1119 return err
1120 }
1121 cp.BingID = &bingID
1122 }
1123 case "readLink":
1124 if v != nil {
1125 var readLink string
1126 err = json.Unmarshal(*v, &readLink)
1127 if err != nil {
1128 return err
1129 }
1130 cp.ReadLink = &readLink
1131 }
1132 case "webSearchUrl":
1133 if v != nil {
1134 var webSearchURL string
1135 err = json.Unmarshal(*v, &webSearchURL)
1136 if err != nil {
1137 return err
1138 }
1139 cp.WebSearchURL = &webSearchURL
1140 }
1141 case "id":
1142 if v != nil {
1143 var ID string
1144 err = json.Unmarshal(*v, &ID)
1145 if err != nil {
1146 return err
1147 }
1148 cp.ID = &ID
1149 }
1150 case "_type":
1151 if v != nil {
1152 var typeVar TypeBasicResponseBase
1153 err = json.Unmarshal(*v, &typeVar)
1154 if err != nil {
1155 return err
1156 }
1157 cp.Type = typeVar
1158 }
1159 }
1160 }
1161
1162 return nil
1163 }
1164
1165
1166
1167 type BasicCreativeWork interface {
1168 AsImageObject() (*ImageObject, bool)
1169 AsMediaObject() (*MediaObject, bool)
1170 AsBasicMediaObject() (BasicMediaObject, bool)
1171 AsImageGallery() (*ImageGallery, bool)
1172 AsRecipe() (*Recipe, bool)
1173 AsWebPage() (*WebPage, bool)
1174 AsBasicWebPage() (BasicWebPage, bool)
1175 AsCollectionPage() (*CollectionPage, bool)
1176 AsBasicCollectionPage() (BasicCollectionPage, bool)
1177 AsCreativeWork() (*CreativeWork, bool)
1178 }
1179
1180
1181
1182 type CreativeWork struct {
1183
1184 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
1185
1186 Provider *[]BasicThing `json:"provider,omitempty"`
1187
1188 DatePublished *string `json:"datePublished,omitempty"`
1189
1190 Text *string `json:"text,omitempty"`
1191
1192 Name *string `json:"name,omitempty"`
1193
1194 URL *string `json:"url,omitempty"`
1195
1196 Image *ImageObject `json:"image,omitempty"`
1197
1198 Description *string `json:"description,omitempty"`
1199
1200 AlternateName *string `json:"alternateName,omitempty"`
1201
1202 BingID *string `json:"bingId,omitempty"`
1203
1204 ReadLink *string `json:"readLink,omitempty"`
1205
1206 WebSearchURL *string `json:"webSearchUrl,omitempty"`
1207
1208 ID *string `json:"id,omitempty"`
1209
1210 Type TypeBasicResponseBase `json:"_type,omitempty"`
1211 }
1212
1213 func unmarshalBasicCreativeWork(body []byte) (BasicCreativeWork, error) {
1214 var m map[string]interface{}
1215 err := json.Unmarshal(body, &m)
1216 if err != nil {
1217 return nil, err
1218 }
1219
1220 switch m["_type"] {
1221 case string(TypeImageObject):
1222 var ioVar ImageObject
1223 err := json.Unmarshal(body, &ioVar)
1224 return ioVar, err
1225 case string(TypeMediaObject):
1226 var mo MediaObject
1227 err := json.Unmarshal(body, &mo)
1228 return mo, err
1229 case string(TypeImageGallery):
1230 var ig ImageGallery
1231 err := json.Unmarshal(body, &ig)
1232 return ig, err
1233 case string(TypeRecipe):
1234 var r Recipe
1235 err := json.Unmarshal(body, &r)
1236 return r, err
1237 case string(TypeWebPage):
1238 var wp WebPage
1239 err := json.Unmarshal(body, &wp)
1240 return wp, err
1241 case string(TypeCollectionPage):
1242 var cp CollectionPage
1243 err := json.Unmarshal(body, &cp)
1244 return cp, err
1245 default:
1246 var cw CreativeWork
1247 err := json.Unmarshal(body, &cw)
1248 return cw, err
1249 }
1250 }
1251 func unmarshalBasicCreativeWorkArray(body []byte) ([]BasicCreativeWork, error) {
1252 var rawMessages []*json.RawMessage
1253 err := json.Unmarshal(body, &rawMessages)
1254 if err != nil {
1255 return nil, err
1256 }
1257
1258 cwArray := make([]BasicCreativeWork, len(rawMessages))
1259
1260 for index, rawMessage := range rawMessages {
1261 cw, err := unmarshalBasicCreativeWork(*rawMessage)
1262 if err != nil {
1263 return nil, err
1264 }
1265 cwArray[index] = cw
1266 }
1267 return cwArray, nil
1268 }
1269
1270
1271 func (cw CreativeWork) MarshalJSON() ([]byte, error) {
1272 cw.Type = TypeCreativeWork
1273 objectMap := make(map[string]interface{})
1274 if cw.Type != "" {
1275 objectMap["_type"] = cw.Type
1276 }
1277 return json.Marshal(objectMap)
1278 }
1279
1280
1281 func (cw CreativeWork) AsOrganization() (*Organization, bool) {
1282 return nil, false
1283 }
1284
1285
1286 func (cw CreativeWork) AsOffer() (*Offer, bool) {
1287 return nil, false
1288 }
1289
1290
1291 func (cw CreativeWork) AsBasicOffer() (BasicOffer, bool) {
1292 return nil, false
1293 }
1294
1295
1296 func (cw CreativeWork) AsAggregateOffer() (*AggregateOffer, bool) {
1297 return nil, false
1298 }
1299
1300
1301 func (cw CreativeWork) AsImageObject() (*ImageObject, bool) {
1302 return nil, false
1303 }
1304
1305
1306 func (cw CreativeWork) AsImages() (*Images, bool) {
1307 return nil, false
1308 }
1309
1310
1311 func (cw CreativeWork) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
1312 return nil, false
1313 }
1314
1315
1316 func (cw CreativeWork) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
1317 return nil, false
1318 }
1319
1320
1321 func (cw CreativeWork) AsAnswer() (*Answer, bool) {
1322 return nil, false
1323 }
1324
1325
1326 func (cw CreativeWork) AsBasicAnswer() (BasicAnswer, bool) {
1327 return nil, false
1328 }
1329
1330
1331 func (cw CreativeWork) AsMediaObject() (*MediaObject, bool) {
1332 return nil, false
1333 }
1334
1335
1336 func (cw CreativeWork) AsBasicMediaObject() (BasicMediaObject, bool) {
1337 return nil, false
1338 }
1339
1340
1341 func (cw CreativeWork) AsResponse() (*Response, bool) {
1342 return nil, false
1343 }
1344
1345
1346 func (cw CreativeWork) AsBasicResponse() (BasicResponse, bool) {
1347 return &cw, true
1348 }
1349
1350
1351 func (cw CreativeWork) AsThing() (*Thing, bool) {
1352 return nil, false
1353 }
1354
1355
1356 func (cw CreativeWork) AsBasicThing() (BasicThing, bool) {
1357 return &cw, true
1358 }
1359
1360
1361 func (cw CreativeWork) AsCreativeWork() (*CreativeWork, bool) {
1362 return &cw, true
1363 }
1364
1365
1366 func (cw CreativeWork) AsBasicCreativeWork() (BasicCreativeWork, bool) {
1367 return &cw, true
1368 }
1369
1370
1371 func (cw CreativeWork) AsIdentifiable() (*Identifiable, bool) {
1372 return nil, false
1373 }
1374
1375
1376 func (cw CreativeWork) AsBasicIdentifiable() (BasicIdentifiable, bool) {
1377 return &cw, true
1378 }
1379
1380
1381 func (cw CreativeWork) AsErrorResponse() (*ErrorResponse, bool) {
1382 return nil, false
1383 }
1384
1385
1386 func (cw CreativeWork) AsImageGallery() (*ImageGallery, bool) {
1387 return nil, false
1388 }
1389
1390
1391 func (cw CreativeWork) AsRecipe() (*Recipe, bool) {
1392 return nil, false
1393 }
1394
1395
1396 func (cw CreativeWork) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
1397 return nil, false
1398 }
1399
1400
1401 func (cw CreativeWork) AsRecognizedEntity() (*RecognizedEntity, bool) {
1402 return nil, false
1403 }
1404
1405
1406 func (cw CreativeWork) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
1407 return nil, false
1408 }
1409
1410
1411 func (cw CreativeWork) AsImageInsights() (*ImageInsights, bool) {
1412 return nil, false
1413 }
1414
1415
1416 func (cw CreativeWork) AsTrendingImages() (*TrendingImages, bool) {
1417 return nil, false
1418 }
1419
1420
1421 func (cw CreativeWork) AsWebPage() (*WebPage, bool) {
1422 return nil, false
1423 }
1424
1425
1426 func (cw CreativeWork) AsBasicWebPage() (BasicWebPage, bool) {
1427 return nil, false
1428 }
1429
1430
1431 func (cw CreativeWork) AsPerson() (*Person, bool) {
1432 return nil, false
1433 }
1434
1435
1436 func (cw CreativeWork) AsIntangible() (*Intangible, bool) {
1437 return nil, false
1438 }
1439
1440
1441 func (cw CreativeWork) AsBasicIntangible() (BasicIntangible, bool) {
1442 return nil, false
1443 }
1444
1445
1446 func (cw CreativeWork) AsCollectionPage() (*CollectionPage, bool) {
1447 return nil, false
1448 }
1449
1450
1451 func (cw CreativeWork) AsBasicCollectionPage() (BasicCollectionPage, bool) {
1452 return nil, false
1453 }
1454
1455
1456 func (cw CreativeWork) AsStructuredValue() (*StructuredValue, bool) {
1457 return nil, false
1458 }
1459
1460
1461 func (cw CreativeWork) AsBasicStructuredValue() (BasicStructuredValue, bool) {
1462 return nil, false
1463 }
1464
1465
1466 func (cw CreativeWork) AsResponseBase() (*ResponseBase, bool) {
1467 return nil, false
1468 }
1469
1470
1471 func (cw CreativeWork) AsBasicResponseBase() (BasicResponseBase, bool) {
1472 return &cw, true
1473 }
1474
1475
1476 func (cw *CreativeWork) UnmarshalJSON(body []byte) error {
1477 var m map[string]*json.RawMessage
1478 err := json.Unmarshal(body, &m)
1479 if err != nil {
1480 return err
1481 }
1482 for k, v := range m {
1483 switch k {
1484 case "thumbnailUrl":
1485 if v != nil {
1486 var thumbnailURL string
1487 err = json.Unmarshal(*v, &thumbnailURL)
1488 if err != nil {
1489 return err
1490 }
1491 cw.ThumbnailURL = &thumbnailURL
1492 }
1493 case "provider":
1494 if v != nil {
1495 provider, err := unmarshalBasicThingArray(*v)
1496 if err != nil {
1497 return err
1498 }
1499 cw.Provider = &provider
1500 }
1501 case "datePublished":
1502 if v != nil {
1503 var datePublished string
1504 err = json.Unmarshal(*v, &datePublished)
1505 if err != nil {
1506 return err
1507 }
1508 cw.DatePublished = &datePublished
1509 }
1510 case "text":
1511 if v != nil {
1512 var textVar string
1513 err = json.Unmarshal(*v, &textVar)
1514 if err != nil {
1515 return err
1516 }
1517 cw.Text = &textVar
1518 }
1519 case "name":
1520 if v != nil {
1521 var name string
1522 err = json.Unmarshal(*v, &name)
1523 if err != nil {
1524 return err
1525 }
1526 cw.Name = &name
1527 }
1528 case "url":
1529 if v != nil {
1530 var URL string
1531 err = json.Unmarshal(*v, &URL)
1532 if err != nil {
1533 return err
1534 }
1535 cw.URL = &URL
1536 }
1537 case "image":
1538 if v != nil {
1539 var imageVar ImageObject
1540 err = json.Unmarshal(*v, &imageVar)
1541 if err != nil {
1542 return err
1543 }
1544 cw.Image = &imageVar
1545 }
1546 case "description":
1547 if v != nil {
1548 var description string
1549 err = json.Unmarshal(*v, &description)
1550 if err != nil {
1551 return err
1552 }
1553 cw.Description = &description
1554 }
1555 case "alternateName":
1556 if v != nil {
1557 var alternateName string
1558 err = json.Unmarshal(*v, &alternateName)
1559 if err != nil {
1560 return err
1561 }
1562 cw.AlternateName = &alternateName
1563 }
1564 case "bingId":
1565 if v != nil {
1566 var bingID string
1567 err = json.Unmarshal(*v, &bingID)
1568 if err != nil {
1569 return err
1570 }
1571 cw.BingID = &bingID
1572 }
1573 case "readLink":
1574 if v != nil {
1575 var readLink string
1576 err = json.Unmarshal(*v, &readLink)
1577 if err != nil {
1578 return err
1579 }
1580 cw.ReadLink = &readLink
1581 }
1582 case "webSearchUrl":
1583 if v != nil {
1584 var webSearchURL string
1585 err = json.Unmarshal(*v, &webSearchURL)
1586 if err != nil {
1587 return err
1588 }
1589 cw.WebSearchURL = &webSearchURL
1590 }
1591 case "id":
1592 if v != nil {
1593 var ID string
1594 err = json.Unmarshal(*v, &ID)
1595 if err != nil {
1596 return err
1597 }
1598 cw.ID = &ID
1599 }
1600 case "_type":
1601 if v != nil {
1602 var typeVar TypeBasicResponseBase
1603 err = json.Unmarshal(*v, &typeVar)
1604 if err != nil {
1605 return err
1606 }
1607 cw.Type = typeVar
1608 }
1609 }
1610 }
1611
1612 return nil
1613 }
1614
1615
1616 type Error struct {
1617
1618 Code ErrorCode `json:"code,omitempty"`
1619
1620 SubCode ErrorSubCode `json:"subCode,omitempty"`
1621
1622 Message *string `json:"message,omitempty"`
1623
1624 MoreDetails *string `json:"moreDetails,omitempty"`
1625
1626 Parameter *string `json:"parameter,omitempty"`
1627
1628 Value *string `json:"value,omitempty"`
1629 }
1630
1631
1632 func (e Error) MarshalJSON() ([]byte, error) {
1633 objectMap := make(map[string]interface{})
1634 if e.Code != "" {
1635 objectMap["code"] = e.Code
1636 }
1637 if e.Message != nil {
1638 objectMap["message"] = e.Message
1639 }
1640 return json.Marshal(objectMap)
1641 }
1642
1643
1644 type ErrorResponse struct {
1645
1646 Errors *[]Error `json:"errors,omitempty"`
1647
1648 ReadLink *string `json:"readLink,omitempty"`
1649
1650 WebSearchURL *string `json:"webSearchUrl,omitempty"`
1651
1652 ID *string `json:"id,omitempty"`
1653
1654 Type TypeBasicResponseBase `json:"_type,omitempty"`
1655 }
1656
1657
1658 func (er ErrorResponse) MarshalJSON() ([]byte, error) {
1659 er.Type = TypeErrorResponse
1660 objectMap := make(map[string]interface{})
1661 if er.Errors != nil {
1662 objectMap["errors"] = er.Errors
1663 }
1664 if er.Type != "" {
1665 objectMap["_type"] = er.Type
1666 }
1667 return json.Marshal(objectMap)
1668 }
1669
1670
1671 func (er ErrorResponse) AsOrganization() (*Organization, bool) {
1672 return nil, false
1673 }
1674
1675
1676 func (er ErrorResponse) AsOffer() (*Offer, bool) {
1677 return nil, false
1678 }
1679
1680
1681 func (er ErrorResponse) AsBasicOffer() (BasicOffer, bool) {
1682 return nil, false
1683 }
1684
1685
1686 func (er ErrorResponse) AsAggregateOffer() (*AggregateOffer, bool) {
1687 return nil, false
1688 }
1689
1690
1691 func (er ErrorResponse) AsImageObject() (*ImageObject, bool) {
1692 return nil, false
1693 }
1694
1695
1696 func (er ErrorResponse) AsImages() (*Images, bool) {
1697 return nil, false
1698 }
1699
1700
1701 func (er ErrorResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
1702 return nil, false
1703 }
1704
1705
1706 func (er ErrorResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
1707 return nil, false
1708 }
1709
1710
1711 func (er ErrorResponse) AsAnswer() (*Answer, bool) {
1712 return nil, false
1713 }
1714
1715
1716 func (er ErrorResponse) AsBasicAnswer() (BasicAnswer, bool) {
1717 return nil, false
1718 }
1719
1720
1721 func (er ErrorResponse) AsMediaObject() (*MediaObject, bool) {
1722 return nil, false
1723 }
1724
1725
1726 func (er ErrorResponse) AsBasicMediaObject() (BasicMediaObject, bool) {
1727 return nil, false
1728 }
1729
1730
1731 func (er ErrorResponse) AsResponse() (*Response, bool) {
1732 return nil, false
1733 }
1734
1735
1736 func (er ErrorResponse) AsBasicResponse() (BasicResponse, bool) {
1737 return &er, true
1738 }
1739
1740
1741 func (er ErrorResponse) AsThing() (*Thing, bool) {
1742 return nil, false
1743 }
1744
1745
1746 func (er ErrorResponse) AsBasicThing() (BasicThing, bool) {
1747 return nil, false
1748 }
1749
1750
1751 func (er ErrorResponse) AsCreativeWork() (*CreativeWork, bool) {
1752 return nil, false
1753 }
1754
1755
1756 func (er ErrorResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) {
1757 return nil, false
1758 }
1759
1760
1761 func (er ErrorResponse) AsIdentifiable() (*Identifiable, bool) {
1762 return nil, false
1763 }
1764
1765
1766 func (er ErrorResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) {
1767 return &er, true
1768 }
1769
1770
1771 func (er ErrorResponse) AsErrorResponse() (*ErrorResponse, bool) {
1772 return &er, true
1773 }
1774
1775
1776 func (er ErrorResponse) AsImageGallery() (*ImageGallery, bool) {
1777 return nil, false
1778 }
1779
1780
1781 func (er ErrorResponse) AsRecipe() (*Recipe, bool) {
1782 return nil, false
1783 }
1784
1785
1786 func (er ErrorResponse) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
1787 return nil, false
1788 }
1789
1790
1791 func (er ErrorResponse) AsRecognizedEntity() (*RecognizedEntity, bool) {
1792 return nil, false
1793 }
1794
1795
1796 func (er ErrorResponse) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
1797 return nil, false
1798 }
1799
1800
1801 func (er ErrorResponse) AsImageInsights() (*ImageInsights, bool) {
1802 return nil, false
1803 }
1804
1805
1806 func (er ErrorResponse) AsTrendingImages() (*TrendingImages, bool) {
1807 return nil, false
1808 }
1809
1810
1811 func (er ErrorResponse) AsWebPage() (*WebPage, bool) {
1812 return nil, false
1813 }
1814
1815
1816 func (er ErrorResponse) AsBasicWebPage() (BasicWebPage, bool) {
1817 return nil, false
1818 }
1819
1820
1821 func (er ErrorResponse) AsPerson() (*Person, bool) {
1822 return nil, false
1823 }
1824
1825
1826 func (er ErrorResponse) AsIntangible() (*Intangible, bool) {
1827 return nil, false
1828 }
1829
1830
1831 func (er ErrorResponse) AsBasicIntangible() (BasicIntangible, bool) {
1832 return nil, false
1833 }
1834
1835
1836 func (er ErrorResponse) AsCollectionPage() (*CollectionPage, bool) {
1837 return nil, false
1838 }
1839
1840
1841 func (er ErrorResponse) AsBasicCollectionPage() (BasicCollectionPage, bool) {
1842 return nil, false
1843 }
1844
1845
1846 func (er ErrorResponse) AsStructuredValue() (*StructuredValue, bool) {
1847 return nil, false
1848 }
1849
1850
1851 func (er ErrorResponse) AsBasicStructuredValue() (BasicStructuredValue, bool) {
1852 return nil, false
1853 }
1854
1855
1856 func (er ErrorResponse) AsResponseBase() (*ResponseBase, bool) {
1857 return nil, false
1858 }
1859
1860
1861 func (er ErrorResponse) AsBasicResponseBase() (BasicResponseBase, bool) {
1862 return &er, true
1863 }
1864
1865
1866 type BasicIdentifiable interface {
1867 AsOrganization() (*Organization, bool)
1868 AsOffer() (*Offer, bool)
1869 AsBasicOffer() (BasicOffer, bool)
1870 AsAggregateOffer() (*AggregateOffer, bool)
1871 AsImageObject() (*ImageObject, bool)
1872 AsImages() (*Images, bool)
1873 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
1874 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
1875 AsAnswer() (*Answer, bool)
1876 AsBasicAnswer() (BasicAnswer, bool)
1877 AsMediaObject() (*MediaObject, bool)
1878 AsBasicMediaObject() (BasicMediaObject, bool)
1879 AsResponse() (*Response, bool)
1880 AsBasicResponse() (BasicResponse, bool)
1881 AsThing() (*Thing, bool)
1882 AsBasicThing() (BasicThing, bool)
1883 AsCreativeWork() (*CreativeWork, bool)
1884 AsBasicCreativeWork() (BasicCreativeWork, bool)
1885 AsErrorResponse() (*ErrorResponse, bool)
1886 AsImageGallery() (*ImageGallery, bool)
1887 AsRecipe() (*Recipe, bool)
1888 AsNormalizedRectangle() (*NormalizedRectangle, bool)
1889 AsRecognizedEntity() (*RecognizedEntity, bool)
1890 AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool)
1891 AsImageInsights() (*ImageInsights, bool)
1892 AsTrendingImages() (*TrendingImages, bool)
1893 AsWebPage() (*WebPage, bool)
1894 AsBasicWebPage() (BasicWebPage, bool)
1895 AsPerson() (*Person, bool)
1896 AsIntangible() (*Intangible, bool)
1897 AsBasicIntangible() (BasicIntangible, bool)
1898 AsCollectionPage() (*CollectionPage, bool)
1899 AsBasicCollectionPage() (BasicCollectionPage, bool)
1900 AsStructuredValue() (*StructuredValue, bool)
1901 AsBasicStructuredValue() (BasicStructuredValue, bool)
1902 AsIdentifiable() (*Identifiable, bool)
1903 }
1904
1905
1906 type Identifiable struct {
1907
1908 ID *string `json:"id,omitempty"`
1909
1910 Type TypeBasicResponseBase `json:"_type,omitempty"`
1911 }
1912
1913 func unmarshalBasicIdentifiable(body []byte) (BasicIdentifiable, error) {
1914 var m map[string]interface{}
1915 err := json.Unmarshal(body, &m)
1916 if err != nil {
1917 return nil, err
1918 }
1919
1920 switch m["_type"] {
1921 case string(TypeOrganization):
1922 var o Organization
1923 err := json.Unmarshal(body, &o)
1924 return o, err
1925 case string(TypeOffer):
1926 var o Offer
1927 err := json.Unmarshal(body, &o)
1928 return o, err
1929 case string(TypeAggregateOffer):
1930 var ao AggregateOffer
1931 err := json.Unmarshal(body, &ao)
1932 return ao, err
1933 case string(TypeImageObject):
1934 var ioVar ImageObject
1935 err := json.Unmarshal(body, &ioVar)
1936 return ioVar, err
1937 case string(TypeImages):
1938 var i Images
1939 err := json.Unmarshal(body, &i)
1940 return i, err
1941 case string(TypeSearchResultsAnswer):
1942 var sra SearchResultsAnswer
1943 err := json.Unmarshal(body, &sra)
1944 return sra, err
1945 case string(TypeAnswer):
1946 var a Answer
1947 err := json.Unmarshal(body, &a)
1948 return a, err
1949 case string(TypeMediaObject):
1950 var mo MediaObject
1951 err := json.Unmarshal(body, &mo)
1952 return mo, err
1953 case string(TypeResponse):
1954 var r Response
1955 err := json.Unmarshal(body, &r)
1956 return r, err
1957 case string(TypeThing):
1958 var t Thing
1959 err := json.Unmarshal(body, &t)
1960 return t, err
1961 case string(TypeCreativeWork):
1962 var cw CreativeWork
1963 err := json.Unmarshal(body, &cw)
1964 return cw, err
1965 case string(TypeErrorResponse):
1966 var er ErrorResponse
1967 err := json.Unmarshal(body, &er)
1968 return er, err
1969 case string(TypeImageGallery):
1970 var ig ImageGallery
1971 err := json.Unmarshal(body, &ig)
1972 return ig, err
1973 case string(TypeRecipe):
1974 var r Recipe
1975 err := json.Unmarshal(body, &r)
1976 return r, err
1977 case string(TypeNormalizedRectangle):
1978 var nr NormalizedRectangle
1979 err := json.Unmarshal(body, &nr)
1980 return nr, err
1981 case string(TypeRecognizedEntity):
1982 var re RecognizedEntity
1983 err := json.Unmarshal(body, &re)
1984 return re, err
1985 case string(TypeRecognizedEntityRegion):
1986 var rer RecognizedEntityRegion
1987 err := json.Unmarshal(body, &rer)
1988 return rer, err
1989 case string(TypeImageInsights):
1990 var ii ImageInsights
1991 err := json.Unmarshal(body, &ii)
1992 return ii, err
1993 case string(TypeTrendingImages):
1994 var ti TrendingImages
1995 err := json.Unmarshal(body, &ti)
1996 return ti, err
1997 case string(TypeWebPage):
1998 var wp WebPage
1999 err := json.Unmarshal(body, &wp)
2000 return wp, err
2001 case string(TypePerson):
2002 var p Person
2003 err := json.Unmarshal(body, &p)
2004 return p, err
2005 case string(TypeIntangible):
2006 var i Intangible
2007 err := json.Unmarshal(body, &i)
2008 return i, err
2009 case string(TypeCollectionPage):
2010 var cp CollectionPage
2011 err := json.Unmarshal(body, &cp)
2012 return cp, err
2013 case string(TypeStructuredValue):
2014 var sv StructuredValue
2015 err := json.Unmarshal(body, &sv)
2016 return sv, err
2017 default:
2018 var i Identifiable
2019 err := json.Unmarshal(body, &i)
2020 return i, err
2021 }
2022 }
2023 func unmarshalBasicIdentifiableArray(body []byte) ([]BasicIdentifiable, error) {
2024 var rawMessages []*json.RawMessage
2025 err := json.Unmarshal(body, &rawMessages)
2026 if err != nil {
2027 return nil, err
2028 }
2029
2030 iArray := make([]BasicIdentifiable, len(rawMessages))
2031
2032 for index, rawMessage := range rawMessages {
2033 i, err := unmarshalBasicIdentifiable(*rawMessage)
2034 if err != nil {
2035 return nil, err
2036 }
2037 iArray[index] = i
2038 }
2039 return iArray, nil
2040 }
2041
2042
2043 func (i Identifiable) MarshalJSON() ([]byte, error) {
2044 i.Type = TypeIdentifiable
2045 objectMap := make(map[string]interface{})
2046 if i.Type != "" {
2047 objectMap["_type"] = i.Type
2048 }
2049 return json.Marshal(objectMap)
2050 }
2051
2052
2053 func (i Identifiable) AsOrganization() (*Organization, bool) {
2054 return nil, false
2055 }
2056
2057
2058 func (i Identifiable) AsOffer() (*Offer, bool) {
2059 return nil, false
2060 }
2061
2062
2063 func (i Identifiable) AsBasicOffer() (BasicOffer, bool) {
2064 return nil, false
2065 }
2066
2067
2068 func (i Identifiable) AsAggregateOffer() (*AggregateOffer, bool) {
2069 return nil, false
2070 }
2071
2072
2073 func (i Identifiable) AsImageObject() (*ImageObject, bool) {
2074 return nil, false
2075 }
2076
2077
2078 func (i Identifiable) AsImages() (*Images, bool) {
2079 return nil, false
2080 }
2081
2082
2083 func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
2084 return nil, false
2085 }
2086
2087
2088 func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
2089 return nil, false
2090 }
2091
2092
2093 func (i Identifiable) AsAnswer() (*Answer, bool) {
2094 return nil, false
2095 }
2096
2097
2098 func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) {
2099 return nil, false
2100 }
2101
2102
2103 func (i Identifiable) AsMediaObject() (*MediaObject, bool) {
2104 return nil, false
2105 }
2106
2107
2108 func (i Identifiable) AsBasicMediaObject() (BasicMediaObject, bool) {
2109 return nil, false
2110 }
2111
2112
2113 func (i Identifiable) AsResponse() (*Response, bool) {
2114 return nil, false
2115 }
2116
2117
2118 func (i Identifiable) AsBasicResponse() (BasicResponse, bool) {
2119 return nil, false
2120 }
2121
2122
2123 func (i Identifiable) AsThing() (*Thing, bool) {
2124 return nil, false
2125 }
2126
2127
2128 func (i Identifiable) AsBasicThing() (BasicThing, bool) {
2129 return nil, false
2130 }
2131
2132
2133 func (i Identifiable) AsCreativeWork() (*CreativeWork, bool) {
2134 return nil, false
2135 }
2136
2137
2138 func (i Identifiable) AsBasicCreativeWork() (BasicCreativeWork, bool) {
2139 return nil, false
2140 }
2141
2142
2143 func (i Identifiable) AsIdentifiable() (*Identifiable, bool) {
2144 return &i, true
2145 }
2146
2147
2148 func (i Identifiable) AsBasicIdentifiable() (BasicIdentifiable, bool) {
2149 return &i, true
2150 }
2151
2152
2153 func (i Identifiable) AsErrorResponse() (*ErrorResponse, bool) {
2154 return nil, false
2155 }
2156
2157
2158 func (i Identifiable) AsImageGallery() (*ImageGallery, bool) {
2159 return nil, false
2160 }
2161
2162
2163 func (i Identifiable) AsRecipe() (*Recipe, bool) {
2164 return nil, false
2165 }
2166
2167
2168 func (i Identifiable) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
2169 return nil, false
2170 }
2171
2172
2173 func (i Identifiable) AsRecognizedEntity() (*RecognizedEntity, bool) {
2174 return nil, false
2175 }
2176
2177
2178 func (i Identifiable) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
2179 return nil, false
2180 }
2181
2182
2183 func (i Identifiable) AsImageInsights() (*ImageInsights, bool) {
2184 return nil, false
2185 }
2186
2187
2188 func (i Identifiable) AsTrendingImages() (*TrendingImages, bool) {
2189 return nil, false
2190 }
2191
2192
2193 func (i Identifiable) AsWebPage() (*WebPage, bool) {
2194 return nil, false
2195 }
2196
2197
2198 func (i Identifiable) AsBasicWebPage() (BasicWebPage, bool) {
2199 return nil, false
2200 }
2201
2202
2203 func (i Identifiable) AsPerson() (*Person, bool) {
2204 return nil, false
2205 }
2206
2207
2208 func (i Identifiable) AsIntangible() (*Intangible, bool) {
2209 return nil, false
2210 }
2211
2212
2213 func (i Identifiable) AsBasicIntangible() (BasicIntangible, bool) {
2214 return nil, false
2215 }
2216
2217
2218 func (i Identifiable) AsCollectionPage() (*CollectionPage, bool) {
2219 return nil, false
2220 }
2221
2222
2223 func (i Identifiable) AsBasicCollectionPage() (BasicCollectionPage, bool) {
2224 return nil, false
2225 }
2226
2227
2228 func (i Identifiable) AsStructuredValue() (*StructuredValue, bool) {
2229 return nil, false
2230 }
2231
2232
2233 func (i Identifiable) AsBasicStructuredValue() (BasicStructuredValue, bool) {
2234 return nil, false
2235 }
2236
2237
2238 func (i Identifiable) AsResponseBase() (*ResponseBase, bool) {
2239 return nil, false
2240 }
2241
2242
2243 func (i Identifiable) AsBasicResponseBase() (BasicResponseBase, bool) {
2244 return &i, true
2245 }
2246
2247
2248 type ImageGallery struct {
2249
2250 Source *string `json:"source,omitempty"`
2251
2252 ImagesCount *int64 `json:"imagesCount,omitempty"`
2253
2254 FollowersCount *int64 `json:"followersCount,omitempty"`
2255
2256 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
2257
2258 Provider *[]BasicThing `json:"provider,omitempty"`
2259
2260 DatePublished *string `json:"datePublished,omitempty"`
2261
2262 Text *string `json:"text,omitempty"`
2263
2264 Name *string `json:"name,omitempty"`
2265
2266 URL *string `json:"url,omitempty"`
2267
2268 Image *ImageObject `json:"image,omitempty"`
2269
2270 Description *string `json:"description,omitempty"`
2271
2272 AlternateName *string `json:"alternateName,omitempty"`
2273
2274 BingID *string `json:"bingId,omitempty"`
2275
2276 ReadLink *string `json:"readLink,omitempty"`
2277
2278 WebSearchURL *string `json:"webSearchUrl,omitempty"`
2279
2280 ID *string `json:"id,omitempty"`
2281
2282 Type TypeBasicResponseBase `json:"_type,omitempty"`
2283 }
2284
2285
2286 func (ig ImageGallery) MarshalJSON() ([]byte, error) {
2287 ig.Type = TypeImageGallery
2288 objectMap := make(map[string]interface{})
2289 if ig.Type != "" {
2290 objectMap["_type"] = ig.Type
2291 }
2292 return json.Marshal(objectMap)
2293 }
2294
2295
2296 func (ig ImageGallery) AsOrganization() (*Organization, bool) {
2297 return nil, false
2298 }
2299
2300
2301 func (ig ImageGallery) AsOffer() (*Offer, bool) {
2302 return nil, false
2303 }
2304
2305
2306 func (ig ImageGallery) AsBasicOffer() (BasicOffer, bool) {
2307 return nil, false
2308 }
2309
2310
2311 func (ig ImageGallery) AsAggregateOffer() (*AggregateOffer, bool) {
2312 return nil, false
2313 }
2314
2315
2316 func (ig ImageGallery) AsImageObject() (*ImageObject, bool) {
2317 return nil, false
2318 }
2319
2320
2321 func (ig ImageGallery) AsImages() (*Images, bool) {
2322 return nil, false
2323 }
2324
2325
2326 func (ig ImageGallery) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
2327 return nil, false
2328 }
2329
2330
2331 func (ig ImageGallery) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
2332 return nil, false
2333 }
2334
2335
2336 func (ig ImageGallery) AsAnswer() (*Answer, bool) {
2337 return nil, false
2338 }
2339
2340
2341 func (ig ImageGallery) AsBasicAnswer() (BasicAnswer, bool) {
2342 return nil, false
2343 }
2344
2345
2346 func (ig ImageGallery) AsMediaObject() (*MediaObject, bool) {
2347 return nil, false
2348 }
2349
2350
2351 func (ig ImageGallery) AsBasicMediaObject() (BasicMediaObject, bool) {
2352 return nil, false
2353 }
2354
2355
2356 func (ig ImageGallery) AsResponse() (*Response, bool) {
2357 return nil, false
2358 }
2359
2360
2361 func (ig ImageGallery) AsBasicResponse() (BasicResponse, bool) {
2362 return &ig, true
2363 }
2364
2365
2366 func (ig ImageGallery) AsThing() (*Thing, bool) {
2367 return nil, false
2368 }
2369
2370
2371 func (ig ImageGallery) AsBasicThing() (BasicThing, bool) {
2372 return &ig, true
2373 }
2374
2375
2376 func (ig ImageGallery) AsCreativeWork() (*CreativeWork, bool) {
2377 return nil, false
2378 }
2379
2380
2381 func (ig ImageGallery) AsBasicCreativeWork() (BasicCreativeWork, bool) {
2382 return &ig, true
2383 }
2384
2385
2386 func (ig ImageGallery) AsIdentifiable() (*Identifiable, bool) {
2387 return nil, false
2388 }
2389
2390
2391 func (ig ImageGallery) AsBasicIdentifiable() (BasicIdentifiable, bool) {
2392 return &ig, true
2393 }
2394
2395
2396 func (ig ImageGallery) AsErrorResponse() (*ErrorResponse, bool) {
2397 return nil, false
2398 }
2399
2400
2401 func (ig ImageGallery) AsImageGallery() (*ImageGallery, bool) {
2402 return &ig, true
2403 }
2404
2405
2406 func (ig ImageGallery) AsRecipe() (*Recipe, bool) {
2407 return nil, false
2408 }
2409
2410
2411 func (ig ImageGallery) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
2412 return nil, false
2413 }
2414
2415
2416 func (ig ImageGallery) AsRecognizedEntity() (*RecognizedEntity, bool) {
2417 return nil, false
2418 }
2419
2420
2421 func (ig ImageGallery) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
2422 return nil, false
2423 }
2424
2425
2426 func (ig ImageGallery) AsImageInsights() (*ImageInsights, bool) {
2427 return nil, false
2428 }
2429
2430
2431 func (ig ImageGallery) AsTrendingImages() (*TrendingImages, bool) {
2432 return nil, false
2433 }
2434
2435
2436 func (ig ImageGallery) AsWebPage() (*WebPage, bool) {
2437 return nil, false
2438 }
2439
2440
2441 func (ig ImageGallery) AsBasicWebPage() (BasicWebPage, bool) {
2442 return &ig, true
2443 }
2444
2445
2446 func (ig ImageGallery) AsPerson() (*Person, bool) {
2447 return nil, false
2448 }
2449
2450
2451 func (ig ImageGallery) AsIntangible() (*Intangible, bool) {
2452 return nil, false
2453 }
2454
2455
2456 func (ig ImageGallery) AsBasicIntangible() (BasicIntangible, bool) {
2457 return nil, false
2458 }
2459
2460
2461 func (ig ImageGallery) AsCollectionPage() (*CollectionPage, bool) {
2462 return nil, false
2463 }
2464
2465
2466 func (ig ImageGallery) AsBasicCollectionPage() (BasicCollectionPage, bool) {
2467 return &ig, true
2468 }
2469
2470
2471 func (ig ImageGallery) AsStructuredValue() (*StructuredValue, bool) {
2472 return nil, false
2473 }
2474
2475
2476 func (ig ImageGallery) AsBasicStructuredValue() (BasicStructuredValue, bool) {
2477 return nil, false
2478 }
2479
2480
2481 func (ig ImageGallery) AsResponseBase() (*ResponseBase, bool) {
2482 return nil, false
2483 }
2484
2485
2486 func (ig ImageGallery) AsBasicResponseBase() (BasicResponseBase, bool) {
2487 return &ig, true
2488 }
2489
2490
2491 func (ig *ImageGallery) UnmarshalJSON(body []byte) error {
2492 var m map[string]*json.RawMessage
2493 err := json.Unmarshal(body, &m)
2494 if err != nil {
2495 return err
2496 }
2497 for k, v := range m {
2498 switch k {
2499 case "source":
2500 if v != nil {
2501 var source string
2502 err = json.Unmarshal(*v, &source)
2503 if err != nil {
2504 return err
2505 }
2506 ig.Source = &source
2507 }
2508 case "imagesCount":
2509 if v != nil {
2510 var imagesCount int64
2511 err = json.Unmarshal(*v, &imagesCount)
2512 if err != nil {
2513 return err
2514 }
2515 ig.ImagesCount = &imagesCount
2516 }
2517 case "followersCount":
2518 if v != nil {
2519 var followersCount int64
2520 err = json.Unmarshal(*v, &followersCount)
2521 if err != nil {
2522 return err
2523 }
2524 ig.FollowersCount = &followersCount
2525 }
2526 case "thumbnailUrl":
2527 if v != nil {
2528 var thumbnailURL string
2529 err = json.Unmarshal(*v, &thumbnailURL)
2530 if err != nil {
2531 return err
2532 }
2533 ig.ThumbnailURL = &thumbnailURL
2534 }
2535 case "provider":
2536 if v != nil {
2537 provider, err := unmarshalBasicThingArray(*v)
2538 if err != nil {
2539 return err
2540 }
2541 ig.Provider = &provider
2542 }
2543 case "datePublished":
2544 if v != nil {
2545 var datePublished string
2546 err = json.Unmarshal(*v, &datePublished)
2547 if err != nil {
2548 return err
2549 }
2550 ig.DatePublished = &datePublished
2551 }
2552 case "text":
2553 if v != nil {
2554 var textVar string
2555 err = json.Unmarshal(*v, &textVar)
2556 if err != nil {
2557 return err
2558 }
2559 ig.Text = &textVar
2560 }
2561 case "name":
2562 if v != nil {
2563 var name string
2564 err = json.Unmarshal(*v, &name)
2565 if err != nil {
2566 return err
2567 }
2568 ig.Name = &name
2569 }
2570 case "url":
2571 if v != nil {
2572 var URL string
2573 err = json.Unmarshal(*v, &URL)
2574 if err != nil {
2575 return err
2576 }
2577 ig.URL = &URL
2578 }
2579 case "image":
2580 if v != nil {
2581 var imageVar ImageObject
2582 err = json.Unmarshal(*v, &imageVar)
2583 if err != nil {
2584 return err
2585 }
2586 ig.Image = &imageVar
2587 }
2588 case "description":
2589 if v != nil {
2590 var description string
2591 err = json.Unmarshal(*v, &description)
2592 if err != nil {
2593 return err
2594 }
2595 ig.Description = &description
2596 }
2597 case "alternateName":
2598 if v != nil {
2599 var alternateName string
2600 err = json.Unmarshal(*v, &alternateName)
2601 if err != nil {
2602 return err
2603 }
2604 ig.AlternateName = &alternateName
2605 }
2606 case "bingId":
2607 if v != nil {
2608 var bingID string
2609 err = json.Unmarshal(*v, &bingID)
2610 if err != nil {
2611 return err
2612 }
2613 ig.BingID = &bingID
2614 }
2615 case "readLink":
2616 if v != nil {
2617 var readLink string
2618 err = json.Unmarshal(*v, &readLink)
2619 if err != nil {
2620 return err
2621 }
2622 ig.ReadLink = &readLink
2623 }
2624 case "webSearchUrl":
2625 if v != nil {
2626 var webSearchURL string
2627 err = json.Unmarshal(*v, &webSearchURL)
2628 if err != nil {
2629 return err
2630 }
2631 ig.WebSearchURL = &webSearchURL
2632 }
2633 case "id":
2634 if v != nil {
2635 var ID string
2636 err = json.Unmarshal(*v, &ID)
2637 if err != nil {
2638 return err
2639 }
2640 ig.ID = &ID
2641 }
2642 case "_type":
2643 if v != nil {
2644 var typeVar TypeBasicResponseBase
2645 err = json.Unmarshal(*v, &typeVar)
2646 if err != nil {
2647 return err
2648 }
2649 ig.Type = typeVar
2650 }
2651 }
2652 }
2653
2654 return nil
2655 }
2656
2657
2658
2659
2660
2661
2662
2663
2664 type ImageInsights struct {
2665 autorest.Response `json:"-"`
2666
2667 ImageInsightsToken *string `json:"imageInsightsToken,omitempty"`
2668
2669 BestRepresentativeQuery *Query `json:"bestRepresentativeQuery,omitempty"`
2670
2671 ImageCaption *ImageInsightsImageCaption `json:"imageCaption,omitempty"`
2672
2673 RelatedCollections *RelatedCollectionsModule `json:"relatedCollections,omitempty"`
2674
2675 PagesIncluding *ImagesModule `json:"pagesIncluding,omitempty"`
2676
2677 ShoppingSources *AggregateOffer `json:"shoppingSources,omitempty"`
2678
2679 RelatedSearches *RelatedSearchesModule `json:"relatedSearches,omitempty"`
2680
2681 Recipes *RecipesModule `json:"recipes,omitempty"`
2682
2683 VisuallySimilarImages *ImagesModule `json:"visuallySimilarImages,omitempty"`
2684
2685 VisuallySimilarProducts *ImagesModule `json:"visuallySimilarProducts,omitempty"`
2686
2687 RecognizedEntityGroups *RecognizedEntitiesModule `json:"recognizedEntityGroups,omitempty"`
2688
2689 ImageTags *ImageTagsModule `json:"imageTags,omitempty"`
2690
2691 ReadLink *string `json:"readLink,omitempty"`
2692
2693 WebSearchURL *string `json:"webSearchUrl,omitempty"`
2694
2695 ID *string `json:"id,omitempty"`
2696
2697 Type TypeBasicResponseBase `json:"_type,omitempty"`
2698 }
2699
2700
2701 func (ii ImageInsights) MarshalJSON() ([]byte, error) {
2702 ii.Type = TypeImageInsights
2703 objectMap := make(map[string]interface{})
2704 if ii.Type != "" {
2705 objectMap["_type"] = ii.Type
2706 }
2707 return json.Marshal(objectMap)
2708 }
2709
2710
2711 func (ii ImageInsights) AsOrganization() (*Organization, bool) {
2712 return nil, false
2713 }
2714
2715
2716 func (ii ImageInsights) AsOffer() (*Offer, bool) {
2717 return nil, false
2718 }
2719
2720
2721 func (ii ImageInsights) AsBasicOffer() (BasicOffer, bool) {
2722 return nil, false
2723 }
2724
2725
2726 func (ii ImageInsights) AsAggregateOffer() (*AggregateOffer, bool) {
2727 return nil, false
2728 }
2729
2730
2731 func (ii ImageInsights) AsImageObject() (*ImageObject, bool) {
2732 return nil, false
2733 }
2734
2735
2736 func (ii ImageInsights) AsImages() (*Images, bool) {
2737 return nil, false
2738 }
2739
2740
2741 func (ii ImageInsights) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
2742 return nil, false
2743 }
2744
2745
2746 func (ii ImageInsights) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
2747 return nil, false
2748 }
2749
2750
2751 func (ii ImageInsights) AsAnswer() (*Answer, bool) {
2752 return nil, false
2753 }
2754
2755
2756 func (ii ImageInsights) AsBasicAnswer() (BasicAnswer, bool) {
2757 return nil, false
2758 }
2759
2760
2761 func (ii ImageInsights) AsMediaObject() (*MediaObject, bool) {
2762 return nil, false
2763 }
2764
2765
2766 func (ii ImageInsights) AsBasicMediaObject() (BasicMediaObject, bool) {
2767 return nil, false
2768 }
2769
2770
2771 func (ii ImageInsights) AsResponse() (*Response, bool) {
2772 return nil, false
2773 }
2774
2775
2776 func (ii ImageInsights) AsBasicResponse() (BasicResponse, bool) {
2777 return &ii, true
2778 }
2779
2780
2781 func (ii ImageInsights) AsThing() (*Thing, bool) {
2782 return nil, false
2783 }
2784
2785
2786 func (ii ImageInsights) AsBasicThing() (BasicThing, bool) {
2787 return nil, false
2788 }
2789
2790
2791 func (ii ImageInsights) AsCreativeWork() (*CreativeWork, bool) {
2792 return nil, false
2793 }
2794
2795
2796 func (ii ImageInsights) AsBasicCreativeWork() (BasicCreativeWork, bool) {
2797 return nil, false
2798 }
2799
2800
2801 func (ii ImageInsights) AsIdentifiable() (*Identifiable, bool) {
2802 return nil, false
2803 }
2804
2805
2806 func (ii ImageInsights) AsBasicIdentifiable() (BasicIdentifiable, bool) {
2807 return &ii, true
2808 }
2809
2810
2811 func (ii ImageInsights) AsErrorResponse() (*ErrorResponse, bool) {
2812 return nil, false
2813 }
2814
2815
2816 func (ii ImageInsights) AsImageGallery() (*ImageGallery, bool) {
2817 return nil, false
2818 }
2819
2820
2821 func (ii ImageInsights) AsRecipe() (*Recipe, bool) {
2822 return nil, false
2823 }
2824
2825
2826 func (ii ImageInsights) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
2827 return nil, false
2828 }
2829
2830
2831 func (ii ImageInsights) AsRecognizedEntity() (*RecognizedEntity, bool) {
2832 return nil, false
2833 }
2834
2835
2836 func (ii ImageInsights) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
2837 return nil, false
2838 }
2839
2840
2841 func (ii ImageInsights) AsImageInsights() (*ImageInsights, bool) {
2842 return &ii, true
2843 }
2844
2845
2846 func (ii ImageInsights) AsTrendingImages() (*TrendingImages, bool) {
2847 return nil, false
2848 }
2849
2850
2851 func (ii ImageInsights) AsWebPage() (*WebPage, bool) {
2852 return nil, false
2853 }
2854
2855
2856 func (ii ImageInsights) AsBasicWebPage() (BasicWebPage, bool) {
2857 return nil, false
2858 }
2859
2860
2861 func (ii ImageInsights) AsPerson() (*Person, bool) {
2862 return nil, false
2863 }
2864
2865
2866 func (ii ImageInsights) AsIntangible() (*Intangible, bool) {
2867 return nil, false
2868 }
2869
2870
2871 func (ii ImageInsights) AsBasicIntangible() (BasicIntangible, bool) {
2872 return nil, false
2873 }
2874
2875
2876 func (ii ImageInsights) AsCollectionPage() (*CollectionPage, bool) {
2877 return nil, false
2878 }
2879
2880
2881 func (ii ImageInsights) AsBasicCollectionPage() (BasicCollectionPage, bool) {
2882 return nil, false
2883 }
2884
2885
2886 func (ii ImageInsights) AsStructuredValue() (*StructuredValue, bool) {
2887 return nil, false
2888 }
2889
2890
2891 func (ii ImageInsights) AsBasicStructuredValue() (BasicStructuredValue, bool) {
2892 return nil, false
2893 }
2894
2895
2896 func (ii ImageInsights) AsResponseBase() (*ResponseBase, bool) {
2897 return nil, false
2898 }
2899
2900
2901 func (ii ImageInsights) AsBasicResponseBase() (BasicResponseBase, bool) {
2902 return &ii, true
2903 }
2904
2905
2906 type ImageInsightsImageCaption struct {
2907
2908 Caption *string `json:"caption,omitempty"`
2909
2910 DataSourceURL *string `json:"dataSourceUrl,omitempty"`
2911
2912 RelatedSearches *[]Query `json:"relatedSearches,omitempty"`
2913 }
2914
2915
2916 type ImageObject struct {
2917
2918 Thumbnail *ImageObject `json:"thumbnail,omitempty"`
2919
2920 ImageInsightsToken *string `json:"imageInsightsToken,omitempty"`
2921
2922 InsightsMetadata *ImagesImageMetadata `json:"insightsMetadata,omitempty"`
2923
2924 ImageID *string `json:"imageId,omitempty"`
2925
2926 AccentColor *string `json:"accentColor,omitempty"`
2927
2928 VisualWords *string `json:"visualWords,omitempty"`
2929
2930 ContentURL *string `json:"contentUrl,omitempty"`
2931
2932 HostPageURL *string `json:"hostPageUrl,omitempty"`
2933
2934 ContentSize *string `json:"contentSize,omitempty"`
2935
2936 EncodingFormat *string `json:"encodingFormat,omitempty"`
2937
2938 HostPageDisplayURL *string `json:"hostPageDisplayUrl,omitempty"`
2939
2940 Width *int32 `json:"width,omitempty"`
2941
2942 Height *int32 `json:"height,omitempty"`
2943
2944 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
2945
2946 Provider *[]BasicThing `json:"provider,omitempty"`
2947
2948 DatePublished *string `json:"datePublished,omitempty"`
2949
2950 Text *string `json:"text,omitempty"`
2951
2952 Name *string `json:"name,omitempty"`
2953
2954 URL *string `json:"url,omitempty"`
2955
2956 Image *ImageObject `json:"image,omitempty"`
2957
2958 Description *string `json:"description,omitempty"`
2959
2960 AlternateName *string `json:"alternateName,omitempty"`
2961
2962 BingID *string `json:"bingId,omitempty"`
2963
2964 ReadLink *string `json:"readLink,omitempty"`
2965
2966 WebSearchURL *string `json:"webSearchUrl,omitempty"`
2967
2968 ID *string `json:"id,omitempty"`
2969
2970 Type TypeBasicResponseBase `json:"_type,omitempty"`
2971 }
2972
2973
2974 func (ioVar ImageObject) MarshalJSON() ([]byte, error) {
2975 ioVar.Type = TypeImageObject
2976 objectMap := make(map[string]interface{})
2977 if ioVar.Type != "" {
2978 objectMap["_type"] = ioVar.Type
2979 }
2980 return json.Marshal(objectMap)
2981 }
2982
2983
2984 func (ioVar ImageObject) AsOrganization() (*Organization, bool) {
2985 return nil, false
2986 }
2987
2988
2989 func (ioVar ImageObject) AsOffer() (*Offer, bool) {
2990 return nil, false
2991 }
2992
2993
2994 func (ioVar ImageObject) AsBasicOffer() (BasicOffer, bool) {
2995 return nil, false
2996 }
2997
2998
2999 func (ioVar ImageObject) AsAggregateOffer() (*AggregateOffer, bool) {
3000 return nil, false
3001 }
3002
3003
3004 func (ioVar ImageObject) AsImageObject() (*ImageObject, bool) {
3005 return &ioVar, true
3006 }
3007
3008
3009 func (ioVar ImageObject) AsImages() (*Images, bool) {
3010 return nil, false
3011 }
3012
3013
3014 func (ioVar ImageObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
3015 return nil, false
3016 }
3017
3018
3019 func (ioVar ImageObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
3020 return nil, false
3021 }
3022
3023
3024 func (ioVar ImageObject) AsAnswer() (*Answer, bool) {
3025 return nil, false
3026 }
3027
3028
3029 func (ioVar ImageObject) AsBasicAnswer() (BasicAnswer, bool) {
3030 return nil, false
3031 }
3032
3033
3034 func (ioVar ImageObject) AsMediaObject() (*MediaObject, bool) {
3035 return nil, false
3036 }
3037
3038
3039 func (ioVar ImageObject) AsBasicMediaObject() (BasicMediaObject, bool) {
3040 return &ioVar, true
3041 }
3042
3043
3044 func (ioVar ImageObject) AsResponse() (*Response, bool) {
3045 return nil, false
3046 }
3047
3048
3049 func (ioVar ImageObject) AsBasicResponse() (BasicResponse, bool) {
3050 return &ioVar, true
3051 }
3052
3053
3054 func (ioVar ImageObject) AsThing() (*Thing, bool) {
3055 return nil, false
3056 }
3057
3058
3059 func (ioVar ImageObject) AsBasicThing() (BasicThing, bool) {
3060 return &ioVar, true
3061 }
3062
3063
3064 func (ioVar ImageObject) AsCreativeWork() (*CreativeWork, bool) {
3065 return nil, false
3066 }
3067
3068
3069 func (ioVar ImageObject) AsBasicCreativeWork() (BasicCreativeWork, bool) {
3070 return &ioVar, true
3071 }
3072
3073
3074 func (ioVar ImageObject) AsIdentifiable() (*Identifiable, bool) {
3075 return nil, false
3076 }
3077
3078
3079 func (ioVar ImageObject) AsBasicIdentifiable() (BasicIdentifiable, bool) {
3080 return &ioVar, true
3081 }
3082
3083
3084 func (ioVar ImageObject) AsErrorResponse() (*ErrorResponse, bool) {
3085 return nil, false
3086 }
3087
3088
3089 func (ioVar ImageObject) AsImageGallery() (*ImageGallery, bool) {
3090 return nil, false
3091 }
3092
3093
3094 func (ioVar ImageObject) AsRecipe() (*Recipe, bool) {
3095 return nil, false
3096 }
3097
3098
3099 func (ioVar ImageObject) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
3100 return nil, false
3101 }
3102
3103
3104 func (ioVar ImageObject) AsRecognizedEntity() (*RecognizedEntity, bool) {
3105 return nil, false
3106 }
3107
3108
3109 func (ioVar ImageObject) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
3110 return nil, false
3111 }
3112
3113
3114 func (ioVar ImageObject) AsImageInsights() (*ImageInsights, bool) {
3115 return nil, false
3116 }
3117
3118
3119 func (ioVar ImageObject) AsTrendingImages() (*TrendingImages, bool) {
3120 return nil, false
3121 }
3122
3123
3124 func (ioVar ImageObject) AsWebPage() (*WebPage, bool) {
3125 return nil, false
3126 }
3127
3128
3129 func (ioVar ImageObject) AsBasicWebPage() (BasicWebPage, bool) {
3130 return nil, false
3131 }
3132
3133
3134 func (ioVar ImageObject) AsPerson() (*Person, bool) {
3135 return nil, false
3136 }
3137
3138
3139 func (ioVar ImageObject) AsIntangible() (*Intangible, bool) {
3140 return nil, false
3141 }
3142
3143
3144 func (ioVar ImageObject) AsBasicIntangible() (BasicIntangible, bool) {
3145 return nil, false
3146 }
3147
3148
3149 func (ioVar ImageObject) AsCollectionPage() (*CollectionPage, bool) {
3150 return nil, false
3151 }
3152
3153
3154 func (ioVar ImageObject) AsBasicCollectionPage() (BasicCollectionPage, bool) {
3155 return nil, false
3156 }
3157
3158
3159 func (ioVar ImageObject) AsStructuredValue() (*StructuredValue, bool) {
3160 return nil, false
3161 }
3162
3163
3164 func (ioVar ImageObject) AsBasicStructuredValue() (BasicStructuredValue, bool) {
3165 return nil, false
3166 }
3167
3168
3169 func (ioVar ImageObject) AsResponseBase() (*ResponseBase, bool) {
3170 return nil, false
3171 }
3172
3173
3174 func (ioVar ImageObject) AsBasicResponseBase() (BasicResponseBase, bool) {
3175 return &ioVar, true
3176 }
3177
3178
3179 func (ioVar *ImageObject) UnmarshalJSON(body []byte) error {
3180 var m map[string]*json.RawMessage
3181 err := json.Unmarshal(body, &m)
3182 if err != nil {
3183 return err
3184 }
3185 for k, v := range m {
3186 switch k {
3187 case "thumbnail":
3188 if v != nil {
3189 var thumbnail ImageObject
3190 err = json.Unmarshal(*v, &thumbnail)
3191 if err != nil {
3192 return err
3193 }
3194 ioVar.Thumbnail = &thumbnail
3195 }
3196 case "imageInsightsToken":
3197 if v != nil {
3198 var imageInsightsToken string
3199 err = json.Unmarshal(*v, &imageInsightsToken)
3200 if err != nil {
3201 return err
3202 }
3203 ioVar.ImageInsightsToken = &imageInsightsToken
3204 }
3205 case "insightsMetadata":
3206 if v != nil {
3207 var insightsMetadata ImagesImageMetadata
3208 err = json.Unmarshal(*v, &insightsMetadata)
3209 if err != nil {
3210 return err
3211 }
3212 ioVar.InsightsMetadata = &insightsMetadata
3213 }
3214 case "imageId":
3215 if v != nil {
3216 var imageID string
3217 err = json.Unmarshal(*v, &imageID)
3218 if err != nil {
3219 return err
3220 }
3221 ioVar.ImageID = &imageID
3222 }
3223 case "accentColor":
3224 if v != nil {
3225 var accentColor string
3226 err = json.Unmarshal(*v, &accentColor)
3227 if err != nil {
3228 return err
3229 }
3230 ioVar.AccentColor = &accentColor
3231 }
3232 case "visualWords":
3233 if v != nil {
3234 var visualWords string
3235 err = json.Unmarshal(*v, &visualWords)
3236 if err != nil {
3237 return err
3238 }
3239 ioVar.VisualWords = &visualWords
3240 }
3241 case "contentUrl":
3242 if v != nil {
3243 var contentURL string
3244 err = json.Unmarshal(*v, &contentURL)
3245 if err != nil {
3246 return err
3247 }
3248 ioVar.ContentURL = &contentURL
3249 }
3250 case "hostPageUrl":
3251 if v != nil {
3252 var hostPageURL string
3253 err = json.Unmarshal(*v, &hostPageURL)
3254 if err != nil {
3255 return err
3256 }
3257 ioVar.HostPageURL = &hostPageURL
3258 }
3259 case "contentSize":
3260 if v != nil {
3261 var contentSize string
3262 err = json.Unmarshal(*v, &contentSize)
3263 if err != nil {
3264 return err
3265 }
3266 ioVar.ContentSize = &contentSize
3267 }
3268 case "encodingFormat":
3269 if v != nil {
3270 var encodingFormat string
3271 err = json.Unmarshal(*v, &encodingFormat)
3272 if err != nil {
3273 return err
3274 }
3275 ioVar.EncodingFormat = &encodingFormat
3276 }
3277 case "hostPageDisplayUrl":
3278 if v != nil {
3279 var hostPageDisplayURL string
3280 err = json.Unmarshal(*v, &hostPageDisplayURL)
3281 if err != nil {
3282 return err
3283 }
3284 ioVar.HostPageDisplayURL = &hostPageDisplayURL
3285 }
3286 case "width":
3287 if v != nil {
3288 var width int32
3289 err = json.Unmarshal(*v, &width)
3290 if err != nil {
3291 return err
3292 }
3293 ioVar.Width = &width
3294 }
3295 case "height":
3296 if v != nil {
3297 var height int32
3298 err = json.Unmarshal(*v, &height)
3299 if err != nil {
3300 return err
3301 }
3302 ioVar.Height = &height
3303 }
3304 case "thumbnailUrl":
3305 if v != nil {
3306 var thumbnailURL string
3307 err = json.Unmarshal(*v, &thumbnailURL)
3308 if err != nil {
3309 return err
3310 }
3311 ioVar.ThumbnailURL = &thumbnailURL
3312 }
3313 case "provider":
3314 if v != nil {
3315 provider, err := unmarshalBasicThingArray(*v)
3316 if err != nil {
3317 return err
3318 }
3319 ioVar.Provider = &provider
3320 }
3321 case "datePublished":
3322 if v != nil {
3323 var datePublished string
3324 err = json.Unmarshal(*v, &datePublished)
3325 if err != nil {
3326 return err
3327 }
3328 ioVar.DatePublished = &datePublished
3329 }
3330 case "text":
3331 if v != nil {
3332 var textVar string
3333 err = json.Unmarshal(*v, &textVar)
3334 if err != nil {
3335 return err
3336 }
3337 ioVar.Text = &textVar
3338 }
3339 case "name":
3340 if v != nil {
3341 var name string
3342 err = json.Unmarshal(*v, &name)
3343 if err != nil {
3344 return err
3345 }
3346 ioVar.Name = &name
3347 }
3348 case "url":
3349 if v != nil {
3350 var URL string
3351 err = json.Unmarshal(*v, &URL)
3352 if err != nil {
3353 return err
3354 }
3355 ioVar.URL = &URL
3356 }
3357 case "image":
3358 if v != nil {
3359 var imageVar ImageObject
3360 err = json.Unmarshal(*v, &imageVar)
3361 if err != nil {
3362 return err
3363 }
3364 ioVar.Image = &imageVar
3365 }
3366 case "description":
3367 if v != nil {
3368 var description string
3369 err = json.Unmarshal(*v, &description)
3370 if err != nil {
3371 return err
3372 }
3373 ioVar.Description = &description
3374 }
3375 case "alternateName":
3376 if v != nil {
3377 var alternateName string
3378 err = json.Unmarshal(*v, &alternateName)
3379 if err != nil {
3380 return err
3381 }
3382 ioVar.AlternateName = &alternateName
3383 }
3384 case "bingId":
3385 if v != nil {
3386 var bingID string
3387 err = json.Unmarshal(*v, &bingID)
3388 if err != nil {
3389 return err
3390 }
3391 ioVar.BingID = &bingID
3392 }
3393 case "readLink":
3394 if v != nil {
3395 var readLink string
3396 err = json.Unmarshal(*v, &readLink)
3397 if err != nil {
3398 return err
3399 }
3400 ioVar.ReadLink = &readLink
3401 }
3402 case "webSearchUrl":
3403 if v != nil {
3404 var webSearchURL string
3405 err = json.Unmarshal(*v, &webSearchURL)
3406 if err != nil {
3407 return err
3408 }
3409 ioVar.WebSearchURL = &webSearchURL
3410 }
3411 case "id":
3412 if v != nil {
3413 var ID string
3414 err = json.Unmarshal(*v, &ID)
3415 if err != nil {
3416 return err
3417 }
3418 ioVar.ID = &ID
3419 }
3420 case "_type":
3421 if v != nil {
3422 var typeVar TypeBasicResponseBase
3423 err = json.Unmarshal(*v, &typeVar)
3424 if err != nil {
3425 return err
3426 }
3427 ioVar.Type = typeVar
3428 }
3429 }
3430 }
3431
3432 return nil
3433 }
3434
3435
3436 type Images struct {
3437 autorest.Response `json:"-"`
3438
3439 NextOffset *int32 `json:"nextOffset,omitempty"`
3440
3441 Value *[]ImageObject `json:"value,omitempty"`
3442
3443 QueryExpansions *[]Query `json:"queryExpansions,omitempty"`
3444
3445 PivotSuggestions *[]PivotSuggestions `json:"pivotSuggestions,omitempty"`
3446
3447 SimilarTerms *[]Query `json:"similarTerms,omitempty"`
3448
3449 TotalEstimatedMatches *int64 `json:"totalEstimatedMatches,omitempty"`
3450
3451 ReadLink *string `json:"readLink,omitempty"`
3452
3453 WebSearchURL *string `json:"webSearchUrl,omitempty"`
3454
3455 ID *string `json:"id,omitempty"`
3456
3457 Type TypeBasicResponseBase `json:"_type,omitempty"`
3458 }
3459
3460
3461 func (i Images) MarshalJSON() ([]byte, error) {
3462 i.Type = TypeImages
3463 objectMap := make(map[string]interface{})
3464 if i.Value != nil {
3465 objectMap["value"] = i.Value
3466 }
3467 if i.Type != "" {
3468 objectMap["_type"] = i.Type
3469 }
3470 return json.Marshal(objectMap)
3471 }
3472
3473
3474 func (i Images) AsOrganization() (*Organization, bool) {
3475 return nil, false
3476 }
3477
3478
3479 func (i Images) AsOffer() (*Offer, bool) {
3480 return nil, false
3481 }
3482
3483
3484 func (i Images) AsBasicOffer() (BasicOffer, bool) {
3485 return nil, false
3486 }
3487
3488
3489 func (i Images) AsAggregateOffer() (*AggregateOffer, bool) {
3490 return nil, false
3491 }
3492
3493
3494 func (i Images) AsImageObject() (*ImageObject, bool) {
3495 return nil, false
3496 }
3497
3498
3499 func (i Images) AsImages() (*Images, bool) {
3500 return &i, true
3501 }
3502
3503
3504 func (i Images) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
3505 return nil, false
3506 }
3507
3508
3509 func (i Images) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
3510 return &i, true
3511 }
3512
3513
3514 func (i Images) AsAnswer() (*Answer, bool) {
3515 return nil, false
3516 }
3517
3518
3519 func (i Images) AsBasicAnswer() (BasicAnswer, bool) {
3520 return &i, true
3521 }
3522
3523
3524 func (i Images) AsMediaObject() (*MediaObject, bool) {
3525 return nil, false
3526 }
3527
3528
3529 func (i Images) AsBasicMediaObject() (BasicMediaObject, bool) {
3530 return nil, false
3531 }
3532
3533
3534 func (i Images) AsResponse() (*Response, bool) {
3535 return nil, false
3536 }
3537
3538
3539 func (i Images) AsBasicResponse() (BasicResponse, bool) {
3540 return &i, true
3541 }
3542
3543
3544 func (i Images) AsThing() (*Thing, bool) {
3545 return nil, false
3546 }
3547
3548
3549 func (i Images) AsBasicThing() (BasicThing, bool) {
3550 return nil, false
3551 }
3552
3553
3554 func (i Images) AsCreativeWork() (*CreativeWork, bool) {
3555 return nil, false
3556 }
3557
3558
3559 func (i Images) AsBasicCreativeWork() (BasicCreativeWork, bool) {
3560 return nil, false
3561 }
3562
3563
3564 func (i Images) AsIdentifiable() (*Identifiable, bool) {
3565 return nil, false
3566 }
3567
3568
3569 func (i Images) AsBasicIdentifiable() (BasicIdentifiable, bool) {
3570 return &i, true
3571 }
3572
3573
3574 func (i Images) AsErrorResponse() (*ErrorResponse, bool) {
3575 return nil, false
3576 }
3577
3578
3579 func (i Images) AsImageGallery() (*ImageGallery, bool) {
3580 return nil, false
3581 }
3582
3583
3584 func (i Images) AsRecipe() (*Recipe, bool) {
3585 return nil, false
3586 }
3587
3588
3589 func (i Images) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
3590 return nil, false
3591 }
3592
3593
3594 func (i Images) AsRecognizedEntity() (*RecognizedEntity, bool) {
3595 return nil, false
3596 }
3597
3598
3599 func (i Images) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
3600 return nil, false
3601 }
3602
3603
3604 func (i Images) AsImageInsights() (*ImageInsights, bool) {
3605 return nil, false
3606 }
3607
3608
3609 func (i Images) AsTrendingImages() (*TrendingImages, bool) {
3610 return nil, false
3611 }
3612
3613
3614 func (i Images) AsWebPage() (*WebPage, bool) {
3615 return nil, false
3616 }
3617
3618
3619 func (i Images) AsBasicWebPage() (BasicWebPage, bool) {
3620 return nil, false
3621 }
3622
3623
3624 func (i Images) AsPerson() (*Person, bool) {
3625 return nil, false
3626 }
3627
3628
3629 func (i Images) AsIntangible() (*Intangible, bool) {
3630 return nil, false
3631 }
3632
3633
3634 func (i Images) AsBasicIntangible() (BasicIntangible, bool) {
3635 return nil, false
3636 }
3637
3638
3639 func (i Images) AsCollectionPage() (*CollectionPage, bool) {
3640 return nil, false
3641 }
3642
3643
3644 func (i Images) AsBasicCollectionPage() (BasicCollectionPage, bool) {
3645 return nil, false
3646 }
3647
3648
3649 func (i Images) AsStructuredValue() (*StructuredValue, bool) {
3650 return nil, false
3651 }
3652
3653
3654 func (i Images) AsBasicStructuredValue() (BasicStructuredValue, bool) {
3655 return nil, false
3656 }
3657
3658
3659 func (i Images) AsResponseBase() (*ResponseBase, bool) {
3660 return nil, false
3661 }
3662
3663
3664 func (i Images) AsBasicResponseBase() (BasicResponseBase, bool) {
3665 return &i, true
3666 }
3667
3668
3669
3670 type ImagesImageMetadata struct {
3671
3672 ShoppingSourcesCount *int32 `json:"shoppingSourcesCount,omitempty"`
3673
3674 RecipeSourcesCount *int32 `json:"recipeSourcesCount,omitempty"`
3675
3676 AggregateOffer *AggregateOffer `json:"aggregateOffer,omitempty"`
3677 }
3678
3679
3680 func (iim ImagesImageMetadata) MarshalJSON() ([]byte, error) {
3681 objectMap := make(map[string]interface{})
3682 return json.Marshal(objectMap)
3683 }
3684
3685
3686 type ImagesModule struct {
3687
3688 Value *[]ImageObject `json:"value,omitempty"`
3689 }
3690
3691
3692 func (im ImagesModule) MarshalJSON() ([]byte, error) {
3693 objectMap := make(map[string]interface{})
3694 return json.Marshal(objectMap)
3695 }
3696
3697
3698 type ImageTagsModule struct {
3699
3700 Value *[]InsightsTag `json:"value,omitempty"`
3701 }
3702
3703
3704 type InsightsTag struct {
3705
3706 Name *string `json:"name,omitempty"`
3707 }
3708
3709
3710 func (it InsightsTag) MarshalJSON() ([]byte, error) {
3711 objectMap := make(map[string]interface{})
3712 return json.Marshal(objectMap)
3713 }
3714
3715
3716
3717 type BasicIntangible interface {
3718 AsNormalizedRectangle() (*NormalizedRectangle, bool)
3719 AsStructuredValue() (*StructuredValue, bool)
3720 AsBasicStructuredValue() (BasicStructuredValue, bool)
3721 AsIntangible() (*Intangible, bool)
3722 }
3723
3724
3725
3726 type Intangible struct {
3727
3728 Name *string `json:"name,omitempty"`
3729
3730 URL *string `json:"url,omitempty"`
3731
3732 Image *ImageObject `json:"image,omitempty"`
3733
3734 Description *string `json:"description,omitempty"`
3735
3736 AlternateName *string `json:"alternateName,omitempty"`
3737
3738 BingID *string `json:"bingId,omitempty"`
3739
3740 ReadLink *string `json:"readLink,omitempty"`
3741
3742 WebSearchURL *string `json:"webSearchUrl,omitempty"`
3743
3744 ID *string `json:"id,omitempty"`
3745
3746 Type TypeBasicResponseBase `json:"_type,omitempty"`
3747 }
3748
3749 func unmarshalBasicIntangible(body []byte) (BasicIntangible, error) {
3750 var m map[string]interface{}
3751 err := json.Unmarshal(body, &m)
3752 if err != nil {
3753 return nil, err
3754 }
3755
3756 switch m["_type"] {
3757 case string(TypeNormalizedRectangle):
3758 var nr NormalizedRectangle
3759 err := json.Unmarshal(body, &nr)
3760 return nr, err
3761 case string(TypeStructuredValue):
3762 var sv StructuredValue
3763 err := json.Unmarshal(body, &sv)
3764 return sv, err
3765 default:
3766 var i Intangible
3767 err := json.Unmarshal(body, &i)
3768 return i, err
3769 }
3770 }
3771 func unmarshalBasicIntangibleArray(body []byte) ([]BasicIntangible, error) {
3772 var rawMessages []*json.RawMessage
3773 err := json.Unmarshal(body, &rawMessages)
3774 if err != nil {
3775 return nil, err
3776 }
3777
3778 iArray := make([]BasicIntangible, len(rawMessages))
3779
3780 for index, rawMessage := range rawMessages {
3781 i, err := unmarshalBasicIntangible(*rawMessage)
3782 if err != nil {
3783 return nil, err
3784 }
3785 iArray[index] = i
3786 }
3787 return iArray, nil
3788 }
3789
3790
3791 func (i Intangible) MarshalJSON() ([]byte, error) {
3792 i.Type = TypeIntangible
3793 objectMap := make(map[string]interface{})
3794 if i.Type != "" {
3795 objectMap["_type"] = i.Type
3796 }
3797 return json.Marshal(objectMap)
3798 }
3799
3800
3801 func (i Intangible) AsOrganization() (*Organization, bool) {
3802 return nil, false
3803 }
3804
3805
3806 func (i Intangible) AsOffer() (*Offer, bool) {
3807 return nil, false
3808 }
3809
3810
3811 func (i Intangible) AsBasicOffer() (BasicOffer, bool) {
3812 return nil, false
3813 }
3814
3815
3816 func (i Intangible) AsAggregateOffer() (*AggregateOffer, bool) {
3817 return nil, false
3818 }
3819
3820
3821 func (i Intangible) AsImageObject() (*ImageObject, bool) {
3822 return nil, false
3823 }
3824
3825
3826 func (i Intangible) AsImages() (*Images, bool) {
3827 return nil, false
3828 }
3829
3830
3831 func (i Intangible) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
3832 return nil, false
3833 }
3834
3835
3836 func (i Intangible) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
3837 return nil, false
3838 }
3839
3840
3841 func (i Intangible) AsAnswer() (*Answer, bool) {
3842 return nil, false
3843 }
3844
3845
3846 func (i Intangible) AsBasicAnswer() (BasicAnswer, bool) {
3847 return nil, false
3848 }
3849
3850
3851 func (i Intangible) AsMediaObject() (*MediaObject, bool) {
3852 return nil, false
3853 }
3854
3855
3856 func (i Intangible) AsBasicMediaObject() (BasicMediaObject, bool) {
3857 return nil, false
3858 }
3859
3860
3861 func (i Intangible) AsResponse() (*Response, bool) {
3862 return nil, false
3863 }
3864
3865
3866 func (i Intangible) AsBasicResponse() (BasicResponse, bool) {
3867 return &i, true
3868 }
3869
3870
3871 func (i Intangible) AsThing() (*Thing, bool) {
3872 return nil, false
3873 }
3874
3875
3876 func (i Intangible) AsBasicThing() (BasicThing, bool) {
3877 return &i, true
3878 }
3879
3880
3881 func (i Intangible) AsCreativeWork() (*CreativeWork, bool) {
3882 return nil, false
3883 }
3884
3885
3886 func (i Intangible) AsBasicCreativeWork() (BasicCreativeWork, bool) {
3887 return nil, false
3888 }
3889
3890
3891 func (i Intangible) AsIdentifiable() (*Identifiable, bool) {
3892 return nil, false
3893 }
3894
3895
3896 func (i Intangible) AsBasicIdentifiable() (BasicIdentifiable, bool) {
3897 return &i, true
3898 }
3899
3900
3901 func (i Intangible) AsErrorResponse() (*ErrorResponse, bool) {
3902 return nil, false
3903 }
3904
3905
3906 func (i Intangible) AsImageGallery() (*ImageGallery, bool) {
3907 return nil, false
3908 }
3909
3910
3911 func (i Intangible) AsRecipe() (*Recipe, bool) {
3912 return nil, false
3913 }
3914
3915
3916 func (i Intangible) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
3917 return nil, false
3918 }
3919
3920
3921 func (i Intangible) AsRecognizedEntity() (*RecognizedEntity, bool) {
3922 return nil, false
3923 }
3924
3925
3926 func (i Intangible) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
3927 return nil, false
3928 }
3929
3930
3931 func (i Intangible) AsImageInsights() (*ImageInsights, bool) {
3932 return nil, false
3933 }
3934
3935
3936 func (i Intangible) AsTrendingImages() (*TrendingImages, bool) {
3937 return nil, false
3938 }
3939
3940
3941 func (i Intangible) AsWebPage() (*WebPage, bool) {
3942 return nil, false
3943 }
3944
3945
3946 func (i Intangible) AsBasicWebPage() (BasicWebPage, bool) {
3947 return nil, false
3948 }
3949
3950
3951 func (i Intangible) AsPerson() (*Person, bool) {
3952 return nil, false
3953 }
3954
3955
3956 func (i Intangible) AsIntangible() (*Intangible, bool) {
3957 return &i, true
3958 }
3959
3960
3961 func (i Intangible) AsBasicIntangible() (BasicIntangible, bool) {
3962 return &i, true
3963 }
3964
3965
3966 func (i Intangible) AsCollectionPage() (*CollectionPage, bool) {
3967 return nil, false
3968 }
3969
3970
3971 func (i Intangible) AsBasicCollectionPage() (BasicCollectionPage, bool) {
3972 return nil, false
3973 }
3974
3975
3976 func (i Intangible) AsStructuredValue() (*StructuredValue, bool) {
3977 return nil, false
3978 }
3979
3980
3981 func (i Intangible) AsBasicStructuredValue() (BasicStructuredValue, bool) {
3982 return nil, false
3983 }
3984
3985
3986 func (i Intangible) AsResponseBase() (*ResponseBase, bool) {
3987 return nil, false
3988 }
3989
3990
3991 func (i Intangible) AsBasicResponseBase() (BasicResponseBase, bool) {
3992 return &i, true
3993 }
3994
3995
3996 type BasicMediaObject interface {
3997 AsImageObject() (*ImageObject, bool)
3998 AsMediaObject() (*MediaObject, bool)
3999 }
4000
4001
4002 type MediaObject struct {
4003
4004 ContentURL *string `json:"contentUrl,omitempty"`
4005
4006 HostPageURL *string `json:"hostPageUrl,omitempty"`
4007
4008 ContentSize *string `json:"contentSize,omitempty"`
4009
4010 EncodingFormat *string `json:"encodingFormat,omitempty"`
4011
4012 HostPageDisplayURL *string `json:"hostPageDisplayUrl,omitempty"`
4013
4014 Width *int32 `json:"width,omitempty"`
4015
4016 Height *int32 `json:"height,omitempty"`
4017
4018 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
4019
4020 Provider *[]BasicThing `json:"provider,omitempty"`
4021
4022 DatePublished *string `json:"datePublished,omitempty"`
4023
4024 Text *string `json:"text,omitempty"`
4025
4026 Name *string `json:"name,omitempty"`
4027
4028 URL *string `json:"url,omitempty"`
4029
4030 Image *ImageObject `json:"image,omitempty"`
4031
4032 Description *string `json:"description,omitempty"`
4033
4034 AlternateName *string `json:"alternateName,omitempty"`
4035
4036 BingID *string `json:"bingId,omitempty"`
4037
4038 ReadLink *string `json:"readLink,omitempty"`
4039
4040 WebSearchURL *string `json:"webSearchUrl,omitempty"`
4041
4042 ID *string `json:"id,omitempty"`
4043
4044 Type TypeBasicResponseBase `json:"_type,omitempty"`
4045 }
4046
4047 func unmarshalBasicMediaObject(body []byte) (BasicMediaObject, error) {
4048 var m map[string]interface{}
4049 err := json.Unmarshal(body, &m)
4050 if err != nil {
4051 return nil, err
4052 }
4053
4054 switch m["_type"] {
4055 case string(TypeImageObject):
4056 var ioVar ImageObject
4057 err := json.Unmarshal(body, &ioVar)
4058 return ioVar, err
4059 default:
4060 var mo MediaObject
4061 err := json.Unmarshal(body, &mo)
4062 return mo, err
4063 }
4064 }
4065 func unmarshalBasicMediaObjectArray(body []byte) ([]BasicMediaObject, error) {
4066 var rawMessages []*json.RawMessage
4067 err := json.Unmarshal(body, &rawMessages)
4068 if err != nil {
4069 return nil, err
4070 }
4071
4072 moArray := make([]BasicMediaObject, len(rawMessages))
4073
4074 for index, rawMessage := range rawMessages {
4075 mo, err := unmarshalBasicMediaObject(*rawMessage)
4076 if err != nil {
4077 return nil, err
4078 }
4079 moArray[index] = mo
4080 }
4081 return moArray, nil
4082 }
4083
4084
4085 func (mo MediaObject) MarshalJSON() ([]byte, error) {
4086 mo.Type = TypeMediaObject
4087 objectMap := make(map[string]interface{})
4088 if mo.Type != "" {
4089 objectMap["_type"] = mo.Type
4090 }
4091 return json.Marshal(objectMap)
4092 }
4093
4094
4095 func (mo MediaObject) AsOrganization() (*Organization, bool) {
4096 return nil, false
4097 }
4098
4099
4100 func (mo MediaObject) AsOffer() (*Offer, bool) {
4101 return nil, false
4102 }
4103
4104
4105 func (mo MediaObject) AsBasicOffer() (BasicOffer, bool) {
4106 return nil, false
4107 }
4108
4109
4110 func (mo MediaObject) AsAggregateOffer() (*AggregateOffer, bool) {
4111 return nil, false
4112 }
4113
4114
4115 func (mo MediaObject) AsImageObject() (*ImageObject, bool) {
4116 return nil, false
4117 }
4118
4119
4120 func (mo MediaObject) AsImages() (*Images, bool) {
4121 return nil, false
4122 }
4123
4124
4125 func (mo MediaObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
4126 return nil, false
4127 }
4128
4129
4130 func (mo MediaObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
4131 return nil, false
4132 }
4133
4134
4135 func (mo MediaObject) AsAnswer() (*Answer, bool) {
4136 return nil, false
4137 }
4138
4139
4140 func (mo MediaObject) AsBasicAnswer() (BasicAnswer, bool) {
4141 return nil, false
4142 }
4143
4144
4145 func (mo MediaObject) AsMediaObject() (*MediaObject, bool) {
4146 return &mo, true
4147 }
4148
4149
4150 func (mo MediaObject) AsBasicMediaObject() (BasicMediaObject, bool) {
4151 return &mo, true
4152 }
4153
4154
4155 func (mo MediaObject) AsResponse() (*Response, bool) {
4156 return nil, false
4157 }
4158
4159
4160 func (mo MediaObject) AsBasicResponse() (BasicResponse, bool) {
4161 return &mo, true
4162 }
4163
4164
4165 func (mo MediaObject) AsThing() (*Thing, bool) {
4166 return nil, false
4167 }
4168
4169
4170 func (mo MediaObject) AsBasicThing() (BasicThing, bool) {
4171 return &mo, true
4172 }
4173
4174
4175 func (mo MediaObject) AsCreativeWork() (*CreativeWork, bool) {
4176 return nil, false
4177 }
4178
4179
4180 func (mo MediaObject) AsBasicCreativeWork() (BasicCreativeWork, bool) {
4181 return &mo, true
4182 }
4183
4184
4185 func (mo MediaObject) AsIdentifiable() (*Identifiable, bool) {
4186 return nil, false
4187 }
4188
4189
4190 func (mo MediaObject) AsBasicIdentifiable() (BasicIdentifiable, bool) {
4191 return &mo, true
4192 }
4193
4194
4195 func (mo MediaObject) AsErrorResponse() (*ErrorResponse, bool) {
4196 return nil, false
4197 }
4198
4199
4200 func (mo MediaObject) AsImageGallery() (*ImageGallery, bool) {
4201 return nil, false
4202 }
4203
4204
4205 func (mo MediaObject) AsRecipe() (*Recipe, bool) {
4206 return nil, false
4207 }
4208
4209
4210 func (mo MediaObject) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
4211 return nil, false
4212 }
4213
4214
4215 func (mo MediaObject) AsRecognizedEntity() (*RecognizedEntity, bool) {
4216 return nil, false
4217 }
4218
4219
4220 func (mo MediaObject) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
4221 return nil, false
4222 }
4223
4224
4225 func (mo MediaObject) AsImageInsights() (*ImageInsights, bool) {
4226 return nil, false
4227 }
4228
4229
4230 func (mo MediaObject) AsTrendingImages() (*TrendingImages, bool) {
4231 return nil, false
4232 }
4233
4234
4235 func (mo MediaObject) AsWebPage() (*WebPage, bool) {
4236 return nil, false
4237 }
4238
4239
4240 func (mo MediaObject) AsBasicWebPage() (BasicWebPage, bool) {
4241 return nil, false
4242 }
4243
4244
4245 func (mo MediaObject) AsPerson() (*Person, bool) {
4246 return nil, false
4247 }
4248
4249
4250 func (mo MediaObject) AsIntangible() (*Intangible, bool) {
4251 return nil, false
4252 }
4253
4254
4255 func (mo MediaObject) AsBasicIntangible() (BasicIntangible, bool) {
4256 return nil, false
4257 }
4258
4259
4260 func (mo MediaObject) AsCollectionPage() (*CollectionPage, bool) {
4261 return nil, false
4262 }
4263
4264
4265 func (mo MediaObject) AsBasicCollectionPage() (BasicCollectionPage, bool) {
4266 return nil, false
4267 }
4268
4269
4270 func (mo MediaObject) AsStructuredValue() (*StructuredValue, bool) {
4271 return nil, false
4272 }
4273
4274
4275 func (mo MediaObject) AsBasicStructuredValue() (BasicStructuredValue, bool) {
4276 return nil, false
4277 }
4278
4279
4280 func (mo MediaObject) AsResponseBase() (*ResponseBase, bool) {
4281 return nil, false
4282 }
4283
4284
4285 func (mo MediaObject) AsBasicResponseBase() (BasicResponseBase, bool) {
4286 return &mo, true
4287 }
4288
4289
4290 func (mo *MediaObject) UnmarshalJSON(body []byte) error {
4291 var m map[string]*json.RawMessage
4292 err := json.Unmarshal(body, &m)
4293 if err != nil {
4294 return err
4295 }
4296 for k, v := range m {
4297 switch k {
4298 case "contentUrl":
4299 if v != nil {
4300 var contentURL string
4301 err = json.Unmarshal(*v, &contentURL)
4302 if err != nil {
4303 return err
4304 }
4305 mo.ContentURL = &contentURL
4306 }
4307 case "hostPageUrl":
4308 if v != nil {
4309 var hostPageURL string
4310 err = json.Unmarshal(*v, &hostPageURL)
4311 if err != nil {
4312 return err
4313 }
4314 mo.HostPageURL = &hostPageURL
4315 }
4316 case "contentSize":
4317 if v != nil {
4318 var contentSize string
4319 err = json.Unmarshal(*v, &contentSize)
4320 if err != nil {
4321 return err
4322 }
4323 mo.ContentSize = &contentSize
4324 }
4325 case "encodingFormat":
4326 if v != nil {
4327 var encodingFormat string
4328 err = json.Unmarshal(*v, &encodingFormat)
4329 if err != nil {
4330 return err
4331 }
4332 mo.EncodingFormat = &encodingFormat
4333 }
4334 case "hostPageDisplayUrl":
4335 if v != nil {
4336 var hostPageDisplayURL string
4337 err = json.Unmarshal(*v, &hostPageDisplayURL)
4338 if err != nil {
4339 return err
4340 }
4341 mo.HostPageDisplayURL = &hostPageDisplayURL
4342 }
4343 case "width":
4344 if v != nil {
4345 var width int32
4346 err = json.Unmarshal(*v, &width)
4347 if err != nil {
4348 return err
4349 }
4350 mo.Width = &width
4351 }
4352 case "height":
4353 if v != nil {
4354 var height int32
4355 err = json.Unmarshal(*v, &height)
4356 if err != nil {
4357 return err
4358 }
4359 mo.Height = &height
4360 }
4361 case "thumbnailUrl":
4362 if v != nil {
4363 var thumbnailURL string
4364 err = json.Unmarshal(*v, &thumbnailURL)
4365 if err != nil {
4366 return err
4367 }
4368 mo.ThumbnailURL = &thumbnailURL
4369 }
4370 case "provider":
4371 if v != nil {
4372 provider, err := unmarshalBasicThingArray(*v)
4373 if err != nil {
4374 return err
4375 }
4376 mo.Provider = &provider
4377 }
4378 case "datePublished":
4379 if v != nil {
4380 var datePublished string
4381 err = json.Unmarshal(*v, &datePublished)
4382 if err != nil {
4383 return err
4384 }
4385 mo.DatePublished = &datePublished
4386 }
4387 case "text":
4388 if v != nil {
4389 var textVar string
4390 err = json.Unmarshal(*v, &textVar)
4391 if err != nil {
4392 return err
4393 }
4394 mo.Text = &textVar
4395 }
4396 case "name":
4397 if v != nil {
4398 var name string
4399 err = json.Unmarshal(*v, &name)
4400 if err != nil {
4401 return err
4402 }
4403 mo.Name = &name
4404 }
4405 case "url":
4406 if v != nil {
4407 var URL string
4408 err = json.Unmarshal(*v, &URL)
4409 if err != nil {
4410 return err
4411 }
4412 mo.URL = &URL
4413 }
4414 case "image":
4415 if v != nil {
4416 var imageVar ImageObject
4417 err = json.Unmarshal(*v, &imageVar)
4418 if err != nil {
4419 return err
4420 }
4421 mo.Image = &imageVar
4422 }
4423 case "description":
4424 if v != nil {
4425 var description string
4426 err = json.Unmarshal(*v, &description)
4427 if err != nil {
4428 return err
4429 }
4430 mo.Description = &description
4431 }
4432 case "alternateName":
4433 if v != nil {
4434 var alternateName string
4435 err = json.Unmarshal(*v, &alternateName)
4436 if err != nil {
4437 return err
4438 }
4439 mo.AlternateName = &alternateName
4440 }
4441 case "bingId":
4442 if v != nil {
4443 var bingID string
4444 err = json.Unmarshal(*v, &bingID)
4445 if err != nil {
4446 return err
4447 }
4448 mo.BingID = &bingID
4449 }
4450 case "readLink":
4451 if v != nil {
4452 var readLink string
4453 err = json.Unmarshal(*v, &readLink)
4454 if err != nil {
4455 return err
4456 }
4457 mo.ReadLink = &readLink
4458 }
4459 case "webSearchUrl":
4460 if v != nil {
4461 var webSearchURL string
4462 err = json.Unmarshal(*v, &webSearchURL)
4463 if err != nil {
4464 return err
4465 }
4466 mo.WebSearchURL = &webSearchURL
4467 }
4468 case "id":
4469 if v != nil {
4470 var ID string
4471 err = json.Unmarshal(*v, &ID)
4472 if err != nil {
4473 return err
4474 }
4475 mo.ID = &ID
4476 }
4477 case "_type":
4478 if v != nil {
4479 var typeVar TypeBasicResponseBase
4480 err = json.Unmarshal(*v, &typeVar)
4481 if err != nil {
4482 return err
4483 }
4484 mo.Type = typeVar
4485 }
4486 }
4487 }
4488
4489 return nil
4490 }
4491
4492
4493
4494
4495 type NormalizedRectangle struct {
4496
4497 Left *float64 `json:"left,omitempty"`
4498
4499 Top *float64 `json:"top,omitempty"`
4500
4501 Right *float64 `json:"right,omitempty"`
4502
4503 Bottom *float64 `json:"bottom,omitempty"`
4504
4505 Name *string `json:"name,omitempty"`
4506
4507 URL *string `json:"url,omitempty"`
4508
4509 Image *ImageObject `json:"image,omitempty"`
4510
4511 Description *string `json:"description,omitempty"`
4512
4513 AlternateName *string `json:"alternateName,omitempty"`
4514
4515 BingID *string `json:"bingId,omitempty"`
4516
4517 ReadLink *string `json:"readLink,omitempty"`
4518
4519 WebSearchURL *string `json:"webSearchUrl,omitempty"`
4520
4521 ID *string `json:"id,omitempty"`
4522
4523 Type TypeBasicResponseBase `json:"_type,omitempty"`
4524 }
4525
4526
4527 func (nr NormalizedRectangle) MarshalJSON() ([]byte, error) {
4528 nr.Type = TypeNormalizedRectangle
4529 objectMap := make(map[string]interface{})
4530 if nr.Left != nil {
4531 objectMap["left"] = nr.Left
4532 }
4533 if nr.Top != nil {
4534 objectMap["top"] = nr.Top
4535 }
4536 if nr.Right != nil {
4537 objectMap["right"] = nr.Right
4538 }
4539 if nr.Bottom != nil {
4540 objectMap["bottom"] = nr.Bottom
4541 }
4542 if nr.Type != "" {
4543 objectMap["_type"] = nr.Type
4544 }
4545 return json.Marshal(objectMap)
4546 }
4547
4548
4549 func (nr NormalizedRectangle) AsOrganization() (*Organization, bool) {
4550 return nil, false
4551 }
4552
4553
4554 func (nr NormalizedRectangle) AsOffer() (*Offer, bool) {
4555 return nil, false
4556 }
4557
4558
4559 func (nr NormalizedRectangle) AsBasicOffer() (BasicOffer, bool) {
4560 return nil, false
4561 }
4562
4563
4564 func (nr NormalizedRectangle) AsAggregateOffer() (*AggregateOffer, bool) {
4565 return nil, false
4566 }
4567
4568
4569 func (nr NormalizedRectangle) AsImageObject() (*ImageObject, bool) {
4570 return nil, false
4571 }
4572
4573
4574 func (nr NormalizedRectangle) AsImages() (*Images, bool) {
4575 return nil, false
4576 }
4577
4578
4579 func (nr NormalizedRectangle) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
4580 return nil, false
4581 }
4582
4583
4584 func (nr NormalizedRectangle) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
4585 return nil, false
4586 }
4587
4588
4589 func (nr NormalizedRectangle) AsAnswer() (*Answer, bool) {
4590 return nil, false
4591 }
4592
4593
4594 func (nr NormalizedRectangle) AsBasicAnswer() (BasicAnswer, bool) {
4595 return nil, false
4596 }
4597
4598
4599 func (nr NormalizedRectangle) AsMediaObject() (*MediaObject, bool) {
4600 return nil, false
4601 }
4602
4603
4604 func (nr NormalizedRectangle) AsBasicMediaObject() (BasicMediaObject, bool) {
4605 return nil, false
4606 }
4607
4608
4609 func (nr NormalizedRectangle) AsResponse() (*Response, bool) {
4610 return nil, false
4611 }
4612
4613
4614 func (nr NormalizedRectangle) AsBasicResponse() (BasicResponse, bool) {
4615 return &nr, true
4616 }
4617
4618
4619 func (nr NormalizedRectangle) AsThing() (*Thing, bool) {
4620 return nil, false
4621 }
4622
4623
4624 func (nr NormalizedRectangle) AsBasicThing() (BasicThing, bool) {
4625 return &nr, true
4626 }
4627
4628
4629 func (nr NormalizedRectangle) AsCreativeWork() (*CreativeWork, bool) {
4630 return nil, false
4631 }
4632
4633
4634 func (nr NormalizedRectangle) AsBasicCreativeWork() (BasicCreativeWork, bool) {
4635 return nil, false
4636 }
4637
4638
4639 func (nr NormalizedRectangle) AsIdentifiable() (*Identifiable, bool) {
4640 return nil, false
4641 }
4642
4643
4644 func (nr NormalizedRectangle) AsBasicIdentifiable() (BasicIdentifiable, bool) {
4645 return &nr, true
4646 }
4647
4648
4649 func (nr NormalizedRectangle) AsErrorResponse() (*ErrorResponse, bool) {
4650 return nil, false
4651 }
4652
4653
4654 func (nr NormalizedRectangle) AsImageGallery() (*ImageGallery, bool) {
4655 return nil, false
4656 }
4657
4658
4659 func (nr NormalizedRectangle) AsRecipe() (*Recipe, bool) {
4660 return nil, false
4661 }
4662
4663
4664 func (nr NormalizedRectangle) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
4665 return &nr, true
4666 }
4667
4668
4669 func (nr NormalizedRectangle) AsRecognizedEntity() (*RecognizedEntity, bool) {
4670 return nil, false
4671 }
4672
4673
4674 func (nr NormalizedRectangle) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
4675 return nil, false
4676 }
4677
4678
4679 func (nr NormalizedRectangle) AsImageInsights() (*ImageInsights, bool) {
4680 return nil, false
4681 }
4682
4683
4684 func (nr NormalizedRectangle) AsTrendingImages() (*TrendingImages, bool) {
4685 return nil, false
4686 }
4687
4688
4689 func (nr NormalizedRectangle) AsWebPage() (*WebPage, bool) {
4690 return nil, false
4691 }
4692
4693
4694 func (nr NormalizedRectangle) AsBasicWebPage() (BasicWebPage, bool) {
4695 return nil, false
4696 }
4697
4698
4699 func (nr NormalizedRectangle) AsPerson() (*Person, bool) {
4700 return nil, false
4701 }
4702
4703
4704 func (nr NormalizedRectangle) AsIntangible() (*Intangible, bool) {
4705 return nil, false
4706 }
4707
4708
4709 func (nr NormalizedRectangle) AsBasicIntangible() (BasicIntangible, bool) {
4710 return &nr, true
4711 }
4712
4713
4714 func (nr NormalizedRectangle) AsCollectionPage() (*CollectionPage, bool) {
4715 return nil, false
4716 }
4717
4718
4719 func (nr NormalizedRectangle) AsBasicCollectionPage() (BasicCollectionPage, bool) {
4720 return nil, false
4721 }
4722
4723
4724 func (nr NormalizedRectangle) AsStructuredValue() (*StructuredValue, bool) {
4725 return nil, false
4726 }
4727
4728
4729 func (nr NormalizedRectangle) AsBasicStructuredValue() (BasicStructuredValue, bool) {
4730 return &nr, true
4731 }
4732
4733
4734 func (nr NormalizedRectangle) AsResponseBase() (*ResponseBase, bool) {
4735 return nil, false
4736 }
4737
4738
4739 func (nr NormalizedRectangle) AsBasicResponseBase() (BasicResponseBase, bool) {
4740 return &nr, true
4741 }
4742
4743
4744 type BasicOffer interface {
4745 AsAggregateOffer() (*AggregateOffer, bool)
4746 AsOffer() (*Offer, bool)
4747 }
4748
4749
4750 type Offer struct {
4751
4752 Seller *Organization `json:"seller,omitempty"`
4753
4754 Price *float64 `json:"price,omitempty"`
4755
4756 PriceCurrency Currency `json:"priceCurrency,omitempty"`
4757
4758 Availability ItemAvailability `json:"availability,omitempty"`
4759
4760 AggregateRating *AggregateRating `json:"aggregateRating,omitempty"`
4761
4762 LastUpdated *string `json:"lastUpdated,omitempty"`
4763
4764 Name *string `json:"name,omitempty"`
4765
4766 URL *string `json:"url,omitempty"`
4767
4768 Image *ImageObject `json:"image,omitempty"`
4769
4770 Description *string `json:"description,omitempty"`
4771
4772 AlternateName *string `json:"alternateName,omitempty"`
4773
4774 BingID *string `json:"bingId,omitempty"`
4775
4776 ReadLink *string `json:"readLink,omitempty"`
4777
4778 WebSearchURL *string `json:"webSearchUrl,omitempty"`
4779
4780 ID *string `json:"id,omitempty"`
4781
4782 Type TypeBasicResponseBase `json:"_type,omitempty"`
4783 }
4784
4785 func unmarshalBasicOffer(body []byte) (BasicOffer, error) {
4786 var m map[string]interface{}
4787 err := json.Unmarshal(body, &m)
4788 if err != nil {
4789 return nil, err
4790 }
4791
4792 switch m["_type"] {
4793 case string(TypeAggregateOffer):
4794 var ao AggregateOffer
4795 err := json.Unmarshal(body, &ao)
4796 return ao, err
4797 default:
4798 var o Offer
4799 err := json.Unmarshal(body, &o)
4800 return o, err
4801 }
4802 }
4803 func unmarshalBasicOfferArray(body []byte) ([]BasicOffer, error) {
4804 var rawMessages []*json.RawMessage
4805 err := json.Unmarshal(body, &rawMessages)
4806 if err != nil {
4807 return nil, err
4808 }
4809
4810 oArray := make([]BasicOffer, len(rawMessages))
4811
4812 for index, rawMessage := range rawMessages {
4813 o, err := unmarshalBasicOffer(*rawMessage)
4814 if err != nil {
4815 return nil, err
4816 }
4817 oArray[index] = o
4818 }
4819 return oArray, nil
4820 }
4821
4822
4823 func (o Offer) MarshalJSON() ([]byte, error) {
4824 o.Type = TypeOffer
4825 objectMap := make(map[string]interface{})
4826 if o.Type != "" {
4827 objectMap["_type"] = o.Type
4828 }
4829 return json.Marshal(objectMap)
4830 }
4831
4832
4833 func (o Offer) AsOrganization() (*Organization, bool) {
4834 return nil, false
4835 }
4836
4837
4838 func (o Offer) AsOffer() (*Offer, bool) {
4839 return &o, true
4840 }
4841
4842
4843 func (o Offer) AsBasicOffer() (BasicOffer, bool) {
4844 return &o, true
4845 }
4846
4847
4848 func (o Offer) AsAggregateOffer() (*AggregateOffer, bool) {
4849 return nil, false
4850 }
4851
4852
4853 func (o Offer) AsImageObject() (*ImageObject, bool) {
4854 return nil, false
4855 }
4856
4857
4858 func (o Offer) AsImages() (*Images, bool) {
4859 return nil, false
4860 }
4861
4862
4863 func (o Offer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
4864 return nil, false
4865 }
4866
4867
4868 func (o Offer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
4869 return nil, false
4870 }
4871
4872
4873 func (o Offer) AsAnswer() (*Answer, bool) {
4874 return nil, false
4875 }
4876
4877
4878 func (o Offer) AsBasicAnswer() (BasicAnswer, bool) {
4879 return nil, false
4880 }
4881
4882
4883 func (o Offer) AsMediaObject() (*MediaObject, bool) {
4884 return nil, false
4885 }
4886
4887
4888 func (o Offer) AsBasicMediaObject() (BasicMediaObject, bool) {
4889 return nil, false
4890 }
4891
4892
4893 func (o Offer) AsResponse() (*Response, bool) {
4894 return nil, false
4895 }
4896
4897
4898 func (o Offer) AsBasicResponse() (BasicResponse, bool) {
4899 return &o, true
4900 }
4901
4902
4903 func (o Offer) AsThing() (*Thing, bool) {
4904 return nil, false
4905 }
4906
4907
4908 func (o Offer) AsBasicThing() (BasicThing, bool) {
4909 return &o, true
4910 }
4911
4912
4913 func (o Offer) AsCreativeWork() (*CreativeWork, bool) {
4914 return nil, false
4915 }
4916
4917
4918 func (o Offer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
4919 return nil, false
4920 }
4921
4922
4923 func (o Offer) AsIdentifiable() (*Identifiable, bool) {
4924 return nil, false
4925 }
4926
4927
4928 func (o Offer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
4929 return &o, true
4930 }
4931
4932
4933 func (o Offer) AsErrorResponse() (*ErrorResponse, bool) {
4934 return nil, false
4935 }
4936
4937
4938 func (o Offer) AsImageGallery() (*ImageGallery, bool) {
4939 return nil, false
4940 }
4941
4942
4943 func (o Offer) AsRecipe() (*Recipe, bool) {
4944 return nil, false
4945 }
4946
4947
4948 func (o Offer) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
4949 return nil, false
4950 }
4951
4952
4953 func (o Offer) AsRecognizedEntity() (*RecognizedEntity, bool) {
4954 return nil, false
4955 }
4956
4957
4958 func (o Offer) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
4959 return nil, false
4960 }
4961
4962
4963 func (o Offer) AsImageInsights() (*ImageInsights, bool) {
4964 return nil, false
4965 }
4966
4967
4968 func (o Offer) AsTrendingImages() (*TrendingImages, bool) {
4969 return nil, false
4970 }
4971
4972
4973 func (o Offer) AsWebPage() (*WebPage, bool) {
4974 return nil, false
4975 }
4976
4977
4978 func (o Offer) AsBasicWebPage() (BasicWebPage, bool) {
4979 return nil, false
4980 }
4981
4982
4983 func (o Offer) AsPerson() (*Person, bool) {
4984 return nil, false
4985 }
4986
4987
4988 func (o Offer) AsIntangible() (*Intangible, bool) {
4989 return nil, false
4990 }
4991
4992
4993 func (o Offer) AsBasicIntangible() (BasicIntangible, bool) {
4994 return nil, false
4995 }
4996
4997
4998 func (o Offer) AsCollectionPage() (*CollectionPage, bool) {
4999 return nil, false
5000 }
5001
5002
5003 func (o Offer) AsBasicCollectionPage() (BasicCollectionPage, bool) {
5004 return nil, false
5005 }
5006
5007
5008 func (o Offer) AsStructuredValue() (*StructuredValue, bool) {
5009 return nil, false
5010 }
5011
5012
5013 func (o Offer) AsBasicStructuredValue() (BasicStructuredValue, bool) {
5014 return nil, false
5015 }
5016
5017
5018 func (o Offer) AsResponseBase() (*ResponseBase, bool) {
5019 return nil, false
5020 }
5021
5022
5023 func (o Offer) AsBasicResponseBase() (BasicResponseBase, bool) {
5024 return &o, true
5025 }
5026
5027
5028 type Organization struct {
5029
5030 Name *string `json:"name,omitempty"`
5031
5032 URL *string `json:"url,omitempty"`
5033
5034 Image *ImageObject `json:"image,omitempty"`
5035
5036 Description *string `json:"description,omitempty"`
5037
5038 AlternateName *string `json:"alternateName,omitempty"`
5039
5040 BingID *string `json:"bingId,omitempty"`
5041
5042 ReadLink *string `json:"readLink,omitempty"`
5043
5044 WebSearchURL *string `json:"webSearchUrl,omitempty"`
5045
5046 ID *string `json:"id,omitempty"`
5047
5048 Type TypeBasicResponseBase `json:"_type,omitempty"`
5049 }
5050
5051
5052 func (o Organization) MarshalJSON() ([]byte, error) {
5053 o.Type = TypeOrganization
5054 objectMap := make(map[string]interface{})
5055 if o.Type != "" {
5056 objectMap["_type"] = o.Type
5057 }
5058 return json.Marshal(objectMap)
5059 }
5060
5061
5062 func (o Organization) AsOrganization() (*Organization, bool) {
5063 return &o, true
5064 }
5065
5066
5067 func (o Organization) AsOffer() (*Offer, bool) {
5068 return nil, false
5069 }
5070
5071
5072 func (o Organization) AsBasicOffer() (BasicOffer, bool) {
5073 return nil, false
5074 }
5075
5076
5077 func (o Organization) AsAggregateOffer() (*AggregateOffer, bool) {
5078 return nil, false
5079 }
5080
5081
5082 func (o Organization) AsImageObject() (*ImageObject, bool) {
5083 return nil, false
5084 }
5085
5086
5087 func (o Organization) AsImages() (*Images, bool) {
5088 return nil, false
5089 }
5090
5091
5092 func (o Organization) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
5093 return nil, false
5094 }
5095
5096
5097 func (o Organization) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
5098 return nil, false
5099 }
5100
5101
5102 func (o Organization) AsAnswer() (*Answer, bool) {
5103 return nil, false
5104 }
5105
5106
5107 func (o Organization) AsBasicAnswer() (BasicAnswer, bool) {
5108 return nil, false
5109 }
5110
5111
5112 func (o Organization) AsMediaObject() (*MediaObject, bool) {
5113 return nil, false
5114 }
5115
5116
5117 func (o Organization) AsBasicMediaObject() (BasicMediaObject, bool) {
5118 return nil, false
5119 }
5120
5121
5122 func (o Organization) AsResponse() (*Response, bool) {
5123 return nil, false
5124 }
5125
5126
5127 func (o Organization) AsBasicResponse() (BasicResponse, bool) {
5128 return &o, true
5129 }
5130
5131
5132 func (o Organization) AsThing() (*Thing, bool) {
5133 return nil, false
5134 }
5135
5136
5137 func (o Organization) AsBasicThing() (BasicThing, bool) {
5138 return &o, true
5139 }
5140
5141
5142 func (o Organization) AsCreativeWork() (*CreativeWork, bool) {
5143 return nil, false
5144 }
5145
5146
5147 func (o Organization) AsBasicCreativeWork() (BasicCreativeWork, bool) {
5148 return nil, false
5149 }
5150
5151
5152 func (o Organization) AsIdentifiable() (*Identifiable, bool) {
5153 return nil, false
5154 }
5155
5156
5157 func (o Organization) AsBasicIdentifiable() (BasicIdentifiable, bool) {
5158 return &o, true
5159 }
5160
5161
5162 func (o Organization) AsErrorResponse() (*ErrorResponse, bool) {
5163 return nil, false
5164 }
5165
5166
5167 func (o Organization) AsImageGallery() (*ImageGallery, bool) {
5168 return nil, false
5169 }
5170
5171
5172 func (o Organization) AsRecipe() (*Recipe, bool) {
5173 return nil, false
5174 }
5175
5176
5177 func (o Organization) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
5178 return nil, false
5179 }
5180
5181
5182 func (o Organization) AsRecognizedEntity() (*RecognizedEntity, bool) {
5183 return nil, false
5184 }
5185
5186
5187 func (o Organization) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
5188 return nil, false
5189 }
5190
5191
5192 func (o Organization) AsImageInsights() (*ImageInsights, bool) {
5193 return nil, false
5194 }
5195
5196
5197 func (o Organization) AsTrendingImages() (*TrendingImages, bool) {
5198 return nil, false
5199 }
5200
5201
5202 func (o Organization) AsWebPage() (*WebPage, bool) {
5203 return nil, false
5204 }
5205
5206
5207 func (o Organization) AsBasicWebPage() (BasicWebPage, bool) {
5208 return nil, false
5209 }
5210
5211
5212 func (o Organization) AsPerson() (*Person, bool) {
5213 return nil, false
5214 }
5215
5216
5217 func (o Organization) AsIntangible() (*Intangible, bool) {
5218 return nil, false
5219 }
5220
5221
5222 func (o Organization) AsBasicIntangible() (BasicIntangible, bool) {
5223 return nil, false
5224 }
5225
5226
5227 func (o Organization) AsCollectionPage() (*CollectionPage, bool) {
5228 return nil, false
5229 }
5230
5231
5232 func (o Organization) AsBasicCollectionPage() (BasicCollectionPage, bool) {
5233 return nil, false
5234 }
5235
5236
5237 func (o Organization) AsStructuredValue() (*StructuredValue, bool) {
5238 return nil, false
5239 }
5240
5241
5242 func (o Organization) AsBasicStructuredValue() (BasicStructuredValue, bool) {
5243 return nil, false
5244 }
5245
5246
5247 func (o Organization) AsResponseBase() (*ResponseBase, bool) {
5248 return nil, false
5249 }
5250
5251
5252 func (o Organization) AsBasicResponseBase() (BasicResponseBase, bool) {
5253 return &o, true
5254 }
5255
5256
5257 type Person struct {
5258
5259 JobTitle *string `json:"jobTitle,omitempty"`
5260
5261 TwitterProfile *string `json:"twitterProfile,omitempty"`
5262
5263 Name *string `json:"name,omitempty"`
5264
5265 URL *string `json:"url,omitempty"`
5266
5267 Image *ImageObject `json:"image,omitempty"`
5268
5269 Description *string `json:"description,omitempty"`
5270
5271 AlternateName *string `json:"alternateName,omitempty"`
5272
5273 BingID *string `json:"bingId,omitempty"`
5274
5275 ReadLink *string `json:"readLink,omitempty"`
5276
5277 WebSearchURL *string `json:"webSearchUrl,omitempty"`
5278
5279 ID *string `json:"id,omitempty"`
5280
5281 Type TypeBasicResponseBase `json:"_type,omitempty"`
5282 }
5283
5284
5285 func (p Person) MarshalJSON() ([]byte, error) {
5286 p.Type = TypePerson
5287 objectMap := make(map[string]interface{})
5288 if p.Type != "" {
5289 objectMap["_type"] = p.Type
5290 }
5291 return json.Marshal(objectMap)
5292 }
5293
5294
5295 func (p Person) AsOrganization() (*Organization, bool) {
5296 return nil, false
5297 }
5298
5299
5300 func (p Person) AsOffer() (*Offer, bool) {
5301 return nil, false
5302 }
5303
5304
5305 func (p Person) AsBasicOffer() (BasicOffer, bool) {
5306 return nil, false
5307 }
5308
5309
5310 func (p Person) AsAggregateOffer() (*AggregateOffer, bool) {
5311 return nil, false
5312 }
5313
5314
5315 func (p Person) AsImageObject() (*ImageObject, bool) {
5316 return nil, false
5317 }
5318
5319
5320 func (p Person) AsImages() (*Images, bool) {
5321 return nil, false
5322 }
5323
5324
5325 func (p Person) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
5326 return nil, false
5327 }
5328
5329
5330 func (p Person) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
5331 return nil, false
5332 }
5333
5334
5335 func (p Person) AsAnswer() (*Answer, bool) {
5336 return nil, false
5337 }
5338
5339
5340 func (p Person) AsBasicAnswer() (BasicAnswer, bool) {
5341 return nil, false
5342 }
5343
5344
5345 func (p Person) AsMediaObject() (*MediaObject, bool) {
5346 return nil, false
5347 }
5348
5349
5350 func (p Person) AsBasicMediaObject() (BasicMediaObject, bool) {
5351 return nil, false
5352 }
5353
5354
5355 func (p Person) AsResponse() (*Response, bool) {
5356 return nil, false
5357 }
5358
5359
5360 func (p Person) AsBasicResponse() (BasicResponse, bool) {
5361 return &p, true
5362 }
5363
5364
5365 func (p Person) AsThing() (*Thing, bool) {
5366 return nil, false
5367 }
5368
5369
5370 func (p Person) AsBasicThing() (BasicThing, bool) {
5371 return &p, true
5372 }
5373
5374
5375 func (p Person) AsCreativeWork() (*CreativeWork, bool) {
5376 return nil, false
5377 }
5378
5379
5380 func (p Person) AsBasicCreativeWork() (BasicCreativeWork, bool) {
5381 return nil, false
5382 }
5383
5384
5385 func (p Person) AsIdentifiable() (*Identifiable, bool) {
5386 return nil, false
5387 }
5388
5389
5390 func (p Person) AsBasicIdentifiable() (BasicIdentifiable, bool) {
5391 return &p, true
5392 }
5393
5394
5395 func (p Person) AsErrorResponse() (*ErrorResponse, bool) {
5396 return nil, false
5397 }
5398
5399
5400 func (p Person) AsImageGallery() (*ImageGallery, bool) {
5401 return nil, false
5402 }
5403
5404
5405 func (p Person) AsRecipe() (*Recipe, bool) {
5406 return nil, false
5407 }
5408
5409
5410 func (p Person) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
5411 return nil, false
5412 }
5413
5414
5415 func (p Person) AsRecognizedEntity() (*RecognizedEntity, bool) {
5416 return nil, false
5417 }
5418
5419
5420 func (p Person) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
5421 return nil, false
5422 }
5423
5424
5425 func (p Person) AsImageInsights() (*ImageInsights, bool) {
5426 return nil, false
5427 }
5428
5429
5430 func (p Person) AsTrendingImages() (*TrendingImages, bool) {
5431 return nil, false
5432 }
5433
5434
5435 func (p Person) AsWebPage() (*WebPage, bool) {
5436 return nil, false
5437 }
5438
5439
5440 func (p Person) AsBasicWebPage() (BasicWebPage, bool) {
5441 return nil, false
5442 }
5443
5444
5445 func (p Person) AsPerson() (*Person, bool) {
5446 return &p, true
5447 }
5448
5449
5450 func (p Person) AsIntangible() (*Intangible, bool) {
5451 return nil, false
5452 }
5453
5454
5455 func (p Person) AsBasicIntangible() (BasicIntangible, bool) {
5456 return nil, false
5457 }
5458
5459
5460 func (p Person) AsCollectionPage() (*CollectionPage, bool) {
5461 return nil, false
5462 }
5463
5464
5465 func (p Person) AsBasicCollectionPage() (BasicCollectionPage, bool) {
5466 return nil, false
5467 }
5468
5469
5470 func (p Person) AsStructuredValue() (*StructuredValue, bool) {
5471 return nil, false
5472 }
5473
5474
5475 func (p Person) AsBasicStructuredValue() (BasicStructuredValue, bool) {
5476 return nil, false
5477 }
5478
5479
5480 func (p Person) AsResponseBase() (*ResponseBase, bool) {
5481 return nil, false
5482 }
5483
5484
5485 func (p Person) AsBasicResponseBase() (BasicResponseBase, bool) {
5486 return &p, true
5487 }
5488
5489
5490 type PivotSuggestions struct {
5491
5492 Pivot *string `json:"pivot,omitempty"`
5493
5494 Suggestions *[]Query `json:"suggestions,omitempty"`
5495 }
5496
5497
5498 type BasicPropertiesItem interface {
5499 AsAggregateRating() (*AggregateRating, bool)
5500 AsRating() (*Rating, bool)
5501 AsBasicRating() (BasicRating, bool)
5502 AsPropertiesItem() (*PropertiesItem, bool)
5503 }
5504
5505
5506 type PropertiesItem struct {
5507
5508 Text *string `json:"text,omitempty"`
5509
5510 Type Type `json:"_type,omitempty"`
5511 }
5512
5513 func unmarshalBasicPropertiesItem(body []byte) (BasicPropertiesItem, error) {
5514 var m map[string]interface{}
5515 err := json.Unmarshal(body, &m)
5516 if err != nil {
5517 return nil, err
5518 }
5519
5520 switch m["_type"] {
5521 case string(TypeAggregateRating):
5522 var ar AggregateRating
5523 err := json.Unmarshal(body, &ar)
5524 return ar, err
5525 case string(TypeRating):
5526 var r Rating
5527 err := json.Unmarshal(body, &r)
5528 return r, err
5529 default:
5530 var pi PropertiesItem
5531 err := json.Unmarshal(body, &pi)
5532 return pi, err
5533 }
5534 }
5535 func unmarshalBasicPropertiesItemArray(body []byte) ([]BasicPropertiesItem, error) {
5536 var rawMessages []*json.RawMessage
5537 err := json.Unmarshal(body, &rawMessages)
5538 if err != nil {
5539 return nil, err
5540 }
5541
5542 piArray := make([]BasicPropertiesItem, len(rawMessages))
5543
5544 for index, rawMessage := range rawMessages {
5545 pi, err := unmarshalBasicPropertiesItem(*rawMessage)
5546 if err != nil {
5547 return nil, err
5548 }
5549 piArray[index] = pi
5550 }
5551 return piArray, nil
5552 }
5553
5554
5555 func (pi PropertiesItem) MarshalJSON() ([]byte, error) {
5556 pi.Type = TypePropertiesItem
5557 objectMap := make(map[string]interface{})
5558 if pi.Type != "" {
5559 objectMap["_type"] = pi.Type
5560 }
5561 return json.Marshal(objectMap)
5562 }
5563
5564
5565 func (pi PropertiesItem) AsAggregateRating() (*AggregateRating, bool) {
5566 return nil, false
5567 }
5568
5569
5570 func (pi PropertiesItem) AsRating() (*Rating, bool) {
5571 return nil, false
5572 }
5573
5574
5575 func (pi PropertiesItem) AsBasicRating() (BasicRating, bool) {
5576 return nil, false
5577 }
5578
5579
5580 func (pi PropertiesItem) AsPropertiesItem() (*PropertiesItem, bool) {
5581 return &pi, true
5582 }
5583
5584
5585 func (pi PropertiesItem) AsBasicPropertiesItem() (BasicPropertiesItem, bool) {
5586 return &pi, true
5587 }
5588
5589
5590 type Query struct {
5591
5592 Text *string `json:"text,omitempty"`
5593
5594 DisplayText *string `json:"displayText,omitempty"`
5595
5596 WebSearchURL *string `json:"webSearchUrl,omitempty"`
5597
5598 SearchLink *string `json:"searchLink,omitempty"`
5599
5600 Thumbnail *ImageObject `json:"thumbnail,omitempty"`
5601 }
5602
5603
5604 func (q Query) MarshalJSON() ([]byte, error) {
5605 objectMap := make(map[string]interface{})
5606 if q.Text != nil {
5607 objectMap["text"] = q.Text
5608 }
5609 return json.Marshal(objectMap)
5610 }
5611
5612
5613 type BasicRating interface {
5614 AsAggregateRating() (*AggregateRating, bool)
5615 AsRating() (*Rating, bool)
5616 }
5617
5618
5619 type Rating struct {
5620
5621 RatingValue *float64 `json:"ratingValue,omitempty"`
5622
5623 BestRating *float64 `json:"bestRating,omitempty"`
5624
5625 Text *string `json:"text,omitempty"`
5626
5627 Type Type `json:"_type,omitempty"`
5628 }
5629
5630 func unmarshalBasicRating(body []byte) (BasicRating, error) {
5631 var m map[string]interface{}
5632 err := json.Unmarshal(body, &m)
5633 if err != nil {
5634 return nil, err
5635 }
5636
5637 switch m["_type"] {
5638 case string(TypeAggregateRating):
5639 var ar AggregateRating
5640 err := json.Unmarshal(body, &ar)
5641 return ar, err
5642 default:
5643 var r Rating
5644 err := json.Unmarshal(body, &r)
5645 return r, err
5646 }
5647 }
5648 func unmarshalBasicRatingArray(body []byte) ([]BasicRating, error) {
5649 var rawMessages []*json.RawMessage
5650 err := json.Unmarshal(body, &rawMessages)
5651 if err != nil {
5652 return nil, err
5653 }
5654
5655 rArray := make([]BasicRating, len(rawMessages))
5656
5657 for index, rawMessage := range rawMessages {
5658 r, err := unmarshalBasicRating(*rawMessage)
5659 if err != nil {
5660 return nil, err
5661 }
5662 rArray[index] = r
5663 }
5664 return rArray, nil
5665 }
5666
5667
5668 func (r Rating) MarshalJSON() ([]byte, error) {
5669 r.Type = TypeRating
5670 objectMap := make(map[string]interface{})
5671 if r.RatingValue != nil {
5672 objectMap["ratingValue"] = r.RatingValue
5673 }
5674 if r.Type != "" {
5675 objectMap["_type"] = r.Type
5676 }
5677 return json.Marshal(objectMap)
5678 }
5679
5680
5681 func (r Rating) AsAggregateRating() (*AggregateRating, bool) {
5682 return nil, false
5683 }
5684
5685
5686 func (r Rating) AsRating() (*Rating, bool) {
5687 return &r, true
5688 }
5689
5690
5691 func (r Rating) AsBasicRating() (BasicRating, bool) {
5692 return &r, true
5693 }
5694
5695
5696 func (r Rating) AsPropertiesItem() (*PropertiesItem, bool) {
5697 return nil, false
5698 }
5699
5700
5701 func (r Rating) AsBasicPropertiesItem() (BasicPropertiesItem, bool) {
5702 return &r, true
5703 }
5704
5705
5706 type Recipe struct {
5707
5708 CookTime *string `json:"cookTime,omitempty"`
5709
5710 PrepTime *string `json:"prepTime,omitempty"`
5711
5712 TotalTime *string `json:"totalTime,omitempty"`
5713
5714 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
5715
5716 Provider *[]BasicThing `json:"provider,omitempty"`
5717
5718 DatePublished *string `json:"datePublished,omitempty"`
5719
5720 Text *string `json:"text,omitempty"`
5721
5722 Name *string `json:"name,omitempty"`
5723
5724 URL *string `json:"url,omitempty"`
5725
5726 Image *ImageObject `json:"image,omitempty"`
5727
5728 Description *string `json:"description,omitempty"`
5729
5730 AlternateName *string `json:"alternateName,omitempty"`
5731
5732 BingID *string `json:"bingId,omitempty"`
5733
5734 ReadLink *string `json:"readLink,omitempty"`
5735
5736 WebSearchURL *string `json:"webSearchUrl,omitempty"`
5737
5738 ID *string `json:"id,omitempty"`
5739
5740 Type TypeBasicResponseBase `json:"_type,omitempty"`
5741 }
5742
5743
5744 func (r Recipe) MarshalJSON() ([]byte, error) {
5745 r.Type = TypeRecipe
5746 objectMap := make(map[string]interface{})
5747 if r.Type != "" {
5748 objectMap["_type"] = r.Type
5749 }
5750 return json.Marshal(objectMap)
5751 }
5752
5753
5754 func (r Recipe) AsOrganization() (*Organization, bool) {
5755 return nil, false
5756 }
5757
5758
5759 func (r Recipe) AsOffer() (*Offer, bool) {
5760 return nil, false
5761 }
5762
5763
5764 func (r Recipe) AsBasicOffer() (BasicOffer, bool) {
5765 return nil, false
5766 }
5767
5768
5769 func (r Recipe) AsAggregateOffer() (*AggregateOffer, bool) {
5770 return nil, false
5771 }
5772
5773
5774 func (r Recipe) AsImageObject() (*ImageObject, bool) {
5775 return nil, false
5776 }
5777
5778
5779 func (r Recipe) AsImages() (*Images, bool) {
5780 return nil, false
5781 }
5782
5783
5784 func (r Recipe) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
5785 return nil, false
5786 }
5787
5788
5789 func (r Recipe) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
5790 return nil, false
5791 }
5792
5793
5794 func (r Recipe) AsAnswer() (*Answer, bool) {
5795 return nil, false
5796 }
5797
5798
5799 func (r Recipe) AsBasicAnswer() (BasicAnswer, bool) {
5800 return nil, false
5801 }
5802
5803
5804 func (r Recipe) AsMediaObject() (*MediaObject, bool) {
5805 return nil, false
5806 }
5807
5808
5809 func (r Recipe) AsBasicMediaObject() (BasicMediaObject, bool) {
5810 return nil, false
5811 }
5812
5813
5814 func (r Recipe) AsResponse() (*Response, bool) {
5815 return nil, false
5816 }
5817
5818
5819 func (r Recipe) AsBasicResponse() (BasicResponse, bool) {
5820 return &r, true
5821 }
5822
5823
5824 func (r Recipe) AsThing() (*Thing, bool) {
5825 return nil, false
5826 }
5827
5828
5829 func (r Recipe) AsBasicThing() (BasicThing, bool) {
5830 return &r, true
5831 }
5832
5833
5834 func (r Recipe) AsCreativeWork() (*CreativeWork, bool) {
5835 return nil, false
5836 }
5837
5838
5839 func (r Recipe) AsBasicCreativeWork() (BasicCreativeWork, bool) {
5840 return &r, true
5841 }
5842
5843
5844 func (r Recipe) AsIdentifiable() (*Identifiable, bool) {
5845 return nil, false
5846 }
5847
5848
5849 func (r Recipe) AsBasicIdentifiable() (BasicIdentifiable, bool) {
5850 return &r, true
5851 }
5852
5853
5854 func (r Recipe) AsErrorResponse() (*ErrorResponse, bool) {
5855 return nil, false
5856 }
5857
5858
5859 func (r Recipe) AsImageGallery() (*ImageGallery, bool) {
5860 return nil, false
5861 }
5862
5863
5864 func (r Recipe) AsRecipe() (*Recipe, bool) {
5865 return &r, true
5866 }
5867
5868
5869 func (r Recipe) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
5870 return nil, false
5871 }
5872
5873
5874 func (r Recipe) AsRecognizedEntity() (*RecognizedEntity, bool) {
5875 return nil, false
5876 }
5877
5878
5879 func (r Recipe) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
5880 return nil, false
5881 }
5882
5883
5884 func (r Recipe) AsImageInsights() (*ImageInsights, bool) {
5885 return nil, false
5886 }
5887
5888
5889 func (r Recipe) AsTrendingImages() (*TrendingImages, bool) {
5890 return nil, false
5891 }
5892
5893
5894 func (r Recipe) AsWebPage() (*WebPage, bool) {
5895 return nil, false
5896 }
5897
5898
5899 func (r Recipe) AsBasicWebPage() (BasicWebPage, bool) {
5900 return nil, false
5901 }
5902
5903
5904 func (r Recipe) AsPerson() (*Person, bool) {
5905 return nil, false
5906 }
5907
5908
5909 func (r Recipe) AsIntangible() (*Intangible, bool) {
5910 return nil, false
5911 }
5912
5913
5914 func (r Recipe) AsBasicIntangible() (BasicIntangible, bool) {
5915 return nil, false
5916 }
5917
5918
5919 func (r Recipe) AsCollectionPage() (*CollectionPage, bool) {
5920 return nil, false
5921 }
5922
5923
5924 func (r Recipe) AsBasicCollectionPage() (BasicCollectionPage, bool) {
5925 return nil, false
5926 }
5927
5928
5929 func (r Recipe) AsStructuredValue() (*StructuredValue, bool) {
5930 return nil, false
5931 }
5932
5933
5934 func (r Recipe) AsBasicStructuredValue() (BasicStructuredValue, bool) {
5935 return nil, false
5936 }
5937
5938
5939 func (r Recipe) AsResponseBase() (*ResponseBase, bool) {
5940 return nil, false
5941 }
5942
5943
5944 func (r Recipe) AsBasicResponseBase() (BasicResponseBase, bool) {
5945 return &r, true
5946 }
5947
5948
5949 func (r *Recipe) UnmarshalJSON(body []byte) error {
5950 var m map[string]*json.RawMessage
5951 err := json.Unmarshal(body, &m)
5952 if err != nil {
5953 return err
5954 }
5955 for k, v := range m {
5956 switch k {
5957 case "cookTime":
5958 if v != nil {
5959 var cookTime string
5960 err = json.Unmarshal(*v, &cookTime)
5961 if err != nil {
5962 return err
5963 }
5964 r.CookTime = &cookTime
5965 }
5966 case "prepTime":
5967 if v != nil {
5968 var prepTime string
5969 err = json.Unmarshal(*v, &prepTime)
5970 if err != nil {
5971 return err
5972 }
5973 r.PrepTime = &prepTime
5974 }
5975 case "totalTime":
5976 if v != nil {
5977 var totalTime string
5978 err = json.Unmarshal(*v, &totalTime)
5979 if err != nil {
5980 return err
5981 }
5982 r.TotalTime = &totalTime
5983 }
5984 case "thumbnailUrl":
5985 if v != nil {
5986 var thumbnailURL string
5987 err = json.Unmarshal(*v, &thumbnailURL)
5988 if err != nil {
5989 return err
5990 }
5991 r.ThumbnailURL = &thumbnailURL
5992 }
5993 case "provider":
5994 if v != nil {
5995 provider, err := unmarshalBasicThingArray(*v)
5996 if err != nil {
5997 return err
5998 }
5999 r.Provider = &provider
6000 }
6001 case "datePublished":
6002 if v != nil {
6003 var datePublished string
6004 err = json.Unmarshal(*v, &datePublished)
6005 if err != nil {
6006 return err
6007 }
6008 r.DatePublished = &datePublished
6009 }
6010 case "text":
6011 if v != nil {
6012 var textVar string
6013 err = json.Unmarshal(*v, &textVar)
6014 if err != nil {
6015 return err
6016 }
6017 r.Text = &textVar
6018 }
6019 case "name":
6020 if v != nil {
6021 var name string
6022 err = json.Unmarshal(*v, &name)
6023 if err != nil {
6024 return err
6025 }
6026 r.Name = &name
6027 }
6028 case "url":
6029 if v != nil {
6030 var URL string
6031 err = json.Unmarshal(*v, &URL)
6032 if err != nil {
6033 return err
6034 }
6035 r.URL = &URL
6036 }
6037 case "image":
6038 if v != nil {
6039 var imageVar ImageObject
6040 err = json.Unmarshal(*v, &imageVar)
6041 if err != nil {
6042 return err
6043 }
6044 r.Image = &imageVar
6045 }
6046 case "description":
6047 if v != nil {
6048 var description string
6049 err = json.Unmarshal(*v, &description)
6050 if err != nil {
6051 return err
6052 }
6053 r.Description = &description
6054 }
6055 case "alternateName":
6056 if v != nil {
6057 var alternateName string
6058 err = json.Unmarshal(*v, &alternateName)
6059 if err != nil {
6060 return err
6061 }
6062 r.AlternateName = &alternateName
6063 }
6064 case "bingId":
6065 if v != nil {
6066 var bingID string
6067 err = json.Unmarshal(*v, &bingID)
6068 if err != nil {
6069 return err
6070 }
6071 r.BingID = &bingID
6072 }
6073 case "readLink":
6074 if v != nil {
6075 var readLink string
6076 err = json.Unmarshal(*v, &readLink)
6077 if err != nil {
6078 return err
6079 }
6080 r.ReadLink = &readLink
6081 }
6082 case "webSearchUrl":
6083 if v != nil {
6084 var webSearchURL string
6085 err = json.Unmarshal(*v, &webSearchURL)
6086 if err != nil {
6087 return err
6088 }
6089 r.WebSearchURL = &webSearchURL
6090 }
6091 case "id":
6092 if v != nil {
6093 var ID string
6094 err = json.Unmarshal(*v, &ID)
6095 if err != nil {
6096 return err
6097 }
6098 r.ID = &ID
6099 }
6100 case "_type":
6101 if v != nil {
6102 var typeVar TypeBasicResponseBase
6103 err = json.Unmarshal(*v, &typeVar)
6104 if err != nil {
6105 return err
6106 }
6107 r.Type = typeVar
6108 }
6109 }
6110 }
6111
6112 return nil
6113 }
6114
6115
6116 type RecipesModule struct {
6117
6118 Value *[]Recipe `json:"value,omitempty"`
6119 }
6120
6121
6122 func (rm RecipesModule) MarshalJSON() ([]byte, error) {
6123 objectMap := make(map[string]interface{})
6124 return json.Marshal(objectMap)
6125 }
6126
6127
6128 type RecognizedEntitiesModule struct {
6129
6130 Value *[]RecognizedEntityGroup `json:"value,omitempty"`
6131 }
6132
6133
6134 func (rem RecognizedEntitiesModule) MarshalJSON() ([]byte, error) {
6135 objectMap := make(map[string]interface{})
6136 return json.Marshal(objectMap)
6137 }
6138
6139
6140 type RecognizedEntity struct {
6141
6142 Entity BasicThing `json:"entity,omitempty"`
6143
6144 MatchConfidence *float64 `json:"matchConfidence,omitempty"`
6145
6146 ReadLink *string `json:"readLink,omitempty"`
6147
6148 WebSearchURL *string `json:"webSearchUrl,omitempty"`
6149
6150 ID *string `json:"id,omitempty"`
6151
6152 Type TypeBasicResponseBase `json:"_type,omitempty"`
6153 }
6154
6155
6156 func (re RecognizedEntity) MarshalJSON() ([]byte, error) {
6157 re.Type = TypeRecognizedEntity
6158 objectMap := make(map[string]interface{})
6159 if re.Type != "" {
6160 objectMap["_type"] = re.Type
6161 }
6162 return json.Marshal(objectMap)
6163 }
6164
6165
6166 func (re RecognizedEntity) AsOrganization() (*Organization, bool) {
6167 return nil, false
6168 }
6169
6170
6171 func (re RecognizedEntity) AsOffer() (*Offer, bool) {
6172 return nil, false
6173 }
6174
6175
6176 func (re RecognizedEntity) AsBasicOffer() (BasicOffer, bool) {
6177 return nil, false
6178 }
6179
6180
6181 func (re RecognizedEntity) AsAggregateOffer() (*AggregateOffer, bool) {
6182 return nil, false
6183 }
6184
6185
6186 func (re RecognizedEntity) AsImageObject() (*ImageObject, bool) {
6187 return nil, false
6188 }
6189
6190
6191 func (re RecognizedEntity) AsImages() (*Images, bool) {
6192 return nil, false
6193 }
6194
6195
6196 func (re RecognizedEntity) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
6197 return nil, false
6198 }
6199
6200
6201 func (re RecognizedEntity) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
6202 return nil, false
6203 }
6204
6205
6206 func (re RecognizedEntity) AsAnswer() (*Answer, bool) {
6207 return nil, false
6208 }
6209
6210
6211 func (re RecognizedEntity) AsBasicAnswer() (BasicAnswer, bool) {
6212 return nil, false
6213 }
6214
6215
6216 func (re RecognizedEntity) AsMediaObject() (*MediaObject, bool) {
6217 return nil, false
6218 }
6219
6220
6221 func (re RecognizedEntity) AsBasicMediaObject() (BasicMediaObject, bool) {
6222 return nil, false
6223 }
6224
6225
6226 func (re RecognizedEntity) AsResponse() (*Response, bool) {
6227 return nil, false
6228 }
6229
6230
6231 func (re RecognizedEntity) AsBasicResponse() (BasicResponse, bool) {
6232 return &re, true
6233 }
6234
6235
6236 func (re RecognizedEntity) AsThing() (*Thing, bool) {
6237 return nil, false
6238 }
6239
6240
6241 func (re RecognizedEntity) AsBasicThing() (BasicThing, bool) {
6242 return nil, false
6243 }
6244
6245
6246 func (re RecognizedEntity) AsCreativeWork() (*CreativeWork, bool) {
6247 return nil, false
6248 }
6249
6250
6251 func (re RecognizedEntity) AsBasicCreativeWork() (BasicCreativeWork, bool) {
6252 return nil, false
6253 }
6254
6255
6256 func (re RecognizedEntity) AsIdentifiable() (*Identifiable, bool) {
6257 return nil, false
6258 }
6259
6260
6261 func (re RecognizedEntity) AsBasicIdentifiable() (BasicIdentifiable, bool) {
6262 return &re, true
6263 }
6264
6265
6266 func (re RecognizedEntity) AsErrorResponse() (*ErrorResponse, bool) {
6267 return nil, false
6268 }
6269
6270
6271 func (re RecognizedEntity) AsImageGallery() (*ImageGallery, bool) {
6272 return nil, false
6273 }
6274
6275
6276 func (re RecognizedEntity) AsRecipe() (*Recipe, bool) {
6277 return nil, false
6278 }
6279
6280
6281 func (re RecognizedEntity) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
6282 return nil, false
6283 }
6284
6285
6286 func (re RecognizedEntity) AsRecognizedEntity() (*RecognizedEntity, bool) {
6287 return &re, true
6288 }
6289
6290
6291 func (re RecognizedEntity) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
6292 return nil, false
6293 }
6294
6295
6296 func (re RecognizedEntity) AsImageInsights() (*ImageInsights, bool) {
6297 return nil, false
6298 }
6299
6300
6301 func (re RecognizedEntity) AsTrendingImages() (*TrendingImages, bool) {
6302 return nil, false
6303 }
6304
6305
6306 func (re RecognizedEntity) AsWebPage() (*WebPage, bool) {
6307 return nil, false
6308 }
6309
6310
6311 func (re RecognizedEntity) AsBasicWebPage() (BasicWebPage, bool) {
6312 return nil, false
6313 }
6314
6315
6316 func (re RecognizedEntity) AsPerson() (*Person, bool) {
6317 return nil, false
6318 }
6319
6320
6321 func (re RecognizedEntity) AsIntangible() (*Intangible, bool) {
6322 return nil, false
6323 }
6324
6325
6326 func (re RecognizedEntity) AsBasicIntangible() (BasicIntangible, bool) {
6327 return nil, false
6328 }
6329
6330
6331 func (re RecognizedEntity) AsCollectionPage() (*CollectionPage, bool) {
6332 return nil, false
6333 }
6334
6335
6336 func (re RecognizedEntity) AsBasicCollectionPage() (BasicCollectionPage, bool) {
6337 return nil, false
6338 }
6339
6340
6341 func (re RecognizedEntity) AsStructuredValue() (*StructuredValue, bool) {
6342 return nil, false
6343 }
6344
6345
6346 func (re RecognizedEntity) AsBasicStructuredValue() (BasicStructuredValue, bool) {
6347 return nil, false
6348 }
6349
6350
6351 func (re RecognizedEntity) AsResponseBase() (*ResponseBase, bool) {
6352 return nil, false
6353 }
6354
6355
6356 func (re RecognizedEntity) AsBasicResponseBase() (BasicResponseBase, bool) {
6357 return &re, true
6358 }
6359
6360
6361 func (re *RecognizedEntity) UnmarshalJSON(body []byte) error {
6362 var m map[string]*json.RawMessage
6363 err := json.Unmarshal(body, &m)
6364 if err != nil {
6365 return err
6366 }
6367 for k, v := range m {
6368 switch k {
6369 case "entity":
6370 if v != nil {
6371 entity, err := unmarshalBasicThing(*v)
6372 if err != nil {
6373 return err
6374 }
6375 re.Entity = entity
6376 }
6377 case "matchConfidence":
6378 if v != nil {
6379 var matchConfidence float64
6380 err = json.Unmarshal(*v, &matchConfidence)
6381 if err != nil {
6382 return err
6383 }
6384 re.MatchConfidence = &matchConfidence
6385 }
6386 case "readLink":
6387 if v != nil {
6388 var readLink string
6389 err = json.Unmarshal(*v, &readLink)
6390 if err != nil {
6391 return err
6392 }
6393 re.ReadLink = &readLink
6394 }
6395 case "webSearchUrl":
6396 if v != nil {
6397 var webSearchURL string
6398 err = json.Unmarshal(*v, &webSearchURL)
6399 if err != nil {
6400 return err
6401 }
6402 re.WebSearchURL = &webSearchURL
6403 }
6404 case "id":
6405 if v != nil {
6406 var ID string
6407 err = json.Unmarshal(*v, &ID)
6408 if err != nil {
6409 return err
6410 }
6411 re.ID = &ID
6412 }
6413 case "_type":
6414 if v != nil {
6415 var typeVar TypeBasicResponseBase
6416 err = json.Unmarshal(*v, &typeVar)
6417 if err != nil {
6418 return err
6419 }
6420 re.Type = typeVar
6421 }
6422 }
6423 }
6424
6425 return nil
6426 }
6427
6428
6429 type RecognizedEntityGroup struct {
6430
6431 RecognizedEntityRegions *[]RecognizedEntityRegion `json:"recognizedEntityRegions,omitempty"`
6432
6433 Name *string `json:"name,omitempty"`
6434 }
6435
6436
6437
6438 type RecognizedEntityRegion struct {
6439
6440 Region *NormalizedRectangle `json:"region,omitempty"`
6441
6442 MatchingEntities *[]RecognizedEntity `json:"matchingEntities,omitempty"`
6443
6444 ReadLink *string `json:"readLink,omitempty"`
6445
6446 WebSearchURL *string `json:"webSearchUrl,omitempty"`
6447
6448 ID *string `json:"id,omitempty"`
6449
6450 Type TypeBasicResponseBase `json:"_type,omitempty"`
6451 }
6452
6453
6454 func (rer RecognizedEntityRegion) MarshalJSON() ([]byte, error) {
6455 rer.Type = TypeRecognizedEntityRegion
6456 objectMap := make(map[string]interface{})
6457 if rer.Type != "" {
6458 objectMap["_type"] = rer.Type
6459 }
6460 return json.Marshal(objectMap)
6461 }
6462
6463
6464 func (rer RecognizedEntityRegion) AsOrganization() (*Organization, bool) {
6465 return nil, false
6466 }
6467
6468
6469 func (rer RecognizedEntityRegion) AsOffer() (*Offer, bool) {
6470 return nil, false
6471 }
6472
6473
6474 func (rer RecognizedEntityRegion) AsBasicOffer() (BasicOffer, bool) {
6475 return nil, false
6476 }
6477
6478
6479 func (rer RecognizedEntityRegion) AsAggregateOffer() (*AggregateOffer, bool) {
6480 return nil, false
6481 }
6482
6483
6484 func (rer RecognizedEntityRegion) AsImageObject() (*ImageObject, bool) {
6485 return nil, false
6486 }
6487
6488
6489 func (rer RecognizedEntityRegion) AsImages() (*Images, bool) {
6490 return nil, false
6491 }
6492
6493
6494 func (rer RecognizedEntityRegion) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
6495 return nil, false
6496 }
6497
6498
6499 func (rer RecognizedEntityRegion) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
6500 return nil, false
6501 }
6502
6503
6504 func (rer RecognizedEntityRegion) AsAnswer() (*Answer, bool) {
6505 return nil, false
6506 }
6507
6508
6509 func (rer RecognizedEntityRegion) AsBasicAnswer() (BasicAnswer, bool) {
6510 return nil, false
6511 }
6512
6513
6514 func (rer RecognizedEntityRegion) AsMediaObject() (*MediaObject, bool) {
6515 return nil, false
6516 }
6517
6518
6519 func (rer RecognizedEntityRegion) AsBasicMediaObject() (BasicMediaObject, bool) {
6520 return nil, false
6521 }
6522
6523
6524 func (rer RecognizedEntityRegion) AsResponse() (*Response, bool) {
6525 return nil, false
6526 }
6527
6528
6529 func (rer RecognizedEntityRegion) AsBasicResponse() (BasicResponse, bool) {
6530 return &rer, true
6531 }
6532
6533
6534 func (rer RecognizedEntityRegion) AsThing() (*Thing, bool) {
6535 return nil, false
6536 }
6537
6538
6539 func (rer RecognizedEntityRegion) AsBasicThing() (BasicThing, bool) {
6540 return nil, false
6541 }
6542
6543
6544 func (rer RecognizedEntityRegion) AsCreativeWork() (*CreativeWork, bool) {
6545 return nil, false
6546 }
6547
6548
6549 func (rer RecognizedEntityRegion) AsBasicCreativeWork() (BasicCreativeWork, bool) {
6550 return nil, false
6551 }
6552
6553
6554 func (rer RecognizedEntityRegion) AsIdentifiable() (*Identifiable, bool) {
6555 return nil, false
6556 }
6557
6558
6559 func (rer RecognizedEntityRegion) AsBasicIdentifiable() (BasicIdentifiable, bool) {
6560 return &rer, true
6561 }
6562
6563
6564 func (rer RecognizedEntityRegion) AsErrorResponse() (*ErrorResponse, bool) {
6565 return nil, false
6566 }
6567
6568
6569 func (rer RecognizedEntityRegion) AsImageGallery() (*ImageGallery, bool) {
6570 return nil, false
6571 }
6572
6573
6574 func (rer RecognizedEntityRegion) AsRecipe() (*Recipe, bool) {
6575 return nil, false
6576 }
6577
6578
6579 func (rer RecognizedEntityRegion) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
6580 return nil, false
6581 }
6582
6583
6584 func (rer RecognizedEntityRegion) AsRecognizedEntity() (*RecognizedEntity, bool) {
6585 return nil, false
6586 }
6587
6588
6589 func (rer RecognizedEntityRegion) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
6590 return &rer, true
6591 }
6592
6593
6594 func (rer RecognizedEntityRegion) AsImageInsights() (*ImageInsights, bool) {
6595 return nil, false
6596 }
6597
6598
6599 func (rer RecognizedEntityRegion) AsTrendingImages() (*TrendingImages, bool) {
6600 return nil, false
6601 }
6602
6603
6604 func (rer RecognizedEntityRegion) AsWebPage() (*WebPage, bool) {
6605 return nil, false
6606 }
6607
6608
6609 func (rer RecognizedEntityRegion) AsBasicWebPage() (BasicWebPage, bool) {
6610 return nil, false
6611 }
6612
6613
6614 func (rer RecognizedEntityRegion) AsPerson() (*Person, bool) {
6615 return nil, false
6616 }
6617
6618
6619 func (rer RecognizedEntityRegion) AsIntangible() (*Intangible, bool) {
6620 return nil, false
6621 }
6622
6623
6624 func (rer RecognizedEntityRegion) AsBasicIntangible() (BasicIntangible, bool) {
6625 return nil, false
6626 }
6627
6628
6629 func (rer RecognizedEntityRegion) AsCollectionPage() (*CollectionPage, bool) {
6630 return nil, false
6631 }
6632
6633
6634 func (rer RecognizedEntityRegion) AsBasicCollectionPage() (BasicCollectionPage, bool) {
6635 return nil, false
6636 }
6637
6638
6639 func (rer RecognizedEntityRegion) AsStructuredValue() (*StructuredValue, bool) {
6640 return nil, false
6641 }
6642
6643
6644 func (rer RecognizedEntityRegion) AsBasicStructuredValue() (BasicStructuredValue, bool) {
6645 return nil, false
6646 }
6647
6648
6649 func (rer RecognizedEntityRegion) AsResponseBase() (*ResponseBase, bool) {
6650 return nil, false
6651 }
6652
6653
6654 func (rer RecognizedEntityRegion) AsBasicResponseBase() (BasicResponseBase, bool) {
6655 return &rer, true
6656 }
6657
6658
6659 type RelatedCollectionsModule struct {
6660
6661 Value *[]ImageGallery `json:"value,omitempty"`
6662 }
6663
6664
6665 func (rcm RelatedCollectionsModule) MarshalJSON() ([]byte, error) {
6666 objectMap := make(map[string]interface{})
6667 return json.Marshal(objectMap)
6668 }
6669
6670
6671 type RelatedSearchesModule struct {
6672
6673 Value *[]Query `json:"value,omitempty"`
6674 }
6675
6676
6677 func (rsm RelatedSearchesModule) MarshalJSON() ([]byte, error) {
6678 objectMap := make(map[string]interface{})
6679 return json.Marshal(objectMap)
6680 }
6681
6682
6683
6684 type BasicResponse interface {
6685 AsOrganization() (*Organization, bool)
6686 AsOffer() (*Offer, bool)
6687 AsBasicOffer() (BasicOffer, bool)
6688 AsAggregateOffer() (*AggregateOffer, bool)
6689 AsImageObject() (*ImageObject, bool)
6690 AsImages() (*Images, bool)
6691 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
6692 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
6693 AsAnswer() (*Answer, bool)
6694 AsBasicAnswer() (BasicAnswer, bool)
6695 AsMediaObject() (*MediaObject, bool)
6696 AsBasicMediaObject() (BasicMediaObject, bool)
6697 AsThing() (*Thing, bool)
6698 AsBasicThing() (BasicThing, bool)
6699 AsCreativeWork() (*CreativeWork, bool)
6700 AsBasicCreativeWork() (BasicCreativeWork, bool)
6701 AsErrorResponse() (*ErrorResponse, bool)
6702 AsImageGallery() (*ImageGallery, bool)
6703 AsRecipe() (*Recipe, bool)
6704 AsNormalizedRectangle() (*NormalizedRectangle, bool)
6705 AsRecognizedEntity() (*RecognizedEntity, bool)
6706 AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool)
6707 AsImageInsights() (*ImageInsights, bool)
6708 AsTrendingImages() (*TrendingImages, bool)
6709 AsWebPage() (*WebPage, bool)
6710 AsBasicWebPage() (BasicWebPage, bool)
6711 AsPerson() (*Person, bool)
6712 AsIntangible() (*Intangible, bool)
6713 AsBasicIntangible() (BasicIntangible, bool)
6714 AsCollectionPage() (*CollectionPage, bool)
6715 AsBasicCollectionPage() (BasicCollectionPage, bool)
6716 AsStructuredValue() (*StructuredValue, bool)
6717 AsBasicStructuredValue() (BasicStructuredValue, bool)
6718 AsResponse() (*Response, bool)
6719 }
6720
6721
6722
6723 type Response struct {
6724
6725 ReadLink *string `json:"readLink,omitempty"`
6726
6727 WebSearchURL *string `json:"webSearchUrl,omitempty"`
6728
6729 ID *string `json:"id,omitempty"`
6730
6731 Type TypeBasicResponseBase `json:"_type,omitempty"`
6732 }
6733
6734 func unmarshalBasicResponse(body []byte) (BasicResponse, error) {
6735 var m map[string]interface{}
6736 err := json.Unmarshal(body, &m)
6737 if err != nil {
6738 return nil, err
6739 }
6740
6741 switch m["_type"] {
6742 case string(TypeOrganization):
6743 var o Organization
6744 err := json.Unmarshal(body, &o)
6745 return o, err
6746 case string(TypeOffer):
6747 var o Offer
6748 err := json.Unmarshal(body, &o)
6749 return o, err
6750 case string(TypeAggregateOffer):
6751 var ao AggregateOffer
6752 err := json.Unmarshal(body, &ao)
6753 return ao, err
6754 case string(TypeImageObject):
6755 var ioVar ImageObject
6756 err := json.Unmarshal(body, &ioVar)
6757 return ioVar, err
6758 case string(TypeImages):
6759 var i Images
6760 err := json.Unmarshal(body, &i)
6761 return i, err
6762 case string(TypeSearchResultsAnswer):
6763 var sra SearchResultsAnswer
6764 err := json.Unmarshal(body, &sra)
6765 return sra, err
6766 case string(TypeAnswer):
6767 var a Answer
6768 err := json.Unmarshal(body, &a)
6769 return a, err
6770 case string(TypeMediaObject):
6771 var mo MediaObject
6772 err := json.Unmarshal(body, &mo)
6773 return mo, err
6774 case string(TypeThing):
6775 var t Thing
6776 err := json.Unmarshal(body, &t)
6777 return t, err
6778 case string(TypeCreativeWork):
6779 var cw CreativeWork
6780 err := json.Unmarshal(body, &cw)
6781 return cw, err
6782 case string(TypeErrorResponse):
6783 var er ErrorResponse
6784 err := json.Unmarshal(body, &er)
6785 return er, err
6786 case string(TypeImageGallery):
6787 var ig ImageGallery
6788 err := json.Unmarshal(body, &ig)
6789 return ig, err
6790 case string(TypeRecipe):
6791 var r Recipe
6792 err := json.Unmarshal(body, &r)
6793 return r, err
6794 case string(TypeNormalizedRectangle):
6795 var nr NormalizedRectangle
6796 err := json.Unmarshal(body, &nr)
6797 return nr, err
6798 case string(TypeRecognizedEntity):
6799 var re RecognizedEntity
6800 err := json.Unmarshal(body, &re)
6801 return re, err
6802 case string(TypeRecognizedEntityRegion):
6803 var rer RecognizedEntityRegion
6804 err := json.Unmarshal(body, &rer)
6805 return rer, err
6806 case string(TypeImageInsights):
6807 var ii ImageInsights
6808 err := json.Unmarshal(body, &ii)
6809 return ii, err
6810 case string(TypeTrendingImages):
6811 var ti TrendingImages
6812 err := json.Unmarshal(body, &ti)
6813 return ti, err
6814 case string(TypeWebPage):
6815 var wp WebPage
6816 err := json.Unmarshal(body, &wp)
6817 return wp, err
6818 case string(TypePerson):
6819 var p Person
6820 err := json.Unmarshal(body, &p)
6821 return p, err
6822 case string(TypeIntangible):
6823 var i Intangible
6824 err := json.Unmarshal(body, &i)
6825 return i, err
6826 case string(TypeCollectionPage):
6827 var cp CollectionPage
6828 err := json.Unmarshal(body, &cp)
6829 return cp, err
6830 case string(TypeStructuredValue):
6831 var sv StructuredValue
6832 err := json.Unmarshal(body, &sv)
6833 return sv, err
6834 default:
6835 var r Response
6836 err := json.Unmarshal(body, &r)
6837 return r, err
6838 }
6839 }
6840 func unmarshalBasicResponseArray(body []byte) ([]BasicResponse, error) {
6841 var rawMessages []*json.RawMessage
6842 err := json.Unmarshal(body, &rawMessages)
6843 if err != nil {
6844 return nil, err
6845 }
6846
6847 rArray := make([]BasicResponse, len(rawMessages))
6848
6849 for index, rawMessage := range rawMessages {
6850 r, err := unmarshalBasicResponse(*rawMessage)
6851 if err != nil {
6852 return nil, err
6853 }
6854 rArray[index] = r
6855 }
6856 return rArray, nil
6857 }
6858
6859
6860 func (r Response) MarshalJSON() ([]byte, error) {
6861 r.Type = TypeResponse
6862 objectMap := make(map[string]interface{})
6863 if r.Type != "" {
6864 objectMap["_type"] = r.Type
6865 }
6866 return json.Marshal(objectMap)
6867 }
6868
6869
6870 func (r Response) AsOrganization() (*Organization, bool) {
6871 return nil, false
6872 }
6873
6874
6875 func (r Response) AsOffer() (*Offer, bool) {
6876 return nil, false
6877 }
6878
6879
6880 func (r Response) AsBasicOffer() (BasicOffer, bool) {
6881 return nil, false
6882 }
6883
6884
6885 func (r Response) AsAggregateOffer() (*AggregateOffer, bool) {
6886 return nil, false
6887 }
6888
6889
6890 func (r Response) AsImageObject() (*ImageObject, bool) {
6891 return nil, false
6892 }
6893
6894
6895 func (r Response) AsImages() (*Images, bool) {
6896 return nil, false
6897 }
6898
6899
6900 func (r Response) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
6901 return nil, false
6902 }
6903
6904
6905 func (r Response) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
6906 return nil, false
6907 }
6908
6909
6910 func (r Response) AsAnswer() (*Answer, bool) {
6911 return nil, false
6912 }
6913
6914
6915 func (r Response) AsBasicAnswer() (BasicAnswer, bool) {
6916 return nil, false
6917 }
6918
6919
6920 func (r Response) AsMediaObject() (*MediaObject, bool) {
6921 return nil, false
6922 }
6923
6924
6925 func (r Response) AsBasicMediaObject() (BasicMediaObject, bool) {
6926 return nil, false
6927 }
6928
6929
6930 func (r Response) AsResponse() (*Response, bool) {
6931 return &r, true
6932 }
6933
6934
6935 func (r Response) AsBasicResponse() (BasicResponse, bool) {
6936 return &r, true
6937 }
6938
6939
6940 func (r Response) AsThing() (*Thing, bool) {
6941 return nil, false
6942 }
6943
6944
6945 func (r Response) AsBasicThing() (BasicThing, bool) {
6946 return nil, false
6947 }
6948
6949
6950 func (r Response) AsCreativeWork() (*CreativeWork, bool) {
6951 return nil, false
6952 }
6953
6954
6955 func (r Response) AsBasicCreativeWork() (BasicCreativeWork, bool) {
6956 return nil, false
6957 }
6958
6959
6960 func (r Response) AsIdentifiable() (*Identifiable, bool) {
6961 return nil, false
6962 }
6963
6964
6965 func (r Response) AsBasicIdentifiable() (BasicIdentifiable, bool) {
6966 return &r, true
6967 }
6968
6969
6970 func (r Response) AsErrorResponse() (*ErrorResponse, bool) {
6971 return nil, false
6972 }
6973
6974
6975 func (r Response) AsImageGallery() (*ImageGallery, bool) {
6976 return nil, false
6977 }
6978
6979
6980 func (r Response) AsRecipe() (*Recipe, bool) {
6981 return nil, false
6982 }
6983
6984
6985 func (r Response) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
6986 return nil, false
6987 }
6988
6989
6990 func (r Response) AsRecognizedEntity() (*RecognizedEntity, bool) {
6991 return nil, false
6992 }
6993
6994
6995 func (r Response) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
6996 return nil, false
6997 }
6998
6999
7000 func (r Response) AsImageInsights() (*ImageInsights, bool) {
7001 return nil, false
7002 }
7003
7004
7005 func (r Response) AsTrendingImages() (*TrendingImages, bool) {
7006 return nil, false
7007 }
7008
7009
7010 func (r Response) AsWebPage() (*WebPage, bool) {
7011 return nil, false
7012 }
7013
7014
7015 func (r Response) AsBasicWebPage() (BasicWebPage, bool) {
7016 return nil, false
7017 }
7018
7019
7020 func (r Response) AsPerson() (*Person, bool) {
7021 return nil, false
7022 }
7023
7024
7025 func (r Response) AsIntangible() (*Intangible, bool) {
7026 return nil, false
7027 }
7028
7029
7030 func (r Response) AsBasicIntangible() (BasicIntangible, bool) {
7031 return nil, false
7032 }
7033
7034
7035 func (r Response) AsCollectionPage() (*CollectionPage, bool) {
7036 return nil, false
7037 }
7038
7039
7040 func (r Response) AsBasicCollectionPage() (BasicCollectionPage, bool) {
7041 return nil, false
7042 }
7043
7044
7045 func (r Response) AsStructuredValue() (*StructuredValue, bool) {
7046 return nil, false
7047 }
7048
7049
7050 func (r Response) AsBasicStructuredValue() (BasicStructuredValue, bool) {
7051 return nil, false
7052 }
7053
7054
7055 func (r Response) AsResponseBase() (*ResponseBase, bool) {
7056 return nil, false
7057 }
7058
7059
7060 func (r Response) AsBasicResponseBase() (BasicResponseBase, bool) {
7061 return &r, true
7062 }
7063
7064
7065 type BasicResponseBase interface {
7066 AsOrganization() (*Organization, bool)
7067 AsOffer() (*Offer, bool)
7068 AsBasicOffer() (BasicOffer, bool)
7069 AsAggregateOffer() (*AggregateOffer, bool)
7070 AsImageObject() (*ImageObject, bool)
7071 AsImages() (*Images, bool)
7072 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
7073 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
7074 AsAnswer() (*Answer, bool)
7075 AsBasicAnswer() (BasicAnswer, bool)
7076 AsMediaObject() (*MediaObject, bool)
7077 AsBasicMediaObject() (BasicMediaObject, bool)
7078 AsResponse() (*Response, bool)
7079 AsBasicResponse() (BasicResponse, bool)
7080 AsThing() (*Thing, bool)
7081 AsBasicThing() (BasicThing, bool)
7082 AsCreativeWork() (*CreativeWork, bool)
7083 AsBasicCreativeWork() (BasicCreativeWork, bool)
7084 AsIdentifiable() (*Identifiable, bool)
7085 AsBasicIdentifiable() (BasicIdentifiable, bool)
7086 AsErrorResponse() (*ErrorResponse, bool)
7087 AsImageGallery() (*ImageGallery, bool)
7088 AsRecipe() (*Recipe, bool)
7089 AsNormalizedRectangle() (*NormalizedRectangle, bool)
7090 AsRecognizedEntity() (*RecognizedEntity, bool)
7091 AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool)
7092 AsImageInsights() (*ImageInsights, bool)
7093 AsTrendingImages() (*TrendingImages, bool)
7094 AsWebPage() (*WebPage, bool)
7095 AsBasicWebPage() (BasicWebPage, bool)
7096 AsPerson() (*Person, bool)
7097 AsIntangible() (*Intangible, bool)
7098 AsBasicIntangible() (BasicIntangible, bool)
7099 AsCollectionPage() (*CollectionPage, bool)
7100 AsBasicCollectionPage() (BasicCollectionPage, bool)
7101 AsStructuredValue() (*StructuredValue, bool)
7102 AsBasicStructuredValue() (BasicStructuredValue, bool)
7103 AsResponseBase() (*ResponseBase, bool)
7104 }
7105
7106
7107 type ResponseBase struct {
7108
7109 Type TypeBasicResponseBase `json:"_type,omitempty"`
7110 }
7111
7112 func unmarshalBasicResponseBase(body []byte) (BasicResponseBase, error) {
7113 var m map[string]interface{}
7114 err := json.Unmarshal(body, &m)
7115 if err != nil {
7116 return nil, err
7117 }
7118
7119 switch m["_type"] {
7120 case string(TypeOrganization):
7121 var o Organization
7122 err := json.Unmarshal(body, &o)
7123 return o, err
7124 case string(TypeOffer):
7125 var o Offer
7126 err := json.Unmarshal(body, &o)
7127 return o, err
7128 case string(TypeAggregateOffer):
7129 var ao AggregateOffer
7130 err := json.Unmarshal(body, &ao)
7131 return ao, err
7132 case string(TypeImageObject):
7133 var ioVar ImageObject
7134 err := json.Unmarshal(body, &ioVar)
7135 return ioVar, err
7136 case string(TypeImages):
7137 var i Images
7138 err := json.Unmarshal(body, &i)
7139 return i, err
7140 case string(TypeSearchResultsAnswer):
7141 var sra SearchResultsAnswer
7142 err := json.Unmarshal(body, &sra)
7143 return sra, err
7144 case string(TypeAnswer):
7145 var a Answer
7146 err := json.Unmarshal(body, &a)
7147 return a, err
7148 case string(TypeMediaObject):
7149 var mo MediaObject
7150 err := json.Unmarshal(body, &mo)
7151 return mo, err
7152 case string(TypeResponse):
7153 var r Response
7154 err := json.Unmarshal(body, &r)
7155 return r, err
7156 case string(TypeThing):
7157 var t Thing
7158 err := json.Unmarshal(body, &t)
7159 return t, err
7160 case string(TypeCreativeWork):
7161 var cw CreativeWork
7162 err := json.Unmarshal(body, &cw)
7163 return cw, err
7164 case string(TypeIdentifiable):
7165 var i Identifiable
7166 err := json.Unmarshal(body, &i)
7167 return i, err
7168 case string(TypeErrorResponse):
7169 var er ErrorResponse
7170 err := json.Unmarshal(body, &er)
7171 return er, err
7172 case string(TypeImageGallery):
7173 var ig ImageGallery
7174 err := json.Unmarshal(body, &ig)
7175 return ig, err
7176 case string(TypeRecipe):
7177 var r Recipe
7178 err := json.Unmarshal(body, &r)
7179 return r, err
7180 case string(TypeNormalizedRectangle):
7181 var nr NormalizedRectangle
7182 err := json.Unmarshal(body, &nr)
7183 return nr, err
7184 case string(TypeRecognizedEntity):
7185 var re RecognizedEntity
7186 err := json.Unmarshal(body, &re)
7187 return re, err
7188 case string(TypeRecognizedEntityRegion):
7189 var rer RecognizedEntityRegion
7190 err := json.Unmarshal(body, &rer)
7191 return rer, err
7192 case string(TypeImageInsights):
7193 var ii ImageInsights
7194 err := json.Unmarshal(body, &ii)
7195 return ii, err
7196 case string(TypeTrendingImages):
7197 var ti TrendingImages
7198 err := json.Unmarshal(body, &ti)
7199 return ti, err
7200 case string(TypeWebPage):
7201 var wp WebPage
7202 err := json.Unmarshal(body, &wp)
7203 return wp, err
7204 case string(TypePerson):
7205 var p Person
7206 err := json.Unmarshal(body, &p)
7207 return p, err
7208 case string(TypeIntangible):
7209 var i Intangible
7210 err := json.Unmarshal(body, &i)
7211 return i, err
7212 case string(TypeCollectionPage):
7213 var cp CollectionPage
7214 err := json.Unmarshal(body, &cp)
7215 return cp, err
7216 case string(TypeStructuredValue):
7217 var sv StructuredValue
7218 err := json.Unmarshal(body, &sv)
7219 return sv, err
7220 default:
7221 var rb ResponseBase
7222 err := json.Unmarshal(body, &rb)
7223 return rb, err
7224 }
7225 }
7226 func unmarshalBasicResponseBaseArray(body []byte) ([]BasicResponseBase, error) {
7227 var rawMessages []*json.RawMessage
7228 err := json.Unmarshal(body, &rawMessages)
7229 if err != nil {
7230 return nil, err
7231 }
7232
7233 rbArray := make([]BasicResponseBase, len(rawMessages))
7234
7235 for index, rawMessage := range rawMessages {
7236 rb, err := unmarshalBasicResponseBase(*rawMessage)
7237 if err != nil {
7238 return nil, err
7239 }
7240 rbArray[index] = rb
7241 }
7242 return rbArray, nil
7243 }
7244
7245
7246 func (rb ResponseBase) MarshalJSON() ([]byte, error) {
7247 rb.Type = TypeResponseBase
7248 objectMap := make(map[string]interface{})
7249 if rb.Type != "" {
7250 objectMap["_type"] = rb.Type
7251 }
7252 return json.Marshal(objectMap)
7253 }
7254
7255
7256 func (rb ResponseBase) AsOrganization() (*Organization, bool) {
7257 return nil, false
7258 }
7259
7260
7261 func (rb ResponseBase) AsOffer() (*Offer, bool) {
7262 return nil, false
7263 }
7264
7265
7266 func (rb ResponseBase) AsBasicOffer() (BasicOffer, bool) {
7267 return nil, false
7268 }
7269
7270
7271 func (rb ResponseBase) AsAggregateOffer() (*AggregateOffer, bool) {
7272 return nil, false
7273 }
7274
7275
7276 func (rb ResponseBase) AsImageObject() (*ImageObject, bool) {
7277 return nil, false
7278 }
7279
7280
7281 func (rb ResponseBase) AsImages() (*Images, bool) {
7282 return nil, false
7283 }
7284
7285
7286 func (rb ResponseBase) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
7287 return nil, false
7288 }
7289
7290
7291 func (rb ResponseBase) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
7292 return nil, false
7293 }
7294
7295
7296 func (rb ResponseBase) AsAnswer() (*Answer, bool) {
7297 return nil, false
7298 }
7299
7300
7301 func (rb ResponseBase) AsBasicAnswer() (BasicAnswer, bool) {
7302 return nil, false
7303 }
7304
7305
7306 func (rb ResponseBase) AsMediaObject() (*MediaObject, bool) {
7307 return nil, false
7308 }
7309
7310
7311 func (rb ResponseBase) AsBasicMediaObject() (BasicMediaObject, bool) {
7312 return nil, false
7313 }
7314
7315
7316 func (rb ResponseBase) AsResponse() (*Response, bool) {
7317 return nil, false
7318 }
7319
7320
7321 func (rb ResponseBase) AsBasicResponse() (BasicResponse, bool) {
7322 return nil, false
7323 }
7324
7325
7326 func (rb ResponseBase) AsThing() (*Thing, bool) {
7327 return nil, false
7328 }
7329
7330
7331 func (rb ResponseBase) AsBasicThing() (BasicThing, bool) {
7332 return nil, false
7333 }
7334
7335
7336 func (rb ResponseBase) AsCreativeWork() (*CreativeWork, bool) {
7337 return nil, false
7338 }
7339
7340
7341 func (rb ResponseBase) AsBasicCreativeWork() (BasicCreativeWork, bool) {
7342 return nil, false
7343 }
7344
7345
7346 func (rb ResponseBase) AsIdentifiable() (*Identifiable, bool) {
7347 return nil, false
7348 }
7349
7350
7351 func (rb ResponseBase) AsBasicIdentifiable() (BasicIdentifiable, bool) {
7352 return nil, false
7353 }
7354
7355
7356 func (rb ResponseBase) AsErrorResponse() (*ErrorResponse, bool) {
7357 return nil, false
7358 }
7359
7360
7361 func (rb ResponseBase) AsImageGallery() (*ImageGallery, bool) {
7362 return nil, false
7363 }
7364
7365
7366 func (rb ResponseBase) AsRecipe() (*Recipe, bool) {
7367 return nil, false
7368 }
7369
7370
7371 func (rb ResponseBase) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
7372 return nil, false
7373 }
7374
7375
7376 func (rb ResponseBase) AsRecognizedEntity() (*RecognizedEntity, bool) {
7377 return nil, false
7378 }
7379
7380
7381 func (rb ResponseBase) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
7382 return nil, false
7383 }
7384
7385
7386 func (rb ResponseBase) AsImageInsights() (*ImageInsights, bool) {
7387 return nil, false
7388 }
7389
7390
7391 func (rb ResponseBase) AsTrendingImages() (*TrendingImages, bool) {
7392 return nil, false
7393 }
7394
7395
7396 func (rb ResponseBase) AsWebPage() (*WebPage, bool) {
7397 return nil, false
7398 }
7399
7400
7401 func (rb ResponseBase) AsBasicWebPage() (BasicWebPage, bool) {
7402 return nil, false
7403 }
7404
7405
7406 func (rb ResponseBase) AsPerson() (*Person, bool) {
7407 return nil, false
7408 }
7409
7410
7411 func (rb ResponseBase) AsIntangible() (*Intangible, bool) {
7412 return nil, false
7413 }
7414
7415
7416 func (rb ResponseBase) AsBasicIntangible() (BasicIntangible, bool) {
7417 return nil, false
7418 }
7419
7420
7421 func (rb ResponseBase) AsCollectionPage() (*CollectionPage, bool) {
7422 return nil, false
7423 }
7424
7425
7426 func (rb ResponseBase) AsBasicCollectionPage() (BasicCollectionPage, bool) {
7427 return nil, false
7428 }
7429
7430
7431 func (rb ResponseBase) AsStructuredValue() (*StructuredValue, bool) {
7432 return nil, false
7433 }
7434
7435
7436 func (rb ResponseBase) AsBasicStructuredValue() (BasicStructuredValue, bool) {
7437 return nil, false
7438 }
7439
7440
7441 func (rb ResponseBase) AsResponseBase() (*ResponseBase, bool) {
7442 return &rb, true
7443 }
7444
7445
7446 func (rb ResponseBase) AsBasicResponseBase() (BasicResponseBase, bool) {
7447 return &rb, true
7448 }
7449
7450
7451 type BasicSearchResultsAnswer interface {
7452 AsImages() (*Images, bool)
7453 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
7454 }
7455
7456
7457 type SearchResultsAnswer struct {
7458
7459 TotalEstimatedMatches *int64 `json:"totalEstimatedMatches,omitempty"`
7460
7461 ReadLink *string `json:"readLink,omitempty"`
7462
7463 WebSearchURL *string `json:"webSearchUrl,omitempty"`
7464
7465 ID *string `json:"id,omitempty"`
7466
7467 Type TypeBasicResponseBase `json:"_type,omitempty"`
7468 }
7469
7470 func unmarshalBasicSearchResultsAnswer(body []byte) (BasicSearchResultsAnswer, error) {
7471 var m map[string]interface{}
7472 err := json.Unmarshal(body, &m)
7473 if err != nil {
7474 return nil, err
7475 }
7476
7477 switch m["_type"] {
7478 case string(TypeImages):
7479 var i Images
7480 err := json.Unmarshal(body, &i)
7481 return i, err
7482 default:
7483 var sra SearchResultsAnswer
7484 err := json.Unmarshal(body, &sra)
7485 return sra, err
7486 }
7487 }
7488 func unmarshalBasicSearchResultsAnswerArray(body []byte) ([]BasicSearchResultsAnswer, error) {
7489 var rawMessages []*json.RawMessage
7490 err := json.Unmarshal(body, &rawMessages)
7491 if err != nil {
7492 return nil, err
7493 }
7494
7495 sraArray := make([]BasicSearchResultsAnswer, len(rawMessages))
7496
7497 for index, rawMessage := range rawMessages {
7498 sra, err := unmarshalBasicSearchResultsAnswer(*rawMessage)
7499 if err != nil {
7500 return nil, err
7501 }
7502 sraArray[index] = sra
7503 }
7504 return sraArray, nil
7505 }
7506
7507
7508 func (sra SearchResultsAnswer) MarshalJSON() ([]byte, error) {
7509 sra.Type = TypeSearchResultsAnswer
7510 objectMap := make(map[string]interface{})
7511 if sra.Type != "" {
7512 objectMap["_type"] = sra.Type
7513 }
7514 return json.Marshal(objectMap)
7515 }
7516
7517
7518 func (sra SearchResultsAnswer) AsOrganization() (*Organization, bool) {
7519 return nil, false
7520 }
7521
7522
7523 func (sra SearchResultsAnswer) AsOffer() (*Offer, bool) {
7524 return nil, false
7525 }
7526
7527
7528 func (sra SearchResultsAnswer) AsBasicOffer() (BasicOffer, bool) {
7529 return nil, false
7530 }
7531
7532
7533 func (sra SearchResultsAnswer) AsAggregateOffer() (*AggregateOffer, bool) {
7534 return nil, false
7535 }
7536
7537
7538 func (sra SearchResultsAnswer) AsImageObject() (*ImageObject, bool) {
7539 return nil, false
7540 }
7541
7542
7543 func (sra SearchResultsAnswer) AsImages() (*Images, bool) {
7544 return nil, false
7545 }
7546
7547
7548 func (sra SearchResultsAnswer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
7549 return &sra, true
7550 }
7551
7552
7553 func (sra SearchResultsAnswer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
7554 return &sra, true
7555 }
7556
7557
7558 func (sra SearchResultsAnswer) AsAnswer() (*Answer, bool) {
7559 return nil, false
7560 }
7561
7562
7563 func (sra SearchResultsAnswer) AsBasicAnswer() (BasicAnswer, bool) {
7564 return &sra, true
7565 }
7566
7567
7568 func (sra SearchResultsAnswer) AsMediaObject() (*MediaObject, bool) {
7569 return nil, false
7570 }
7571
7572
7573 func (sra SearchResultsAnswer) AsBasicMediaObject() (BasicMediaObject, bool) {
7574 return nil, false
7575 }
7576
7577
7578 func (sra SearchResultsAnswer) AsResponse() (*Response, bool) {
7579 return nil, false
7580 }
7581
7582
7583 func (sra SearchResultsAnswer) AsBasicResponse() (BasicResponse, bool) {
7584 return &sra, true
7585 }
7586
7587
7588 func (sra SearchResultsAnswer) AsThing() (*Thing, bool) {
7589 return nil, false
7590 }
7591
7592
7593 func (sra SearchResultsAnswer) AsBasicThing() (BasicThing, bool) {
7594 return nil, false
7595 }
7596
7597
7598 func (sra SearchResultsAnswer) AsCreativeWork() (*CreativeWork, bool) {
7599 return nil, false
7600 }
7601
7602
7603 func (sra SearchResultsAnswer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
7604 return nil, false
7605 }
7606
7607
7608 func (sra SearchResultsAnswer) AsIdentifiable() (*Identifiable, bool) {
7609 return nil, false
7610 }
7611
7612
7613 func (sra SearchResultsAnswer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
7614 return &sra, true
7615 }
7616
7617
7618 func (sra SearchResultsAnswer) AsErrorResponse() (*ErrorResponse, bool) {
7619 return nil, false
7620 }
7621
7622
7623 func (sra SearchResultsAnswer) AsImageGallery() (*ImageGallery, bool) {
7624 return nil, false
7625 }
7626
7627
7628 func (sra SearchResultsAnswer) AsRecipe() (*Recipe, bool) {
7629 return nil, false
7630 }
7631
7632
7633 func (sra SearchResultsAnswer) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
7634 return nil, false
7635 }
7636
7637
7638 func (sra SearchResultsAnswer) AsRecognizedEntity() (*RecognizedEntity, bool) {
7639 return nil, false
7640 }
7641
7642
7643 func (sra SearchResultsAnswer) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
7644 return nil, false
7645 }
7646
7647
7648 func (sra SearchResultsAnswer) AsImageInsights() (*ImageInsights, bool) {
7649 return nil, false
7650 }
7651
7652
7653 func (sra SearchResultsAnswer) AsTrendingImages() (*TrendingImages, bool) {
7654 return nil, false
7655 }
7656
7657
7658 func (sra SearchResultsAnswer) AsWebPage() (*WebPage, bool) {
7659 return nil, false
7660 }
7661
7662
7663 func (sra SearchResultsAnswer) AsBasicWebPage() (BasicWebPage, bool) {
7664 return nil, false
7665 }
7666
7667
7668 func (sra SearchResultsAnswer) AsPerson() (*Person, bool) {
7669 return nil, false
7670 }
7671
7672
7673 func (sra SearchResultsAnswer) AsIntangible() (*Intangible, bool) {
7674 return nil, false
7675 }
7676
7677
7678 func (sra SearchResultsAnswer) AsBasicIntangible() (BasicIntangible, bool) {
7679 return nil, false
7680 }
7681
7682
7683 func (sra SearchResultsAnswer) AsCollectionPage() (*CollectionPage, bool) {
7684 return nil, false
7685 }
7686
7687
7688 func (sra SearchResultsAnswer) AsBasicCollectionPage() (BasicCollectionPage, bool) {
7689 return nil, false
7690 }
7691
7692
7693 func (sra SearchResultsAnswer) AsStructuredValue() (*StructuredValue, bool) {
7694 return nil, false
7695 }
7696
7697
7698 func (sra SearchResultsAnswer) AsBasicStructuredValue() (BasicStructuredValue, bool) {
7699 return nil, false
7700 }
7701
7702
7703 func (sra SearchResultsAnswer) AsResponseBase() (*ResponseBase, bool) {
7704 return nil, false
7705 }
7706
7707
7708 func (sra SearchResultsAnswer) AsBasicResponseBase() (BasicResponseBase, bool) {
7709 return &sra, true
7710 }
7711
7712
7713 type BasicStructuredValue interface {
7714 AsNormalizedRectangle() (*NormalizedRectangle, bool)
7715 AsStructuredValue() (*StructuredValue, bool)
7716 }
7717
7718
7719 type StructuredValue struct {
7720
7721 Name *string `json:"name,omitempty"`
7722
7723 URL *string `json:"url,omitempty"`
7724
7725 Image *ImageObject `json:"image,omitempty"`
7726
7727 Description *string `json:"description,omitempty"`
7728
7729 AlternateName *string `json:"alternateName,omitempty"`
7730
7731 BingID *string `json:"bingId,omitempty"`
7732
7733 ReadLink *string `json:"readLink,omitempty"`
7734
7735 WebSearchURL *string `json:"webSearchUrl,omitempty"`
7736
7737 ID *string `json:"id,omitempty"`
7738
7739 Type TypeBasicResponseBase `json:"_type,omitempty"`
7740 }
7741
7742 func unmarshalBasicStructuredValue(body []byte) (BasicStructuredValue, error) {
7743 var m map[string]interface{}
7744 err := json.Unmarshal(body, &m)
7745 if err != nil {
7746 return nil, err
7747 }
7748
7749 switch m["_type"] {
7750 case string(TypeNormalizedRectangle):
7751 var nr NormalizedRectangle
7752 err := json.Unmarshal(body, &nr)
7753 return nr, err
7754 default:
7755 var sv StructuredValue
7756 err := json.Unmarshal(body, &sv)
7757 return sv, err
7758 }
7759 }
7760 func unmarshalBasicStructuredValueArray(body []byte) ([]BasicStructuredValue, error) {
7761 var rawMessages []*json.RawMessage
7762 err := json.Unmarshal(body, &rawMessages)
7763 if err != nil {
7764 return nil, err
7765 }
7766
7767 svArray := make([]BasicStructuredValue, len(rawMessages))
7768
7769 for index, rawMessage := range rawMessages {
7770 sv, err := unmarshalBasicStructuredValue(*rawMessage)
7771 if err != nil {
7772 return nil, err
7773 }
7774 svArray[index] = sv
7775 }
7776 return svArray, nil
7777 }
7778
7779
7780 func (sv StructuredValue) MarshalJSON() ([]byte, error) {
7781 sv.Type = TypeStructuredValue
7782 objectMap := make(map[string]interface{})
7783 if sv.Type != "" {
7784 objectMap["_type"] = sv.Type
7785 }
7786 return json.Marshal(objectMap)
7787 }
7788
7789
7790 func (sv StructuredValue) AsOrganization() (*Organization, bool) {
7791 return nil, false
7792 }
7793
7794
7795 func (sv StructuredValue) AsOffer() (*Offer, bool) {
7796 return nil, false
7797 }
7798
7799
7800 func (sv StructuredValue) AsBasicOffer() (BasicOffer, bool) {
7801 return nil, false
7802 }
7803
7804
7805 func (sv StructuredValue) AsAggregateOffer() (*AggregateOffer, bool) {
7806 return nil, false
7807 }
7808
7809
7810 func (sv StructuredValue) AsImageObject() (*ImageObject, bool) {
7811 return nil, false
7812 }
7813
7814
7815 func (sv StructuredValue) AsImages() (*Images, bool) {
7816 return nil, false
7817 }
7818
7819
7820 func (sv StructuredValue) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
7821 return nil, false
7822 }
7823
7824
7825 func (sv StructuredValue) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
7826 return nil, false
7827 }
7828
7829
7830 func (sv StructuredValue) AsAnswer() (*Answer, bool) {
7831 return nil, false
7832 }
7833
7834
7835 func (sv StructuredValue) AsBasicAnswer() (BasicAnswer, bool) {
7836 return nil, false
7837 }
7838
7839
7840 func (sv StructuredValue) AsMediaObject() (*MediaObject, bool) {
7841 return nil, false
7842 }
7843
7844
7845 func (sv StructuredValue) AsBasicMediaObject() (BasicMediaObject, bool) {
7846 return nil, false
7847 }
7848
7849
7850 func (sv StructuredValue) AsResponse() (*Response, bool) {
7851 return nil, false
7852 }
7853
7854
7855 func (sv StructuredValue) AsBasicResponse() (BasicResponse, bool) {
7856 return &sv, true
7857 }
7858
7859
7860 func (sv StructuredValue) AsThing() (*Thing, bool) {
7861 return nil, false
7862 }
7863
7864
7865 func (sv StructuredValue) AsBasicThing() (BasicThing, bool) {
7866 return &sv, true
7867 }
7868
7869
7870 func (sv StructuredValue) AsCreativeWork() (*CreativeWork, bool) {
7871 return nil, false
7872 }
7873
7874
7875 func (sv StructuredValue) AsBasicCreativeWork() (BasicCreativeWork, bool) {
7876 return nil, false
7877 }
7878
7879
7880 func (sv StructuredValue) AsIdentifiable() (*Identifiable, bool) {
7881 return nil, false
7882 }
7883
7884
7885 func (sv StructuredValue) AsBasicIdentifiable() (BasicIdentifiable, bool) {
7886 return &sv, true
7887 }
7888
7889
7890 func (sv StructuredValue) AsErrorResponse() (*ErrorResponse, bool) {
7891 return nil, false
7892 }
7893
7894
7895 func (sv StructuredValue) AsImageGallery() (*ImageGallery, bool) {
7896 return nil, false
7897 }
7898
7899
7900 func (sv StructuredValue) AsRecipe() (*Recipe, bool) {
7901 return nil, false
7902 }
7903
7904
7905 func (sv StructuredValue) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
7906 return nil, false
7907 }
7908
7909
7910 func (sv StructuredValue) AsRecognizedEntity() (*RecognizedEntity, bool) {
7911 return nil, false
7912 }
7913
7914
7915 func (sv StructuredValue) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
7916 return nil, false
7917 }
7918
7919
7920 func (sv StructuredValue) AsImageInsights() (*ImageInsights, bool) {
7921 return nil, false
7922 }
7923
7924
7925 func (sv StructuredValue) AsTrendingImages() (*TrendingImages, bool) {
7926 return nil, false
7927 }
7928
7929
7930 func (sv StructuredValue) AsWebPage() (*WebPage, bool) {
7931 return nil, false
7932 }
7933
7934
7935 func (sv StructuredValue) AsBasicWebPage() (BasicWebPage, bool) {
7936 return nil, false
7937 }
7938
7939
7940 func (sv StructuredValue) AsPerson() (*Person, bool) {
7941 return nil, false
7942 }
7943
7944
7945 func (sv StructuredValue) AsIntangible() (*Intangible, bool) {
7946 return nil, false
7947 }
7948
7949
7950 func (sv StructuredValue) AsBasicIntangible() (BasicIntangible, bool) {
7951 return &sv, true
7952 }
7953
7954
7955 func (sv StructuredValue) AsCollectionPage() (*CollectionPage, bool) {
7956 return nil, false
7957 }
7958
7959
7960 func (sv StructuredValue) AsBasicCollectionPage() (BasicCollectionPage, bool) {
7961 return nil, false
7962 }
7963
7964
7965 func (sv StructuredValue) AsStructuredValue() (*StructuredValue, bool) {
7966 return &sv, true
7967 }
7968
7969
7970 func (sv StructuredValue) AsBasicStructuredValue() (BasicStructuredValue, bool) {
7971 return &sv, true
7972 }
7973
7974
7975 func (sv StructuredValue) AsResponseBase() (*ResponseBase, bool) {
7976 return nil, false
7977 }
7978
7979
7980 func (sv StructuredValue) AsBasicResponseBase() (BasicResponseBase, bool) {
7981 return &sv, true
7982 }
7983
7984
7985 type BasicThing interface {
7986 AsOrganization() (*Organization, bool)
7987 AsOffer() (*Offer, bool)
7988 AsBasicOffer() (BasicOffer, bool)
7989 AsAggregateOffer() (*AggregateOffer, bool)
7990 AsImageObject() (*ImageObject, bool)
7991 AsMediaObject() (*MediaObject, bool)
7992 AsBasicMediaObject() (BasicMediaObject, bool)
7993 AsCreativeWork() (*CreativeWork, bool)
7994 AsBasicCreativeWork() (BasicCreativeWork, bool)
7995 AsImageGallery() (*ImageGallery, bool)
7996 AsRecipe() (*Recipe, bool)
7997 AsNormalizedRectangle() (*NormalizedRectangle, bool)
7998 AsWebPage() (*WebPage, bool)
7999 AsBasicWebPage() (BasicWebPage, bool)
8000 AsPerson() (*Person, bool)
8001 AsIntangible() (*Intangible, bool)
8002 AsBasicIntangible() (BasicIntangible, bool)
8003 AsCollectionPage() (*CollectionPage, bool)
8004 AsBasicCollectionPage() (BasicCollectionPage, bool)
8005 AsStructuredValue() (*StructuredValue, bool)
8006 AsBasicStructuredValue() (BasicStructuredValue, bool)
8007 AsThing() (*Thing, bool)
8008 }
8009
8010
8011 type Thing struct {
8012
8013 Name *string `json:"name,omitempty"`
8014
8015 URL *string `json:"url,omitempty"`
8016
8017 Image *ImageObject `json:"image,omitempty"`
8018
8019 Description *string `json:"description,omitempty"`
8020
8021 AlternateName *string `json:"alternateName,omitempty"`
8022
8023 BingID *string `json:"bingId,omitempty"`
8024
8025 ReadLink *string `json:"readLink,omitempty"`
8026
8027 WebSearchURL *string `json:"webSearchUrl,omitempty"`
8028
8029 ID *string `json:"id,omitempty"`
8030
8031 Type TypeBasicResponseBase `json:"_type,omitempty"`
8032 }
8033
8034 func unmarshalBasicThing(body []byte) (BasicThing, error) {
8035 var m map[string]interface{}
8036 err := json.Unmarshal(body, &m)
8037 if err != nil {
8038 return nil, err
8039 }
8040
8041 switch m["_type"] {
8042 case string(TypeOrganization):
8043 var o Organization
8044 err := json.Unmarshal(body, &o)
8045 return o, err
8046 case string(TypeOffer):
8047 var o Offer
8048 err := json.Unmarshal(body, &o)
8049 return o, err
8050 case string(TypeAggregateOffer):
8051 var ao AggregateOffer
8052 err := json.Unmarshal(body, &ao)
8053 return ao, err
8054 case string(TypeImageObject):
8055 var ioVar ImageObject
8056 err := json.Unmarshal(body, &ioVar)
8057 return ioVar, err
8058 case string(TypeMediaObject):
8059 var mo MediaObject
8060 err := json.Unmarshal(body, &mo)
8061 return mo, err
8062 case string(TypeCreativeWork):
8063 var cw CreativeWork
8064 err := json.Unmarshal(body, &cw)
8065 return cw, err
8066 case string(TypeImageGallery):
8067 var ig ImageGallery
8068 err := json.Unmarshal(body, &ig)
8069 return ig, err
8070 case string(TypeRecipe):
8071 var r Recipe
8072 err := json.Unmarshal(body, &r)
8073 return r, err
8074 case string(TypeNormalizedRectangle):
8075 var nr NormalizedRectangle
8076 err := json.Unmarshal(body, &nr)
8077 return nr, err
8078 case string(TypeWebPage):
8079 var wp WebPage
8080 err := json.Unmarshal(body, &wp)
8081 return wp, err
8082 case string(TypePerson):
8083 var p Person
8084 err := json.Unmarshal(body, &p)
8085 return p, err
8086 case string(TypeIntangible):
8087 var i Intangible
8088 err := json.Unmarshal(body, &i)
8089 return i, err
8090 case string(TypeCollectionPage):
8091 var cp CollectionPage
8092 err := json.Unmarshal(body, &cp)
8093 return cp, err
8094 case string(TypeStructuredValue):
8095 var sv StructuredValue
8096 err := json.Unmarshal(body, &sv)
8097 return sv, err
8098 default:
8099 var t Thing
8100 err := json.Unmarshal(body, &t)
8101 return t, err
8102 }
8103 }
8104 func unmarshalBasicThingArray(body []byte) ([]BasicThing, error) {
8105 var rawMessages []*json.RawMessage
8106 err := json.Unmarshal(body, &rawMessages)
8107 if err != nil {
8108 return nil, err
8109 }
8110
8111 tArray := make([]BasicThing, len(rawMessages))
8112
8113 for index, rawMessage := range rawMessages {
8114 t, err := unmarshalBasicThing(*rawMessage)
8115 if err != nil {
8116 return nil, err
8117 }
8118 tArray[index] = t
8119 }
8120 return tArray, nil
8121 }
8122
8123
8124 func (t Thing) MarshalJSON() ([]byte, error) {
8125 t.Type = TypeThing
8126 objectMap := make(map[string]interface{})
8127 if t.Type != "" {
8128 objectMap["_type"] = t.Type
8129 }
8130 return json.Marshal(objectMap)
8131 }
8132
8133
8134 func (t Thing) AsOrganization() (*Organization, bool) {
8135 return nil, false
8136 }
8137
8138
8139 func (t Thing) AsOffer() (*Offer, bool) {
8140 return nil, false
8141 }
8142
8143
8144 func (t Thing) AsBasicOffer() (BasicOffer, bool) {
8145 return nil, false
8146 }
8147
8148
8149 func (t Thing) AsAggregateOffer() (*AggregateOffer, bool) {
8150 return nil, false
8151 }
8152
8153
8154 func (t Thing) AsImageObject() (*ImageObject, bool) {
8155 return nil, false
8156 }
8157
8158
8159 func (t Thing) AsImages() (*Images, bool) {
8160 return nil, false
8161 }
8162
8163
8164 func (t Thing) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
8165 return nil, false
8166 }
8167
8168
8169 func (t Thing) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
8170 return nil, false
8171 }
8172
8173
8174 func (t Thing) AsAnswer() (*Answer, bool) {
8175 return nil, false
8176 }
8177
8178
8179 func (t Thing) AsBasicAnswer() (BasicAnswer, bool) {
8180 return nil, false
8181 }
8182
8183
8184 func (t Thing) AsMediaObject() (*MediaObject, bool) {
8185 return nil, false
8186 }
8187
8188
8189 func (t Thing) AsBasicMediaObject() (BasicMediaObject, bool) {
8190 return nil, false
8191 }
8192
8193
8194 func (t Thing) AsResponse() (*Response, bool) {
8195 return nil, false
8196 }
8197
8198
8199 func (t Thing) AsBasicResponse() (BasicResponse, bool) {
8200 return &t, true
8201 }
8202
8203
8204 func (t Thing) AsThing() (*Thing, bool) {
8205 return &t, true
8206 }
8207
8208
8209 func (t Thing) AsBasicThing() (BasicThing, bool) {
8210 return &t, true
8211 }
8212
8213
8214 func (t Thing) AsCreativeWork() (*CreativeWork, bool) {
8215 return nil, false
8216 }
8217
8218
8219 func (t Thing) AsBasicCreativeWork() (BasicCreativeWork, bool) {
8220 return nil, false
8221 }
8222
8223
8224 func (t Thing) AsIdentifiable() (*Identifiable, bool) {
8225 return nil, false
8226 }
8227
8228
8229 func (t Thing) AsBasicIdentifiable() (BasicIdentifiable, bool) {
8230 return &t, true
8231 }
8232
8233
8234 func (t Thing) AsErrorResponse() (*ErrorResponse, bool) {
8235 return nil, false
8236 }
8237
8238
8239 func (t Thing) AsImageGallery() (*ImageGallery, bool) {
8240 return nil, false
8241 }
8242
8243
8244 func (t Thing) AsRecipe() (*Recipe, bool) {
8245 return nil, false
8246 }
8247
8248
8249 func (t Thing) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
8250 return nil, false
8251 }
8252
8253
8254 func (t Thing) AsRecognizedEntity() (*RecognizedEntity, bool) {
8255 return nil, false
8256 }
8257
8258
8259 func (t Thing) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
8260 return nil, false
8261 }
8262
8263
8264 func (t Thing) AsImageInsights() (*ImageInsights, bool) {
8265 return nil, false
8266 }
8267
8268
8269 func (t Thing) AsTrendingImages() (*TrendingImages, bool) {
8270 return nil, false
8271 }
8272
8273
8274 func (t Thing) AsWebPage() (*WebPage, bool) {
8275 return nil, false
8276 }
8277
8278
8279 func (t Thing) AsBasicWebPage() (BasicWebPage, bool) {
8280 return nil, false
8281 }
8282
8283
8284 func (t Thing) AsPerson() (*Person, bool) {
8285 return nil, false
8286 }
8287
8288
8289 func (t Thing) AsIntangible() (*Intangible, bool) {
8290 return nil, false
8291 }
8292
8293
8294 func (t Thing) AsBasicIntangible() (BasicIntangible, bool) {
8295 return nil, false
8296 }
8297
8298
8299 func (t Thing) AsCollectionPage() (*CollectionPage, bool) {
8300 return nil, false
8301 }
8302
8303
8304 func (t Thing) AsBasicCollectionPage() (BasicCollectionPage, bool) {
8305 return nil, false
8306 }
8307
8308
8309 func (t Thing) AsStructuredValue() (*StructuredValue, bool) {
8310 return nil, false
8311 }
8312
8313
8314 func (t Thing) AsBasicStructuredValue() (BasicStructuredValue, bool) {
8315 return nil, false
8316 }
8317
8318
8319 func (t Thing) AsResponseBase() (*ResponseBase, bool) {
8320 return nil, false
8321 }
8322
8323
8324 func (t Thing) AsBasicResponseBase() (BasicResponseBase, bool) {
8325 return &t, true
8326 }
8327
8328
8329 type TrendingImages struct {
8330 autorest.Response `json:"-"`
8331
8332 Categories *[]TrendingImagesCategory `json:"categories,omitempty"`
8333
8334 ReadLink *string `json:"readLink,omitempty"`
8335
8336 WebSearchURL *string `json:"webSearchUrl,omitempty"`
8337
8338 ID *string `json:"id,omitempty"`
8339
8340 Type TypeBasicResponseBase `json:"_type,omitempty"`
8341 }
8342
8343
8344 func (ti TrendingImages) MarshalJSON() ([]byte, error) {
8345 ti.Type = TypeTrendingImages
8346 objectMap := make(map[string]interface{})
8347 if ti.Categories != nil {
8348 objectMap["categories"] = ti.Categories
8349 }
8350 if ti.Type != "" {
8351 objectMap["_type"] = ti.Type
8352 }
8353 return json.Marshal(objectMap)
8354 }
8355
8356
8357 func (ti TrendingImages) AsOrganization() (*Organization, bool) {
8358 return nil, false
8359 }
8360
8361
8362 func (ti TrendingImages) AsOffer() (*Offer, bool) {
8363 return nil, false
8364 }
8365
8366
8367 func (ti TrendingImages) AsBasicOffer() (BasicOffer, bool) {
8368 return nil, false
8369 }
8370
8371
8372 func (ti TrendingImages) AsAggregateOffer() (*AggregateOffer, bool) {
8373 return nil, false
8374 }
8375
8376
8377 func (ti TrendingImages) AsImageObject() (*ImageObject, bool) {
8378 return nil, false
8379 }
8380
8381
8382 func (ti TrendingImages) AsImages() (*Images, bool) {
8383 return nil, false
8384 }
8385
8386
8387 func (ti TrendingImages) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
8388 return nil, false
8389 }
8390
8391
8392 func (ti TrendingImages) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
8393 return nil, false
8394 }
8395
8396
8397 func (ti TrendingImages) AsAnswer() (*Answer, bool) {
8398 return nil, false
8399 }
8400
8401
8402 func (ti TrendingImages) AsBasicAnswer() (BasicAnswer, bool) {
8403 return nil, false
8404 }
8405
8406
8407 func (ti TrendingImages) AsMediaObject() (*MediaObject, bool) {
8408 return nil, false
8409 }
8410
8411
8412 func (ti TrendingImages) AsBasicMediaObject() (BasicMediaObject, bool) {
8413 return nil, false
8414 }
8415
8416
8417 func (ti TrendingImages) AsResponse() (*Response, bool) {
8418 return nil, false
8419 }
8420
8421
8422 func (ti TrendingImages) AsBasicResponse() (BasicResponse, bool) {
8423 return &ti, true
8424 }
8425
8426
8427 func (ti TrendingImages) AsThing() (*Thing, bool) {
8428 return nil, false
8429 }
8430
8431
8432 func (ti TrendingImages) AsBasicThing() (BasicThing, bool) {
8433 return nil, false
8434 }
8435
8436
8437 func (ti TrendingImages) AsCreativeWork() (*CreativeWork, bool) {
8438 return nil, false
8439 }
8440
8441
8442 func (ti TrendingImages) AsBasicCreativeWork() (BasicCreativeWork, bool) {
8443 return nil, false
8444 }
8445
8446
8447 func (ti TrendingImages) AsIdentifiable() (*Identifiable, bool) {
8448 return nil, false
8449 }
8450
8451
8452 func (ti TrendingImages) AsBasicIdentifiable() (BasicIdentifiable, bool) {
8453 return &ti, true
8454 }
8455
8456
8457 func (ti TrendingImages) AsErrorResponse() (*ErrorResponse, bool) {
8458 return nil, false
8459 }
8460
8461
8462 func (ti TrendingImages) AsImageGallery() (*ImageGallery, bool) {
8463 return nil, false
8464 }
8465
8466
8467 func (ti TrendingImages) AsRecipe() (*Recipe, bool) {
8468 return nil, false
8469 }
8470
8471
8472 func (ti TrendingImages) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
8473 return nil, false
8474 }
8475
8476
8477 func (ti TrendingImages) AsRecognizedEntity() (*RecognizedEntity, bool) {
8478 return nil, false
8479 }
8480
8481
8482 func (ti TrendingImages) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
8483 return nil, false
8484 }
8485
8486
8487 func (ti TrendingImages) AsImageInsights() (*ImageInsights, bool) {
8488 return nil, false
8489 }
8490
8491
8492 func (ti TrendingImages) AsTrendingImages() (*TrendingImages, bool) {
8493 return &ti, true
8494 }
8495
8496
8497 func (ti TrendingImages) AsWebPage() (*WebPage, bool) {
8498 return nil, false
8499 }
8500
8501
8502 func (ti TrendingImages) AsBasicWebPage() (BasicWebPage, bool) {
8503 return nil, false
8504 }
8505
8506
8507 func (ti TrendingImages) AsPerson() (*Person, bool) {
8508 return nil, false
8509 }
8510
8511
8512 func (ti TrendingImages) AsIntangible() (*Intangible, bool) {
8513 return nil, false
8514 }
8515
8516
8517 func (ti TrendingImages) AsBasicIntangible() (BasicIntangible, bool) {
8518 return nil, false
8519 }
8520
8521
8522 func (ti TrendingImages) AsCollectionPage() (*CollectionPage, bool) {
8523 return nil, false
8524 }
8525
8526
8527 func (ti TrendingImages) AsBasicCollectionPage() (BasicCollectionPage, bool) {
8528 return nil, false
8529 }
8530
8531
8532 func (ti TrendingImages) AsStructuredValue() (*StructuredValue, bool) {
8533 return nil, false
8534 }
8535
8536
8537 func (ti TrendingImages) AsBasicStructuredValue() (BasicStructuredValue, bool) {
8538 return nil, false
8539 }
8540
8541
8542 func (ti TrendingImages) AsResponseBase() (*ResponseBase, bool) {
8543 return nil, false
8544 }
8545
8546
8547 func (ti TrendingImages) AsBasicResponseBase() (BasicResponseBase, bool) {
8548 return &ti, true
8549 }
8550
8551
8552 type TrendingImagesCategory struct {
8553
8554 Title *string `json:"title,omitempty"`
8555
8556 Tiles *[]TrendingImagesTile `json:"tiles,omitempty"`
8557 }
8558
8559
8560 type TrendingImagesTile struct {
8561
8562 Query *Query `json:"query,omitempty"`
8563
8564 Image *ImageObject `json:"image,omitempty"`
8565 }
8566
8567
8568 type BasicWebPage interface {
8569 AsImageGallery() (*ImageGallery, bool)
8570 AsCollectionPage() (*CollectionPage, bool)
8571 AsBasicCollectionPage() (BasicCollectionPage, bool)
8572 AsWebPage() (*WebPage, bool)
8573 }
8574
8575
8576 type WebPage struct {
8577
8578 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
8579
8580 Provider *[]BasicThing `json:"provider,omitempty"`
8581
8582 DatePublished *string `json:"datePublished,omitempty"`
8583
8584 Text *string `json:"text,omitempty"`
8585
8586 Name *string `json:"name,omitempty"`
8587
8588 URL *string `json:"url,omitempty"`
8589
8590 Image *ImageObject `json:"image,omitempty"`
8591
8592 Description *string `json:"description,omitempty"`
8593
8594 AlternateName *string `json:"alternateName,omitempty"`
8595
8596 BingID *string `json:"bingId,omitempty"`
8597
8598 ReadLink *string `json:"readLink,omitempty"`
8599
8600 WebSearchURL *string `json:"webSearchUrl,omitempty"`
8601
8602 ID *string `json:"id,omitempty"`
8603
8604 Type TypeBasicResponseBase `json:"_type,omitempty"`
8605 }
8606
8607 func unmarshalBasicWebPage(body []byte) (BasicWebPage, error) {
8608 var m map[string]interface{}
8609 err := json.Unmarshal(body, &m)
8610 if err != nil {
8611 return nil, err
8612 }
8613
8614 switch m["_type"] {
8615 case string(TypeImageGallery):
8616 var ig ImageGallery
8617 err := json.Unmarshal(body, &ig)
8618 return ig, err
8619 case string(TypeCollectionPage):
8620 var cp CollectionPage
8621 err := json.Unmarshal(body, &cp)
8622 return cp, err
8623 default:
8624 var wp WebPage
8625 err := json.Unmarshal(body, &wp)
8626 return wp, err
8627 }
8628 }
8629 func unmarshalBasicWebPageArray(body []byte) ([]BasicWebPage, error) {
8630 var rawMessages []*json.RawMessage
8631 err := json.Unmarshal(body, &rawMessages)
8632 if err != nil {
8633 return nil, err
8634 }
8635
8636 wpArray := make([]BasicWebPage, len(rawMessages))
8637
8638 for index, rawMessage := range rawMessages {
8639 wp, err := unmarshalBasicWebPage(*rawMessage)
8640 if err != nil {
8641 return nil, err
8642 }
8643 wpArray[index] = wp
8644 }
8645 return wpArray, nil
8646 }
8647
8648
8649 func (wp WebPage) MarshalJSON() ([]byte, error) {
8650 wp.Type = TypeWebPage
8651 objectMap := make(map[string]interface{})
8652 if wp.Type != "" {
8653 objectMap["_type"] = wp.Type
8654 }
8655 return json.Marshal(objectMap)
8656 }
8657
8658
8659 func (wp WebPage) AsOrganization() (*Organization, bool) {
8660 return nil, false
8661 }
8662
8663
8664 func (wp WebPage) AsOffer() (*Offer, bool) {
8665 return nil, false
8666 }
8667
8668
8669 func (wp WebPage) AsBasicOffer() (BasicOffer, bool) {
8670 return nil, false
8671 }
8672
8673
8674 func (wp WebPage) AsAggregateOffer() (*AggregateOffer, bool) {
8675 return nil, false
8676 }
8677
8678
8679 func (wp WebPage) AsImageObject() (*ImageObject, bool) {
8680 return nil, false
8681 }
8682
8683
8684 func (wp WebPage) AsImages() (*Images, bool) {
8685 return nil, false
8686 }
8687
8688
8689 func (wp WebPage) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
8690 return nil, false
8691 }
8692
8693
8694 func (wp WebPage) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
8695 return nil, false
8696 }
8697
8698
8699 func (wp WebPage) AsAnswer() (*Answer, bool) {
8700 return nil, false
8701 }
8702
8703
8704 func (wp WebPage) AsBasicAnswer() (BasicAnswer, bool) {
8705 return nil, false
8706 }
8707
8708
8709 func (wp WebPage) AsMediaObject() (*MediaObject, bool) {
8710 return nil, false
8711 }
8712
8713
8714 func (wp WebPage) AsBasicMediaObject() (BasicMediaObject, bool) {
8715 return nil, false
8716 }
8717
8718
8719 func (wp WebPage) AsResponse() (*Response, bool) {
8720 return nil, false
8721 }
8722
8723
8724 func (wp WebPage) AsBasicResponse() (BasicResponse, bool) {
8725 return &wp, true
8726 }
8727
8728
8729 func (wp WebPage) AsThing() (*Thing, bool) {
8730 return nil, false
8731 }
8732
8733
8734 func (wp WebPage) AsBasicThing() (BasicThing, bool) {
8735 return &wp, true
8736 }
8737
8738
8739 func (wp WebPage) AsCreativeWork() (*CreativeWork, bool) {
8740 return nil, false
8741 }
8742
8743
8744 func (wp WebPage) AsBasicCreativeWork() (BasicCreativeWork, bool) {
8745 return &wp, true
8746 }
8747
8748
8749 func (wp WebPage) AsIdentifiable() (*Identifiable, bool) {
8750 return nil, false
8751 }
8752
8753
8754 func (wp WebPage) AsBasicIdentifiable() (BasicIdentifiable, bool) {
8755 return &wp, true
8756 }
8757
8758
8759 func (wp WebPage) AsErrorResponse() (*ErrorResponse, bool) {
8760 return nil, false
8761 }
8762
8763
8764 func (wp WebPage) AsImageGallery() (*ImageGallery, bool) {
8765 return nil, false
8766 }
8767
8768
8769 func (wp WebPage) AsRecipe() (*Recipe, bool) {
8770 return nil, false
8771 }
8772
8773
8774 func (wp WebPage) AsNormalizedRectangle() (*NormalizedRectangle, bool) {
8775 return nil, false
8776 }
8777
8778
8779 func (wp WebPage) AsRecognizedEntity() (*RecognizedEntity, bool) {
8780 return nil, false
8781 }
8782
8783
8784 func (wp WebPage) AsRecognizedEntityRegion() (*RecognizedEntityRegion, bool) {
8785 return nil, false
8786 }
8787
8788
8789 func (wp WebPage) AsImageInsights() (*ImageInsights, bool) {
8790 return nil, false
8791 }
8792
8793
8794 func (wp WebPage) AsTrendingImages() (*TrendingImages, bool) {
8795 return nil, false
8796 }
8797
8798
8799 func (wp WebPage) AsWebPage() (*WebPage, bool) {
8800 return &wp, true
8801 }
8802
8803
8804 func (wp WebPage) AsBasicWebPage() (BasicWebPage, bool) {
8805 return &wp, true
8806 }
8807
8808
8809 func (wp WebPage) AsPerson() (*Person, bool) {
8810 return nil, false
8811 }
8812
8813
8814 func (wp WebPage) AsIntangible() (*Intangible, bool) {
8815 return nil, false
8816 }
8817
8818
8819 func (wp WebPage) AsBasicIntangible() (BasicIntangible, bool) {
8820 return nil, false
8821 }
8822
8823
8824 func (wp WebPage) AsCollectionPage() (*CollectionPage, bool) {
8825 return nil, false
8826 }
8827
8828
8829 func (wp WebPage) AsBasicCollectionPage() (BasicCollectionPage, bool) {
8830 return nil, false
8831 }
8832
8833
8834 func (wp WebPage) AsStructuredValue() (*StructuredValue, bool) {
8835 return nil, false
8836 }
8837
8838
8839 func (wp WebPage) AsBasicStructuredValue() (BasicStructuredValue, bool) {
8840 return nil, false
8841 }
8842
8843
8844 func (wp WebPage) AsResponseBase() (*ResponseBase, bool) {
8845 return nil, false
8846 }
8847
8848
8849 func (wp WebPage) AsBasicResponseBase() (BasicResponseBase, bool) {
8850 return &wp, true
8851 }
8852
8853
8854 func (wp *WebPage) UnmarshalJSON(body []byte) error {
8855 var m map[string]*json.RawMessage
8856 err := json.Unmarshal(body, &m)
8857 if err != nil {
8858 return err
8859 }
8860 for k, v := range m {
8861 switch k {
8862 case "thumbnailUrl":
8863 if v != nil {
8864 var thumbnailURL string
8865 err = json.Unmarshal(*v, &thumbnailURL)
8866 if err != nil {
8867 return err
8868 }
8869 wp.ThumbnailURL = &thumbnailURL
8870 }
8871 case "provider":
8872 if v != nil {
8873 provider, err := unmarshalBasicThingArray(*v)
8874 if err != nil {
8875 return err
8876 }
8877 wp.Provider = &provider
8878 }
8879 case "datePublished":
8880 if v != nil {
8881 var datePublished string
8882 err = json.Unmarshal(*v, &datePublished)
8883 if err != nil {
8884 return err
8885 }
8886 wp.DatePublished = &datePublished
8887 }
8888 case "text":
8889 if v != nil {
8890 var textVar string
8891 err = json.Unmarshal(*v, &textVar)
8892 if err != nil {
8893 return err
8894 }
8895 wp.Text = &textVar
8896 }
8897 case "name":
8898 if v != nil {
8899 var name string
8900 err = json.Unmarshal(*v, &name)
8901 if err != nil {
8902 return err
8903 }
8904 wp.Name = &name
8905 }
8906 case "url":
8907 if v != nil {
8908 var URL string
8909 err = json.Unmarshal(*v, &URL)
8910 if err != nil {
8911 return err
8912 }
8913 wp.URL = &URL
8914 }
8915 case "image":
8916 if v != nil {
8917 var imageVar ImageObject
8918 err = json.Unmarshal(*v, &imageVar)
8919 if err != nil {
8920 return err
8921 }
8922 wp.Image = &imageVar
8923 }
8924 case "description":
8925 if v != nil {
8926 var description string
8927 err = json.Unmarshal(*v, &description)
8928 if err != nil {
8929 return err
8930 }
8931 wp.Description = &description
8932 }
8933 case "alternateName":
8934 if v != nil {
8935 var alternateName string
8936 err = json.Unmarshal(*v, &alternateName)
8937 if err != nil {
8938 return err
8939 }
8940 wp.AlternateName = &alternateName
8941 }
8942 case "bingId":
8943 if v != nil {
8944 var bingID string
8945 err = json.Unmarshal(*v, &bingID)
8946 if err != nil {
8947 return err
8948 }
8949 wp.BingID = &bingID
8950 }
8951 case "readLink":
8952 if v != nil {
8953 var readLink string
8954 err = json.Unmarshal(*v, &readLink)
8955 if err != nil {
8956 return err
8957 }
8958 wp.ReadLink = &readLink
8959 }
8960 case "webSearchUrl":
8961 if v != nil {
8962 var webSearchURL string
8963 err = json.Unmarshal(*v, &webSearchURL)
8964 if err != nil {
8965 return err
8966 }
8967 wp.WebSearchURL = &webSearchURL
8968 }
8969 case "id":
8970 if v != nil {
8971 var ID string
8972 err = json.Unmarshal(*v, &ID)
8973 if err != nil {
8974 return err
8975 }
8976 wp.ID = &ID
8977 }
8978 case "_type":
8979 if v != nil {
8980 var typeVar TypeBasicResponseBase
8981 err = json.Unmarshal(*v, &typeVar)
8982 if err != nil {
8983 return err
8984 }
8985 wp.Type = typeVar
8986 }
8987 }
8988 }
8989
8990 return nil
8991 }
8992
View as plain text