1 package entitysearch
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/entitysearch"
16
17
18 type Airport struct {
19
20 IataCode *string `json:"iataCode,omitempty"`
21
22 IcaoCode *string `json:"icaoCode,omitempty"`
23
24 Address *PostalAddress `json:"address,omitempty"`
25
26 Telephone *string `json:"telephone,omitempty"`
27
28 Name *string `json:"name,omitempty"`
29
30 URL *string `json:"url,omitempty"`
31
32 Image *ImageObject `json:"image,omitempty"`
33
34 Description *string `json:"description,omitempty"`
35
36 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
37
38 BingID *string `json:"bingId,omitempty"`
39
40 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
41
42 WebSearchURL *string `json:"webSearchUrl,omitempty"`
43
44 ID *string `json:"id,omitempty"`
45
46 Type TypeBasicResponseBase `json:"_type,omitempty"`
47 }
48
49
50 func (a Airport) MarshalJSON() ([]byte, error) {
51 a.Type = TypeAirport
52 objectMap := make(map[string]interface{})
53 if a.Type != "" {
54 objectMap["_type"] = a.Type
55 }
56 return json.Marshal(objectMap)
57 }
58
59
60 func (a Airport) AsImageObject() (*ImageObject, bool) {
61 return nil, false
62 }
63
64
65 func (a Airport) AsThing() (*Thing, bool) {
66 return nil, false
67 }
68
69
70 func (a Airport) AsBasicThing() (BasicThing, bool) {
71 return &a, true
72 }
73
74
75 func (a Airport) AsEntities() (*Entities, bool) {
76 return nil, false
77 }
78
79
80 func (a Airport) AsPlaces() (*Places, bool) {
81 return nil, false
82 }
83
84
85 func (a Airport) AsSearchResponse() (*SearchResponse, bool) {
86 return nil, false
87 }
88
89
90 func (a Airport) AsResponse() (*Response, bool) {
91 return nil, false
92 }
93
94
95 func (a Airport) AsBasicResponse() (BasicResponse, bool) {
96 return &a, true
97 }
98
99
100 func (a Airport) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
101 return nil, false
102 }
103
104
105 func (a Airport) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
106 return nil, false
107 }
108
109
110 func (a Airport) AsIdentifiable() (*Identifiable, bool) {
111 return nil, false
112 }
113
114
115 func (a Airport) AsBasicIdentifiable() (BasicIdentifiable, bool) {
116 return &a, true
117 }
118
119
120 func (a Airport) AsAnswer() (*Answer, bool) {
121 return nil, false
122 }
123
124
125 func (a Airport) AsBasicAnswer() (BasicAnswer, bool) {
126 return nil, false
127 }
128
129
130 func (a Airport) AsErrorResponse() (*ErrorResponse, bool) {
131 return nil, false
132 }
133
134
135 func (a Airport) AsPostalAddress() (*PostalAddress, bool) {
136 return nil, false
137 }
138
139
140 func (a Airport) AsPlace() (*Place, bool) {
141 return nil, false
142 }
143
144
145 func (a Airport) AsBasicPlace() (BasicPlace, bool) {
146 return &a, true
147 }
148
149
150 func (a Airport) AsOrganization() (*Organization, bool) {
151 return nil, false
152 }
153
154
155 func (a Airport) AsCreativeWork() (*CreativeWork, bool) {
156 return nil, false
157 }
158
159
160 func (a Airport) AsBasicCreativeWork() (BasicCreativeWork, bool) {
161 return nil, false
162 }
163
164
165 func (a Airport) AsIntangible() (*Intangible, bool) {
166 return nil, false
167 }
168
169
170 func (a Airport) AsBasicIntangible() (BasicIntangible, bool) {
171 return nil, false
172 }
173
174
175 func (a Airport) AsMovieTheater() (*MovieTheater, bool) {
176 return nil, false
177 }
178
179
180 func (a Airport) AsMediaObject() (*MediaObject, bool) {
181 return nil, false
182 }
183
184
185 func (a Airport) AsBasicMediaObject() (BasicMediaObject, bool) {
186 return nil, false
187 }
188
189
190 func (a Airport) AsCivicStructure() (*CivicStructure, bool) {
191 return nil, false
192 }
193
194
195 func (a Airport) AsBasicCivicStructure() (BasicCivicStructure, bool) {
196 return &a, true
197 }
198
199
200 func (a Airport) AsLocalBusiness() (*LocalBusiness, bool) {
201 return nil, false
202 }
203
204
205 func (a Airport) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
206 return nil, false
207 }
208
209
210 func (a Airport) AsTouristAttraction() (*TouristAttraction, bool) {
211 return nil, false
212 }
213
214
215 func (a Airport) AsAirport() (*Airport, bool) {
216 return &a, true
217 }
218
219
220 func (a Airport) AsLicense() (*License, bool) {
221 return nil, false
222 }
223
224
225 func (a Airport) AsStructuredValue() (*StructuredValue, bool) {
226 return nil, false
227 }
228
229
230 func (a Airport) AsBasicStructuredValue() (BasicStructuredValue, bool) {
231 return nil, false
232 }
233
234
235 func (a Airport) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
236 return nil, false
237 }
238
239
240 func (a Airport) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
241 return nil, false
242 }
243
244
245 func (a Airport) AsFoodEstablishment() (*FoodEstablishment, bool) {
246 return nil, false
247 }
248
249
250 func (a Airport) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
251 return nil, false
252 }
253
254
255 func (a Airport) AsLodgingBusiness() (*LodgingBusiness, bool) {
256 return nil, false
257 }
258
259
260 func (a Airport) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
261 return nil, false
262 }
263
264
265 func (a Airport) AsRestaurant() (*Restaurant, bool) {
266 return nil, false
267 }
268
269
270 func (a Airport) AsHotel() (*Hotel, bool) {
271 return nil, false
272 }
273
274
275 func (a Airport) AsResponseBase() (*ResponseBase, bool) {
276 return nil, false
277 }
278
279
280 func (a Airport) AsBasicResponseBase() (BasicResponseBase, bool) {
281 return &a, true
282 }
283
284
285 func (a *Airport) UnmarshalJSON(body []byte) error {
286 var m map[string]*json.RawMessage
287 err := json.Unmarshal(body, &m)
288 if err != nil {
289 return err
290 }
291 for k, v := range m {
292 switch k {
293 case "iataCode":
294 if v != nil {
295 var iataCode string
296 err = json.Unmarshal(*v, &iataCode)
297 if err != nil {
298 return err
299 }
300 a.IataCode = &iataCode
301 }
302 case "icaoCode":
303 if v != nil {
304 var icaoCode string
305 err = json.Unmarshal(*v, &icaoCode)
306 if err != nil {
307 return err
308 }
309 a.IcaoCode = &icaoCode
310 }
311 case "address":
312 if v != nil {
313 var address PostalAddress
314 err = json.Unmarshal(*v, &address)
315 if err != nil {
316 return err
317 }
318 a.Address = &address
319 }
320 case "telephone":
321 if v != nil {
322 var telephone string
323 err = json.Unmarshal(*v, &telephone)
324 if err != nil {
325 return err
326 }
327 a.Telephone = &telephone
328 }
329 case "name":
330 if v != nil {
331 var name string
332 err = json.Unmarshal(*v, &name)
333 if err != nil {
334 return err
335 }
336 a.Name = &name
337 }
338 case "url":
339 if v != nil {
340 var URL string
341 err = json.Unmarshal(*v, &URL)
342 if err != nil {
343 return err
344 }
345 a.URL = &URL
346 }
347 case "image":
348 if v != nil {
349 var imageVar ImageObject
350 err = json.Unmarshal(*v, &imageVar)
351 if err != nil {
352 return err
353 }
354 a.Image = &imageVar
355 }
356 case "description":
357 if v != nil {
358 var description string
359 err = json.Unmarshal(*v, &description)
360 if err != nil {
361 return err
362 }
363 a.Description = &description
364 }
365 case "entityPresentationInfo":
366 if v != nil {
367 var entityPresentationInfo EntitiesEntityPresentationInfo
368 err = json.Unmarshal(*v, &entityPresentationInfo)
369 if err != nil {
370 return err
371 }
372 a.EntityPresentationInfo = &entityPresentationInfo
373 }
374 case "bingId":
375 if v != nil {
376 var bingID string
377 err = json.Unmarshal(*v, &bingID)
378 if err != nil {
379 return err
380 }
381 a.BingID = &bingID
382 }
383 case "contractualRules":
384 if v != nil {
385 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
386 if err != nil {
387 return err
388 }
389 a.ContractualRules = &contractualRules
390 }
391 case "webSearchUrl":
392 if v != nil {
393 var webSearchURL string
394 err = json.Unmarshal(*v, &webSearchURL)
395 if err != nil {
396 return err
397 }
398 a.WebSearchURL = &webSearchURL
399 }
400 case "id":
401 if v != nil {
402 var ID string
403 err = json.Unmarshal(*v, &ID)
404 if err != nil {
405 return err
406 }
407 a.ID = &ID
408 }
409 case "_type":
410 if v != nil {
411 var typeVar TypeBasicResponseBase
412 err = json.Unmarshal(*v, &typeVar)
413 if err != nil {
414 return err
415 }
416 a.Type = typeVar
417 }
418 }
419 }
420
421 return nil
422 }
423
424
425 type BasicAnswer interface {
426 AsEntities() (*Entities, bool)
427 AsPlaces() (*Places, bool)
428 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
429 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
430 AsAnswer() (*Answer, bool)
431 }
432
433
434 type Answer struct {
435
436 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
437
438 WebSearchURL *string `json:"webSearchUrl,omitempty"`
439
440 ID *string `json:"id,omitempty"`
441
442 Type TypeBasicResponseBase `json:"_type,omitempty"`
443 }
444
445 func unmarshalBasicAnswer(body []byte) (BasicAnswer, error) {
446 var m map[string]interface{}
447 err := json.Unmarshal(body, &m)
448 if err != nil {
449 return nil, err
450 }
451
452 switch m["_type"] {
453 case string(TypeEntities):
454 var e Entities
455 err := json.Unmarshal(body, &e)
456 return e, err
457 case string(TypePlaces):
458 var p Places
459 err := json.Unmarshal(body, &p)
460 return p, err
461 case string(TypeSearchResultsAnswer):
462 var sra SearchResultsAnswer
463 err := json.Unmarshal(body, &sra)
464 return sra, err
465 default:
466 var a Answer
467 err := json.Unmarshal(body, &a)
468 return a, err
469 }
470 }
471 func unmarshalBasicAnswerArray(body []byte) ([]BasicAnswer, error) {
472 var rawMessages []*json.RawMessage
473 err := json.Unmarshal(body, &rawMessages)
474 if err != nil {
475 return nil, err
476 }
477
478 aArray := make([]BasicAnswer, len(rawMessages))
479
480 for index, rawMessage := range rawMessages {
481 a, err := unmarshalBasicAnswer(*rawMessage)
482 if err != nil {
483 return nil, err
484 }
485 aArray[index] = a
486 }
487 return aArray, nil
488 }
489
490
491 func (a Answer) MarshalJSON() ([]byte, error) {
492 a.Type = TypeAnswer
493 objectMap := make(map[string]interface{})
494 if a.Type != "" {
495 objectMap["_type"] = a.Type
496 }
497 return json.Marshal(objectMap)
498 }
499
500
501 func (a Answer) AsImageObject() (*ImageObject, bool) {
502 return nil, false
503 }
504
505
506 func (a Answer) AsThing() (*Thing, bool) {
507 return nil, false
508 }
509
510
511 func (a Answer) AsBasicThing() (BasicThing, bool) {
512 return nil, false
513 }
514
515
516 func (a Answer) AsEntities() (*Entities, bool) {
517 return nil, false
518 }
519
520
521 func (a Answer) AsPlaces() (*Places, bool) {
522 return nil, false
523 }
524
525
526 func (a Answer) AsSearchResponse() (*SearchResponse, bool) {
527 return nil, false
528 }
529
530
531 func (a Answer) AsResponse() (*Response, bool) {
532 return nil, false
533 }
534
535
536 func (a Answer) AsBasicResponse() (BasicResponse, bool) {
537 return &a, true
538 }
539
540
541 func (a Answer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
542 return nil, false
543 }
544
545
546 func (a Answer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
547 return nil, false
548 }
549
550
551 func (a Answer) AsIdentifiable() (*Identifiable, bool) {
552 return nil, false
553 }
554
555
556 func (a Answer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
557 return &a, true
558 }
559
560
561 func (a Answer) AsAnswer() (*Answer, bool) {
562 return &a, true
563 }
564
565
566 func (a Answer) AsBasicAnswer() (BasicAnswer, bool) {
567 return &a, true
568 }
569
570
571 func (a Answer) AsErrorResponse() (*ErrorResponse, bool) {
572 return nil, false
573 }
574
575
576 func (a Answer) AsPostalAddress() (*PostalAddress, bool) {
577 return nil, false
578 }
579
580
581 func (a Answer) AsPlace() (*Place, bool) {
582 return nil, false
583 }
584
585
586 func (a Answer) AsBasicPlace() (BasicPlace, bool) {
587 return nil, false
588 }
589
590
591 func (a Answer) AsOrganization() (*Organization, bool) {
592 return nil, false
593 }
594
595
596 func (a Answer) AsCreativeWork() (*CreativeWork, bool) {
597 return nil, false
598 }
599
600
601 func (a Answer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
602 return nil, false
603 }
604
605
606 func (a Answer) AsIntangible() (*Intangible, bool) {
607 return nil, false
608 }
609
610
611 func (a Answer) AsBasicIntangible() (BasicIntangible, bool) {
612 return nil, false
613 }
614
615
616 func (a Answer) AsMovieTheater() (*MovieTheater, bool) {
617 return nil, false
618 }
619
620
621 func (a Answer) AsMediaObject() (*MediaObject, bool) {
622 return nil, false
623 }
624
625
626 func (a Answer) AsBasicMediaObject() (BasicMediaObject, bool) {
627 return nil, false
628 }
629
630
631 func (a Answer) AsCivicStructure() (*CivicStructure, bool) {
632 return nil, false
633 }
634
635
636 func (a Answer) AsBasicCivicStructure() (BasicCivicStructure, bool) {
637 return nil, false
638 }
639
640
641 func (a Answer) AsLocalBusiness() (*LocalBusiness, bool) {
642 return nil, false
643 }
644
645
646 func (a Answer) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
647 return nil, false
648 }
649
650
651 func (a Answer) AsTouristAttraction() (*TouristAttraction, bool) {
652 return nil, false
653 }
654
655
656 func (a Answer) AsAirport() (*Airport, bool) {
657 return nil, false
658 }
659
660
661 func (a Answer) AsLicense() (*License, bool) {
662 return nil, false
663 }
664
665
666 func (a Answer) AsStructuredValue() (*StructuredValue, bool) {
667 return nil, false
668 }
669
670
671 func (a Answer) AsBasicStructuredValue() (BasicStructuredValue, bool) {
672 return nil, false
673 }
674
675
676 func (a Answer) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
677 return nil, false
678 }
679
680
681 func (a Answer) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
682 return nil, false
683 }
684
685
686 func (a Answer) AsFoodEstablishment() (*FoodEstablishment, bool) {
687 return nil, false
688 }
689
690
691 func (a Answer) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
692 return nil, false
693 }
694
695
696 func (a Answer) AsLodgingBusiness() (*LodgingBusiness, bool) {
697 return nil, false
698 }
699
700
701 func (a Answer) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
702 return nil, false
703 }
704
705
706 func (a Answer) AsRestaurant() (*Restaurant, bool) {
707 return nil, false
708 }
709
710
711 func (a Answer) AsHotel() (*Hotel, bool) {
712 return nil, false
713 }
714
715
716 func (a Answer) AsResponseBase() (*ResponseBase, bool) {
717 return nil, false
718 }
719
720
721 func (a Answer) AsBasicResponseBase() (BasicResponseBase, bool) {
722 return &a, true
723 }
724
725
726 func (a *Answer) UnmarshalJSON(body []byte) error {
727 var m map[string]*json.RawMessage
728 err := json.Unmarshal(body, &m)
729 if err != nil {
730 return err
731 }
732 for k, v := range m {
733 switch k {
734 case "contractualRules":
735 if v != nil {
736 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
737 if err != nil {
738 return err
739 }
740 a.ContractualRules = &contractualRules
741 }
742 case "webSearchUrl":
743 if v != nil {
744 var webSearchURL string
745 err = json.Unmarshal(*v, &webSearchURL)
746 if err != nil {
747 return err
748 }
749 a.WebSearchURL = &webSearchURL
750 }
751 case "id":
752 if v != nil {
753 var ID string
754 err = json.Unmarshal(*v, &ID)
755 if err != nil {
756 return err
757 }
758 a.ID = &ID
759 }
760 case "_type":
761 if v != nil {
762 var typeVar TypeBasicResponseBase
763 err = json.Unmarshal(*v, &typeVar)
764 if err != nil {
765 return err
766 }
767 a.Type = typeVar
768 }
769 }
770 }
771
772 return nil
773 }
774
775
776 type BasicCivicStructure interface {
777 AsAirport() (*Airport, bool)
778 AsCivicStructure() (*CivicStructure, bool)
779 }
780
781
782 type CivicStructure struct {
783
784 Address *PostalAddress `json:"address,omitempty"`
785
786 Telephone *string `json:"telephone,omitempty"`
787
788 Name *string `json:"name,omitempty"`
789
790 URL *string `json:"url,omitempty"`
791
792 Image *ImageObject `json:"image,omitempty"`
793
794 Description *string `json:"description,omitempty"`
795
796 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
797
798 BingID *string `json:"bingId,omitempty"`
799
800 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
801
802 WebSearchURL *string `json:"webSearchUrl,omitempty"`
803
804 ID *string `json:"id,omitempty"`
805
806 Type TypeBasicResponseBase `json:"_type,omitempty"`
807 }
808
809 func unmarshalBasicCivicStructure(body []byte) (BasicCivicStructure, error) {
810 var m map[string]interface{}
811 err := json.Unmarshal(body, &m)
812 if err != nil {
813 return nil, err
814 }
815
816 switch m["_type"] {
817 case string(TypeAirport):
818 var a Airport
819 err := json.Unmarshal(body, &a)
820 return a, err
821 default:
822 var cs CivicStructure
823 err := json.Unmarshal(body, &cs)
824 return cs, err
825 }
826 }
827 func unmarshalBasicCivicStructureArray(body []byte) ([]BasicCivicStructure, error) {
828 var rawMessages []*json.RawMessage
829 err := json.Unmarshal(body, &rawMessages)
830 if err != nil {
831 return nil, err
832 }
833
834 csArray := make([]BasicCivicStructure, len(rawMessages))
835
836 for index, rawMessage := range rawMessages {
837 cs, err := unmarshalBasicCivicStructure(*rawMessage)
838 if err != nil {
839 return nil, err
840 }
841 csArray[index] = cs
842 }
843 return csArray, nil
844 }
845
846
847 func (cs CivicStructure) MarshalJSON() ([]byte, error) {
848 cs.Type = TypeCivicStructure
849 objectMap := make(map[string]interface{})
850 if cs.Type != "" {
851 objectMap["_type"] = cs.Type
852 }
853 return json.Marshal(objectMap)
854 }
855
856
857 func (cs CivicStructure) AsImageObject() (*ImageObject, bool) {
858 return nil, false
859 }
860
861
862 func (cs CivicStructure) AsThing() (*Thing, bool) {
863 return nil, false
864 }
865
866
867 func (cs CivicStructure) AsBasicThing() (BasicThing, bool) {
868 return &cs, true
869 }
870
871
872 func (cs CivicStructure) AsEntities() (*Entities, bool) {
873 return nil, false
874 }
875
876
877 func (cs CivicStructure) AsPlaces() (*Places, bool) {
878 return nil, false
879 }
880
881
882 func (cs CivicStructure) AsSearchResponse() (*SearchResponse, bool) {
883 return nil, false
884 }
885
886
887 func (cs CivicStructure) AsResponse() (*Response, bool) {
888 return nil, false
889 }
890
891
892 func (cs CivicStructure) AsBasicResponse() (BasicResponse, bool) {
893 return &cs, true
894 }
895
896
897 func (cs CivicStructure) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
898 return nil, false
899 }
900
901
902 func (cs CivicStructure) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
903 return nil, false
904 }
905
906
907 func (cs CivicStructure) AsIdentifiable() (*Identifiable, bool) {
908 return nil, false
909 }
910
911
912 func (cs CivicStructure) AsBasicIdentifiable() (BasicIdentifiable, bool) {
913 return &cs, true
914 }
915
916
917 func (cs CivicStructure) AsAnswer() (*Answer, bool) {
918 return nil, false
919 }
920
921
922 func (cs CivicStructure) AsBasicAnswer() (BasicAnswer, bool) {
923 return nil, false
924 }
925
926
927 func (cs CivicStructure) AsErrorResponse() (*ErrorResponse, bool) {
928 return nil, false
929 }
930
931
932 func (cs CivicStructure) AsPostalAddress() (*PostalAddress, bool) {
933 return nil, false
934 }
935
936
937 func (cs CivicStructure) AsPlace() (*Place, bool) {
938 return nil, false
939 }
940
941
942 func (cs CivicStructure) AsBasicPlace() (BasicPlace, bool) {
943 return &cs, true
944 }
945
946
947 func (cs CivicStructure) AsOrganization() (*Organization, bool) {
948 return nil, false
949 }
950
951
952 func (cs CivicStructure) AsCreativeWork() (*CreativeWork, bool) {
953 return nil, false
954 }
955
956
957 func (cs CivicStructure) AsBasicCreativeWork() (BasicCreativeWork, bool) {
958 return nil, false
959 }
960
961
962 func (cs CivicStructure) AsIntangible() (*Intangible, bool) {
963 return nil, false
964 }
965
966
967 func (cs CivicStructure) AsBasicIntangible() (BasicIntangible, bool) {
968 return nil, false
969 }
970
971
972 func (cs CivicStructure) AsMovieTheater() (*MovieTheater, bool) {
973 return nil, false
974 }
975
976
977 func (cs CivicStructure) AsMediaObject() (*MediaObject, bool) {
978 return nil, false
979 }
980
981
982 func (cs CivicStructure) AsBasicMediaObject() (BasicMediaObject, bool) {
983 return nil, false
984 }
985
986
987 func (cs CivicStructure) AsCivicStructure() (*CivicStructure, bool) {
988 return &cs, true
989 }
990
991
992 func (cs CivicStructure) AsBasicCivicStructure() (BasicCivicStructure, bool) {
993 return &cs, true
994 }
995
996
997 func (cs CivicStructure) AsLocalBusiness() (*LocalBusiness, bool) {
998 return nil, false
999 }
1000
1001
1002 func (cs CivicStructure) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
1003 return nil, false
1004 }
1005
1006
1007 func (cs CivicStructure) AsTouristAttraction() (*TouristAttraction, bool) {
1008 return nil, false
1009 }
1010
1011
1012 func (cs CivicStructure) AsAirport() (*Airport, bool) {
1013 return nil, false
1014 }
1015
1016
1017 func (cs CivicStructure) AsLicense() (*License, bool) {
1018 return nil, false
1019 }
1020
1021
1022 func (cs CivicStructure) AsStructuredValue() (*StructuredValue, bool) {
1023 return nil, false
1024 }
1025
1026
1027 func (cs CivicStructure) AsBasicStructuredValue() (BasicStructuredValue, bool) {
1028 return nil, false
1029 }
1030
1031
1032 func (cs CivicStructure) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
1033 return nil, false
1034 }
1035
1036
1037 func (cs CivicStructure) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
1038 return nil, false
1039 }
1040
1041
1042 func (cs CivicStructure) AsFoodEstablishment() (*FoodEstablishment, bool) {
1043 return nil, false
1044 }
1045
1046
1047 func (cs CivicStructure) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
1048 return nil, false
1049 }
1050
1051
1052 func (cs CivicStructure) AsLodgingBusiness() (*LodgingBusiness, bool) {
1053 return nil, false
1054 }
1055
1056
1057 func (cs CivicStructure) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
1058 return nil, false
1059 }
1060
1061
1062 func (cs CivicStructure) AsRestaurant() (*Restaurant, bool) {
1063 return nil, false
1064 }
1065
1066
1067 func (cs CivicStructure) AsHotel() (*Hotel, bool) {
1068 return nil, false
1069 }
1070
1071
1072 func (cs CivicStructure) AsResponseBase() (*ResponseBase, bool) {
1073 return nil, false
1074 }
1075
1076
1077 func (cs CivicStructure) AsBasicResponseBase() (BasicResponseBase, bool) {
1078 return &cs, true
1079 }
1080
1081
1082 func (cs *CivicStructure) UnmarshalJSON(body []byte) error {
1083 var m map[string]*json.RawMessage
1084 err := json.Unmarshal(body, &m)
1085 if err != nil {
1086 return err
1087 }
1088 for k, v := range m {
1089 switch k {
1090 case "address":
1091 if v != nil {
1092 var address PostalAddress
1093 err = json.Unmarshal(*v, &address)
1094 if err != nil {
1095 return err
1096 }
1097 cs.Address = &address
1098 }
1099 case "telephone":
1100 if v != nil {
1101 var telephone string
1102 err = json.Unmarshal(*v, &telephone)
1103 if err != nil {
1104 return err
1105 }
1106 cs.Telephone = &telephone
1107 }
1108 case "name":
1109 if v != nil {
1110 var name string
1111 err = json.Unmarshal(*v, &name)
1112 if err != nil {
1113 return err
1114 }
1115 cs.Name = &name
1116 }
1117 case "url":
1118 if v != nil {
1119 var URL string
1120 err = json.Unmarshal(*v, &URL)
1121 if err != nil {
1122 return err
1123 }
1124 cs.URL = &URL
1125 }
1126 case "image":
1127 if v != nil {
1128 var imageVar ImageObject
1129 err = json.Unmarshal(*v, &imageVar)
1130 if err != nil {
1131 return err
1132 }
1133 cs.Image = &imageVar
1134 }
1135 case "description":
1136 if v != nil {
1137 var description string
1138 err = json.Unmarshal(*v, &description)
1139 if err != nil {
1140 return err
1141 }
1142 cs.Description = &description
1143 }
1144 case "entityPresentationInfo":
1145 if v != nil {
1146 var entityPresentationInfo EntitiesEntityPresentationInfo
1147 err = json.Unmarshal(*v, &entityPresentationInfo)
1148 if err != nil {
1149 return err
1150 }
1151 cs.EntityPresentationInfo = &entityPresentationInfo
1152 }
1153 case "bingId":
1154 if v != nil {
1155 var bingID string
1156 err = json.Unmarshal(*v, &bingID)
1157 if err != nil {
1158 return err
1159 }
1160 cs.BingID = &bingID
1161 }
1162 case "contractualRules":
1163 if v != nil {
1164 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
1165 if err != nil {
1166 return err
1167 }
1168 cs.ContractualRules = &contractualRules
1169 }
1170 case "webSearchUrl":
1171 if v != nil {
1172 var webSearchURL string
1173 err = json.Unmarshal(*v, &webSearchURL)
1174 if err != nil {
1175 return err
1176 }
1177 cs.WebSearchURL = &webSearchURL
1178 }
1179 case "id":
1180 if v != nil {
1181 var ID string
1182 err = json.Unmarshal(*v, &ID)
1183 if err != nil {
1184 return err
1185 }
1186 cs.ID = &ID
1187 }
1188 case "_type":
1189 if v != nil {
1190 var typeVar TypeBasicResponseBase
1191 err = json.Unmarshal(*v, &typeVar)
1192 if err != nil {
1193 return err
1194 }
1195 cs.Type = typeVar
1196 }
1197 }
1198 }
1199
1200 return nil
1201 }
1202
1203
1204 type BasicContractualRulesAttribution interface {
1205 AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool)
1206 AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool)
1207 AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool)
1208 AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool)
1209 AsContractualRulesAttribution() (*ContractualRulesAttribution, bool)
1210 }
1211
1212
1213 type ContractualRulesAttribution struct {
1214
1215 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"`
1216
1217 TargetPropertyName *string `json:"targetPropertyName,omitempty"`
1218
1219 Type Type `json:"_type,omitempty"`
1220 }
1221
1222 func unmarshalBasicContractualRulesAttribution(body []byte) (BasicContractualRulesAttribution, error) {
1223 var m map[string]interface{}
1224 err := json.Unmarshal(body, &m)
1225 if err != nil {
1226 return nil, err
1227 }
1228
1229 switch m["_type"] {
1230 case string(TypeContractualRulesLicenseAttribution):
1231 var crla ContractualRulesLicenseAttribution
1232 err := json.Unmarshal(body, &crla)
1233 return crla, err
1234 case string(TypeContractualRulesLinkAttribution):
1235 var crla ContractualRulesLinkAttribution
1236 err := json.Unmarshal(body, &crla)
1237 return crla, err
1238 case string(TypeContractualRulesMediaAttribution):
1239 var crma ContractualRulesMediaAttribution
1240 err := json.Unmarshal(body, &crma)
1241 return crma, err
1242 case string(TypeContractualRulesTextAttribution):
1243 var crta ContractualRulesTextAttribution
1244 err := json.Unmarshal(body, &crta)
1245 return crta, err
1246 default:
1247 var cra ContractualRulesAttribution
1248 err := json.Unmarshal(body, &cra)
1249 return cra, err
1250 }
1251 }
1252 func unmarshalBasicContractualRulesAttributionArray(body []byte) ([]BasicContractualRulesAttribution, error) {
1253 var rawMessages []*json.RawMessage
1254 err := json.Unmarshal(body, &rawMessages)
1255 if err != nil {
1256 return nil, err
1257 }
1258
1259 craArray := make([]BasicContractualRulesAttribution, len(rawMessages))
1260
1261 for index, rawMessage := range rawMessages {
1262 cra, err := unmarshalBasicContractualRulesAttribution(*rawMessage)
1263 if err != nil {
1264 return nil, err
1265 }
1266 craArray[index] = cra
1267 }
1268 return craArray, nil
1269 }
1270
1271
1272 func (cra ContractualRulesAttribution) MarshalJSON() ([]byte, error) {
1273 cra.Type = TypeContractualRulesAttribution
1274 objectMap := make(map[string]interface{})
1275 if cra.Type != "" {
1276 objectMap["_type"] = cra.Type
1277 }
1278 return json.Marshal(objectMap)
1279 }
1280
1281
1282 func (cra ContractualRulesAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) {
1283 return &cra, true
1284 }
1285
1286
1287 func (cra ContractualRulesAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) {
1288 return &cra, true
1289 }
1290
1291
1292 func (cra ContractualRulesAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) {
1293 return nil, false
1294 }
1295
1296
1297 func (cra ContractualRulesAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) {
1298 return nil, false
1299 }
1300
1301
1302 func (cra ContractualRulesAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) {
1303 return nil, false
1304 }
1305
1306
1307 func (cra ContractualRulesAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) {
1308 return nil, false
1309 }
1310
1311
1312 func (cra ContractualRulesAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) {
1313 return nil, false
1314 }
1315
1316
1317 func (cra ContractualRulesAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) {
1318 return &cra, true
1319 }
1320
1321
1322 type BasicContractualRulesContractualRule interface {
1323 AsContractualRulesAttribution() (*ContractualRulesAttribution, bool)
1324 AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool)
1325 AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool)
1326 AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool)
1327 AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool)
1328 AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool)
1329 AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool)
1330 }
1331
1332
1333 type ContractualRulesContractualRule struct {
1334
1335 TargetPropertyName *string `json:"targetPropertyName,omitempty"`
1336
1337 Type Type `json:"_type,omitempty"`
1338 }
1339
1340 func unmarshalBasicContractualRulesContractualRule(body []byte) (BasicContractualRulesContractualRule, error) {
1341 var m map[string]interface{}
1342 err := json.Unmarshal(body, &m)
1343 if err != nil {
1344 return nil, err
1345 }
1346
1347 switch m["_type"] {
1348 case string(TypeContractualRulesAttribution):
1349 var cra ContractualRulesAttribution
1350 err := json.Unmarshal(body, &cra)
1351 return cra, err
1352 case string(TypeContractualRulesLicenseAttribution):
1353 var crla ContractualRulesLicenseAttribution
1354 err := json.Unmarshal(body, &crla)
1355 return crla, err
1356 case string(TypeContractualRulesLinkAttribution):
1357 var crla ContractualRulesLinkAttribution
1358 err := json.Unmarshal(body, &crla)
1359 return crla, err
1360 case string(TypeContractualRulesMediaAttribution):
1361 var crma ContractualRulesMediaAttribution
1362 err := json.Unmarshal(body, &crma)
1363 return crma, err
1364 case string(TypeContractualRulesTextAttribution):
1365 var crta ContractualRulesTextAttribution
1366 err := json.Unmarshal(body, &crta)
1367 return crta, err
1368 default:
1369 var crcr ContractualRulesContractualRule
1370 err := json.Unmarshal(body, &crcr)
1371 return crcr, err
1372 }
1373 }
1374 func unmarshalBasicContractualRulesContractualRuleArray(body []byte) ([]BasicContractualRulesContractualRule, error) {
1375 var rawMessages []*json.RawMessage
1376 err := json.Unmarshal(body, &rawMessages)
1377 if err != nil {
1378 return nil, err
1379 }
1380
1381 crcrArray := make([]BasicContractualRulesContractualRule, len(rawMessages))
1382
1383 for index, rawMessage := range rawMessages {
1384 crcr, err := unmarshalBasicContractualRulesContractualRule(*rawMessage)
1385 if err != nil {
1386 return nil, err
1387 }
1388 crcrArray[index] = crcr
1389 }
1390 return crcrArray, nil
1391 }
1392
1393
1394 func (crcr ContractualRulesContractualRule) MarshalJSON() ([]byte, error) {
1395 crcr.Type = TypeContractualRulesContractualRule
1396 objectMap := make(map[string]interface{})
1397 if crcr.Type != "" {
1398 objectMap["_type"] = crcr.Type
1399 }
1400 return json.Marshal(objectMap)
1401 }
1402
1403
1404 func (crcr ContractualRulesContractualRule) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) {
1405 return nil, false
1406 }
1407
1408
1409 func (crcr ContractualRulesContractualRule) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) {
1410 return nil, false
1411 }
1412
1413
1414 func (crcr ContractualRulesContractualRule) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) {
1415 return nil, false
1416 }
1417
1418
1419 func (crcr ContractualRulesContractualRule) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) {
1420 return nil, false
1421 }
1422
1423
1424 func (crcr ContractualRulesContractualRule) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) {
1425 return nil, false
1426 }
1427
1428
1429 func (crcr ContractualRulesContractualRule) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) {
1430 return nil, false
1431 }
1432
1433
1434 func (crcr ContractualRulesContractualRule) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) {
1435 return &crcr, true
1436 }
1437
1438
1439 func (crcr ContractualRulesContractualRule) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) {
1440 return &crcr, true
1441 }
1442
1443
1444 type ContractualRulesLicenseAttribution struct {
1445
1446 License *License `json:"license,omitempty"`
1447
1448 LicenseNotice *string `json:"licenseNotice,omitempty"`
1449
1450 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"`
1451
1452 TargetPropertyName *string `json:"targetPropertyName,omitempty"`
1453
1454 Type Type `json:"_type,omitempty"`
1455 }
1456
1457
1458 func (crla ContractualRulesLicenseAttribution) MarshalJSON() ([]byte, error) {
1459 crla.Type = TypeContractualRulesLicenseAttribution
1460 objectMap := make(map[string]interface{})
1461 if crla.Type != "" {
1462 objectMap["_type"] = crla.Type
1463 }
1464 return json.Marshal(objectMap)
1465 }
1466
1467
1468 func (crla ContractualRulesLicenseAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) {
1469 return nil, false
1470 }
1471
1472
1473 func (crla ContractualRulesLicenseAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) {
1474 return &crla, true
1475 }
1476
1477
1478 func (crla ContractualRulesLicenseAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) {
1479 return &crla, true
1480 }
1481
1482
1483 func (crla ContractualRulesLicenseAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) {
1484 return nil, false
1485 }
1486
1487
1488 func (crla ContractualRulesLicenseAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) {
1489 return nil, false
1490 }
1491
1492
1493 func (crla ContractualRulesLicenseAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) {
1494 return nil, false
1495 }
1496
1497
1498 func (crla ContractualRulesLicenseAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) {
1499 return nil, false
1500 }
1501
1502
1503 func (crla ContractualRulesLicenseAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) {
1504 return &crla, true
1505 }
1506
1507
1508 type ContractualRulesLinkAttribution struct {
1509
1510 Text *string `json:"text,omitempty"`
1511
1512 URL *string `json:"url,omitempty"`
1513
1514 OptionalForListDisplay *bool `json:"optionalForListDisplay,omitempty"`
1515
1516 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"`
1517
1518 TargetPropertyName *string `json:"targetPropertyName,omitempty"`
1519
1520 Type Type `json:"_type,omitempty"`
1521 }
1522
1523
1524 func (crla ContractualRulesLinkAttribution) MarshalJSON() ([]byte, error) {
1525 crla.Type = TypeContractualRulesLinkAttribution
1526 objectMap := make(map[string]interface{})
1527 if crla.Text != nil {
1528 objectMap["text"] = crla.Text
1529 }
1530 if crla.URL != nil {
1531 objectMap["url"] = crla.URL
1532 }
1533 if crla.Type != "" {
1534 objectMap["_type"] = crla.Type
1535 }
1536 return json.Marshal(objectMap)
1537 }
1538
1539
1540 func (crla ContractualRulesLinkAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) {
1541 return nil, false
1542 }
1543
1544
1545 func (crla ContractualRulesLinkAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) {
1546 return &crla, true
1547 }
1548
1549
1550 func (crla ContractualRulesLinkAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) {
1551 return nil, false
1552 }
1553
1554
1555 func (crla ContractualRulesLinkAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) {
1556 return &crla, true
1557 }
1558
1559
1560 func (crla ContractualRulesLinkAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) {
1561 return nil, false
1562 }
1563
1564
1565 func (crla ContractualRulesLinkAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) {
1566 return nil, false
1567 }
1568
1569
1570 func (crla ContractualRulesLinkAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) {
1571 return nil, false
1572 }
1573
1574
1575 func (crla ContractualRulesLinkAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) {
1576 return &crla, true
1577 }
1578
1579
1580 type ContractualRulesMediaAttribution struct {
1581
1582 URL *string `json:"url,omitempty"`
1583
1584 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"`
1585
1586 TargetPropertyName *string `json:"targetPropertyName,omitempty"`
1587
1588 Type Type `json:"_type,omitempty"`
1589 }
1590
1591
1592 func (crma ContractualRulesMediaAttribution) MarshalJSON() ([]byte, error) {
1593 crma.Type = TypeContractualRulesMediaAttribution
1594 objectMap := make(map[string]interface{})
1595 if crma.Type != "" {
1596 objectMap["_type"] = crma.Type
1597 }
1598 return json.Marshal(objectMap)
1599 }
1600
1601
1602 func (crma ContractualRulesMediaAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) {
1603 return nil, false
1604 }
1605
1606
1607 func (crma ContractualRulesMediaAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) {
1608 return &crma, true
1609 }
1610
1611
1612 func (crma ContractualRulesMediaAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) {
1613 return nil, false
1614 }
1615
1616
1617 func (crma ContractualRulesMediaAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) {
1618 return nil, false
1619 }
1620
1621
1622 func (crma ContractualRulesMediaAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) {
1623 return &crma, true
1624 }
1625
1626
1627 func (crma ContractualRulesMediaAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) {
1628 return nil, false
1629 }
1630
1631
1632 func (crma ContractualRulesMediaAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) {
1633 return nil, false
1634 }
1635
1636
1637 func (crma ContractualRulesMediaAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) {
1638 return &crma, true
1639 }
1640
1641
1642 type ContractualRulesTextAttribution struct {
1643
1644 Text *string `json:"text,omitempty"`
1645
1646 OptionalForListDisplay *bool `json:"optionalForListDisplay,omitempty"`
1647
1648 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"`
1649
1650 TargetPropertyName *string `json:"targetPropertyName,omitempty"`
1651
1652 Type Type `json:"_type,omitempty"`
1653 }
1654
1655
1656 func (crta ContractualRulesTextAttribution) MarshalJSON() ([]byte, error) {
1657 crta.Type = TypeContractualRulesTextAttribution
1658 objectMap := make(map[string]interface{})
1659 if crta.Text != nil {
1660 objectMap["text"] = crta.Text
1661 }
1662 if crta.Type != "" {
1663 objectMap["_type"] = crta.Type
1664 }
1665 return json.Marshal(objectMap)
1666 }
1667
1668
1669 func (crta ContractualRulesTextAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) {
1670 return nil, false
1671 }
1672
1673
1674 func (crta ContractualRulesTextAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) {
1675 return &crta, true
1676 }
1677
1678
1679 func (crta ContractualRulesTextAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) {
1680 return nil, false
1681 }
1682
1683
1684 func (crta ContractualRulesTextAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) {
1685 return nil, false
1686 }
1687
1688
1689 func (crta ContractualRulesTextAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) {
1690 return nil, false
1691 }
1692
1693
1694 func (crta ContractualRulesTextAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) {
1695 return &crta, true
1696 }
1697
1698
1699 func (crta ContractualRulesTextAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) {
1700 return nil, false
1701 }
1702
1703
1704 func (crta ContractualRulesTextAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) {
1705 return &crta, true
1706 }
1707
1708
1709 type BasicCreativeWork interface {
1710 AsImageObject() (*ImageObject, bool)
1711 AsMediaObject() (*MediaObject, bool)
1712 AsBasicMediaObject() (BasicMediaObject, bool)
1713 AsLicense() (*License, bool)
1714 AsCreativeWork() (*CreativeWork, bool)
1715 }
1716
1717
1718 type CreativeWork struct {
1719
1720 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
1721
1722 Provider *[]BasicThing `json:"provider,omitempty"`
1723
1724 Text *string `json:"text,omitempty"`
1725
1726 Name *string `json:"name,omitempty"`
1727
1728 URL *string `json:"url,omitempty"`
1729
1730 Image *ImageObject `json:"image,omitempty"`
1731
1732 Description *string `json:"description,omitempty"`
1733
1734 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
1735
1736 BingID *string `json:"bingId,omitempty"`
1737
1738 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
1739
1740 WebSearchURL *string `json:"webSearchUrl,omitempty"`
1741
1742 ID *string `json:"id,omitempty"`
1743
1744 Type TypeBasicResponseBase `json:"_type,omitempty"`
1745 }
1746
1747 func unmarshalBasicCreativeWork(body []byte) (BasicCreativeWork, error) {
1748 var m map[string]interface{}
1749 err := json.Unmarshal(body, &m)
1750 if err != nil {
1751 return nil, err
1752 }
1753
1754 switch m["_type"] {
1755 case string(TypeImageObject):
1756 var ioVar ImageObject
1757 err := json.Unmarshal(body, &ioVar)
1758 return ioVar, err
1759 case string(TypeMediaObject):
1760 var mo MediaObject
1761 err := json.Unmarshal(body, &mo)
1762 return mo, err
1763 case string(TypeLicense):
1764 var l License
1765 err := json.Unmarshal(body, &l)
1766 return l, err
1767 default:
1768 var cw CreativeWork
1769 err := json.Unmarshal(body, &cw)
1770 return cw, err
1771 }
1772 }
1773 func unmarshalBasicCreativeWorkArray(body []byte) ([]BasicCreativeWork, error) {
1774 var rawMessages []*json.RawMessage
1775 err := json.Unmarshal(body, &rawMessages)
1776 if err != nil {
1777 return nil, err
1778 }
1779
1780 cwArray := make([]BasicCreativeWork, len(rawMessages))
1781
1782 for index, rawMessage := range rawMessages {
1783 cw, err := unmarshalBasicCreativeWork(*rawMessage)
1784 if err != nil {
1785 return nil, err
1786 }
1787 cwArray[index] = cw
1788 }
1789 return cwArray, nil
1790 }
1791
1792
1793 func (cw CreativeWork) MarshalJSON() ([]byte, error) {
1794 cw.Type = TypeCreativeWork
1795 objectMap := make(map[string]interface{})
1796 if cw.Type != "" {
1797 objectMap["_type"] = cw.Type
1798 }
1799 return json.Marshal(objectMap)
1800 }
1801
1802
1803 func (cw CreativeWork) AsImageObject() (*ImageObject, bool) {
1804 return nil, false
1805 }
1806
1807
1808 func (cw CreativeWork) AsThing() (*Thing, bool) {
1809 return nil, false
1810 }
1811
1812
1813 func (cw CreativeWork) AsBasicThing() (BasicThing, bool) {
1814 return &cw, true
1815 }
1816
1817
1818 func (cw CreativeWork) AsEntities() (*Entities, bool) {
1819 return nil, false
1820 }
1821
1822
1823 func (cw CreativeWork) AsPlaces() (*Places, bool) {
1824 return nil, false
1825 }
1826
1827
1828 func (cw CreativeWork) AsSearchResponse() (*SearchResponse, bool) {
1829 return nil, false
1830 }
1831
1832
1833 func (cw CreativeWork) AsResponse() (*Response, bool) {
1834 return nil, false
1835 }
1836
1837
1838 func (cw CreativeWork) AsBasicResponse() (BasicResponse, bool) {
1839 return &cw, true
1840 }
1841
1842
1843 func (cw CreativeWork) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
1844 return nil, false
1845 }
1846
1847
1848 func (cw CreativeWork) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
1849 return nil, false
1850 }
1851
1852
1853 func (cw CreativeWork) AsIdentifiable() (*Identifiable, bool) {
1854 return nil, false
1855 }
1856
1857
1858 func (cw CreativeWork) AsBasicIdentifiable() (BasicIdentifiable, bool) {
1859 return &cw, true
1860 }
1861
1862
1863 func (cw CreativeWork) AsAnswer() (*Answer, bool) {
1864 return nil, false
1865 }
1866
1867
1868 func (cw CreativeWork) AsBasicAnswer() (BasicAnswer, bool) {
1869 return nil, false
1870 }
1871
1872
1873 func (cw CreativeWork) AsErrorResponse() (*ErrorResponse, bool) {
1874 return nil, false
1875 }
1876
1877
1878 func (cw CreativeWork) AsPostalAddress() (*PostalAddress, bool) {
1879 return nil, false
1880 }
1881
1882
1883 func (cw CreativeWork) AsPlace() (*Place, bool) {
1884 return nil, false
1885 }
1886
1887
1888 func (cw CreativeWork) AsBasicPlace() (BasicPlace, bool) {
1889 return nil, false
1890 }
1891
1892
1893 func (cw CreativeWork) AsOrganization() (*Organization, bool) {
1894 return nil, false
1895 }
1896
1897
1898 func (cw CreativeWork) AsCreativeWork() (*CreativeWork, bool) {
1899 return &cw, true
1900 }
1901
1902
1903 func (cw CreativeWork) AsBasicCreativeWork() (BasicCreativeWork, bool) {
1904 return &cw, true
1905 }
1906
1907
1908 func (cw CreativeWork) AsIntangible() (*Intangible, bool) {
1909 return nil, false
1910 }
1911
1912
1913 func (cw CreativeWork) AsBasicIntangible() (BasicIntangible, bool) {
1914 return nil, false
1915 }
1916
1917
1918 func (cw CreativeWork) AsMovieTheater() (*MovieTheater, bool) {
1919 return nil, false
1920 }
1921
1922
1923 func (cw CreativeWork) AsMediaObject() (*MediaObject, bool) {
1924 return nil, false
1925 }
1926
1927
1928 func (cw CreativeWork) AsBasicMediaObject() (BasicMediaObject, bool) {
1929 return nil, false
1930 }
1931
1932
1933 func (cw CreativeWork) AsCivicStructure() (*CivicStructure, bool) {
1934 return nil, false
1935 }
1936
1937
1938 func (cw CreativeWork) AsBasicCivicStructure() (BasicCivicStructure, bool) {
1939 return nil, false
1940 }
1941
1942
1943 func (cw CreativeWork) AsLocalBusiness() (*LocalBusiness, bool) {
1944 return nil, false
1945 }
1946
1947
1948 func (cw CreativeWork) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
1949 return nil, false
1950 }
1951
1952
1953 func (cw CreativeWork) AsTouristAttraction() (*TouristAttraction, bool) {
1954 return nil, false
1955 }
1956
1957
1958 func (cw CreativeWork) AsAirport() (*Airport, bool) {
1959 return nil, false
1960 }
1961
1962
1963 func (cw CreativeWork) AsLicense() (*License, bool) {
1964 return nil, false
1965 }
1966
1967
1968 func (cw CreativeWork) AsStructuredValue() (*StructuredValue, bool) {
1969 return nil, false
1970 }
1971
1972
1973 func (cw CreativeWork) AsBasicStructuredValue() (BasicStructuredValue, bool) {
1974 return nil, false
1975 }
1976
1977
1978 func (cw CreativeWork) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
1979 return nil, false
1980 }
1981
1982
1983 func (cw CreativeWork) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
1984 return nil, false
1985 }
1986
1987
1988 func (cw CreativeWork) AsFoodEstablishment() (*FoodEstablishment, bool) {
1989 return nil, false
1990 }
1991
1992
1993 func (cw CreativeWork) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
1994 return nil, false
1995 }
1996
1997
1998 func (cw CreativeWork) AsLodgingBusiness() (*LodgingBusiness, bool) {
1999 return nil, false
2000 }
2001
2002
2003 func (cw CreativeWork) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
2004 return nil, false
2005 }
2006
2007
2008 func (cw CreativeWork) AsRestaurant() (*Restaurant, bool) {
2009 return nil, false
2010 }
2011
2012
2013 func (cw CreativeWork) AsHotel() (*Hotel, bool) {
2014 return nil, false
2015 }
2016
2017
2018 func (cw CreativeWork) AsResponseBase() (*ResponseBase, bool) {
2019 return nil, false
2020 }
2021
2022
2023 func (cw CreativeWork) AsBasicResponseBase() (BasicResponseBase, bool) {
2024 return &cw, true
2025 }
2026
2027
2028 func (cw *CreativeWork) UnmarshalJSON(body []byte) error {
2029 var m map[string]*json.RawMessage
2030 err := json.Unmarshal(body, &m)
2031 if err != nil {
2032 return err
2033 }
2034 for k, v := range m {
2035 switch k {
2036 case "thumbnailUrl":
2037 if v != nil {
2038 var thumbnailURL string
2039 err = json.Unmarshal(*v, &thumbnailURL)
2040 if err != nil {
2041 return err
2042 }
2043 cw.ThumbnailURL = &thumbnailURL
2044 }
2045 case "provider":
2046 if v != nil {
2047 provider, err := unmarshalBasicThingArray(*v)
2048 if err != nil {
2049 return err
2050 }
2051 cw.Provider = &provider
2052 }
2053 case "text":
2054 if v != nil {
2055 var textVar string
2056 err = json.Unmarshal(*v, &textVar)
2057 if err != nil {
2058 return err
2059 }
2060 cw.Text = &textVar
2061 }
2062 case "name":
2063 if v != nil {
2064 var name string
2065 err = json.Unmarshal(*v, &name)
2066 if err != nil {
2067 return err
2068 }
2069 cw.Name = &name
2070 }
2071 case "url":
2072 if v != nil {
2073 var URL string
2074 err = json.Unmarshal(*v, &URL)
2075 if err != nil {
2076 return err
2077 }
2078 cw.URL = &URL
2079 }
2080 case "image":
2081 if v != nil {
2082 var imageVar ImageObject
2083 err = json.Unmarshal(*v, &imageVar)
2084 if err != nil {
2085 return err
2086 }
2087 cw.Image = &imageVar
2088 }
2089 case "description":
2090 if v != nil {
2091 var description string
2092 err = json.Unmarshal(*v, &description)
2093 if err != nil {
2094 return err
2095 }
2096 cw.Description = &description
2097 }
2098 case "entityPresentationInfo":
2099 if v != nil {
2100 var entityPresentationInfo EntitiesEntityPresentationInfo
2101 err = json.Unmarshal(*v, &entityPresentationInfo)
2102 if err != nil {
2103 return err
2104 }
2105 cw.EntityPresentationInfo = &entityPresentationInfo
2106 }
2107 case "bingId":
2108 if v != nil {
2109 var bingID string
2110 err = json.Unmarshal(*v, &bingID)
2111 if err != nil {
2112 return err
2113 }
2114 cw.BingID = &bingID
2115 }
2116 case "contractualRules":
2117 if v != nil {
2118 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
2119 if err != nil {
2120 return err
2121 }
2122 cw.ContractualRules = &contractualRules
2123 }
2124 case "webSearchUrl":
2125 if v != nil {
2126 var webSearchURL string
2127 err = json.Unmarshal(*v, &webSearchURL)
2128 if err != nil {
2129 return err
2130 }
2131 cw.WebSearchURL = &webSearchURL
2132 }
2133 case "id":
2134 if v != nil {
2135 var ID string
2136 err = json.Unmarshal(*v, &ID)
2137 if err != nil {
2138 return err
2139 }
2140 cw.ID = &ID
2141 }
2142 case "_type":
2143 if v != nil {
2144 var typeVar TypeBasicResponseBase
2145 err = json.Unmarshal(*v, &typeVar)
2146 if err != nil {
2147 return err
2148 }
2149 cw.Type = typeVar
2150 }
2151 }
2152 }
2153
2154 return nil
2155 }
2156
2157
2158 type BasicEntertainmentBusiness interface {
2159 AsMovieTheater() (*MovieTheater, bool)
2160 AsEntertainmentBusiness() (*EntertainmentBusiness, bool)
2161 }
2162
2163
2164 type EntertainmentBusiness struct {
2165
2166 PriceRange *string `json:"priceRange,omitempty"`
2167
2168 Panoramas *[]ImageObject `json:"panoramas,omitempty"`
2169
2170 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"`
2171
2172 TagLine *string `json:"tagLine,omitempty"`
2173
2174 Address *PostalAddress `json:"address,omitempty"`
2175
2176 Telephone *string `json:"telephone,omitempty"`
2177
2178 Name *string `json:"name,omitempty"`
2179
2180 URL *string `json:"url,omitempty"`
2181
2182 Image *ImageObject `json:"image,omitempty"`
2183
2184 Description *string `json:"description,omitempty"`
2185
2186 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
2187
2188 BingID *string `json:"bingId,omitempty"`
2189
2190 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
2191
2192 WebSearchURL *string `json:"webSearchUrl,omitempty"`
2193
2194 ID *string `json:"id,omitempty"`
2195
2196 Type TypeBasicResponseBase `json:"_type,omitempty"`
2197 }
2198
2199 func unmarshalBasicEntertainmentBusiness(body []byte) (BasicEntertainmentBusiness, error) {
2200 var m map[string]interface{}
2201 err := json.Unmarshal(body, &m)
2202 if err != nil {
2203 return nil, err
2204 }
2205
2206 switch m["_type"] {
2207 case string(TypeMovieTheater):
2208 var mt MovieTheater
2209 err := json.Unmarshal(body, &mt)
2210 return mt, err
2211 default:
2212 var eb EntertainmentBusiness
2213 err := json.Unmarshal(body, &eb)
2214 return eb, err
2215 }
2216 }
2217 func unmarshalBasicEntertainmentBusinessArray(body []byte) ([]BasicEntertainmentBusiness, error) {
2218 var rawMessages []*json.RawMessage
2219 err := json.Unmarshal(body, &rawMessages)
2220 if err != nil {
2221 return nil, err
2222 }
2223
2224 ebArray := make([]BasicEntertainmentBusiness, len(rawMessages))
2225
2226 for index, rawMessage := range rawMessages {
2227 eb, err := unmarshalBasicEntertainmentBusiness(*rawMessage)
2228 if err != nil {
2229 return nil, err
2230 }
2231 ebArray[index] = eb
2232 }
2233 return ebArray, nil
2234 }
2235
2236
2237 func (eb EntertainmentBusiness) MarshalJSON() ([]byte, error) {
2238 eb.Type = TypeEntertainmentBusiness
2239 objectMap := make(map[string]interface{})
2240 if eb.Type != "" {
2241 objectMap["_type"] = eb.Type
2242 }
2243 return json.Marshal(objectMap)
2244 }
2245
2246
2247 func (eb EntertainmentBusiness) AsImageObject() (*ImageObject, bool) {
2248 return nil, false
2249 }
2250
2251
2252 func (eb EntertainmentBusiness) AsThing() (*Thing, bool) {
2253 return nil, false
2254 }
2255
2256
2257 func (eb EntertainmentBusiness) AsBasicThing() (BasicThing, bool) {
2258 return &eb, true
2259 }
2260
2261
2262 func (eb EntertainmentBusiness) AsEntities() (*Entities, bool) {
2263 return nil, false
2264 }
2265
2266
2267 func (eb EntertainmentBusiness) AsPlaces() (*Places, bool) {
2268 return nil, false
2269 }
2270
2271
2272 func (eb EntertainmentBusiness) AsSearchResponse() (*SearchResponse, bool) {
2273 return nil, false
2274 }
2275
2276
2277 func (eb EntertainmentBusiness) AsResponse() (*Response, bool) {
2278 return nil, false
2279 }
2280
2281
2282 func (eb EntertainmentBusiness) AsBasicResponse() (BasicResponse, bool) {
2283 return &eb, true
2284 }
2285
2286
2287 func (eb EntertainmentBusiness) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
2288 return nil, false
2289 }
2290
2291
2292 func (eb EntertainmentBusiness) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
2293 return nil, false
2294 }
2295
2296
2297 func (eb EntertainmentBusiness) AsIdentifiable() (*Identifiable, bool) {
2298 return nil, false
2299 }
2300
2301
2302 func (eb EntertainmentBusiness) AsBasicIdentifiable() (BasicIdentifiable, bool) {
2303 return &eb, true
2304 }
2305
2306
2307 func (eb EntertainmentBusiness) AsAnswer() (*Answer, bool) {
2308 return nil, false
2309 }
2310
2311
2312 func (eb EntertainmentBusiness) AsBasicAnswer() (BasicAnswer, bool) {
2313 return nil, false
2314 }
2315
2316
2317 func (eb EntertainmentBusiness) AsErrorResponse() (*ErrorResponse, bool) {
2318 return nil, false
2319 }
2320
2321
2322 func (eb EntertainmentBusiness) AsPostalAddress() (*PostalAddress, bool) {
2323 return nil, false
2324 }
2325
2326
2327 func (eb EntertainmentBusiness) AsPlace() (*Place, bool) {
2328 return nil, false
2329 }
2330
2331
2332 func (eb EntertainmentBusiness) AsBasicPlace() (BasicPlace, bool) {
2333 return &eb, true
2334 }
2335
2336
2337 func (eb EntertainmentBusiness) AsOrganization() (*Organization, bool) {
2338 return nil, false
2339 }
2340
2341
2342 func (eb EntertainmentBusiness) AsCreativeWork() (*CreativeWork, bool) {
2343 return nil, false
2344 }
2345
2346
2347 func (eb EntertainmentBusiness) AsBasicCreativeWork() (BasicCreativeWork, bool) {
2348 return nil, false
2349 }
2350
2351
2352 func (eb EntertainmentBusiness) AsIntangible() (*Intangible, bool) {
2353 return nil, false
2354 }
2355
2356
2357 func (eb EntertainmentBusiness) AsBasicIntangible() (BasicIntangible, bool) {
2358 return nil, false
2359 }
2360
2361
2362 func (eb EntertainmentBusiness) AsMovieTheater() (*MovieTheater, bool) {
2363 return nil, false
2364 }
2365
2366
2367 func (eb EntertainmentBusiness) AsMediaObject() (*MediaObject, bool) {
2368 return nil, false
2369 }
2370
2371
2372 func (eb EntertainmentBusiness) AsBasicMediaObject() (BasicMediaObject, bool) {
2373 return nil, false
2374 }
2375
2376
2377 func (eb EntertainmentBusiness) AsCivicStructure() (*CivicStructure, bool) {
2378 return nil, false
2379 }
2380
2381
2382 func (eb EntertainmentBusiness) AsBasicCivicStructure() (BasicCivicStructure, bool) {
2383 return nil, false
2384 }
2385
2386
2387 func (eb EntertainmentBusiness) AsLocalBusiness() (*LocalBusiness, bool) {
2388 return nil, false
2389 }
2390
2391
2392 func (eb EntertainmentBusiness) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
2393 return &eb, true
2394 }
2395
2396
2397 func (eb EntertainmentBusiness) AsTouristAttraction() (*TouristAttraction, bool) {
2398 return nil, false
2399 }
2400
2401
2402 func (eb EntertainmentBusiness) AsAirport() (*Airport, bool) {
2403 return nil, false
2404 }
2405
2406
2407 func (eb EntertainmentBusiness) AsLicense() (*License, bool) {
2408 return nil, false
2409 }
2410
2411
2412 func (eb EntertainmentBusiness) AsStructuredValue() (*StructuredValue, bool) {
2413 return nil, false
2414 }
2415
2416
2417 func (eb EntertainmentBusiness) AsBasicStructuredValue() (BasicStructuredValue, bool) {
2418 return nil, false
2419 }
2420
2421
2422 func (eb EntertainmentBusiness) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
2423 return &eb, true
2424 }
2425
2426
2427 func (eb EntertainmentBusiness) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
2428 return &eb, true
2429 }
2430
2431
2432 func (eb EntertainmentBusiness) AsFoodEstablishment() (*FoodEstablishment, bool) {
2433 return nil, false
2434 }
2435
2436
2437 func (eb EntertainmentBusiness) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
2438 return nil, false
2439 }
2440
2441
2442 func (eb EntertainmentBusiness) AsLodgingBusiness() (*LodgingBusiness, bool) {
2443 return nil, false
2444 }
2445
2446
2447 func (eb EntertainmentBusiness) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
2448 return nil, false
2449 }
2450
2451
2452 func (eb EntertainmentBusiness) AsRestaurant() (*Restaurant, bool) {
2453 return nil, false
2454 }
2455
2456
2457 func (eb EntertainmentBusiness) AsHotel() (*Hotel, bool) {
2458 return nil, false
2459 }
2460
2461
2462 func (eb EntertainmentBusiness) AsResponseBase() (*ResponseBase, bool) {
2463 return nil, false
2464 }
2465
2466
2467 func (eb EntertainmentBusiness) AsBasicResponseBase() (BasicResponseBase, bool) {
2468 return &eb, true
2469 }
2470
2471
2472 func (eb *EntertainmentBusiness) UnmarshalJSON(body []byte) error {
2473 var m map[string]*json.RawMessage
2474 err := json.Unmarshal(body, &m)
2475 if err != nil {
2476 return err
2477 }
2478 for k, v := range m {
2479 switch k {
2480 case "priceRange":
2481 if v != nil {
2482 var priceRange string
2483 err = json.Unmarshal(*v, &priceRange)
2484 if err != nil {
2485 return err
2486 }
2487 eb.PriceRange = &priceRange
2488 }
2489 case "panoramas":
2490 if v != nil {
2491 var panoramas []ImageObject
2492 err = json.Unmarshal(*v, &panoramas)
2493 if err != nil {
2494 return err
2495 }
2496 eb.Panoramas = &panoramas
2497 }
2498 case "isPermanentlyClosed":
2499 if v != nil {
2500 var isPermanentlyClosed bool
2501 err = json.Unmarshal(*v, &isPermanentlyClosed)
2502 if err != nil {
2503 return err
2504 }
2505 eb.IsPermanentlyClosed = &isPermanentlyClosed
2506 }
2507 case "tagLine":
2508 if v != nil {
2509 var tagLine string
2510 err = json.Unmarshal(*v, &tagLine)
2511 if err != nil {
2512 return err
2513 }
2514 eb.TagLine = &tagLine
2515 }
2516 case "address":
2517 if v != nil {
2518 var address PostalAddress
2519 err = json.Unmarshal(*v, &address)
2520 if err != nil {
2521 return err
2522 }
2523 eb.Address = &address
2524 }
2525 case "telephone":
2526 if v != nil {
2527 var telephone string
2528 err = json.Unmarshal(*v, &telephone)
2529 if err != nil {
2530 return err
2531 }
2532 eb.Telephone = &telephone
2533 }
2534 case "name":
2535 if v != nil {
2536 var name string
2537 err = json.Unmarshal(*v, &name)
2538 if err != nil {
2539 return err
2540 }
2541 eb.Name = &name
2542 }
2543 case "url":
2544 if v != nil {
2545 var URL string
2546 err = json.Unmarshal(*v, &URL)
2547 if err != nil {
2548 return err
2549 }
2550 eb.URL = &URL
2551 }
2552 case "image":
2553 if v != nil {
2554 var imageVar ImageObject
2555 err = json.Unmarshal(*v, &imageVar)
2556 if err != nil {
2557 return err
2558 }
2559 eb.Image = &imageVar
2560 }
2561 case "description":
2562 if v != nil {
2563 var description string
2564 err = json.Unmarshal(*v, &description)
2565 if err != nil {
2566 return err
2567 }
2568 eb.Description = &description
2569 }
2570 case "entityPresentationInfo":
2571 if v != nil {
2572 var entityPresentationInfo EntitiesEntityPresentationInfo
2573 err = json.Unmarshal(*v, &entityPresentationInfo)
2574 if err != nil {
2575 return err
2576 }
2577 eb.EntityPresentationInfo = &entityPresentationInfo
2578 }
2579 case "bingId":
2580 if v != nil {
2581 var bingID string
2582 err = json.Unmarshal(*v, &bingID)
2583 if err != nil {
2584 return err
2585 }
2586 eb.BingID = &bingID
2587 }
2588 case "contractualRules":
2589 if v != nil {
2590 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
2591 if err != nil {
2592 return err
2593 }
2594 eb.ContractualRules = &contractualRules
2595 }
2596 case "webSearchUrl":
2597 if v != nil {
2598 var webSearchURL string
2599 err = json.Unmarshal(*v, &webSearchURL)
2600 if err != nil {
2601 return err
2602 }
2603 eb.WebSearchURL = &webSearchURL
2604 }
2605 case "id":
2606 if v != nil {
2607 var ID string
2608 err = json.Unmarshal(*v, &ID)
2609 if err != nil {
2610 return err
2611 }
2612 eb.ID = &ID
2613 }
2614 case "_type":
2615 if v != nil {
2616 var typeVar TypeBasicResponseBase
2617 err = json.Unmarshal(*v, &typeVar)
2618 if err != nil {
2619 return err
2620 }
2621 eb.Type = typeVar
2622 }
2623 }
2624 }
2625
2626 return nil
2627 }
2628
2629
2630 type Entities struct {
2631
2632 QueryScenario EntityQueryScenario `json:"queryScenario,omitempty"`
2633
2634 Value *[]BasicThing `json:"value,omitempty"`
2635
2636 QueryContext *QueryContext `json:"queryContext,omitempty"`
2637
2638 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
2639
2640 WebSearchURL *string `json:"webSearchUrl,omitempty"`
2641
2642 ID *string `json:"id,omitempty"`
2643
2644 Type TypeBasicResponseBase `json:"_type,omitempty"`
2645 }
2646
2647
2648 func (e Entities) MarshalJSON() ([]byte, error) {
2649 e.Type = TypeEntities
2650 objectMap := make(map[string]interface{})
2651 if e.Value != nil {
2652 objectMap["value"] = e.Value
2653 }
2654 if e.Type != "" {
2655 objectMap["_type"] = e.Type
2656 }
2657 return json.Marshal(objectMap)
2658 }
2659
2660
2661 func (e Entities) AsImageObject() (*ImageObject, bool) {
2662 return nil, false
2663 }
2664
2665
2666 func (e Entities) AsThing() (*Thing, bool) {
2667 return nil, false
2668 }
2669
2670
2671 func (e Entities) AsBasicThing() (BasicThing, bool) {
2672 return nil, false
2673 }
2674
2675
2676 func (e Entities) AsEntities() (*Entities, bool) {
2677 return &e, true
2678 }
2679
2680
2681 func (e Entities) AsPlaces() (*Places, bool) {
2682 return nil, false
2683 }
2684
2685
2686 func (e Entities) AsSearchResponse() (*SearchResponse, bool) {
2687 return nil, false
2688 }
2689
2690
2691 func (e Entities) AsResponse() (*Response, bool) {
2692 return nil, false
2693 }
2694
2695
2696 func (e Entities) AsBasicResponse() (BasicResponse, bool) {
2697 return &e, true
2698 }
2699
2700
2701 func (e Entities) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
2702 return nil, false
2703 }
2704
2705
2706 func (e Entities) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
2707 return &e, true
2708 }
2709
2710
2711 func (e Entities) AsIdentifiable() (*Identifiable, bool) {
2712 return nil, false
2713 }
2714
2715
2716 func (e Entities) AsBasicIdentifiable() (BasicIdentifiable, bool) {
2717 return &e, true
2718 }
2719
2720
2721 func (e Entities) AsAnswer() (*Answer, bool) {
2722 return nil, false
2723 }
2724
2725
2726 func (e Entities) AsBasicAnswer() (BasicAnswer, bool) {
2727 return &e, true
2728 }
2729
2730
2731 func (e Entities) AsErrorResponse() (*ErrorResponse, bool) {
2732 return nil, false
2733 }
2734
2735
2736 func (e Entities) AsPostalAddress() (*PostalAddress, bool) {
2737 return nil, false
2738 }
2739
2740
2741 func (e Entities) AsPlace() (*Place, bool) {
2742 return nil, false
2743 }
2744
2745
2746 func (e Entities) AsBasicPlace() (BasicPlace, bool) {
2747 return nil, false
2748 }
2749
2750
2751 func (e Entities) AsOrganization() (*Organization, bool) {
2752 return nil, false
2753 }
2754
2755
2756 func (e Entities) AsCreativeWork() (*CreativeWork, bool) {
2757 return nil, false
2758 }
2759
2760
2761 func (e Entities) AsBasicCreativeWork() (BasicCreativeWork, bool) {
2762 return nil, false
2763 }
2764
2765
2766 func (e Entities) AsIntangible() (*Intangible, bool) {
2767 return nil, false
2768 }
2769
2770
2771 func (e Entities) AsBasicIntangible() (BasicIntangible, bool) {
2772 return nil, false
2773 }
2774
2775
2776 func (e Entities) AsMovieTheater() (*MovieTheater, bool) {
2777 return nil, false
2778 }
2779
2780
2781 func (e Entities) AsMediaObject() (*MediaObject, bool) {
2782 return nil, false
2783 }
2784
2785
2786 func (e Entities) AsBasicMediaObject() (BasicMediaObject, bool) {
2787 return nil, false
2788 }
2789
2790
2791 func (e Entities) AsCivicStructure() (*CivicStructure, bool) {
2792 return nil, false
2793 }
2794
2795
2796 func (e Entities) AsBasicCivicStructure() (BasicCivicStructure, bool) {
2797 return nil, false
2798 }
2799
2800
2801 func (e Entities) AsLocalBusiness() (*LocalBusiness, bool) {
2802 return nil, false
2803 }
2804
2805
2806 func (e Entities) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
2807 return nil, false
2808 }
2809
2810
2811 func (e Entities) AsTouristAttraction() (*TouristAttraction, bool) {
2812 return nil, false
2813 }
2814
2815
2816 func (e Entities) AsAirport() (*Airport, bool) {
2817 return nil, false
2818 }
2819
2820
2821 func (e Entities) AsLicense() (*License, bool) {
2822 return nil, false
2823 }
2824
2825
2826 func (e Entities) AsStructuredValue() (*StructuredValue, bool) {
2827 return nil, false
2828 }
2829
2830
2831 func (e Entities) AsBasicStructuredValue() (BasicStructuredValue, bool) {
2832 return nil, false
2833 }
2834
2835
2836 func (e Entities) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
2837 return nil, false
2838 }
2839
2840
2841 func (e Entities) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
2842 return nil, false
2843 }
2844
2845
2846 func (e Entities) AsFoodEstablishment() (*FoodEstablishment, bool) {
2847 return nil, false
2848 }
2849
2850
2851 func (e Entities) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
2852 return nil, false
2853 }
2854
2855
2856 func (e Entities) AsLodgingBusiness() (*LodgingBusiness, bool) {
2857 return nil, false
2858 }
2859
2860
2861 func (e Entities) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
2862 return nil, false
2863 }
2864
2865
2866 func (e Entities) AsRestaurant() (*Restaurant, bool) {
2867 return nil, false
2868 }
2869
2870
2871 func (e Entities) AsHotel() (*Hotel, bool) {
2872 return nil, false
2873 }
2874
2875
2876 func (e Entities) AsResponseBase() (*ResponseBase, bool) {
2877 return nil, false
2878 }
2879
2880
2881 func (e Entities) AsBasicResponseBase() (BasicResponseBase, bool) {
2882 return &e, true
2883 }
2884
2885
2886 func (e *Entities) UnmarshalJSON(body []byte) error {
2887 var m map[string]*json.RawMessage
2888 err := json.Unmarshal(body, &m)
2889 if err != nil {
2890 return err
2891 }
2892 for k, v := range m {
2893 switch k {
2894 case "queryScenario":
2895 if v != nil {
2896 var queryScenario EntityQueryScenario
2897 err = json.Unmarshal(*v, &queryScenario)
2898 if err != nil {
2899 return err
2900 }
2901 e.QueryScenario = queryScenario
2902 }
2903 case "value":
2904 if v != nil {
2905 value, err := unmarshalBasicThingArray(*v)
2906 if err != nil {
2907 return err
2908 }
2909 e.Value = &value
2910 }
2911 case "queryContext":
2912 if v != nil {
2913 var queryContext QueryContext
2914 err = json.Unmarshal(*v, &queryContext)
2915 if err != nil {
2916 return err
2917 }
2918 e.QueryContext = &queryContext
2919 }
2920 case "contractualRules":
2921 if v != nil {
2922 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
2923 if err != nil {
2924 return err
2925 }
2926 e.ContractualRules = &contractualRules
2927 }
2928 case "webSearchUrl":
2929 if v != nil {
2930 var webSearchURL string
2931 err = json.Unmarshal(*v, &webSearchURL)
2932 if err != nil {
2933 return err
2934 }
2935 e.WebSearchURL = &webSearchURL
2936 }
2937 case "id":
2938 if v != nil {
2939 var ID string
2940 err = json.Unmarshal(*v, &ID)
2941 if err != nil {
2942 return err
2943 }
2944 e.ID = &ID
2945 }
2946 case "_type":
2947 if v != nil {
2948 var typeVar TypeBasicResponseBase
2949 err = json.Unmarshal(*v, &typeVar)
2950 if err != nil {
2951 return err
2952 }
2953 e.Type = typeVar
2954 }
2955 }
2956 }
2957
2958 return nil
2959 }
2960
2961
2962 type EntitiesEntityPresentationInfo struct {
2963
2964 EntityScenario EntityScenario `json:"entityScenario,omitempty"`
2965
2966 EntityTypeHints *[]EntityType `json:"entityTypeHints,omitempty"`
2967
2968 EntityTypeDisplayHint *string `json:"entityTypeDisplayHint,omitempty"`
2969 }
2970
2971
2972 func (eepi EntitiesEntityPresentationInfo) MarshalJSON() ([]byte, error) {
2973 objectMap := make(map[string]interface{})
2974 if eepi.EntityScenario != "" {
2975 objectMap["entityScenario"] = eepi.EntityScenario
2976 }
2977 return json.Marshal(objectMap)
2978 }
2979
2980
2981 type Error struct {
2982
2983 Code ErrorCode `json:"code,omitempty"`
2984
2985 SubCode ErrorSubCode `json:"subCode,omitempty"`
2986
2987 Message *string `json:"message,omitempty"`
2988
2989 MoreDetails *string `json:"moreDetails,omitempty"`
2990
2991 Parameter *string `json:"parameter,omitempty"`
2992
2993 Value *string `json:"value,omitempty"`
2994 }
2995
2996
2997 func (e Error) MarshalJSON() ([]byte, error) {
2998 objectMap := make(map[string]interface{})
2999 if e.Code != "" {
3000 objectMap["code"] = e.Code
3001 }
3002 if e.Message != nil {
3003 objectMap["message"] = e.Message
3004 }
3005 return json.Marshal(objectMap)
3006 }
3007
3008
3009 type ErrorResponse struct {
3010
3011 Errors *[]Error `json:"errors,omitempty"`
3012
3013 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
3014
3015 WebSearchURL *string `json:"webSearchUrl,omitempty"`
3016
3017 ID *string `json:"id,omitempty"`
3018
3019 Type TypeBasicResponseBase `json:"_type,omitempty"`
3020 }
3021
3022
3023 func (er ErrorResponse) MarshalJSON() ([]byte, error) {
3024 er.Type = TypeErrorResponse
3025 objectMap := make(map[string]interface{})
3026 if er.Errors != nil {
3027 objectMap["errors"] = er.Errors
3028 }
3029 if er.Type != "" {
3030 objectMap["_type"] = er.Type
3031 }
3032 return json.Marshal(objectMap)
3033 }
3034
3035
3036 func (er ErrorResponse) AsImageObject() (*ImageObject, bool) {
3037 return nil, false
3038 }
3039
3040
3041 func (er ErrorResponse) AsThing() (*Thing, bool) {
3042 return nil, false
3043 }
3044
3045
3046 func (er ErrorResponse) AsBasicThing() (BasicThing, bool) {
3047 return nil, false
3048 }
3049
3050
3051 func (er ErrorResponse) AsEntities() (*Entities, bool) {
3052 return nil, false
3053 }
3054
3055
3056 func (er ErrorResponse) AsPlaces() (*Places, bool) {
3057 return nil, false
3058 }
3059
3060
3061 func (er ErrorResponse) AsSearchResponse() (*SearchResponse, bool) {
3062 return nil, false
3063 }
3064
3065
3066 func (er ErrorResponse) AsResponse() (*Response, bool) {
3067 return nil, false
3068 }
3069
3070
3071 func (er ErrorResponse) AsBasicResponse() (BasicResponse, bool) {
3072 return &er, true
3073 }
3074
3075
3076 func (er ErrorResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
3077 return nil, false
3078 }
3079
3080
3081 func (er ErrorResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
3082 return nil, false
3083 }
3084
3085
3086 func (er ErrorResponse) AsIdentifiable() (*Identifiable, bool) {
3087 return nil, false
3088 }
3089
3090
3091 func (er ErrorResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) {
3092 return &er, true
3093 }
3094
3095
3096 func (er ErrorResponse) AsAnswer() (*Answer, bool) {
3097 return nil, false
3098 }
3099
3100
3101 func (er ErrorResponse) AsBasicAnswer() (BasicAnswer, bool) {
3102 return nil, false
3103 }
3104
3105
3106 func (er ErrorResponse) AsErrorResponse() (*ErrorResponse, bool) {
3107 return &er, true
3108 }
3109
3110
3111 func (er ErrorResponse) AsPostalAddress() (*PostalAddress, bool) {
3112 return nil, false
3113 }
3114
3115
3116 func (er ErrorResponse) AsPlace() (*Place, bool) {
3117 return nil, false
3118 }
3119
3120
3121 func (er ErrorResponse) AsBasicPlace() (BasicPlace, bool) {
3122 return nil, false
3123 }
3124
3125
3126 func (er ErrorResponse) AsOrganization() (*Organization, bool) {
3127 return nil, false
3128 }
3129
3130
3131 func (er ErrorResponse) AsCreativeWork() (*CreativeWork, bool) {
3132 return nil, false
3133 }
3134
3135
3136 func (er ErrorResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) {
3137 return nil, false
3138 }
3139
3140
3141 func (er ErrorResponse) AsIntangible() (*Intangible, bool) {
3142 return nil, false
3143 }
3144
3145
3146 func (er ErrorResponse) AsBasicIntangible() (BasicIntangible, bool) {
3147 return nil, false
3148 }
3149
3150
3151 func (er ErrorResponse) AsMovieTheater() (*MovieTheater, bool) {
3152 return nil, false
3153 }
3154
3155
3156 func (er ErrorResponse) AsMediaObject() (*MediaObject, bool) {
3157 return nil, false
3158 }
3159
3160
3161 func (er ErrorResponse) AsBasicMediaObject() (BasicMediaObject, bool) {
3162 return nil, false
3163 }
3164
3165
3166 func (er ErrorResponse) AsCivicStructure() (*CivicStructure, bool) {
3167 return nil, false
3168 }
3169
3170
3171 func (er ErrorResponse) AsBasicCivicStructure() (BasicCivicStructure, bool) {
3172 return nil, false
3173 }
3174
3175
3176 func (er ErrorResponse) AsLocalBusiness() (*LocalBusiness, bool) {
3177 return nil, false
3178 }
3179
3180
3181 func (er ErrorResponse) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
3182 return nil, false
3183 }
3184
3185
3186 func (er ErrorResponse) AsTouristAttraction() (*TouristAttraction, bool) {
3187 return nil, false
3188 }
3189
3190
3191 func (er ErrorResponse) AsAirport() (*Airport, bool) {
3192 return nil, false
3193 }
3194
3195
3196 func (er ErrorResponse) AsLicense() (*License, bool) {
3197 return nil, false
3198 }
3199
3200
3201 func (er ErrorResponse) AsStructuredValue() (*StructuredValue, bool) {
3202 return nil, false
3203 }
3204
3205
3206 func (er ErrorResponse) AsBasicStructuredValue() (BasicStructuredValue, bool) {
3207 return nil, false
3208 }
3209
3210
3211 func (er ErrorResponse) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
3212 return nil, false
3213 }
3214
3215
3216 func (er ErrorResponse) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
3217 return nil, false
3218 }
3219
3220
3221 func (er ErrorResponse) AsFoodEstablishment() (*FoodEstablishment, bool) {
3222 return nil, false
3223 }
3224
3225
3226 func (er ErrorResponse) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
3227 return nil, false
3228 }
3229
3230
3231 func (er ErrorResponse) AsLodgingBusiness() (*LodgingBusiness, bool) {
3232 return nil, false
3233 }
3234
3235
3236 func (er ErrorResponse) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
3237 return nil, false
3238 }
3239
3240
3241 func (er ErrorResponse) AsRestaurant() (*Restaurant, bool) {
3242 return nil, false
3243 }
3244
3245
3246 func (er ErrorResponse) AsHotel() (*Hotel, bool) {
3247 return nil, false
3248 }
3249
3250
3251 func (er ErrorResponse) AsResponseBase() (*ResponseBase, bool) {
3252 return nil, false
3253 }
3254
3255
3256 func (er ErrorResponse) AsBasicResponseBase() (BasicResponseBase, bool) {
3257 return &er, true
3258 }
3259
3260
3261 func (er *ErrorResponse) UnmarshalJSON(body []byte) error {
3262 var m map[string]*json.RawMessage
3263 err := json.Unmarshal(body, &m)
3264 if err != nil {
3265 return err
3266 }
3267 for k, v := range m {
3268 switch k {
3269 case "errors":
3270 if v != nil {
3271 var errorsVar []Error
3272 err = json.Unmarshal(*v, &errorsVar)
3273 if err != nil {
3274 return err
3275 }
3276 er.Errors = &errorsVar
3277 }
3278 case "contractualRules":
3279 if v != nil {
3280 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
3281 if err != nil {
3282 return err
3283 }
3284 er.ContractualRules = &contractualRules
3285 }
3286 case "webSearchUrl":
3287 if v != nil {
3288 var webSearchURL string
3289 err = json.Unmarshal(*v, &webSearchURL)
3290 if err != nil {
3291 return err
3292 }
3293 er.WebSearchURL = &webSearchURL
3294 }
3295 case "id":
3296 if v != nil {
3297 var ID string
3298 err = json.Unmarshal(*v, &ID)
3299 if err != nil {
3300 return err
3301 }
3302 er.ID = &ID
3303 }
3304 case "_type":
3305 if v != nil {
3306 var typeVar TypeBasicResponseBase
3307 err = json.Unmarshal(*v, &typeVar)
3308 if err != nil {
3309 return err
3310 }
3311 er.Type = typeVar
3312 }
3313 }
3314 }
3315
3316 return nil
3317 }
3318
3319
3320 type BasicFoodEstablishment interface {
3321 AsRestaurant() (*Restaurant, bool)
3322 AsFoodEstablishment() (*FoodEstablishment, bool)
3323 }
3324
3325
3326 type FoodEstablishment struct {
3327
3328 PriceRange *string `json:"priceRange,omitempty"`
3329
3330 Panoramas *[]ImageObject `json:"panoramas,omitempty"`
3331
3332 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"`
3333
3334 TagLine *string `json:"tagLine,omitempty"`
3335
3336 Address *PostalAddress `json:"address,omitempty"`
3337
3338 Telephone *string `json:"telephone,omitempty"`
3339
3340 Name *string `json:"name,omitempty"`
3341
3342 URL *string `json:"url,omitempty"`
3343
3344 Image *ImageObject `json:"image,omitempty"`
3345
3346 Description *string `json:"description,omitempty"`
3347
3348 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
3349
3350 BingID *string `json:"bingId,omitempty"`
3351
3352 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
3353
3354 WebSearchURL *string `json:"webSearchUrl,omitempty"`
3355
3356 ID *string `json:"id,omitempty"`
3357
3358 Type TypeBasicResponseBase `json:"_type,omitempty"`
3359 }
3360
3361 func unmarshalBasicFoodEstablishment(body []byte) (BasicFoodEstablishment, error) {
3362 var m map[string]interface{}
3363 err := json.Unmarshal(body, &m)
3364 if err != nil {
3365 return nil, err
3366 }
3367
3368 switch m["_type"] {
3369 case string(TypeRestaurant):
3370 var r Restaurant
3371 err := json.Unmarshal(body, &r)
3372 return r, err
3373 default:
3374 var fe FoodEstablishment
3375 err := json.Unmarshal(body, &fe)
3376 return fe, err
3377 }
3378 }
3379 func unmarshalBasicFoodEstablishmentArray(body []byte) ([]BasicFoodEstablishment, error) {
3380 var rawMessages []*json.RawMessage
3381 err := json.Unmarshal(body, &rawMessages)
3382 if err != nil {
3383 return nil, err
3384 }
3385
3386 feArray := make([]BasicFoodEstablishment, len(rawMessages))
3387
3388 for index, rawMessage := range rawMessages {
3389 fe, err := unmarshalBasicFoodEstablishment(*rawMessage)
3390 if err != nil {
3391 return nil, err
3392 }
3393 feArray[index] = fe
3394 }
3395 return feArray, nil
3396 }
3397
3398
3399 func (fe FoodEstablishment) MarshalJSON() ([]byte, error) {
3400 fe.Type = TypeFoodEstablishment
3401 objectMap := make(map[string]interface{})
3402 if fe.Type != "" {
3403 objectMap["_type"] = fe.Type
3404 }
3405 return json.Marshal(objectMap)
3406 }
3407
3408
3409 func (fe FoodEstablishment) AsImageObject() (*ImageObject, bool) {
3410 return nil, false
3411 }
3412
3413
3414 func (fe FoodEstablishment) AsThing() (*Thing, bool) {
3415 return nil, false
3416 }
3417
3418
3419 func (fe FoodEstablishment) AsBasicThing() (BasicThing, bool) {
3420 return &fe, true
3421 }
3422
3423
3424 func (fe FoodEstablishment) AsEntities() (*Entities, bool) {
3425 return nil, false
3426 }
3427
3428
3429 func (fe FoodEstablishment) AsPlaces() (*Places, bool) {
3430 return nil, false
3431 }
3432
3433
3434 func (fe FoodEstablishment) AsSearchResponse() (*SearchResponse, bool) {
3435 return nil, false
3436 }
3437
3438
3439 func (fe FoodEstablishment) AsResponse() (*Response, bool) {
3440 return nil, false
3441 }
3442
3443
3444 func (fe FoodEstablishment) AsBasicResponse() (BasicResponse, bool) {
3445 return &fe, true
3446 }
3447
3448
3449 func (fe FoodEstablishment) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
3450 return nil, false
3451 }
3452
3453
3454 func (fe FoodEstablishment) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
3455 return nil, false
3456 }
3457
3458
3459 func (fe FoodEstablishment) AsIdentifiable() (*Identifiable, bool) {
3460 return nil, false
3461 }
3462
3463
3464 func (fe FoodEstablishment) AsBasicIdentifiable() (BasicIdentifiable, bool) {
3465 return &fe, true
3466 }
3467
3468
3469 func (fe FoodEstablishment) AsAnswer() (*Answer, bool) {
3470 return nil, false
3471 }
3472
3473
3474 func (fe FoodEstablishment) AsBasicAnswer() (BasicAnswer, bool) {
3475 return nil, false
3476 }
3477
3478
3479 func (fe FoodEstablishment) AsErrorResponse() (*ErrorResponse, bool) {
3480 return nil, false
3481 }
3482
3483
3484 func (fe FoodEstablishment) AsPostalAddress() (*PostalAddress, bool) {
3485 return nil, false
3486 }
3487
3488
3489 func (fe FoodEstablishment) AsPlace() (*Place, bool) {
3490 return nil, false
3491 }
3492
3493
3494 func (fe FoodEstablishment) AsBasicPlace() (BasicPlace, bool) {
3495 return &fe, true
3496 }
3497
3498
3499 func (fe FoodEstablishment) AsOrganization() (*Organization, bool) {
3500 return nil, false
3501 }
3502
3503
3504 func (fe FoodEstablishment) AsCreativeWork() (*CreativeWork, bool) {
3505 return nil, false
3506 }
3507
3508
3509 func (fe FoodEstablishment) AsBasicCreativeWork() (BasicCreativeWork, bool) {
3510 return nil, false
3511 }
3512
3513
3514 func (fe FoodEstablishment) AsIntangible() (*Intangible, bool) {
3515 return nil, false
3516 }
3517
3518
3519 func (fe FoodEstablishment) AsBasicIntangible() (BasicIntangible, bool) {
3520 return nil, false
3521 }
3522
3523
3524 func (fe FoodEstablishment) AsMovieTheater() (*MovieTheater, bool) {
3525 return nil, false
3526 }
3527
3528
3529 func (fe FoodEstablishment) AsMediaObject() (*MediaObject, bool) {
3530 return nil, false
3531 }
3532
3533
3534 func (fe FoodEstablishment) AsBasicMediaObject() (BasicMediaObject, bool) {
3535 return nil, false
3536 }
3537
3538
3539 func (fe FoodEstablishment) AsCivicStructure() (*CivicStructure, bool) {
3540 return nil, false
3541 }
3542
3543
3544 func (fe FoodEstablishment) AsBasicCivicStructure() (BasicCivicStructure, bool) {
3545 return nil, false
3546 }
3547
3548
3549 func (fe FoodEstablishment) AsLocalBusiness() (*LocalBusiness, bool) {
3550 return nil, false
3551 }
3552
3553
3554 func (fe FoodEstablishment) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
3555 return &fe, true
3556 }
3557
3558
3559 func (fe FoodEstablishment) AsTouristAttraction() (*TouristAttraction, bool) {
3560 return nil, false
3561 }
3562
3563
3564 func (fe FoodEstablishment) AsAirport() (*Airport, bool) {
3565 return nil, false
3566 }
3567
3568
3569 func (fe FoodEstablishment) AsLicense() (*License, bool) {
3570 return nil, false
3571 }
3572
3573
3574 func (fe FoodEstablishment) AsStructuredValue() (*StructuredValue, bool) {
3575 return nil, false
3576 }
3577
3578
3579 func (fe FoodEstablishment) AsBasicStructuredValue() (BasicStructuredValue, bool) {
3580 return nil, false
3581 }
3582
3583
3584 func (fe FoodEstablishment) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
3585 return nil, false
3586 }
3587
3588
3589 func (fe FoodEstablishment) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
3590 return nil, false
3591 }
3592
3593
3594 func (fe FoodEstablishment) AsFoodEstablishment() (*FoodEstablishment, bool) {
3595 return &fe, true
3596 }
3597
3598
3599 func (fe FoodEstablishment) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
3600 return &fe, true
3601 }
3602
3603
3604 func (fe FoodEstablishment) AsLodgingBusiness() (*LodgingBusiness, bool) {
3605 return nil, false
3606 }
3607
3608
3609 func (fe FoodEstablishment) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
3610 return nil, false
3611 }
3612
3613
3614 func (fe FoodEstablishment) AsRestaurant() (*Restaurant, bool) {
3615 return nil, false
3616 }
3617
3618
3619 func (fe FoodEstablishment) AsHotel() (*Hotel, bool) {
3620 return nil, false
3621 }
3622
3623
3624 func (fe FoodEstablishment) AsResponseBase() (*ResponseBase, bool) {
3625 return nil, false
3626 }
3627
3628
3629 func (fe FoodEstablishment) AsBasicResponseBase() (BasicResponseBase, bool) {
3630 return &fe, true
3631 }
3632
3633
3634 func (fe *FoodEstablishment) UnmarshalJSON(body []byte) error {
3635 var m map[string]*json.RawMessage
3636 err := json.Unmarshal(body, &m)
3637 if err != nil {
3638 return err
3639 }
3640 for k, v := range m {
3641 switch k {
3642 case "priceRange":
3643 if v != nil {
3644 var priceRange string
3645 err = json.Unmarshal(*v, &priceRange)
3646 if err != nil {
3647 return err
3648 }
3649 fe.PriceRange = &priceRange
3650 }
3651 case "panoramas":
3652 if v != nil {
3653 var panoramas []ImageObject
3654 err = json.Unmarshal(*v, &panoramas)
3655 if err != nil {
3656 return err
3657 }
3658 fe.Panoramas = &panoramas
3659 }
3660 case "isPermanentlyClosed":
3661 if v != nil {
3662 var isPermanentlyClosed bool
3663 err = json.Unmarshal(*v, &isPermanentlyClosed)
3664 if err != nil {
3665 return err
3666 }
3667 fe.IsPermanentlyClosed = &isPermanentlyClosed
3668 }
3669 case "tagLine":
3670 if v != nil {
3671 var tagLine string
3672 err = json.Unmarshal(*v, &tagLine)
3673 if err != nil {
3674 return err
3675 }
3676 fe.TagLine = &tagLine
3677 }
3678 case "address":
3679 if v != nil {
3680 var address PostalAddress
3681 err = json.Unmarshal(*v, &address)
3682 if err != nil {
3683 return err
3684 }
3685 fe.Address = &address
3686 }
3687 case "telephone":
3688 if v != nil {
3689 var telephone string
3690 err = json.Unmarshal(*v, &telephone)
3691 if err != nil {
3692 return err
3693 }
3694 fe.Telephone = &telephone
3695 }
3696 case "name":
3697 if v != nil {
3698 var name string
3699 err = json.Unmarshal(*v, &name)
3700 if err != nil {
3701 return err
3702 }
3703 fe.Name = &name
3704 }
3705 case "url":
3706 if v != nil {
3707 var URL string
3708 err = json.Unmarshal(*v, &URL)
3709 if err != nil {
3710 return err
3711 }
3712 fe.URL = &URL
3713 }
3714 case "image":
3715 if v != nil {
3716 var imageVar ImageObject
3717 err = json.Unmarshal(*v, &imageVar)
3718 if err != nil {
3719 return err
3720 }
3721 fe.Image = &imageVar
3722 }
3723 case "description":
3724 if v != nil {
3725 var description string
3726 err = json.Unmarshal(*v, &description)
3727 if err != nil {
3728 return err
3729 }
3730 fe.Description = &description
3731 }
3732 case "entityPresentationInfo":
3733 if v != nil {
3734 var entityPresentationInfo EntitiesEntityPresentationInfo
3735 err = json.Unmarshal(*v, &entityPresentationInfo)
3736 if err != nil {
3737 return err
3738 }
3739 fe.EntityPresentationInfo = &entityPresentationInfo
3740 }
3741 case "bingId":
3742 if v != nil {
3743 var bingID string
3744 err = json.Unmarshal(*v, &bingID)
3745 if err != nil {
3746 return err
3747 }
3748 fe.BingID = &bingID
3749 }
3750 case "contractualRules":
3751 if v != nil {
3752 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
3753 if err != nil {
3754 return err
3755 }
3756 fe.ContractualRules = &contractualRules
3757 }
3758 case "webSearchUrl":
3759 if v != nil {
3760 var webSearchURL string
3761 err = json.Unmarshal(*v, &webSearchURL)
3762 if err != nil {
3763 return err
3764 }
3765 fe.WebSearchURL = &webSearchURL
3766 }
3767 case "id":
3768 if v != nil {
3769 var ID string
3770 err = json.Unmarshal(*v, &ID)
3771 if err != nil {
3772 return err
3773 }
3774 fe.ID = &ID
3775 }
3776 case "_type":
3777 if v != nil {
3778 var typeVar TypeBasicResponseBase
3779 err = json.Unmarshal(*v, &typeVar)
3780 if err != nil {
3781 return err
3782 }
3783 fe.Type = typeVar
3784 }
3785 }
3786 }
3787
3788 return nil
3789 }
3790
3791
3792 type Hotel struct {
3793
3794 HotelClass *string `json:"hotelClass,omitempty"`
3795
3796 Amenities *[]string `json:"amenities,omitempty"`
3797
3798 PriceRange *string `json:"priceRange,omitempty"`
3799
3800 Panoramas *[]ImageObject `json:"panoramas,omitempty"`
3801
3802 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"`
3803
3804 TagLine *string `json:"tagLine,omitempty"`
3805
3806 Address *PostalAddress `json:"address,omitempty"`
3807
3808 Telephone *string `json:"telephone,omitempty"`
3809
3810 Name *string `json:"name,omitempty"`
3811
3812 URL *string `json:"url,omitempty"`
3813
3814 Image *ImageObject `json:"image,omitempty"`
3815
3816 Description *string `json:"description,omitempty"`
3817
3818 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
3819
3820 BingID *string `json:"bingId,omitempty"`
3821
3822 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
3823
3824 WebSearchURL *string `json:"webSearchUrl,omitempty"`
3825
3826 ID *string `json:"id,omitempty"`
3827
3828 Type TypeBasicResponseBase `json:"_type,omitempty"`
3829 }
3830
3831
3832 func (h Hotel) MarshalJSON() ([]byte, error) {
3833 h.Type = TypeHotel
3834 objectMap := make(map[string]interface{})
3835 if h.Type != "" {
3836 objectMap["_type"] = h.Type
3837 }
3838 return json.Marshal(objectMap)
3839 }
3840
3841
3842 func (h Hotel) AsImageObject() (*ImageObject, bool) {
3843 return nil, false
3844 }
3845
3846
3847 func (h Hotel) AsThing() (*Thing, bool) {
3848 return nil, false
3849 }
3850
3851
3852 func (h Hotel) AsBasicThing() (BasicThing, bool) {
3853 return &h, true
3854 }
3855
3856
3857 func (h Hotel) AsEntities() (*Entities, bool) {
3858 return nil, false
3859 }
3860
3861
3862 func (h Hotel) AsPlaces() (*Places, bool) {
3863 return nil, false
3864 }
3865
3866
3867 func (h Hotel) AsSearchResponse() (*SearchResponse, bool) {
3868 return nil, false
3869 }
3870
3871
3872 func (h Hotel) AsResponse() (*Response, bool) {
3873 return nil, false
3874 }
3875
3876
3877 func (h Hotel) AsBasicResponse() (BasicResponse, bool) {
3878 return &h, true
3879 }
3880
3881
3882 func (h Hotel) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
3883 return nil, false
3884 }
3885
3886
3887 func (h Hotel) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
3888 return nil, false
3889 }
3890
3891
3892 func (h Hotel) AsIdentifiable() (*Identifiable, bool) {
3893 return nil, false
3894 }
3895
3896
3897 func (h Hotel) AsBasicIdentifiable() (BasicIdentifiable, bool) {
3898 return &h, true
3899 }
3900
3901
3902 func (h Hotel) AsAnswer() (*Answer, bool) {
3903 return nil, false
3904 }
3905
3906
3907 func (h Hotel) AsBasicAnswer() (BasicAnswer, bool) {
3908 return nil, false
3909 }
3910
3911
3912 func (h Hotel) AsErrorResponse() (*ErrorResponse, bool) {
3913 return nil, false
3914 }
3915
3916
3917 func (h Hotel) AsPostalAddress() (*PostalAddress, bool) {
3918 return nil, false
3919 }
3920
3921
3922 func (h Hotel) AsPlace() (*Place, bool) {
3923 return nil, false
3924 }
3925
3926
3927 func (h Hotel) AsBasicPlace() (BasicPlace, bool) {
3928 return &h, true
3929 }
3930
3931
3932 func (h Hotel) AsOrganization() (*Organization, bool) {
3933 return nil, false
3934 }
3935
3936
3937 func (h Hotel) AsCreativeWork() (*CreativeWork, bool) {
3938 return nil, false
3939 }
3940
3941
3942 func (h Hotel) AsBasicCreativeWork() (BasicCreativeWork, bool) {
3943 return nil, false
3944 }
3945
3946
3947 func (h Hotel) AsIntangible() (*Intangible, bool) {
3948 return nil, false
3949 }
3950
3951
3952 func (h Hotel) AsBasicIntangible() (BasicIntangible, bool) {
3953 return nil, false
3954 }
3955
3956
3957 func (h Hotel) AsMovieTheater() (*MovieTheater, bool) {
3958 return nil, false
3959 }
3960
3961
3962 func (h Hotel) AsMediaObject() (*MediaObject, bool) {
3963 return nil, false
3964 }
3965
3966
3967 func (h Hotel) AsBasicMediaObject() (BasicMediaObject, bool) {
3968 return nil, false
3969 }
3970
3971
3972 func (h Hotel) AsCivicStructure() (*CivicStructure, bool) {
3973 return nil, false
3974 }
3975
3976
3977 func (h Hotel) AsBasicCivicStructure() (BasicCivicStructure, bool) {
3978 return nil, false
3979 }
3980
3981
3982 func (h Hotel) AsLocalBusiness() (*LocalBusiness, bool) {
3983 return nil, false
3984 }
3985
3986
3987 func (h Hotel) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
3988 return &h, true
3989 }
3990
3991
3992 func (h Hotel) AsTouristAttraction() (*TouristAttraction, bool) {
3993 return nil, false
3994 }
3995
3996
3997 func (h Hotel) AsAirport() (*Airport, bool) {
3998 return nil, false
3999 }
4000
4001
4002 func (h Hotel) AsLicense() (*License, bool) {
4003 return nil, false
4004 }
4005
4006
4007 func (h Hotel) AsStructuredValue() (*StructuredValue, bool) {
4008 return nil, false
4009 }
4010
4011
4012 func (h Hotel) AsBasicStructuredValue() (BasicStructuredValue, bool) {
4013 return nil, false
4014 }
4015
4016
4017 func (h Hotel) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
4018 return nil, false
4019 }
4020
4021
4022 func (h Hotel) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
4023 return nil, false
4024 }
4025
4026
4027 func (h Hotel) AsFoodEstablishment() (*FoodEstablishment, bool) {
4028 return nil, false
4029 }
4030
4031
4032 func (h Hotel) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
4033 return nil, false
4034 }
4035
4036
4037 func (h Hotel) AsLodgingBusiness() (*LodgingBusiness, bool) {
4038 return nil, false
4039 }
4040
4041
4042 func (h Hotel) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
4043 return &h, true
4044 }
4045
4046
4047 func (h Hotel) AsRestaurant() (*Restaurant, bool) {
4048 return nil, false
4049 }
4050
4051
4052 func (h Hotel) AsHotel() (*Hotel, bool) {
4053 return &h, true
4054 }
4055
4056
4057 func (h Hotel) AsResponseBase() (*ResponseBase, bool) {
4058 return nil, false
4059 }
4060
4061
4062 func (h Hotel) AsBasicResponseBase() (BasicResponseBase, bool) {
4063 return &h, true
4064 }
4065
4066
4067 func (h *Hotel) UnmarshalJSON(body []byte) error {
4068 var m map[string]*json.RawMessage
4069 err := json.Unmarshal(body, &m)
4070 if err != nil {
4071 return err
4072 }
4073 for k, v := range m {
4074 switch k {
4075 case "hotelClass":
4076 if v != nil {
4077 var hotelClass string
4078 err = json.Unmarshal(*v, &hotelClass)
4079 if err != nil {
4080 return err
4081 }
4082 h.HotelClass = &hotelClass
4083 }
4084 case "amenities":
4085 if v != nil {
4086 var amenities []string
4087 err = json.Unmarshal(*v, &amenities)
4088 if err != nil {
4089 return err
4090 }
4091 h.Amenities = &amenities
4092 }
4093 case "priceRange":
4094 if v != nil {
4095 var priceRange string
4096 err = json.Unmarshal(*v, &priceRange)
4097 if err != nil {
4098 return err
4099 }
4100 h.PriceRange = &priceRange
4101 }
4102 case "panoramas":
4103 if v != nil {
4104 var panoramas []ImageObject
4105 err = json.Unmarshal(*v, &panoramas)
4106 if err != nil {
4107 return err
4108 }
4109 h.Panoramas = &panoramas
4110 }
4111 case "isPermanentlyClosed":
4112 if v != nil {
4113 var isPermanentlyClosed bool
4114 err = json.Unmarshal(*v, &isPermanentlyClosed)
4115 if err != nil {
4116 return err
4117 }
4118 h.IsPermanentlyClosed = &isPermanentlyClosed
4119 }
4120 case "tagLine":
4121 if v != nil {
4122 var tagLine string
4123 err = json.Unmarshal(*v, &tagLine)
4124 if err != nil {
4125 return err
4126 }
4127 h.TagLine = &tagLine
4128 }
4129 case "address":
4130 if v != nil {
4131 var address PostalAddress
4132 err = json.Unmarshal(*v, &address)
4133 if err != nil {
4134 return err
4135 }
4136 h.Address = &address
4137 }
4138 case "telephone":
4139 if v != nil {
4140 var telephone string
4141 err = json.Unmarshal(*v, &telephone)
4142 if err != nil {
4143 return err
4144 }
4145 h.Telephone = &telephone
4146 }
4147 case "name":
4148 if v != nil {
4149 var name string
4150 err = json.Unmarshal(*v, &name)
4151 if err != nil {
4152 return err
4153 }
4154 h.Name = &name
4155 }
4156 case "url":
4157 if v != nil {
4158 var URL string
4159 err = json.Unmarshal(*v, &URL)
4160 if err != nil {
4161 return err
4162 }
4163 h.URL = &URL
4164 }
4165 case "image":
4166 if v != nil {
4167 var imageVar ImageObject
4168 err = json.Unmarshal(*v, &imageVar)
4169 if err != nil {
4170 return err
4171 }
4172 h.Image = &imageVar
4173 }
4174 case "description":
4175 if v != nil {
4176 var description string
4177 err = json.Unmarshal(*v, &description)
4178 if err != nil {
4179 return err
4180 }
4181 h.Description = &description
4182 }
4183 case "entityPresentationInfo":
4184 if v != nil {
4185 var entityPresentationInfo EntitiesEntityPresentationInfo
4186 err = json.Unmarshal(*v, &entityPresentationInfo)
4187 if err != nil {
4188 return err
4189 }
4190 h.EntityPresentationInfo = &entityPresentationInfo
4191 }
4192 case "bingId":
4193 if v != nil {
4194 var bingID string
4195 err = json.Unmarshal(*v, &bingID)
4196 if err != nil {
4197 return err
4198 }
4199 h.BingID = &bingID
4200 }
4201 case "contractualRules":
4202 if v != nil {
4203 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
4204 if err != nil {
4205 return err
4206 }
4207 h.ContractualRules = &contractualRules
4208 }
4209 case "webSearchUrl":
4210 if v != nil {
4211 var webSearchURL string
4212 err = json.Unmarshal(*v, &webSearchURL)
4213 if err != nil {
4214 return err
4215 }
4216 h.WebSearchURL = &webSearchURL
4217 }
4218 case "id":
4219 if v != nil {
4220 var ID string
4221 err = json.Unmarshal(*v, &ID)
4222 if err != nil {
4223 return err
4224 }
4225 h.ID = &ID
4226 }
4227 case "_type":
4228 if v != nil {
4229 var typeVar TypeBasicResponseBase
4230 err = json.Unmarshal(*v, &typeVar)
4231 if err != nil {
4232 return err
4233 }
4234 h.Type = typeVar
4235 }
4236 }
4237 }
4238
4239 return nil
4240 }
4241
4242
4243 type BasicIdentifiable interface {
4244 AsImageObject() (*ImageObject, bool)
4245 AsThing() (*Thing, bool)
4246 AsBasicThing() (BasicThing, bool)
4247 AsEntities() (*Entities, bool)
4248 AsPlaces() (*Places, bool)
4249 AsSearchResponse() (*SearchResponse, bool)
4250 AsResponse() (*Response, bool)
4251 AsBasicResponse() (BasicResponse, bool)
4252 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
4253 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
4254 AsAnswer() (*Answer, bool)
4255 AsBasicAnswer() (BasicAnswer, bool)
4256 AsErrorResponse() (*ErrorResponse, bool)
4257 AsPostalAddress() (*PostalAddress, bool)
4258 AsPlace() (*Place, bool)
4259 AsBasicPlace() (BasicPlace, bool)
4260 AsOrganization() (*Organization, bool)
4261 AsCreativeWork() (*CreativeWork, bool)
4262 AsBasicCreativeWork() (BasicCreativeWork, bool)
4263 AsIntangible() (*Intangible, bool)
4264 AsBasicIntangible() (BasicIntangible, bool)
4265 AsMovieTheater() (*MovieTheater, bool)
4266 AsMediaObject() (*MediaObject, bool)
4267 AsBasicMediaObject() (BasicMediaObject, bool)
4268 AsCivicStructure() (*CivicStructure, bool)
4269 AsBasicCivicStructure() (BasicCivicStructure, bool)
4270 AsLocalBusiness() (*LocalBusiness, bool)
4271 AsBasicLocalBusiness() (BasicLocalBusiness, bool)
4272 AsTouristAttraction() (*TouristAttraction, bool)
4273 AsAirport() (*Airport, bool)
4274 AsLicense() (*License, bool)
4275 AsStructuredValue() (*StructuredValue, bool)
4276 AsBasicStructuredValue() (BasicStructuredValue, bool)
4277 AsEntertainmentBusiness() (*EntertainmentBusiness, bool)
4278 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool)
4279 AsFoodEstablishment() (*FoodEstablishment, bool)
4280 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool)
4281 AsLodgingBusiness() (*LodgingBusiness, bool)
4282 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool)
4283 AsRestaurant() (*Restaurant, bool)
4284 AsHotel() (*Hotel, bool)
4285 AsIdentifiable() (*Identifiable, bool)
4286 }
4287
4288
4289 type Identifiable struct {
4290
4291 ID *string `json:"id,omitempty"`
4292
4293 Type TypeBasicResponseBase `json:"_type,omitempty"`
4294 }
4295
4296 func unmarshalBasicIdentifiable(body []byte) (BasicIdentifiable, error) {
4297 var m map[string]interface{}
4298 err := json.Unmarshal(body, &m)
4299 if err != nil {
4300 return nil, err
4301 }
4302
4303 switch m["_type"] {
4304 case string(TypeImageObject):
4305 var ioVar ImageObject
4306 err := json.Unmarshal(body, &ioVar)
4307 return ioVar, err
4308 case string(TypeThing):
4309 var t Thing
4310 err := json.Unmarshal(body, &t)
4311 return t, err
4312 case string(TypeEntities):
4313 var e Entities
4314 err := json.Unmarshal(body, &e)
4315 return e, err
4316 case string(TypePlaces):
4317 var p Places
4318 err := json.Unmarshal(body, &p)
4319 return p, err
4320 case string(TypeSearchResponse):
4321 var sr SearchResponse
4322 err := json.Unmarshal(body, &sr)
4323 return sr, err
4324 case string(TypeResponse):
4325 var r Response
4326 err := json.Unmarshal(body, &r)
4327 return r, err
4328 case string(TypeSearchResultsAnswer):
4329 var sra SearchResultsAnswer
4330 err := json.Unmarshal(body, &sra)
4331 return sra, err
4332 case string(TypeAnswer):
4333 var a Answer
4334 err := json.Unmarshal(body, &a)
4335 return a, err
4336 case string(TypeErrorResponse):
4337 var er ErrorResponse
4338 err := json.Unmarshal(body, &er)
4339 return er, err
4340 case string(TypePostalAddress):
4341 var pa PostalAddress
4342 err := json.Unmarshal(body, &pa)
4343 return pa, err
4344 case string(TypePlace):
4345 var p Place
4346 err := json.Unmarshal(body, &p)
4347 return p, err
4348 case string(TypeOrganization):
4349 var o Organization
4350 err := json.Unmarshal(body, &o)
4351 return o, err
4352 case string(TypeCreativeWork):
4353 var cw CreativeWork
4354 err := json.Unmarshal(body, &cw)
4355 return cw, err
4356 case string(TypeIntangible):
4357 var i Intangible
4358 err := json.Unmarshal(body, &i)
4359 return i, err
4360 case string(TypeMovieTheater):
4361 var mt MovieTheater
4362 err := json.Unmarshal(body, &mt)
4363 return mt, err
4364 case string(TypeMediaObject):
4365 var mo MediaObject
4366 err := json.Unmarshal(body, &mo)
4367 return mo, err
4368 case string(TypeCivicStructure):
4369 var cs CivicStructure
4370 err := json.Unmarshal(body, &cs)
4371 return cs, err
4372 case string(TypeLocalBusiness):
4373 var lb LocalBusiness
4374 err := json.Unmarshal(body, &lb)
4375 return lb, err
4376 case string(TypeTouristAttraction):
4377 var ta TouristAttraction
4378 err := json.Unmarshal(body, &ta)
4379 return ta, err
4380 case string(TypeAirport):
4381 var a Airport
4382 err := json.Unmarshal(body, &a)
4383 return a, err
4384 case string(TypeLicense):
4385 var l License
4386 err := json.Unmarshal(body, &l)
4387 return l, err
4388 case string(TypeStructuredValue):
4389 var sv StructuredValue
4390 err := json.Unmarshal(body, &sv)
4391 return sv, err
4392 case string(TypeEntertainmentBusiness):
4393 var eb EntertainmentBusiness
4394 err := json.Unmarshal(body, &eb)
4395 return eb, err
4396 case string(TypeFoodEstablishment):
4397 var fe FoodEstablishment
4398 err := json.Unmarshal(body, &fe)
4399 return fe, err
4400 case string(TypeLodgingBusiness):
4401 var lb LodgingBusiness
4402 err := json.Unmarshal(body, &lb)
4403 return lb, err
4404 case string(TypeRestaurant):
4405 var r Restaurant
4406 err := json.Unmarshal(body, &r)
4407 return r, err
4408 case string(TypeHotel):
4409 var h Hotel
4410 err := json.Unmarshal(body, &h)
4411 return h, err
4412 default:
4413 var i Identifiable
4414 err := json.Unmarshal(body, &i)
4415 return i, err
4416 }
4417 }
4418 func unmarshalBasicIdentifiableArray(body []byte) ([]BasicIdentifiable, error) {
4419 var rawMessages []*json.RawMessage
4420 err := json.Unmarshal(body, &rawMessages)
4421 if err != nil {
4422 return nil, err
4423 }
4424
4425 iArray := make([]BasicIdentifiable, len(rawMessages))
4426
4427 for index, rawMessage := range rawMessages {
4428 i, err := unmarshalBasicIdentifiable(*rawMessage)
4429 if err != nil {
4430 return nil, err
4431 }
4432 iArray[index] = i
4433 }
4434 return iArray, nil
4435 }
4436
4437
4438 func (i Identifiable) MarshalJSON() ([]byte, error) {
4439 i.Type = TypeIdentifiable
4440 objectMap := make(map[string]interface{})
4441 if i.Type != "" {
4442 objectMap["_type"] = i.Type
4443 }
4444 return json.Marshal(objectMap)
4445 }
4446
4447
4448 func (i Identifiable) AsImageObject() (*ImageObject, bool) {
4449 return nil, false
4450 }
4451
4452
4453 func (i Identifiable) AsThing() (*Thing, bool) {
4454 return nil, false
4455 }
4456
4457
4458 func (i Identifiable) AsBasicThing() (BasicThing, bool) {
4459 return nil, false
4460 }
4461
4462
4463 func (i Identifiable) AsEntities() (*Entities, bool) {
4464 return nil, false
4465 }
4466
4467
4468 func (i Identifiable) AsPlaces() (*Places, bool) {
4469 return nil, false
4470 }
4471
4472
4473 func (i Identifiable) AsSearchResponse() (*SearchResponse, bool) {
4474 return nil, false
4475 }
4476
4477
4478 func (i Identifiable) AsResponse() (*Response, bool) {
4479 return nil, false
4480 }
4481
4482
4483 func (i Identifiable) AsBasicResponse() (BasicResponse, bool) {
4484 return nil, false
4485 }
4486
4487
4488 func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
4489 return nil, false
4490 }
4491
4492
4493 func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
4494 return nil, false
4495 }
4496
4497
4498 func (i Identifiable) AsIdentifiable() (*Identifiable, bool) {
4499 return &i, true
4500 }
4501
4502
4503 func (i Identifiable) AsBasicIdentifiable() (BasicIdentifiable, bool) {
4504 return &i, true
4505 }
4506
4507
4508 func (i Identifiable) AsAnswer() (*Answer, bool) {
4509 return nil, false
4510 }
4511
4512
4513 func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) {
4514 return nil, false
4515 }
4516
4517
4518 func (i Identifiable) AsErrorResponse() (*ErrorResponse, bool) {
4519 return nil, false
4520 }
4521
4522
4523 func (i Identifiable) AsPostalAddress() (*PostalAddress, bool) {
4524 return nil, false
4525 }
4526
4527
4528 func (i Identifiable) AsPlace() (*Place, bool) {
4529 return nil, false
4530 }
4531
4532
4533 func (i Identifiable) AsBasicPlace() (BasicPlace, bool) {
4534 return nil, false
4535 }
4536
4537
4538 func (i Identifiable) AsOrganization() (*Organization, bool) {
4539 return nil, false
4540 }
4541
4542
4543 func (i Identifiable) AsCreativeWork() (*CreativeWork, bool) {
4544 return nil, false
4545 }
4546
4547
4548 func (i Identifiable) AsBasicCreativeWork() (BasicCreativeWork, bool) {
4549 return nil, false
4550 }
4551
4552
4553 func (i Identifiable) AsIntangible() (*Intangible, bool) {
4554 return nil, false
4555 }
4556
4557
4558 func (i Identifiable) AsBasicIntangible() (BasicIntangible, bool) {
4559 return nil, false
4560 }
4561
4562
4563 func (i Identifiable) AsMovieTheater() (*MovieTheater, bool) {
4564 return nil, false
4565 }
4566
4567
4568 func (i Identifiable) AsMediaObject() (*MediaObject, bool) {
4569 return nil, false
4570 }
4571
4572
4573 func (i Identifiable) AsBasicMediaObject() (BasicMediaObject, bool) {
4574 return nil, false
4575 }
4576
4577
4578 func (i Identifiable) AsCivicStructure() (*CivicStructure, bool) {
4579 return nil, false
4580 }
4581
4582
4583 func (i Identifiable) AsBasicCivicStructure() (BasicCivicStructure, bool) {
4584 return nil, false
4585 }
4586
4587
4588 func (i Identifiable) AsLocalBusiness() (*LocalBusiness, bool) {
4589 return nil, false
4590 }
4591
4592
4593 func (i Identifiable) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
4594 return nil, false
4595 }
4596
4597
4598 func (i Identifiable) AsTouristAttraction() (*TouristAttraction, bool) {
4599 return nil, false
4600 }
4601
4602
4603 func (i Identifiable) AsAirport() (*Airport, bool) {
4604 return nil, false
4605 }
4606
4607
4608 func (i Identifiable) AsLicense() (*License, bool) {
4609 return nil, false
4610 }
4611
4612
4613 func (i Identifiable) AsStructuredValue() (*StructuredValue, bool) {
4614 return nil, false
4615 }
4616
4617
4618 func (i Identifiable) AsBasicStructuredValue() (BasicStructuredValue, bool) {
4619 return nil, false
4620 }
4621
4622
4623 func (i Identifiable) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
4624 return nil, false
4625 }
4626
4627
4628 func (i Identifiable) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
4629 return nil, false
4630 }
4631
4632
4633 func (i Identifiable) AsFoodEstablishment() (*FoodEstablishment, bool) {
4634 return nil, false
4635 }
4636
4637
4638 func (i Identifiable) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
4639 return nil, false
4640 }
4641
4642
4643 func (i Identifiable) AsLodgingBusiness() (*LodgingBusiness, bool) {
4644 return nil, false
4645 }
4646
4647
4648 func (i Identifiable) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
4649 return nil, false
4650 }
4651
4652
4653 func (i Identifiable) AsRestaurant() (*Restaurant, bool) {
4654 return nil, false
4655 }
4656
4657
4658 func (i Identifiable) AsHotel() (*Hotel, bool) {
4659 return nil, false
4660 }
4661
4662
4663 func (i Identifiable) AsResponseBase() (*ResponseBase, bool) {
4664 return nil, false
4665 }
4666
4667
4668 func (i Identifiable) AsBasicResponseBase() (BasicResponseBase, bool) {
4669 return &i, true
4670 }
4671
4672
4673 type ImageObject struct {
4674
4675 Thumbnail *ImageObject `json:"thumbnail,omitempty"`
4676
4677 ContentURL *string `json:"contentUrl,omitempty"`
4678
4679 HostPageURL *string `json:"hostPageUrl,omitempty"`
4680
4681 Width *int32 `json:"width,omitempty"`
4682
4683 Height *int32 `json:"height,omitempty"`
4684
4685 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
4686
4687 Provider *[]BasicThing `json:"provider,omitempty"`
4688
4689 Text *string `json:"text,omitempty"`
4690
4691 Name *string `json:"name,omitempty"`
4692
4693 URL *string `json:"url,omitempty"`
4694
4695 Image *ImageObject `json:"image,omitempty"`
4696
4697 Description *string `json:"description,omitempty"`
4698
4699 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
4700
4701 BingID *string `json:"bingId,omitempty"`
4702
4703 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
4704
4705 WebSearchURL *string `json:"webSearchUrl,omitempty"`
4706
4707 ID *string `json:"id,omitempty"`
4708
4709 Type TypeBasicResponseBase `json:"_type,omitempty"`
4710 }
4711
4712
4713 func (ioVar ImageObject) MarshalJSON() ([]byte, error) {
4714 ioVar.Type = TypeImageObject
4715 objectMap := make(map[string]interface{})
4716 if ioVar.Type != "" {
4717 objectMap["_type"] = ioVar.Type
4718 }
4719 return json.Marshal(objectMap)
4720 }
4721
4722
4723 func (ioVar ImageObject) AsImageObject() (*ImageObject, bool) {
4724 return &ioVar, true
4725 }
4726
4727
4728 func (ioVar ImageObject) AsThing() (*Thing, bool) {
4729 return nil, false
4730 }
4731
4732
4733 func (ioVar ImageObject) AsBasicThing() (BasicThing, bool) {
4734 return &ioVar, true
4735 }
4736
4737
4738 func (ioVar ImageObject) AsEntities() (*Entities, bool) {
4739 return nil, false
4740 }
4741
4742
4743 func (ioVar ImageObject) AsPlaces() (*Places, bool) {
4744 return nil, false
4745 }
4746
4747
4748 func (ioVar ImageObject) AsSearchResponse() (*SearchResponse, bool) {
4749 return nil, false
4750 }
4751
4752
4753 func (ioVar ImageObject) AsResponse() (*Response, bool) {
4754 return nil, false
4755 }
4756
4757
4758 func (ioVar ImageObject) AsBasicResponse() (BasicResponse, bool) {
4759 return &ioVar, true
4760 }
4761
4762
4763 func (ioVar ImageObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
4764 return nil, false
4765 }
4766
4767
4768 func (ioVar ImageObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
4769 return nil, false
4770 }
4771
4772
4773 func (ioVar ImageObject) AsIdentifiable() (*Identifiable, bool) {
4774 return nil, false
4775 }
4776
4777
4778 func (ioVar ImageObject) AsBasicIdentifiable() (BasicIdentifiable, bool) {
4779 return &ioVar, true
4780 }
4781
4782
4783 func (ioVar ImageObject) AsAnswer() (*Answer, bool) {
4784 return nil, false
4785 }
4786
4787
4788 func (ioVar ImageObject) AsBasicAnswer() (BasicAnswer, bool) {
4789 return nil, false
4790 }
4791
4792
4793 func (ioVar ImageObject) AsErrorResponse() (*ErrorResponse, bool) {
4794 return nil, false
4795 }
4796
4797
4798 func (ioVar ImageObject) AsPostalAddress() (*PostalAddress, bool) {
4799 return nil, false
4800 }
4801
4802
4803 func (ioVar ImageObject) AsPlace() (*Place, bool) {
4804 return nil, false
4805 }
4806
4807
4808 func (ioVar ImageObject) AsBasicPlace() (BasicPlace, bool) {
4809 return nil, false
4810 }
4811
4812
4813 func (ioVar ImageObject) AsOrganization() (*Organization, bool) {
4814 return nil, false
4815 }
4816
4817
4818 func (ioVar ImageObject) AsCreativeWork() (*CreativeWork, bool) {
4819 return nil, false
4820 }
4821
4822
4823 func (ioVar ImageObject) AsBasicCreativeWork() (BasicCreativeWork, bool) {
4824 return &ioVar, true
4825 }
4826
4827
4828 func (ioVar ImageObject) AsIntangible() (*Intangible, bool) {
4829 return nil, false
4830 }
4831
4832
4833 func (ioVar ImageObject) AsBasicIntangible() (BasicIntangible, bool) {
4834 return nil, false
4835 }
4836
4837
4838 func (ioVar ImageObject) AsMovieTheater() (*MovieTheater, bool) {
4839 return nil, false
4840 }
4841
4842
4843 func (ioVar ImageObject) AsMediaObject() (*MediaObject, bool) {
4844 return nil, false
4845 }
4846
4847
4848 func (ioVar ImageObject) AsBasicMediaObject() (BasicMediaObject, bool) {
4849 return &ioVar, true
4850 }
4851
4852
4853 func (ioVar ImageObject) AsCivicStructure() (*CivicStructure, bool) {
4854 return nil, false
4855 }
4856
4857
4858 func (ioVar ImageObject) AsBasicCivicStructure() (BasicCivicStructure, bool) {
4859 return nil, false
4860 }
4861
4862
4863 func (ioVar ImageObject) AsLocalBusiness() (*LocalBusiness, bool) {
4864 return nil, false
4865 }
4866
4867
4868 func (ioVar ImageObject) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
4869 return nil, false
4870 }
4871
4872
4873 func (ioVar ImageObject) AsTouristAttraction() (*TouristAttraction, bool) {
4874 return nil, false
4875 }
4876
4877
4878 func (ioVar ImageObject) AsAirport() (*Airport, bool) {
4879 return nil, false
4880 }
4881
4882
4883 func (ioVar ImageObject) AsLicense() (*License, bool) {
4884 return nil, false
4885 }
4886
4887
4888 func (ioVar ImageObject) AsStructuredValue() (*StructuredValue, bool) {
4889 return nil, false
4890 }
4891
4892
4893 func (ioVar ImageObject) AsBasicStructuredValue() (BasicStructuredValue, bool) {
4894 return nil, false
4895 }
4896
4897
4898 func (ioVar ImageObject) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
4899 return nil, false
4900 }
4901
4902
4903 func (ioVar ImageObject) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
4904 return nil, false
4905 }
4906
4907
4908 func (ioVar ImageObject) AsFoodEstablishment() (*FoodEstablishment, bool) {
4909 return nil, false
4910 }
4911
4912
4913 func (ioVar ImageObject) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
4914 return nil, false
4915 }
4916
4917
4918 func (ioVar ImageObject) AsLodgingBusiness() (*LodgingBusiness, bool) {
4919 return nil, false
4920 }
4921
4922
4923 func (ioVar ImageObject) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
4924 return nil, false
4925 }
4926
4927
4928 func (ioVar ImageObject) AsRestaurant() (*Restaurant, bool) {
4929 return nil, false
4930 }
4931
4932
4933 func (ioVar ImageObject) AsHotel() (*Hotel, bool) {
4934 return nil, false
4935 }
4936
4937
4938 func (ioVar ImageObject) AsResponseBase() (*ResponseBase, bool) {
4939 return nil, false
4940 }
4941
4942
4943 func (ioVar ImageObject) AsBasicResponseBase() (BasicResponseBase, bool) {
4944 return &ioVar, true
4945 }
4946
4947
4948 func (ioVar *ImageObject) UnmarshalJSON(body []byte) error {
4949 var m map[string]*json.RawMessage
4950 err := json.Unmarshal(body, &m)
4951 if err != nil {
4952 return err
4953 }
4954 for k, v := range m {
4955 switch k {
4956 case "thumbnail":
4957 if v != nil {
4958 var thumbnail ImageObject
4959 err = json.Unmarshal(*v, &thumbnail)
4960 if err != nil {
4961 return err
4962 }
4963 ioVar.Thumbnail = &thumbnail
4964 }
4965 case "contentUrl":
4966 if v != nil {
4967 var contentURL string
4968 err = json.Unmarshal(*v, &contentURL)
4969 if err != nil {
4970 return err
4971 }
4972 ioVar.ContentURL = &contentURL
4973 }
4974 case "hostPageUrl":
4975 if v != nil {
4976 var hostPageURL string
4977 err = json.Unmarshal(*v, &hostPageURL)
4978 if err != nil {
4979 return err
4980 }
4981 ioVar.HostPageURL = &hostPageURL
4982 }
4983 case "width":
4984 if v != nil {
4985 var width int32
4986 err = json.Unmarshal(*v, &width)
4987 if err != nil {
4988 return err
4989 }
4990 ioVar.Width = &width
4991 }
4992 case "height":
4993 if v != nil {
4994 var height int32
4995 err = json.Unmarshal(*v, &height)
4996 if err != nil {
4997 return err
4998 }
4999 ioVar.Height = &height
5000 }
5001 case "thumbnailUrl":
5002 if v != nil {
5003 var thumbnailURL string
5004 err = json.Unmarshal(*v, &thumbnailURL)
5005 if err != nil {
5006 return err
5007 }
5008 ioVar.ThumbnailURL = &thumbnailURL
5009 }
5010 case "provider":
5011 if v != nil {
5012 provider, err := unmarshalBasicThingArray(*v)
5013 if err != nil {
5014 return err
5015 }
5016 ioVar.Provider = &provider
5017 }
5018 case "text":
5019 if v != nil {
5020 var textVar string
5021 err = json.Unmarshal(*v, &textVar)
5022 if err != nil {
5023 return err
5024 }
5025 ioVar.Text = &textVar
5026 }
5027 case "name":
5028 if v != nil {
5029 var name string
5030 err = json.Unmarshal(*v, &name)
5031 if err != nil {
5032 return err
5033 }
5034 ioVar.Name = &name
5035 }
5036 case "url":
5037 if v != nil {
5038 var URL string
5039 err = json.Unmarshal(*v, &URL)
5040 if err != nil {
5041 return err
5042 }
5043 ioVar.URL = &URL
5044 }
5045 case "image":
5046 if v != nil {
5047 var imageVar ImageObject
5048 err = json.Unmarshal(*v, &imageVar)
5049 if err != nil {
5050 return err
5051 }
5052 ioVar.Image = &imageVar
5053 }
5054 case "description":
5055 if v != nil {
5056 var description string
5057 err = json.Unmarshal(*v, &description)
5058 if err != nil {
5059 return err
5060 }
5061 ioVar.Description = &description
5062 }
5063 case "entityPresentationInfo":
5064 if v != nil {
5065 var entityPresentationInfo EntitiesEntityPresentationInfo
5066 err = json.Unmarshal(*v, &entityPresentationInfo)
5067 if err != nil {
5068 return err
5069 }
5070 ioVar.EntityPresentationInfo = &entityPresentationInfo
5071 }
5072 case "bingId":
5073 if v != nil {
5074 var bingID string
5075 err = json.Unmarshal(*v, &bingID)
5076 if err != nil {
5077 return err
5078 }
5079 ioVar.BingID = &bingID
5080 }
5081 case "contractualRules":
5082 if v != nil {
5083 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
5084 if err != nil {
5085 return err
5086 }
5087 ioVar.ContractualRules = &contractualRules
5088 }
5089 case "webSearchUrl":
5090 if v != nil {
5091 var webSearchURL string
5092 err = json.Unmarshal(*v, &webSearchURL)
5093 if err != nil {
5094 return err
5095 }
5096 ioVar.WebSearchURL = &webSearchURL
5097 }
5098 case "id":
5099 if v != nil {
5100 var ID string
5101 err = json.Unmarshal(*v, &ID)
5102 if err != nil {
5103 return err
5104 }
5105 ioVar.ID = &ID
5106 }
5107 case "_type":
5108 if v != nil {
5109 var typeVar TypeBasicResponseBase
5110 err = json.Unmarshal(*v, &typeVar)
5111 if err != nil {
5112 return err
5113 }
5114 ioVar.Type = typeVar
5115 }
5116 }
5117 }
5118
5119 return nil
5120 }
5121
5122
5123 type BasicIntangible interface {
5124 AsPostalAddress() (*PostalAddress, bool)
5125 AsStructuredValue() (*StructuredValue, bool)
5126 AsBasicStructuredValue() (BasicStructuredValue, bool)
5127 AsIntangible() (*Intangible, bool)
5128 }
5129
5130
5131 type Intangible struct {
5132
5133 Name *string `json:"name,omitempty"`
5134
5135 URL *string `json:"url,omitempty"`
5136
5137 Image *ImageObject `json:"image,omitempty"`
5138
5139 Description *string `json:"description,omitempty"`
5140
5141 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
5142
5143 BingID *string `json:"bingId,omitempty"`
5144
5145 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
5146
5147 WebSearchURL *string `json:"webSearchUrl,omitempty"`
5148
5149 ID *string `json:"id,omitempty"`
5150
5151 Type TypeBasicResponseBase `json:"_type,omitempty"`
5152 }
5153
5154 func unmarshalBasicIntangible(body []byte) (BasicIntangible, error) {
5155 var m map[string]interface{}
5156 err := json.Unmarshal(body, &m)
5157 if err != nil {
5158 return nil, err
5159 }
5160
5161 switch m["_type"] {
5162 case string(TypePostalAddress):
5163 var pa PostalAddress
5164 err := json.Unmarshal(body, &pa)
5165 return pa, err
5166 case string(TypeStructuredValue):
5167 var sv StructuredValue
5168 err := json.Unmarshal(body, &sv)
5169 return sv, err
5170 default:
5171 var i Intangible
5172 err := json.Unmarshal(body, &i)
5173 return i, err
5174 }
5175 }
5176 func unmarshalBasicIntangibleArray(body []byte) ([]BasicIntangible, error) {
5177 var rawMessages []*json.RawMessage
5178 err := json.Unmarshal(body, &rawMessages)
5179 if err != nil {
5180 return nil, err
5181 }
5182
5183 iArray := make([]BasicIntangible, len(rawMessages))
5184
5185 for index, rawMessage := range rawMessages {
5186 i, err := unmarshalBasicIntangible(*rawMessage)
5187 if err != nil {
5188 return nil, err
5189 }
5190 iArray[index] = i
5191 }
5192 return iArray, nil
5193 }
5194
5195
5196 func (i Intangible) MarshalJSON() ([]byte, error) {
5197 i.Type = TypeIntangible
5198 objectMap := make(map[string]interface{})
5199 if i.Type != "" {
5200 objectMap["_type"] = i.Type
5201 }
5202 return json.Marshal(objectMap)
5203 }
5204
5205
5206 func (i Intangible) AsImageObject() (*ImageObject, bool) {
5207 return nil, false
5208 }
5209
5210
5211 func (i Intangible) AsThing() (*Thing, bool) {
5212 return nil, false
5213 }
5214
5215
5216 func (i Intangible) AsBasicThing() (BasicThing, bool) {
5217 return &i, true
5218 }
5219
5220
5221 func (i Intangible) AsEntities() (*Entities, bool) {
5222 return nil, false
5223 }
5224
5225
5226 func (i Intangible) AsPlaces() (*Places, bool) {
5227 return nil, false
5228 }
5229
5230
5231 func (i Intangible) AsSearchResponse() (*SearchResponse, bool) {
5232 return nil, false
5233 }
5234
5235
5236 func (i Intangible) AsResponse() (*Response, bool) {
5237 return nil, false
5238 }
5239
5240
5241 func (i Intangible) AsBasicResponse() (BasicResponse, bool) {
5242 return &i, true
5243 }
5244
5245
5246 func (i Intangible) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
5247 return nil, false
5248 }
5249
5250
5251 func (i Intangible) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
5252 return nil, false
5253 }
5254
5255
5256 func (i Intangible) AsIdentifiable() (*Identifiable, bool) {
5257 return nil, false
5258 }
5259
5260
5261 func (i Intangible) AsBasicIdentifiable() (BasicIdentifiable, bool) {
5262 return &i, true
5263 }
5264
5265
5266 func (i Intangible) AsAnswer() (*Answer, bool) {
5267 return nil, false
5268 }
5269
5270
5271 func (i Intangible) AsBasicAnswer() (BasicAnswer, bool) {
5272 return nil, false
5273 }
5274
5275
5276 func (i Intangible) AsErrorResponse() (*ErrorResponse, bool) {
5277 return nil, false
5278 }
5279
5280
5281 func (i Intangible) AsPostalAddress() (*PostalAddress, bool) {
5282 return nil, false
5283 }
5284
5285
5286 func (i Intangible) AsPlace() (*Place, bool) {
5287 return nil, false
5288 }
5289
5290
5291 func (i Intangible) AsBasicPlace() (BasicPlace, bool) {
5292 return nil, false
5293 }
5294
5295
5296 func (i Intangible) AsOrganization() (*Organization, bool) {
5297 return nil, false
5298 }
5299
5300
5301 func (i Intangible) AsCreativeWork() (*CreativeWork, bool) {
5302 return nil, false
5303 }
5304
5305
5306 func (i Intangible) AsBasicCreativeWork() (BasicCreativeWork, bool) {
5307 return nil, false
5308 }
5309
5310
5311 func (i Intangible) AsIntangible() (*Intangible, bool) {
5312 return &i, true
5313 }
5314
5315
5316 func (i Intangible) AsBasicIntangible() (BasicIntangible, bool) {
5317 return &i, true
5318 }
5319
5320
5321 func (i Intangible) AsMovieTheater() (*MovieTheater, bool) {
5322 return nil, false
5323 }
5324
5325
5326 func (i Intangible) AsMediaObject() (*MediaObject, bool) {
5327 return nil, false
5328 }
5329
5330
5331 func (i Intangible) AsBasicMediaObject() (BasicMediaObject, bool) {
5332 return nil, false
5333 }
5334
5335
5336 func (i Intangible) AsCivicStructure() (*CivicStructure, bool) {
5337 return nil, false
5338 }
5339
5340
5341 func (i Intangible) AsBasicCivicStructure() (BasicCivicStructure, bool) {
5342 return nil, false
5343 }
5344
5345
5346 func (i Intangible) AsLocalBusiness() (*LocalBusiness, bool) {
5347 return nil, false
5348 }
5349
5350
5351 func (i Intangible) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
5352 return nil, false
5353 }
5354
5355
5356 func (i Intangible) AsTouristAttraction() (*TouristAttraction, bool) {
5357 return nil, false
5358 }
5359
5360
5361 func (i Intangible) AsAirport() (*Airport, bool) {
5362 return nil, false
5363 }
5364
5365
5366 func (i Intangible) AsLicense() (*License, bool) {
5367 return nil, false
5368 }
5369
5370
5371 func (i Intangible) AsStructuredValue() (*StructuredValue, bool) {
5372 return nil, false
5373 }
5374
5375
5376 func (i Intangible) AsBasicStructuredValue() (BasicStructuredValue, bool) {
5377 return nil, false
5378 }
5379
5380
5381 func (i Intangible) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
5382 return nil, false
5383 }
5384
5385
5386 func (i Intangible) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
5387 return nil, false
5388 }
5389
5390
5391 func (i Intangible) AsFoodEstablishment() (*FoodEstablishment, bool) {
5392 return nil, false
5393 }
5394
5395
5396 func (i Intangible) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
5397 return nil, false
5398 }
5399
5400
5401 func (i Intangible) AsLodgingBusiness() (*LodgingBusiness, bool) {
5402 return nil, false
5403 }
5404
5405
5406 func (i Intangible) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
5407 return nil, false
5408 }
5409
5410
5411 func (i Intangible) AsRestaurant() (*Restaurant, bool) {
5412 return nil, false
5413 }
5414
5415
5416 func (i Intangible) AsHotel() (*Hotel, bool) {
5417 return nil, false
5418 }
5419
5420
5421 func (i Intangible) AsResponseBase() (*ResponseBase, bool) {
5422 return nil, false
5423 }
5424
5425
5426 func (i Intangible) AsBasicResponseBase() (BasicResponseBase, bool) {
5427 return &i, true
5428 }
5429
5430
5431 func (i *Intangible) UnmarshalJSON(body []byte) error {
5432 var m map[string]*json.RawMessage
5433 err := json.Unmarshal(body, &m)
5434 if err != nil {
5435 return err
5436 }
5437 for k, v := range m {
5438 switch k {
5439 case "name":
5440 if v != nil {
5441 var name string
5442 err = json.Unmarshal(*v, &name)
5443 if err != nil {
5444 return err
5445 }
5446 i.Name = &name
5447 }
5448 case "url":
5449 if v != nil {
5450 var URL string
5451 err = json.Unmarshal(*v, &URL)
5452 if err != nil {
5453 return err
5454 }
5455 i.URL = &URL
5456 }
5457 case "image":
5458 if v != nil {
5459 var imageVar ImageObject
5460 err = json.Unmarshal(*v, &imageVar)
5461 if err != nil {
5462 return err
5463 }
5464 i.Image = &imageVar
5465 }
5466 case "description":
5467 if v != nil {
5468 var description string
5469 err = json.Unmarshal(*v, &description)
5470 if err != nil {
5471 return err
5472 }
5473 i.Description = &description
5474 }
5475 case "entityPresentationInfo":
5476 if v != nil {
5477 var entityPresentationInfo EntitiesEntityPresentationInfo
5478 err = json.Unmarshal(*v, &entityPresentationInfo)
5479 if err != nil {
5480 return err
5481 }
5482 i.EntityPresentationInfo = &entityPresentationInfo
5483 }
5484 case "bingId":
5485 if v != nil {
5486 var bingID string
5487 err = json.Unmarshal(*v, &bingID)
5488 if err != nil {
5489 return err
5490 }
5491 i.BingID = &bingID
5492 }
5493 case "contractualRules":
5494 if v != nil {
5495 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
5496 if err != nil {
5497 return err
5498 }
5499 i.ContractualRules = &contractualRules
5500 }
5501 case "webSearchUrl":
5502 if v != nil {
5503 var webSearchURL string
5504 err = json.Unmarshal(*v, &webSearchURL)
5505 if err != nil {
5506 return err
5507 }
5508 i.WebSearchURL = &webSearchURL
5509 }
5510 case "id":
5511 if v != nil {
5512 var ID string
5513 err = json.Unmarshal(*v, &ID)
5514 if err != nil {
5515 return err
5516 }
5517 i.ID = &ID
5518 }
5519 case "_type":
5520 if v != nil {
5521 var typeVar TypeBasicResponseBase
5522 err = json.Unmarshal(*v, &typeVar)
5523 if err != nil {
5524 return err
5525 }
5526 i.Type = typeVar
5527 }
5528 }
5529 }
5530
5531 return nil
5532 }
5533
5534
5535 type License struct {
5536
5537 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
5538
5539 Provider *[]BasicThing `json:"provider,omitempty"`
5540
5541 Text *string `json:"text,omitempty"`
5542
5543 Name *string `json:"name,omitempty"`
5544
5545 URL *string `json:"url,omitempty"`
5546
5547 Image *ImageObject `json:"image,omitempty"`
5548
5549 Description *string `json:"description,omitempty"`
5550
5551 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
5552
5553 BingID *string `json:"bingId,omitempty"`
5554
5555 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
5556
5557 WebSearchURL *string `json:"webSearchUrl,omitempty"`
5558
5559 ID *string `json:"id,omitempty"`
5560
5561 Type TypeBasicResponseBase `json:"_type,omitempty"`
5562 }
5563
5564
5565 func (l License) MarshalJSON() ([]byte, error) {
5566 l.Type = TypeLicense
5567 objectMap := make(map[string]interface{})
5568 if l.Type != "" {
5569 objectMap["_type"] = l.Type
5570 }
5571 return json.Marshal(objectMap)
5572 }
5573
5574
5575 func (l License) AsImageObject() (*ImageObject, bool) {
5576 return nil, false
5577 }
5578
5579
5580 func (l License) AsThing() (*Thing, bool) {
5581 return nil, false
5582 }
5583
5584
5585 func (l License) AsBasicThing() (BasicThing, bool) {
5586 return &l, true
5587 }
5588
5589
5590 func (l License) AsEntities() (*Entities, bool) {
5591 return nil, false
5592 }
5593
5594
5595 func (l License) AsPlaces() (*Places, bool) {
5596 return nil, false
5597 }
5598
5599
5600 func (l License) AsSearchResponse() (*SearchResponse, bool) {
5601 return nil, false
5602 }
5603
5604
5605 func (l License) AsResponse() (*Response, bool) {
5606 return nil, false
5607 }
5608
5609
5610 func (l License) AsBasicResponse() (BasicResponse, bool) {
5611 return &l, true
5612 }
5613
5614
5615 func (l License) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
5616 return nil, false
5617 }
5618
5619
5620 func (l License) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
5621 return nil, false
5622 }
5623
5624
5625 func (l License) AsIdentifiable() (*Identifiable, bool) {
5626 return nil, false
5627 }
5628
5629
5630 func (l License) AsBasicIdentifiable() (BasicIdentifiable, bool) {
5631 return &l, true
5632 }
5633
5634
5635 func (l License) AsAnswer() (*Answer, bool) {
5636 return nil, false
5637 }
5638
5639
5640 func (l License) AsBasicAnswer() (BasicAnswer, bool) {
5641 return nil, false
5642 }
5643
5644
5645 func (l License) AsErrorResponse() (*ErrorResponse, bool) {
5646 return nil, false
5647 }
5648
5649
5650 func (l License) AsPostalAddress() (*PostalAddress, bool) {
5651 return nil, false
5652 }
5653
5654
5655 func (l License) AsPlace() (*Place, bool) {
5656 return nil, false
5657 }
5658
5659
5660 func (l License) AsBasicPlace() (BasicPlace, bool) {
5661 return nil, false
5662 }
5663
5664
5665 func (l License) AsOrganization() (*Organization, bool) {
5666 return nil, false
5667 }
5668
5669
5670 func (l License) AsCreativeWork() (*CreativeWork, bool) {
5671 return nil, false
5672 }
5673
5674
5675 func (l License) AsBasicCreativeWork() (BasicCreativeWork, bool) {
5676 return &l, true
5677 }
5678
5679
5680 func (l License) AsIntangible() (*Intangible, bool) {
5681 return nil, false
5682 }
5683
5684
5685 func (l License) AsBasicIntangible() (BasicIntangible, bool) {
5686 return nil, false
5687 }
5688
5689
5690 func (l License) AsMovieTheater() (*MovieTheater, bool) {
5691 return nil, false
5692 }
5693
5694
5695 func (l License) AsMediaObject() (*MediaObject, bool) {
5696 return nil, false
5697 }
5698
5699
5700 func (l License) AsBasicMediaObject() (BasicMediaObject, bool) {
5701 return nil, false
5702 }
5703
5704
5705 func (l License) AsCivicStructure() (*CivicStructure, bool) {
5706 return nil, false
5707 }
5708
5709
5710 func (l License) AsBasicCivicStructure() (BasicCivicStructure, bool) {
5711 return nil, false
5712 }
5713
5714
5715 func (l License) AsLocalBusiness() (*LocalBusiness, bool) {
5716 return nil, false
5717 }
5718
5719
5720 func (l License) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
5721 return nil, false
5722 }
5723
5724
5725 func (l License) AsTouristAttraction() (*TouristAttraction, bool) {
5726 return nil, false
5727 }
5728
5729
5730 func (l License) AsAirport() (*Airport, bool) {
5731 return nil, false
5732 }
5733
5734
5735 func (l License) AsLicense() (*License, bool) {
5736 return &l, true
5737 }
5738
5739
5740 func (l License) AsStructuredValue() (*StructuredValue, bool) {
5741 return nil, false
5742 }
5743
5744
5745 func (l License) AsBasicStructuredValue() (BasicStructuredValue, bool) {
5746 return nil, false
5747 }
5748
5749
5750 func (l License) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
5751 return nil, false
5752 }
5753
5754
5755 func (l License) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
5756 return nil, false
5757 }
5758
5759
5760 func (l License) AsFoodEstablishment() (*FoodEstablishment, bool) {
5761 return nil, false
5762 }
5763
5764
5765 func (l License) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
5766 return nil, false
5767 }
5768
5769
5770 func (l License) AsLodgingBusiness() (*LodgingBusiness, bool) {
5771 return nil, false
5772 }
5773
5774
5775 func (l License) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
5776 return nil, false
5777 }
5778
5779
5780 func (l License) AsRestaurant() (*Restaurant, bool) {
5781 return nil, false
5782 }
5783
5784
5785 func (l License) AsHotel() (*Hotel, bool) {
5786 return nil, false
5787 }
5788
5789
5790 func (l License) AsResponseBase() (*ResponseBase, bool) {
5791 return nil, false
5792 }
5793
5794
5795 func (l License) AsBasicResponseBase() (BasicResponseBase, bool) {
5796 return &l, true
5797 }
5798
5799
5800 func (l *License) UnmarshalJSON(body []byte) error {
5801 var m map[string]*json.RawMessage
5802 err := json.Unmarshal(body, &m)
5803 if err != nil {
5804 return err
5805 }
5806 for k, v := range m {
5807 switch k {
5808 case "thumbnailUrl":
5809 if v != nil {
5810 var thumbnailURL string
5811 err = json.Unmarshal(*v, &thumbnailURL)
5812 if err != nil {
5813 return err
5814 }
5815 l.ThumbnailURL = &thumbnailURL
5816 }
5817 case "provider":
5818 if v != nil {
5819 provider, err := unmarshalBasicThingArray(*v)
5820 if err != nil {
5821 return err
5822 }
5823 l.Provider = &provider
5824 }
5825 case "text":
5826 if v != nil {
5827 var textVar string
5828 err = json.Unmarshal(*v, &textVar)
5829 if err != nil {
5830 return err
5831 }
5832 l.Text = &textVar
5833 }
5834 case "name":
5835 if v != nil {
5836 var name string
5837 err = json.Unmarshal(*v, &name)
5838 if err != nil {
5839 return err
5840 }
5841 l.Name = &name
5842 }
5843 case "url":
5844 if v != nil {
5845 var URL string
5846 err = json.Unmarshal(*v, &URL)
5847 if err != nil {
5848 return err
5849 }
5850 l.URL = &URL
5851 }
5852 case "image":
5853 if v != nil {
5854 var imageVar ImageObject
5855 err = json.Unmarshal(*v, &imageVar)
5856 if err != nil {
5857 return err
5858 }
5859 l.Image = &imageVar
5860 }
5861 case "description":
5862 if v != nil {
5863 var description string
5864 err = json.Unmarshal(*v, &description)
5865 if err != nil {
5866 return err
5867 }
5868 l.Description = &description
5869 }
5870 case "entityPresentationInfo":
5871 if v != nil {
5872 var entityPresentationInfo EntitiesEntityPresentationInfo
5873 err = json.Unmarshal(*v, &entityPresentationInfo)
5874 if err != nil {
5875 return err
5876 }
5877 l.EntityPresentationInfo = &entityPresentationInfo
5878 }
5879 case "bingId":
5880 if v != nil {
5881 var bingID string
5882 err = json.Unmarshal(*v, &bingID)
5883 if err != nil {
5884 return err
5885 }
5886 l.BingID = &bingID
5887 }
5888 case "contractualRules":
5889 if v != nil {
5890 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
5891 if err != nil {
5892 return err
5893 }
5894 l.ContractualRules = &contractualRules
5895 }
5896 case "webSearchUrl":
5897 if v != nil {
5898 var webSearchURL string
5899 err = json.Unmarshal(*v, &webSearchURL)
5900 if err != nil {
5901 return err
5902 }
5903 l.WebSearchURL = &webSearchURL
5904 }
5905 case "id":
5906 if v != nil {
5907 var ID string
5908 err = json.Unmarshal(*v, &ID)
5909 if err != nil {
5910 return err
5911 }
5912 l.ID = &ID
5913 }
5914 case "_type":
5915 if v != nil {
5916 var typeVar TypeBasicResponseBase
5917 err = json.Unmarshal(*v, &typeVar)
5918 if err != nil {
5919 return err
5920 }
5921 l.Type = typeVar
5922 }
5923 }
5924 }
5925
5926 return nil
5927 }
5928
5929
5930 type BasicLocalBusiness interface {
5931 AsMovieTheater() (*MovieTheater, bool)
5932 AsEntertainmentBusiness() (*EntertainmentBusiness, bool)
5933 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool)
5934 AsFoodEstablishment() (*FoodEstablishment, bool)
5935 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool)
5936 AsLodgingBusiness() (*LodgingBusiness, bool)
5937 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool)
5938 AsRestaurant() (*Restaurant, bool)
5939 AsHotel() (*Hotel, bool)
5940 AsLocalBusiness() (*LocalBusiness, bool)
5941 }
5942
5943
5944 type LocalBusiness struct {
5945
5946 PriceRange *string `json:"priceRange,omitempty"`
5947
5948 Panoramas *[]ImageObject `json:"panoramas,omitempty"`
5949
5950 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"`
5951
5952 TagLine *string `json:"tagLine,omitempty"`
5953
5954 Address *PostalAddress `json:"address,omitempty"`
5955
5956 Telephone *string `json:"telephone,omitempty"`
5957
5958 Name *string `json:"name,omitempty"`
5959
5960 URL *string `json:"url,omitempty"`
5961
5962 Image *ImageObject `json:"image,omitempty"`
5963
5964 Description *string `json:"description,omitempty"`
5965
5966 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
5967
5968 BingID *string `json:"bingId,omitempty"`
5969
5970 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
5971
5972 WebSearchURL *string `json:"webSearchUrl,omitempty"`
5973
5974 ID *string `json:"id,omitempty"`
5975
5976 Type TypeBasicResponseBase `json:"_type,omitempty"`
5977 }
5978
5979 func unmarshalBasicLocalBusiness(body []byte) (BasicLocalBusiness, error) {
5980 var m map[string]interface{}
5981 err := json.Unmarshal(body, &m)
5982 if err != nil {
5983 return nil, err
5984 }
5985
5986 switch m["_type"] {
5987 case string(TypeMovieTheater):
5988 var mt MovieTheater
5989 err := json.Unmarshal(body, &mt)
5990 return mt, err
5991 case string(TypeEntertainmentBusiness):
5992 var eb EntertainmentBusiness
5993 err := json.Unmarshal(body, &eb)
5994 return eb, err
5995 case string(TypeFoodEstablishment):
5996 var fe FoodEstablishment
5997 err := json.Unmarshal(body, &fe)
5998 return fe, err
5999 case string(TypeLodgingBusiness):
6000 var lb LodgingBusiness
6001 err := json.Unmarshal(body, &lb)
6002 return lb, err
6003 case string(TypeRestaurant):
6004 var r Restaurant
6005 err := json.Unmarshal(body, &r)
6006 return r, err
6007 case string(TypeHotel):
6008 var h Hotel
6009 err := json.Unmarshal(body, &h)
6010 return h, err
6011 default:
6012 var lb LocalBusiness
6013 err := json.Unmarshal(body, &lb)
6014 return lb, err
6015 }
6016 }
6017 func unmarshalBasicLocalBusinessArray(body []byte) ([]BasicLocalBusiness, error) {
6018 var rawMessages []*json.RawMessage
6019 err := json.Unmarshal(body, &rawMessages)
6020 if err != nil {
6021 return nil, err
6022 }
6023
6024 lbArray := make([]BasicLocalBusiness, len(rawMessages))
6025
6026 for index, rawMessage := range rawMessages {
6027 lb, err := unmarshalBasicLocalBusiness(*rawMessage)
6028 if err != nil {
6029 return nil, err
6030 }
6031 lbArray[index] = lb
6032 }
6033 return lbArray, nil
6034 }
6035
6036
6037 func (lb LocalBusiness) MarshalJSON() ([]byte, error) {
6038 lb.Type = TypeLocalBusiness
6039 objectMap := make(map[string]interface{})
6040 if lb.Type != "" {
6041 objectMap["_type"] = lb.Type
6042 }
6043 return json.Marshal(objectMap)
6044 }
6045
6046
6047 func (lb LocalBusiness) AsImageObject() (*ImageObject, bool) {
6048 return nil, false
6049 }
6050
6051
6052 func (lb LocalBusiness) AsThing() (*Thing, bool) {
6053 return nil, false
6054 }
6055
6056
6057 func (lb LocalBusiness) AsBasicThing() (BasicThing, bool) {
6058 return &lb, true
6059 }
6060
6061
6062 func (lb LocalBusiness) AsEntities() (*Entities, bool) {
6063 return nil, false
6064 }
6065
6066
6067 func (lb LocalBusiness) AsPlaces() (*Places, bool) {
6068 return nil, false
6069 }
6070
6071
6072 func (lb LocalBusiness) AsSearchResponse() (*SearchResponse, bool) {
6073 return nil, false
6074 }
6075
6076
6077 func (lb LocalBusiness) AsResponse() (*Response, bool) {
6078 return nil, false
6079 }
6080
6081
6082 func (lb LocalBusiness) AsBasicResponse() (BasicResponse, bool) {
6083 return &lb, true
6084 }
6085
6086
6087 func (lb LocalBusiness) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
6088 return nil, false
6089 }
6090
6091
6092 func (lb LocalBusiness) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
6093 return nil, false
6094 }
6095
6096
6097 func (lb LocalBusiness) AsIdentifiable() (*Identifiable, bool) {
6098 return nil, false
6099 }
6100
6101
6102 func (lb LocalBusiness) AsBasicIdentifiable() (BasicIdentifiable, bool) {
6103 return &lb, true
6104 }
6105
6106
6107 func (lb LocalBusiness) AsAnswer() (*Answer, bool) {
6108 return nil, false
6109 }
6110
6111
6112 func (lb LocalBusiness) AsBasicAnswer() (BasicAnswer, bool) {
6113 return nil, false
6114 }
6115
6116
6117 func (lb LocalBusiness) AsErrorResponse() (*ErrorResponse, bool) {
6118 return nil, false
6119 }
6120
6121
6122 func (lb LocalBusiness) AsPostalAddress() (*PostalAddress, bool) {
6123 return nil, false
6124 }
6125
6126
6127 func (lb LocalBusiness) AsPlace() (*Place, bool) {
6128 return nil, false
6129 }
6130
6131
6132 func (lb LocalBusiness) AsBasicPlace() (BasicPlace, bool) {
6133 return &lb, true
6134 }
6135
6136
6137 func (lb LocalBusiness) AsOrganization() (*Organization, bool) {
6138 return nil, false
6139 }
6140
6141
6142 func (lb LocalBusiness) AsCreativeWork() (*CreativeWork, bool) {
6143 return nil, false
6144 }
6145
6146
6147 func (lb LocalBusiness) AsBasicCreativeWork() (BasicCreativeWork, bool) {
6148 return nil, false
6149 }
6150
6151
6152 func (lb LocalBusiness) AsIntangible() (*Intangible, bool) {
6153 return nil, false
6154 }
6155
6156
6157 func (lb LocalBusiness) AsBasicIntangible() (BasicIntangible, bool) {
6158 return nil, false
6159 }
6160
6161
6162 func (lb LocalBusiness) AsMovieTheater() (*MovieTheater, bool) {
6163 return nil, false
6164 }
6165
6166
6167 func (lb LocalBusiness) AsMediaObject() (*MediaObject, bool) {
6168 return nil, false
6169 }
6170
6171
6172 func (lb LocalBusiness) AsBasicMediaObject() (BasicMediaObject, bool) {
6173 return nil, false
6174 }
6175
6176
6177 func (lb LocalBusiness) AsCivicStructure() (*CivicStructure, bool) {
6178 return nil, false
6179 }
6180
6181
6182 func (lb LocalBusiness) AsBasicCivicStructure() (BasicCivicStructure, bool) {
6183 return nil, false
6184 }
6185
6186
6187 func (lb LocalBusiness) AsLocalBusiness() (*LocalBusiness, bool) {
6188 return &lb, true
6189 }
6190
6191
6192 func (lb LocalBusiness) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
6193 return &lb, true
6194 }
6195
6196
6197 func (lb LocalBusiness) AsTouristAttraction() (*TouristAttraction, bool) {
6198 return nil, false
6199 }
6200
6201
6202 func (lb LocalBusiness) AsAirport() (*Airport, bool) {
6203 return nil, false
6204 }
6205
6206
6207 func (lb LocalBusiness) AsLicense() (*License, bool) {
6208 return nil, false
6209 }
6210
6211
6212 func (lb LocalBusiness) AsStructuredValue() (*StructuredValue, bool) {
6213 return nil, false
6214 }
6215
6216
6217 func (lb LocalBusiness) AsBasicStructuredValue() (BasicStructuredValue, bool) {
6218 return nil, false
6219 }
6220
6221
6222 func (lb LocalBusiness) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
6223 return nil, false
6224 }
6225
6226
6227 func (lb LocalBusiness) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
6228 return nil, false
6229 }
6230
6231
6232 func (lb LocalBusiness) AsFoodEstablishment() (*FoodEstablishment, bool) {
6233 return nil, false
6234 }
6235
6236
6237 func (lb LocalBusiness) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
6238 return nil, false
6239 }
6240
6241
6242 func (lb LocalBusiness) AsLodgingBusiness() (*LodgingBusiness, bool) {
6243 return nil, false
6244 }
6245
6246
6247 func (lb LocalBusiness) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
6248 return nil, false
6249 }
6250
6251
6252 func (lb LocalBusiness) AsRestaurant() (*Restaurant, bool) {
6253 return nil, false
6254 }
6255
6256
6257 func (lb LocalBusiness) AsHotel() (*Hotel, bool) {
6258 return nil, false
6259 }
6260
6261
6262 func (lb LocalBusiness) AsResponseBase() (*ResponseBase, bool) {
6263 return nil, false
6264 }
6265
6266
6267 func (lb LocalBusiness) AsBasicResponseBase() (BasicResponseBase, bool) {
6268 return &lb, true
6269 }
6270
6271
6272 func (lb *LocalBusiness) UnmarshalJSON(body []byte) error {
6273 var m map[string]*json.RawMessage
6274 err := json.Unmarshal(body, &m)
6275 if err != nil {
6276 return err
6277 }
6278 for k, v := range m {
6279 switch k {
6280 case "priceRange":
6281 if v != nil {
6282 var priceRange string
6283 err = json.Unmarshal(*v, &priceRange)
6284 if err != nil {
6285 return err
6286 }
6287 lb.PriceRange = &priceRange
6288 }
6289 case "panoramas":
6290 if v != nil {
6291 var panoramas []ImageObject
6292 err = json.Unmarshal(*v, &panoramas)
6293 if err != nil {
6294 return err
6295 }
6296 lb.Panoramas = &panoramas
6297 }
6298 case "isPermanentlyClosed":
6299 if v != nil {
6300 var isPermanentlyClosed bool
6301 err = json.Unmarshal(*v, &isPermanentlyClosed)
6302 if err != nil {
6303 return err
6304 }
6305 lb.IsPermanentlyClosed = &isPermanentlyClosed
6306 }
6307 case "tagLine":
6308 if v != nil {
6309 var tagLine string
6310 err = json.Unmarshal(*v, &tagLine)
6311 if err != nil {
6312 return err
6313 }
6314 lb.TagLine = &tagLine
6315 }
6316 case "address":
6317 if v != nil {
6318 var address PostalAddress
6319 err = json.Unmarshal(*v, &address)
6320 if err != nil {
6321 return err
6322 }
6323 lb.Address = &address
6324 }
6325 case "telephone":
6326 if v != nil {
6327 var telephone string
6328 err = json.Unmarshal(*v, &telephone)
6329 if err != nil {
6330 return err
6331 }
6332 lb.Telephone = &telephone
6333 }
6334 case "name":
6335 if v != nil {
6336 var name string
6337 err = json.Unmarshal(*v, &name)
6338 if err != nil {
6339 return err
6340 }
6341 lb.Name = &name
6342 }
6343 case "url":
6344 if v != nil {
6345 var URL string
6346 err = json.Unmarshal(*v, &URL)
6347 if err != nil {
6348 return err
6349 }
6350 lb.URL = &URL
6351 }
6352 case "image":
6353 if v != nil {
6354 var imageVar ImageObject
6355 err = json.Unmarshal(*v, &imageVar)
6356 if err != nil {
6357 return err
6358 }
6359 lb.Image = &imageVar
6360 }
6361 case "description":
6362 if v != nil {
6363 var description string
6364 err = json.Unmarshal(*v, &description)
6365 if err != nil {
6366 return err
6367 }
6368 lb.Description = &description
6369 }
6370 case "entityPresentationInfo":
6371 if v != nil {
6372 var entityPresentationInfo EntitiesEntityPresentationInfo
6373 err = json.Unmarshal(*v, &entityPresentationInfo)
6374 if err != nil {
6375 return err
6376 }
6377 lb.EntityPresentationInfo = &entityPresentationInfo
6378 }
6379 case "bingId":
6380 if v != nil {
6381 var bingID string
6382 err = json.Unmarshal(*v, &bingID)
6383 if err != nil {
6384 return err
6385 }
6386 lb.BingID = &bingID
6387 }
6388 case "contractualRules":
6389 if v != nil {
6390 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
6391 if err != nil {
6392 return err
6393 }
6394 lb.ContractualRules = &contractualRules
6395 }
6396 case "webSearchUrl":
6397 if v != nil {
6398 var webSearchURL string
6399 err = json.Unmarshal(*v, &webSearchURL)
6400 if err != nil {
6401 return err
6402 }
6403 lb.WebSearchURL = &webSearchURL
6404 }
6405 case "id":
6406 if v != nil {
6407 var ID string
6408 err = json.Unmarshal(*v, &ID)
6409 if err != nil {
6410 return err
6411 }
6412 lb.ID = &ID
6413 }
6414 case "_type":
6415 if v != nil {
6416 var typeVar TypeBasicResponseBase
6417 err = json.Unmarshal(*v, &typeVar)
6418 if err != nil {
6419 return err
6420 }
6421 lb.Type = typeVar
6422 }
6423 }
6424 }
6425
6426 return nil
6427 }
6428
6429
6430 type BasicLodgingBusiness interface {
6431 AsHotel() (*Hotel, bool)
6432 AsLodgingBusiness() (*LodgingBusiness, bool)
6433 }
6434
6435
6436 type LodgingBusiness struct {
6437
6438 PriceRange *string `json:"priceRange,omitempty"`
6439
6440 Panoramas *[]ImageObject `json:"panoramas,omitempty"`
6441
6442 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"`
6443
6444 TagLine *string `json:"tagLine,omitempty"`
6445
6446 Address *PostalAddress `json:"address,omitempty"`
6447
6448 Telephone *string `json:"telephone,omitempty"`
6449
6450 Name *string `json:"name,omitempty"`
6451
6452 URL *string `json:"url,omitempty"`
6453
6454 Image *ImageObject `json:"image,omitempty"`
6455
6456 Description *string `json:"description,omitempty"`
6457
6458 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
6459
6460 BingID *string `json:"bingId,omitempty"`
6461
6462 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
6463
6464 WebSearchURL *string `json:"webSearchUrl,omitempty"`
6465
6466 ID *string `json:"id,omitempty"`
6467
6468 Type TypeBasicResponseBase `json:"_type,omitempty"`
6469 }
6470
6471 func unmarshalBasicLodgingBusiness(body []byte) (BasicLodgingBusiness, error) {
6472 var m map[string]interface{}
6473 err := json.Unmarshal(body, &m)
6474 if err != nil {
6475 return nil, err
6476 }
6477
6478 switch m["_type"] {
6479 case string(TypeHotel):
6480 var h Hotel
6481 err := json.Unmarshal(body, &h)
6482 return h, err
6483 default:
6484 var lb LodgingBusiness
6485 err := json.Unmarshal(body, &lb)
6486 return lb, err
6487 }
6488 }
6489 func unmarshalBasicLodgingBusinessArray(body []byte) ([]BasicLodgingBusiness, error) {
6490 var rawMessages []*json.RawMessage
6491 err := json.Unmarshal(body, &rawMessages)
6492 if err != nil {
6493 return nil, err
6494 }
6495
6496 lbArray := make([]BasicLodgingBusiness, len(rawMessages))
6497
6498 for index, rawMessage := range rawMessages {
6499 lb, err := unmarshalBasicLodgingBusiness(*rawMessage)
6500 if err != nil {
6501 return nil, err
6502 }
6503 lbArray[index] = lb
6504 }
6505 return lbArray, nil
6506 }
6507
6508
6509 func (lb LodgingBusiness) MarshalJSON() ([]byte, error) {
6510 lb.Type = TypeLodgingBusiness
6511 objectMap := make(map[string]interface{})
6512 if lb.Type != "" {
6513 objectMap["_type"] = lb.Type
6514 }
6515 return json.Marshal(objectMap)
6516 }
6517
6518
6519 func (lb LodgingBusiness) AsImageObject() (*ImageObject, bool) {
6520 return nil, false
6521 }
6522
6523
6524 func (lb LodgingBusiness) AsThing() (*Thing, bool) {
6525 return nil, false
6526 }
6527
6528
6529 func (lb LodgingBusiness) AsBasicThing() (BasicThing, bool) {
6530 return &lb, true
6531 }
6532
6533
6534 func (lb LodgingBusiness) AsEntities() (*Entities, bool) {
6535 return nil, false
6536 }
6537
6538
6539 func (lb LodgingBusiness) AsPlaces() (*Places, bool) {
6540 return nil, false
6541 }
6542
6543
6544 func (lb LodgingBusiness) AsSearchResponse() (*SearchResponse, bool) {
6545 return nil, false
6546 }
6547
6548
6549 func (lb LodgingBusiness) AsResponse() (*Response, bool) {
6550 return nil, false
6551 }
6552
6553
6554 func (lb LodgingBusiness) AsBasicResponse() (BasicResponse, bool) {
6555 return &lb, true
6556 }
6557
6558
6559 func (lb LodgingBusiness) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
6560 return nil, false
6561 }
6562
6563
6564 func (lb LodgingBusiness) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
6565 return nil, false
6566 }
6567
6568
6569 func (lb LodgingBusiness) AsIdentifiable() (*Identifiable, bool) {
6570 return nil, false
6571 }
6572
6573
6574 func (lb LodgingBusiness) AsBasicIdentifiable() (BasicIdentifiable, bool) {
6575 return &lb, true
6576 }
6577
6578
6579 func (lb LodgingBusiness) AsAnswer() (*Answer, bool) {
6580 return nil, false
6581 }
6582
6583
6584 func (lb LodgingBusiness) AsBasicAnswer() (BasicAnswer, bool) {
6585 return nil, false
6586 }
6587
6588
6589 func (lb LodgingBusiness) AsErrorResponse() (*ErrorResponse, bool) {
6590 return nil, false
6591 }
6592
6593
6594 func (lb LodgingBusiness) AsPostalAddress() (*PostalAddress, bool) {
6595 return nil, false
6596 }
6597
6598
6599 func (lb LodgingBusiness) AsPlace() (*Place, bool) {
6600 return nil, false
6601 }
6602
6603
6604 func (lb LodgingBusiness) AsBasicPlace() (BasicPlace, bool) {
6605 return &lb, true
6606 }
6607
6608
6609 func (lb LodgingBusiness) AsOrganization() (*Organization, bool) {
6610 return nil, false
6611 }
6612
6613
6614 func (lb LodgingBusiness) AsCreativeWork() (*CreativeWork, bool) {
6615 return nil, false
6616 }
6617
6618
6619 func (lb LodgingBusiness) AsBasicCreativeWork() (BasicCreativeWork, bool) {
6620 return nil, false
6621 }
6622
6623
6624 func (lb LodgingBusiness) AsIntangible() (*Intangible, bool) {
6625 return nil, false
6626 }
6627
6628
6629 func (lb LodgingBusiness) AsBasicIntangible() (BasicIntangible, bool) {
6630 return nil, false
6631 }
6632
6633
6634 func (lb LodgingBusiness) AsMovieTheater() (*MovieTheater, bool) {
6635 return nil, false
6636 }
6637
6638
6639 func (lb LodgingBusiness) AsMediaObject() (*MediaObject, bool) {
6640 return nil, false
6641 }
6642
6643
6644 func (lb LodgingBusiness) AsBasicMediaObject() (BasicMediaObject, bool) {
6645 return nil, false
6646 }
6647
6648
6649 func (lb LodgingBusiness) AsCivicStructure() (*CivicStructure, bool) {
6650 return nil, false
6651 }
6652
6653
6654 func (lb LodgingBusiness) AsBasicCivicStructure() (BasicCivicStructure, bool) {
6655 return nil, false
6656 }
6657
6658
6659 func (lb LodgingBusiness) AsLocalBusiness() (*LocalBusiness, bool) {
6660 return nil, false
6661 }
6662
6663
6664 func (lb LodgingBusiness) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
6665 return &lb, true
6666 }
6667
6668
6669 func (lb LodgingBusiness) AsTouristAttraction() (*TouristAttraction, bool) {
6670 return nil, false
6671 }
6672
6673
6674 func (lb LodgingBusiness) AsAirport() (*Airport, bool) {
6675 return nil, false
6676 }
6677
6678
6679 func (lb LodgingBusiness) AsLicense() (*License, bool) {
6680 return nil, false
6681 }
6682
6683
6684 func (lb LodgingBusiness) AsStructuredValue() (*StructuredValue, bool) {
6685 return nil, false
6686 }
6687
6688
6689 func (lb LodgingBusiness) AsBasicStructuredValue() (BasicStructuredValue, bool) {
6690 return nil, false
6691 }
6692
6693
6694 func (lb LodgingBusiness) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
6695 return nil, false
6696 }
6697
6698
6699 func (lb LodgingBusiness) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
6700 return nil, false
6701 }
6702
6703
6704 func (lb LodgingBusiness) AsFoodEstablishment() (*FoodEstablishment, bool) {
6705 return nil, false
6706 }
6707
6708
6709 func (lb LodgingBusiness) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
6710 return nil, false
6711 }
6712
6713
6714 func (lb LodgingBusiness) AsLodgingBusiness() (*LodgingBusiness, bool) {
6715 return &lb, true
6716 }
6717
6718
6719 func (lb LodgingBusiness) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
6720 return &lb, true
6721 }
6722
6723
6724 func (lb LodgingBusiness) AsRestaurant() (*Restaurant, bool) {
6725 return nil, false
6726 }
6727
6728
6729 func (lb LodgingBusiness) AsHotel() (*Hotel, bool) {
6730 return nil, false
6731 }
6732
6733
6734 func (lb LodgingBusiness) AsResponseBase() (*ResponseBase, bool) {
6735 return nil, false
6736 }
6737
6738
6739 func (lb LodgingBusiness) AsBasicResponseBase() (BasicResponseBase, bool) {
6740 return &lb, true
6741 }
6742
6743
6744 func (lb *LodgingBusiness) UnmarshalJSON(body []byte) error {
6745 var m map[string]*json.RawMessage
6746 err := json.Unmarshal(body, &m)
6747 if err != nil {
6748 return err
6749 }
6750 for k, v := range m {
6751 switch k {
6752 case "priceRange":
6753 if v != nil {
6754 var priceRange string
6755 err = json.Unmarshal(*v, &priceRange)
6756 if err != nil {
6757 return err
6758 }
6759 lb.PriceRange = &priceRange
6760 }
6761 case "panoramas":
6762 if v != nil {
6763 var panoramas []ImageObject
6764 err = json.Unmarshal(*v, &panoramas)
6765 if err != nil {
6766 return err
6767 }
6768 lb.Panoramas = &panoramas
6769 }
6770 case "isPermanentlyClosed":
6771 if v != nil {
6772 var isPermanentlyClosed bool
6773 err = json.Unmarshal(*v, &isPermanentlyClosed)
6774 if err != nil {
6775 return err
6776 }
6777 lb.IsPermanentlyClosed = &isPermanentlyClosed
6778 }
6779 case "tagLine":
6780 if v != nil {
6781 var tagLine string
6782 err = json.Unmarshal(*v, &tagLine)
6783 if err != nil {
6784 return err
6785 }
6786 lb.TagLine = &tagLine
6787 }
6788 case "address":
6789 if v != nil {
6790 var address PostalAddress
6791 err = json.Unmarshal(*v, &address)
6792 if err != nil {
6793 return err
6794 }
6795 lb.Address = &address
6796 }
6797 case "telephone":
6798 if v != nil {
6799 var telephone string
6800 err = json.Unmarshal(*v, &telephone)
6801 if err != nil {
6802 return err
6803 }
6804 lb.Telephone = &telephone
6805 }
6806 case "name":
6807 if v != nil {
6808 var name string
6809 err = json.Unmarshal(*v, &name)
6810 if err != nil {
6811 return err
6812 }
6813 lb.Name = &name
6814 }
6815 case "url":
6816 if v != nil {
6817 var URL string
6818 err = json.Unmarshal(*v, &URL)
6819 if err != nil {
6820 return err
6821 }
6822 lb.URL = &URL
6823 }
6824 case "image":
6825 if v != nil {
6826 var imageVar ImageObject
6827 err = json.Unmarshal(*v, &imageVar)
6828 if err != nil {
6829 return err
6830 }
6831 lb.Image = &imageVar
6832 }
6833 case "description":
6834 if v != nil {
6835 var description string
6836 err = json.Unmarshal(*v, &description)
6837 if err != nil {
6838 return err
6839 }
6840 lb.Description = &description
6841 }
6842 case "entityPresentationInfo":
6843 if v != nil {
6844 var entityPresentationInfo EntitiesEntityPresentationInfo
6845 err = json.Unmarshal(*v, &entityPresentationInfo)
6846 if err != nil {
6847 return err
6848 }
6849 lb.EntityPresentationInfo = &entityPresentationInfo
6850 }
6851 case "bingId":
6852 if v != nil {
6853 var bingID string
6854 err = json.Unmarshal(*v, &bingID)
6855 if err != nil {
6856 return err
6857 }
6858 lb.BingID = &bingID
6859 }
6860 case "contractualRules":
6861 if v != nil {
6862 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
6863 if err != nil {
6864 return err
6865 }
6866 lb.ContractualRules = &contractualRules
6867 }
6868 case "webSearchUrl":
6869 if v != nil {
6870 var webSearchURL string
6871 err = json.Unmarshal(*v, &webSearchURL)
6872 if err != nil {
6873 return err
6874 }
6875 lb.WebSearchURL = &webSearchURL
6876 }
6877 case "id":
6878 if v != nil {
6879 var ID string
6880 err = json.Unmarshal(*v, &ID)
6881 if err != nil {
6882 return err
6883 }
6884 lb.ID = &ID
6885 }
6886 case "_type":
6887 if v != nil {
6888 var typeVar TypeBasicResponseBase
6889 err = json.Unmarshal(*v, &typeVar)
6890 if err != nil {
6891 return err
6892 }
6893 lb.Type = typeVar
6894 }
6895 }
6896 }
6897
6898 return nil
6899 }
6900
6901
6902 type BasicMediaObject interface {
6903 AsImageObject() (*ImageObject, bool)
6904 AsMediaObject() (*MediaObject, bool)
6905 }
6906
6907
6908 type MediaObject struct {
6909
6910 ContentURL *string `json:"contentUrl,omitempty"`
6911
6912 HostPageURL *string `json:"hostPageUrl,omitempty"`
6913
6914 Width *int32 `json:"width,omitempty"`
6915
6916 Height *int32 `json:"height,omitempty"`
6917
6918 ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
6919
6920 Provider *[]BasicThing `json:"provider,omitempty"`
6921
6922 Text *string `json:"text,omitempty"`
6923
6924 Name *string `json:"name,omitempty"`
6925
6926 URL *string `json:"url,omitempty"`
6927
6928 Image *ImageObject `json:"image,omitempty"`
6929
6930 Description *string `json:"description,omitempty"`
6931
6932 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
6933
6934 BingID *string `json:"bingId,omitempty"`
6935
6936 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
6937
6938 WebSearchURL *string `json:"webSearchUrl,omitempty"`
6939
6940 ID *string `json:"id,omitempty"`
6941
6942 Type TypeBasicResponseBase `json:"_type,omitempty"`
6943 }
6944
6945 func unmarshalBasicMediaObject(body []byte) (BasicMediaObject, error) {
6946 var m map[string]interface{}
6947 err := json.Unmarshal(body, &m)
6948 if err != nil {
6949 return nil, err
6950 }
6951
6952 switch m["_type"] {
6953 case string(TypeImageObject):
6954 var ioVar ImageObject
6955 err := json.Unmarshal(body, &ioVar)
6956 return ioVar, err
6957 default:
6958 var mo MediaObject
6959 err := json.Unmarshal(body, &mo)
6960 return mo, err
6961 }
6962 }
6963 func unmarshalBasicMediaObjectArray(body []byte) ([]BasicMediaObject, error) {
6964 var rawMessages []*json.RawMessage
6965 err := json.Unmarshal(body, &rawMessages)
6966 if err != nil {
6967 return nil, err
6968 }
6969
6970 moArray := make([]BasicMediaObject, len(rawMessages))
6971
6972 for index, rawMessage := range rawMessages {
6973 mo, err := unmarshalBasicMediaObject(*rawMessage)
6974 if err != nil {
6975 return nil, err
6976 }
6977 moArray[index] = mo
6978 }
6979 return moArray, nil
6980 }
6981
6982
6983 func (mo MediaObject) MarshalJSON() ([]byte, error) {
6984 mo.Type = TypeMediaObject
6985 objectMap := make(map[string]interface{})
6986 if mo.Type != "" {
6987 objectMap["_type"] = mo.Type
6988 }
6989 return json.Marshal(objectMap)
6990 }
6991
6992
6993 func (mo MediaObject) AsImageObject() (*ImageObject, bool) {
6994 return nil, false
6995 }
6996
6997
6998 func (mo MediaObject) AsThing() (*Thing, bool) {
6999 return nil, false
7000 }
7001
7002
7003 func (mo MediaObject) AsBasicThing() (BasicThing, bool) {
7004 return &mo, true
7005 }
7006
7007
7008 func (mo MediaObject) AsEntities() (*Entities, bool) {
7009 return nil, false
7010 }
7011
7012
7013 func (mo MediaObject) AsPlaces() (*Places, bool) {
7014 return nil, false
7015 }
7016
7017
7018 func (mo MediaObject) AsSearchResponse() (*SearchResponse, bool) {
7019 return nil, false
7020 }
7021
7022
7023 func (mo MediaObject) AsResponse() (*Response, bool) {
7024 return nil, false
7025 }
7026
7027
7028 func (mo MediaObject) AsBasicResponse() (BasicResponse, bool) {
7029 return &mo, true
7030 }
7031
7032
7033 func (mo MediaObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
7034 return nil, false
7035 }
7036
7037
7038 func (mo MediaObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
7039 return nil, false
7040 }
7041
7042
7043 func (mo MediaObject) AsIdentifiable() (*Identifiable, bool) {
7044 return nil, false
7045 }
7046
7047
7048 func (mo MediaObject) AsBasicIdentifiable() (BasicIdentifiable, bool) {
7049 return &mo, true
7050 }
7051
7052
7053 func (mo MediaObject) AsAnswer() (*Answer, bool) {
7054 return nil, false
7055 }
7056
7057
7058 func (mo MediaObject) AsBasicAnswer() (BasicAnswer, bool) {
7059 return nil, false
7060 }
7061
7062
7063 func (mo MediaObject) AsErrorResponse() (*ErrorResponse, bool) {
7064 return nil, false
7065 }
7066
7067
7068 func (mo MediaObject) AsPostalAddress() (*PostalAddress, bool) {
7069 return nil, false
7070 }
7071
7072
7073 func (mo MediaObject) AsPlace() (*Place, bool) {
7074 return nil, false
7075 }
7076
7077
7078 func (mo MediaObject) AsBasicPlace() (BasicPlace, bool) {
7079 return nil, false
7080 }
7081
7082
7083 func (mo MediaObject) AsOrganization() (*Organization, bool) {
7084 return nil, false
7085 }
7086
7087
7088 func (mo MediaObject) AsCreativeWork() (*CreativeWork, bool) {
7089 return nil, false
7090 }
7091
7092
7093 func (mo MediaObject) AsBasicCreativeWork() (BasicCreativeWork, bool) {
7094 return &mo, true
7095 }
7096
7097
7098 func (mo MediaObject) AsIntangible() (*Intangible, bool) {
7099 return nil, false
7100 }
7101
7102
7103 func (mo MediaObject) AsBasicIntangible() (BasicIntangible, bool) {
7104 return nil, false
7105 }
7106
7107
7108 func (mo MediaObject) AsMovieTheater() (*MovieTheater, bool) {
7109 return nil, false
7110 }
7111
7112
7113 func (mo MediaObject) AsMediaObject() (*MediaObject, bool) {
7114 return &mo, true
7115 }
7116
7117
7118 func (mo MediaObject) AsBasicMediaObject() (BasicMediaObject, bool) {
7119 return &mo, true
7120 }
7121
7122
7123 func (mo MediaObject) AsCivicStructure() (*CivicStructure, bool) {
7124 return nil, false
7125 }
7126
7127
7128 func (mo MediaObject) AsBasicCivicStructure() (BasicCivicStructure, bool) {
7129 return nil, false
7130 }
7131
7132
7133 func (mo MediaObject) AsLocalBusiness() (*LocalBusiness, bool) {
7134 return nil, false
7135 }
7136
7137
7138 func (mo MediaObject) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
7139 return nil, false
7140 }
7141
7142
7143 func (mo MediaObject) AsTouristAttraction() (*TouristAttraction, bool) {
7144 return nil, false
7145 }
7146
7147
7148 func (mo MediaObject) AsAirport() (*Airport, bool) {
7149 return nil, false
7150 }
7151
7152
7153 func (mo MediaObject) AsLicense() (*License, bool) {
7154 return nil, false
7155 }
7156
7157
7158 func (mo MediaObject) AsStructuredValue() (*StructuredValue, bool) {
7159 return nil, false
7160 }
7161
7162
7163 func (mo MediaObject) AsBasicStructuredValue() (BasicStructuredValue, bool) {
7164 return nil, false
7165 }
7166
7167
7168 func (mo MediaObject) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
7169 return nil, false
7170 }
7171
7172
7173 func (mo MediaObject) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
7174 return nil, false
7175 }
7176
7177
7178 func (mo MediaObject) AsFoodEstablishment() (*FoodEstablishment, bool) {
7179 return nil, false
7180 }
7181
7182
7183 func (mo MediaObject) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
7184 return nil, false
7185 }
7186
7187
7188 func (mo MediaObject) AsLodgingBusiness() (*LodgingBusiness, bool) {
7189 return nil, false
7190 }
7191
7192
7193 func (mo MediaObject) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
7194 return nil, false
7195 }
7196
7197
7198 func (mo MediaObject) AsRestaurant() (*Restaurant, bool) {
7199 return nil, false
7200 }
7201
7202
7203 func (mo MediaObject) AsHotel() (*Hotel, bool) {
7204 return nil, false
7205 }
7206
7207
7208 func (mo MediaObject) AsResponseBase() (*ResponseBase, bool) {
7209 return nil, false
7210 }
7211
7212
7213 func (mo MediaObject) AsBasicResponseBase() (BasicResponseBase, bool) {
7214 return &mo, true
7215 }
7216
7217
7218 func (mo *MediaObject) UnmarshalJSON(body []byte) error {
7219 var m map[string]*json.RawMessage
7220 err := json.Unmarshal(body, &m)
7221 if err != nil {
7222 return err
7223 }
7224 for k, v := range m {
7225 switch k {
7226 case "contentUrl":
7227 if v != nil {
7228 var contentURL string
7229 err = json.Unmarshal(*v, &contentURL)
7230 if err != nil {
7231 return err
7232 }
7233 mo.ContentURL = &contentURL
7234 }
7235 case "hostPageUrl":
7236 if v != nil {
7237 var hostPageURL string
7238 err = json.Unmarshal(*v, &hostPageURL)
7239 if err != nil {
7240 return err
7241 }
7242 mo.HostPageURL = &hostPageURL
7243 }
7244 case "width":
7245 if v != nil {
7246 var width int32
7247 err = json.Unmarshal(*v, &width)
7248 if err != nil {
7249 return err
7250 }
7251 mo.Width = &width
7252 }
7253 case "height":
7254 if v != nil {
7255 var height int32
7256 err = json.Unmarshal(*v, &height)
7257 if err != nil {
7258 return err
7259 }
7260 mo.Height = &height
7261 }
7262 case "thumbnailUrl":
7263 if v != nil {
7264 var thumbnailURL string
7265 err = json.Unmarshal(*v, &thumbnailURL)
7266 if err != nil {
7267 return err
7268 }
7269 mo.ThumbnailURL = &thumbnailURL
7270 }
7271 case "provider":
7272 if v != nil {
7273 provider, err := unmarshalBasicThingArray(*v)
7274 if err != nil {
7275 return err
7276 }
7277 mo.Provider = &provider
7278 }
7279 case "text":
7280 if v != nil {
7281 var textVar string
7282 err = json.Unmarshal(*v, &textVar)
7283 if err != nil {
7284 return err
7285 }
7286 mo.Text = &textVar
7287 }
7288 case "name":
7289 if v != nil {
7290 var name string
7291 err = json.Unmarshal(*v, &name)
7292 if err != nil {
7293 return err
7294 }
7295 mo.Name = &name
7296 }
7297 case "url":
7298 if v != nil {
7299 var URL string
7300 err = json.Unmarshal(*v, &URL)
7301 if err != nil {
7302 return err
7303 }
7304 mo.URL = &URL
7305 }
7306 case "image":
7307 if v != nil {
7308 var imageVar ImageObject
7309 err = json.Unmarshal(*v, &imageVar)
7310 if err != nil {
7311 return err
7312 }
7313 mo.Image = &imageVar
7314 }
7315 case "description":
7316 if v != nil {
7317 var description string
7318 err = json.Unmarshal(*v, &description)
7319 if err != nil {
7320 return err
7321 }
7322 mo.Description = &description
7323 }
7324 case "entityPresentationInfo":
7325 if v != nil {
7326 var entityPresentationInfo EntitiesEntityPresentationInfo
7327 err = json.Unmarshal(*v, &entityPresentationInfo)
7328 if err != nil {
7329 return err
7330 }
7331 mo.EntityPresentationInfo = &entityPresentationInfo
7332 }
7333 case "bingId":
7334 if v != nil {
7335 var bingID string
7336 err = json.Unmarshal(*v, &bingID)
7337 if err != nil {
7338 return err
7339 }
7340 mo.BingID = &bingID
7341 }
7342 case "contractualRules":
7343 if v != nil {
7344 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
7345 if err != nil {
7346 return err
7347 }
7348 mo.ContractualRules = &contractualRules
7349 }
7350 case "webSearchUrl":
7351 if v != nil {
7352 var webSearchURL string
7353 err = json.Unmarshal(*v, &webSearchURL)
7354 if err != nil {
7355 return err
7356 }
7357 mo.WebSearchURL = &webSearchURL
7358 }
7359 case "id":
7360 if v != nil {
7361 var ID string
7362 err = json.Unmarshal(*v, &ID)
7363 if err != nil {
7364 return err
7365 }
7366 mo.ID = &ID
7367 }
7368 case "_type":
7369 if v != nil {
7370 var typeVar TypeBasicResponseBase
7371 err = json.Unmarshal(*v, &typeVar)
7372 if err != nil {
7373 return err
7374 }
7375 mo.Type = typeVar
7376 }
7377 }
7378 }
7379
7380 return nil
7381 }
7382
7383
7384 type MovieTheater struct {
7385
7386 ScreenCount *int32 `json:"screenCount,omitempty"`
7387
7388 PriceRange *string `json:"priceRange,omitempty"`
7389
7390 Panoramas *[]ImageObject `json:"panoramas,omitempty"`
7391
7392 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"`
7393
7394 TagLine *string `json:"tagLine,omitempty"`
7395
7396 Address *PostalAddress `json:"address,omitempty"`
7397
7398 Telephone *string `json:"telephone,omitempty"`
7399
7400 Name *string `json:"name,omitempty"`
7401
7402 URL *string `json:"url,omitempty"`
7403
7404 Image *ImageObject `json:"image,omitempty"`
7405
7406 Description *string `json:"description,omitempty"`
7407
7408 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
7409
7410 BingID *string `json:"bingId,omitempty"`
7411
7412 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
7413
7414 WebSearchURL *string `json:"webSearchUrl,omitempty"`
7415
7416 ID *string `json:"id,omitempty"`
7417
7418 Type TypeBasicResponseBase `json:"_type,omitempty"`
7419 }
7420
7421
7422 func (mt MovieTheater) MarshalJSON() ([]byte, error) {
7423 mt.Type = TypeMovieTheater
7424 objectMap := make(map[string]interface{})
7425 if mt.Type != "" {
7426 objectMap["_type"] = mt.Type
7427 }
7428 return json.Marshal(objectMap)
7429 }
7430
7431
7432 func (mt MovieTheater) AsImageObject() (*ImageObject, bool) {
7433 return nil, false
7434 }
7435
7436
7437 func (mt MovieTheater) AsThing() (*Thing, bool) {
7438 return nil, false
7439 }
7440
7441
7442 func (mt MovieTheater) AsBasicThing() (BasicThing, bool) {
7443 return &mt, true
7444 }
7445
7446
7447 func (mt MovieTheater) AsEntities() (*Entities, bool) {
7448 return nil, false
7449 }
7450
7451
7452 func (mt MovieTheater) AsPlaces() (*Places, bool) {
7453 return nil, false
7454 }
7455
7456
7457 func (mt MovieTheater) AsSearchResponse() (*SearchResponse, bool) {
7458 return nil, false
7459 }
7460
7461
7462 func (mt MovieTheater) AsResponse() (*Response, bool) {
7463 return nil, false
7464 }
7465
7466
7467 func (mt MovieTheater) AsBasicResponse() (BasicResponse, bool) {
7468 return &mt, true
7469 }
7470
7471
7472 func (mt MovieTheater) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
7473 return nil, false
7474 }
7475
7476
7477 func (mt MovieTheater) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
7478 return nil, false
7479 }
7480
7481
7482 func (mt MovieTheater) AsIdentifiable() (*Identifiable, bool) {
7483 return nil, false
7484 }
7485
7486
7487 func (mt MovieTheater) AsBasicIdentifiable() (BasicIdentifiable, bool) {
7488 return &mt, true
7489 }
7490
7491
7492 func (mt MovieTheater) AsAnswer() (*Answer, bool) {
7493 return nil, false
7494 }
7495
7496
7497 func (mt MovieTheater) AsBasicAnswer() (BasicAnswer, bool) {
7498 return nil, false
7499 }
7500
7501
7502 func (mt MovieTheater) AsErrorResponse() (*ErrorResponse, bool) {
7503 return nil, false
7504 }
7505
7506
7507 func (mt MovieTheater) AsPostalAddress() (*PostalAddress, bool) {
7508 return nil, false
7509 }
7510
7511
7512 func (mt MovieTheater) AsPlace() (*Place, bool) {
7513 return nil, false
7514 }
7515
7516
7517 func (mt MovieTheater) AsBasicPlace() (BasicPlace, bool) {
7518 return &mt, true
7519 }
7520
7521
7522 func (mt MovieTheater) AsOrganization() (*Organization, bool) {
7523 return nil, false
7524 }
7525
7526
7527 func (mt MovieTheater) AsCreativeWork() (*CreativeWork, bool) {
7528 return nil, false
7529 }
7530
7531
7532 func (mt MovieTheater) AsBasicCreativeWork() (BasicCreativeWork, bool) {
7533 return nil, false
7534 }
7535
7536
7537 func (mt MovieTheater) AsIntangible() (*Intangible, bool) {
7538 return nil, false
7539 }
7540
7541
7542 func (mt MovieTheater) AsBasicIntangible() (BasicIntangible, bool) {
7543 return nil, false
7544 }
7545
7546
7547 func (mt MovieTheater) AsMovieTheater() (*MovieTheater, bool) {
7548 return &mt, true
7549 }
7550
7551
7552 func (mt MovieTheater) AsMediaObject() (*MediaObject, bool) {
7553 return nil, false
7554 }
7555
7556
7557 func (mt MovieTheater) AsBasicMediaObject() (BasicMediaObject, bool) {
7558 return nil, false
7559 }
7560
7561
7562 func (mt MovieTheater) AsCivicStructure() (*CivicStructure, bool) {
7563 return nil, false
7564 }
7565
7566
7567 func (mt MovieTheater) AsBasicCivicStructure() (BasicCivicStructure, bool) {
7568 return nil, false
7569 }
7570
7571
7572 func (mt MovieTheater) AsLocalBusiness() (*LocalBusiness, bool) {
7573 return nil, false
7574 }
7575
7576
7577 func (mt MovieTheater) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
7578 return &mt, true
7579 }
7580
7581
7582 func (mt MovieTheater) AsTouristAttraction() (*TouristAttraction, bool) {
7583 return nil, false
7584 }
7585
7586
7587 func (mt MovieTheater) AsAirport() (*Airport, bool) {
7588 return nil, false
7589 }
7590
7591
7592 func (mt MovieTheater) AsLicense() (*License, bool) {
7593 return nil, false
7594 }
7595
7596
7597 func (mt MovieTheater) AsStructuredValue() (*StructuredValue, bool) {
7598 return nil, false
7599 }
7600
7601
7602 func (mt MovieTheater) AsBasicStructuredValue() (BasicStructuredValue, bool) {
7603 return nil, false
7604 }
7605
7606
7607 func (mt MovieTheater) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
7608 return nil, false
7609 }
7610
7611
7612 func (mt MovieTheater) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
7613 return &mt, true
7614 }
7615
7616
7617 func (mt MovieTheater) AsFoodEstablishment() (*FoodEstablishment, bool) {
7618 return nil, false
7619 }
7620
7621
7622 func (mt MovieTheater) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
7623 return nil, false
7624 }
7625
7626
7627 func (mt MovieTheater) AsLodgingBusiness() (*LodgingBusiness, bool) {
7628 return nil, false
7629 }
7630
7631
7632 func (mt MovieTheater) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
7633 return nil, false
7634 }
7635
7636
7637 func (mt MovieTheater) AsRestaurant() (*Restaurant, bool) {
7638 return nil, false
7639 }
7640
7641
7642 func (mt MovieTheater) AsHotel() (*Hotel, bool) {
7643 return nil, false
7644 }
7645
7646
7647 func (mt MovieTheater) AsResponseBase() (*ResponseBase, bool) {
7648 return nil, false
7649 }
7650
7651
7652 func (mt MovieTheater) AsBasicResponseBase() (BasicResponseBase, bool) {
7653 return &mt, true
7654 }
7655
7656
7657 func (mt *MovieTheater) UnmarshalJSON(body []byte) error {
7658 var m map[string]*json.RawMessage
7659 err := json.Unmarshal(body, &m)
7660 if err != nil {
7661 return err
7662 }
7663 for k, v := range m {
7664 switch k {
7665 case "screenCount":
7666 if v != nil {
7667 var screenCount int32
7668 err = json.Unmarshal(*v, &screenCount)
7669 if err != nil {
7670 return err
7671 }
7672 mt.ScreenCount = &screenCount
7673 }
7674 case "priceRange":
7675 if v != nil {
7676 var priceRange string
7677 err = json.Unmarshal(*v, &priceRange)
7678 if err != nil {
7679 return err
7680 }
7681 mt.PriceRange = &priceRange
7682 }
7683 case "panoramas":
7684 if v != nil {
7685 var panoramas []ImageObject
7686 err = json.Unmarshal(*v, &panoramas)
7687 if err != nil {
7688 return err
7689 }
7690 mt.Panoramas = &panoramas
7691 }
7692 case "isPermanentlyClosed":
7693 if v != nil {
7694 var isPermanentlyClosed bool
7695 err = json.Unmarshal(*v, &isPermanentlyClosed)
7696 if err != nil {
7697 return err
7698 }
7699 mt.IsPermanentlyClosed = &isPermanentlyClosed
7700 }
7701 case "tagLine":
7702 if v != nil {
7703 var tagLine string
7704 err = json.Unmarshal(*v, &tagLine)
7705 if err != nil {
7706 return err
7707 }
7708 mt.TagLine = &tagLine
7709 }
7710 case "address":
7711 if v != nil {
7712 var address PostalAddress
7713 err = json.Unmarshal(*v, &address)
7714 if err != nil {
7715 return err
7716 }
7717 mt.Address = &address
7718 }
7719 case "telephone":
7720 if v != nil {
7721 var telephone string
7722 err = json.Unmarshal(*v, &telephone)
7723 if err != nil {
7724 return err
7725 }
7726 mt.Telephone = &telephone
7727 }
7728 case "name":
7729 if v != nil {
7730 var name string
7731 err = json.Unmarshal(*v, &name)
7732 if err != nil {
7733 return err
7734 }
7735 mt.Name = &name
7736 }
7737 case "url":
7738 if v != nil {
7739 var URL string
7740 err = json.Unmarshal(*v, &URL)
7741 if err != nil {
7742 return err
7743 }
7744 mt.URL = &URL
7745 }
7746 case "image":
7747 if v != nil {
7748 var imageVar ImageObject
7749 err = json.Unmarshal(*v, &imageVar)
7750 if err != nil {
7751 return err
7752 }
7753 mt.Image = &imageVar
7754 }
7755 case "description":
7756 if v != nil {
7757 var description string
7758 err = json.Unmarshal(*v, &description)
7759 if err != nil {
7760 return err
7761 }
7762 mt.Description = &description
7763 }
7764 case "entityPresentationInfo":
7765 if v != nil {
7766 var entityPresentationInfo EntitiesEntityPresentationInfo
7767 err = json.Unmarshal(*v, &entityPresentationInfo)
7768 if err != nil {
7769 return err
7770 }
7771 mt.EntityPresentationInfo = &entityPresentationInfo
7772 }
7773 case "bingId":
7774 if v != nil {
7775 var bingID string
7776 err = json.Unmarshal(*v, &bingID)
7777 if err != nil {
7778 return err
7779 }
7780 mt.BingID = &bingID
7781 }
7782 case "contractualRules":
7783 if v != nil {
7784 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
7785 if err != nil {
7786 return err
7787 }
7788 mt.ContractualRules = &contractualRules
7789 }
7790 case "webSearchUrl":
7791 if v != nil {
7792 var webSearchURL string
7793 err = json.Unmarshal(*v, &webSearchURL)
7794 if err != nil {
7795 return err
7796 }
7797 mt.WebSearchURL = &webSearchURL
7798 }
7799 case "id":
7800 if v != nil {
7801 var ID string
7802 err = json.Unmarshal(*v, &ID)
7803 if err != nil {
7804 return err
7805 }
7806 mt.ID = &ID
7807 }
7808 case "_type":
7809 if v != nil {
7810 var typeVar TypeBasicResponseBase
7811 err = json.Unmarshal(*v, &typeVar)
7812 if err != nil {
7813 return err
7814 }
7815 mt.Type = typeVar
7816 }
7817 }
7818 }
7819
7820 return nil
7821 }
7822
7823
7824 type Organization struct {
7825
7826 Name *string `json:"name,omitempty"`
7827
7828 URL *string `json:"url,omitempty"`
7829
7830 Image *ImageObject `json:"image,omitempty"`
7831
7832 Description *string `json:"description,omitempty"`
7833
7834 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
7835
7836 BingID *string `json:"bingId,omitempty"`
7837
7838 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
7839
7840 WebSearchURL *string `json:"webSearchUrl,omitempty"`
7841
7842 ID *string `json:"id,omitempty"`
7843
7844 Type TypeBasicResponseBase `json:"_type,omitempty"`
7845 }
7846
7847
7848 func (o Organization) MarshalJSON() ([]byte, error) {
7849 o.Type = TypeOrganization
7850 objectMap := make(map[string]interface{})
7851 if o.Type != "" {
7852 objectMap["_type"] = o.Type
7853 }
7854 return json.Marshal(objectMap)
7855 }
7856
7857
7858 func (o Organization) AsImageObject() (*ImageObject, bool) {
7859 return nil, false
7860 }
7861
7862
7863 func (o Organization) AsThing() (*Thing, bool) {
7864 return nil, false
7865 }
7866
7867
7868 func (o Organization) AsBasicThing() (BasicThing, bool) {
7869 return &o, true
7870 }
7871
7872
7873 func (o Organization) AsEntities() (*Entities, bool) {
7874 return nil, false
7875 }
7876
7877
7878 func (o Organization) AsPlaces() (*Places, bool) {
7879 return nil, false
7880 }
7881
7882
7883 func (o Organization) AsSearchResponse() (*SearchResponse, bool) {
7884 return nil, false
7885 }
7886
7887
7888 func (o Organization) AsResponse() (*Response, bool) {
7889 return nil, false
7890 }
7891
7892
7893 func (o Organization) AsBasicResponse() (BasicResponse, bool) {
7894 return &o, true
7895 }
7896
7897
7898 func (o Organization) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
7899 return nil, false
7900 }
7901
7902
7903 func (o Organization) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
7904 return nil, false
7905 }
7906
7907
7908 func (o Organization) AsIdentifiable() (*Identifiable, bool) {
7909 return nil, false
7910 }
7911
7912
7913 func (o Organization) AsBasicIdentifiable() (BasicIdentifiable, bool) {
7914 return &o, true
7915 }
7916
7917
7918 func (o Organization) AsAnswer() (*Answer, bool) {
7919 return nil, false
7920 }
7921
7922
7923 func (o Organization) AsBasicAnswer() (BasicAnswer, bool) {
7924 return nil, false
7925 }
7926
7927
7928 func (o Organization) AsErrorResponse() (*ErrorResponse, bool) {
7929 return nil, false
7930 }
7931
7932
7933 func (o Organization) AsPostalAddress() (*PostalAddress, bool) {
7934 return nil, false
7935 }
7936
7937
7938 func (o Organization) AsPlace() (*Place, bool) {
7939 return nil, false
7940 }
7941
7942
7943 func (o Organization) AsBasicPlace() (BasicPlace, bool) {
7944 return nil, false
7945 }
7946
7947
7948 func (o Organization) AsOrganization() (*Organization, bool) {
7949 return &o, true
7950 }
7951
7952
7953 func (o Organization) AsCreativeWork() (*CreativeWork, bool) {
7954 return nil, false
7955 }
7956
7957
7958 func (o Organization) AsBasicCreativeWork() (BasicCreativeWork, bool) {
7959 return nil, false
7960 }
7961
7962
7963 func (o Organization) AsIntangible() (*Intangible, bool) {
7964 return nil, false
7965 }
7966
7967
7968 func (o Organization) AsBasicIntangible() (BasicIntangible, bool) {
7969 return nil, false
7970 }
7971
7972
7973 func (o Organization) AsMovieTheater() (*MovieTheater, bool) {
7974 return nil, false
7975 }
7976
7977
7978 func (o Organization) AsMediaObject() (*MediaObject, bool) {
7979 return nil, false
7980 }
7981
7982
7983 func (o Organization) AsBasicMediaObject() (BasicMediaObject, bool) {
7984 return nil, false
7985 }
7986
7987
7988 func (o Organization) AsCivicStructure() (*CivicStructure, bool) {
7989 return nil, false
7990 }
7991
7992
7993 func (o Organization) AsBasicCivicStructure() (BasicCivicStructure, bool) {
7994 return nil, false
7995 }
7996
7997
7998 func (o Organization) AsLocalBusiness() (*LocalBusiness, bool) {
7999 return nil, false
8000 }
8001
8002
8003 func (o Organization) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
8004 return nil, false
8005 }
8006
8007
8008 func (o Organization) AsTouristAttraction() (*TouristAttraction, bool) {
8009 return nil, false
8010 }
8011
8012
8013 func (o Organization) AsAirport() (*Airport, bool) {
8014 return nil, false
8015 }
8016
8017
8018 func (o Organization) AsLicense() (*License, bool) {
8019 return nil, false
8020 }
8021
8022
8023 func (o Organization) AsStructuredValue() (*StructuredValue, bool) {
8024 return nil, false
8025 }
8026
8027
8028 func (o Organization) AsBasicStructuredValue() (BasicStructuredValue, bool) {
8029 return nil, false
8030 }
8031
8032
8033 func (o Organization) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
8034 return nil, false
8035 }
8036
8037
8038 func (o Organization) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
8039 return nil, false
8040 }
8041
8042
8043 func (o Organization) AsFoodEstablishment() (*FoodEstablishment, bool) {
8044 return nil, false
8045 }
8046
8047
8048 func (o Organization) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
8049 return nil, false
8050 }
8051
8052
8053 func (o Organization) AsLodgingBusiness() (*LodgingBusiness, bool) {
8054 return nil, false
8055 }
8056
8057
8058 func (o Organization) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
8059 return nil, false
8060 }
8061
8062
8063 func (o Organization) AsRestaurant() (*Restaurant, bool) {
8064 return nil, false
8065 }
8066
8067
8068 func (o Organization) AsHotel() (*Hotel, bool) {
8069 return nil, false
8070 }
8071
8072
8073 func (o Organization) AsResponseBase() (*ResponseBase, bool) {
8074 return nil, false
8075 }
8076
8077
8078 func (o Organization) AsBasicResponseBase() (BasicResponseBase, bool) {
8079 return &o, true
8080 }
8081
8082
8083 func (o *Organization) UnmarshalJSON(body []byte) error {
8084 var m map[string]*json.RawMessage
8085 err := json.Unmarshal(body, &m)
8086 if err != nil {
8087 return err
8088 }
8089 for k, v := range m {
8090 switch k {
8091 case "name":
8092 if v != nil {
8093 var name string
8094 err = json.Unmarshal(*v, &name)
8095 if err != nil {
8096 return err
8097 }
8098 o.Name = &name
8099 }
8100 case "url":
8101 if v != nil {
8102 var URL string
8103 err = json.Unmarshal(*v, &URL)
8104 if err != nil {
8105 return err
8106 }
8107 o.URL = &URL
8108 }
8109 case "image":
8110 if v != nil {
8111 var imageVar ImageObject
8112 err = json.Unmarshal(*v, &imageVar)
8113 if err != nil {
8114 return err
8115 }
8116 o.Image = &imageVar
8117 }
8118 case "description":
8119 if v != nil {
8120 var description string
8121 err = json.Unmarshal(*v, &description)
8122 if err != nil {
8123 return err
8124 }
8125 o.Description = &description
8126 }
8127 case "entityPresentationInfo":
8128 if v != nil {
8129 var entityPresentationInfo EntitiesEntityPresentationInfo
8130 err = json.Unmarshal(*v, &entityPresentationInfo)
8131 if err != nil {
8132 return err
8133 }
8134 o.EntityPresentationInfo = &entityPresentationInfo
8135 }
8136 case "bingId":
8137 if v != nil {
8138 var bingID string
8139 err = json.Unmarshal(*v, &bingID)
8140 if err != nil {
8141 return err
8142 }
8143 o.BingID = &bingID
8144 }
8145 case "contractualRules":
8146 if v != nil {
8147 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
8148 if err != nil {
8149 return err
8150 }
8151 o.ContractualRules = &contractualRules
8152 }
8153 case "webSearchUrl":
8154 if v != nil {
8155 var webSearchURL string
8156 err = json.Unmarshal(*v, &webSearchURL)
8157 if err != nil {
8158 return err
8159 }
8160 o.WebSearchURL = &webSearchURL
8161 }
8162 case "id":
8163 if v != nil {
8164 var ID string
8165 err = json.Unmarshal(*v, &ID)
8166 if err != nil {
8167 return err
8168 }
8169 o.ID = &ID
8170 }
8171 case "_type":
8172 if v != nil {
8173 var typeVar TypeBasicResponseBase
8174 err = json.Unmarshal(*v, &typeVar)
8175 if err != nil {
8176 return err
8177 }
8178 o.Type = typeVar
8179 }
8180 }
8181 }
8182
8183 return nil
8184 }
8185
8186
8187 type BasicPlace interface {
8188 AsMovieTheater() (*MovieTheater, bool)
8189 AsCivicStructure() (*CivicStructure, bool)
8190 AsBasicCivicStructure() (BasicCivicStructure, bool)
8191 AsLocalBusiness() (*LocalBusiness, bool)
8192 AsBasicLocalBusiness() (BasicLocalBusiness, bool)
8193 AsTouristAttraction() (*TouristAttraction, bool)
8194 AsAirport() (*Airport, bool)
8195 AsEntertainmentBusiness() (*EntertainmentBusiness, bool)
8196 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool)
8197 AsFoodEstablishment() (*FoodEstablishment, bool)
8198 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool)
8199 AsLodgingBusiness() (*LodgingBusiness, bool)
8200 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool)
8201 AsRestaurant() (*Restaurant, bool)
8202 AsHotel() (*Hotel, bool)
8203 AsPlace() (*Place, bool)
8204 }
8205
8206
8207 type Place struct {
8208
8209 Address *PostalAddress `json:"address,omitempty"`
8210
8211 Telephone *string `json:"telephone,omitempty"`
8212
8213 Name *string `json:"name,omitempty"`
8214
8215 URL *string `json:"url,omitempty"`
8216
8217 Image *ImageObject `json:"image,omitempty"`
8218
8219 Description *string `json:"description,omitempty"`
8220
8221 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
8222
8223 BingID *string `json:"bingId,omitempty"`
8224
8225 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
8226
8227 WebSearchURL *string `json:"webSearchUrl,omitempty"`
8228
8229 ID *string `json:"id,omitempty"`
8230
8231 Type TypeBasicResponseBase `json:"_type,omitempty"`
8232 }
8233
8234 func unmarshalBasicPlace(body []byte) (BasicPlace, error) {
8235 var m map[string]interface{}
8236 err := json.Unmarshal(body, &m)
8237 if err != nil {
8238 return nil, err
8239 }
8240
8241 switch m["_type"] {
8242 case string(TypeMovieTheater):
8243 var mt MovieTheater
8244 err := json.Unmarshal(body, &mt)
8245 return mt, err
8246 case string(TypeCivicStructure):
8247 var cs CivicStructure
8248 err := json.Unmarshal(body, &cs)
8249 return cs, err
8250 case string(TypeLocalBusiness):
8251 var lb LocalBusiness
8252 err := json.Unmarshal(body, &lb)
8253 return lb, err
8254 case string(TypeTouristAttraction):
8255 var ta TouristAttraction
8256 err := json.Unmarshal(body, &ta)
8257 return ta, err
8258 case string(TypeAirport):
8259 var a Airport
8260 err := json.Unmarshal(body, &a)
8261 return a, err
8262 case string(TypeEntertainmentBusiness):
8263 var eb EntertainmentBusiness
8264 err := json.Unmarshal(body, &eb)
8265 return eb, err
8266 case string(TypeFoodEstablishment):
8267 var fe FoodEstablishment
8268 err := json.Unmarshal(body, &fe)
8269 return fe, err
8270 case string(TypeLodgingBusiness):
8271 var lb LodgingBusiness
8272 err := json.Unmarshal(body, &lb)
8273 return lb, err
8274 case string(TypeRestaurant):
8275 var r Restaurant
8276 err := json.Unmarshal(body, &r)
8277 return r, err
8278 case string(TypeHotel):
8279 var h Hotel
8280 err := json.Unmarshal(body, &h)
8281 return h, err
8282 default:
8283 var p Place
8284 err := json.Unmarshal(body, &p)
8285 return p, err
8286 }
8287 }
8288 func unmarshalBasicPlaceArray(body []byte) ([]BasicPlace, error) {
8289 var rawMessages []*json.RawMessage
8290 err := json.Unmarshal(body, &rawMessages)
8291 if err != nil {
8292 return nil, err
8293 }
8294
8295 pArray := make([]BasicPlace, len(rawMessages))
8296
8297 for index, rawMessage := range rawMessages {
8298 p, err := unmarshalBasicPlace(*rawMessage)
8299 if err != nil {
8300 return nil, err
8301 }
8302 pArray[index] = p
8303 }
8304 return pArray, nil
8305 }
8306
8307
8308 func (p Place) MarshalJSON() ([]byte, error) {
8309 p.Type = TypePlace
8310 objectMap := make(map[string]interface{})
8311 if p.Type != "" {
8312 objectMap["_type"] = p.Type
8313 }
8314 return json.Marshal(objectMap)
8315 }
8316
8317
8318 func (p Place) AsImageObject() (*ImageObject, bool) {
8319 return nil, false
8320 }
8321
8322
8323 func (p Place) AsThing() (*Thing, bool) {
8324 return nil, false
8325 }
8326
8327
8328 func (p Place) AsBasicThing() (BasicThing, bool) {
8329 return &p, true
8330 }
8331
8332
8333 func (p Place) AsEntities() (*Entities, bool) {
8334 return nil, false
8335 }
8336
8337
8338 func (p Place) AsPlaces() (*Places, bool) {
8339 return nil, false
8340 }
8341
8342
8343 func (p Place) AsSearchResponse() (*SearchResponse, bool) {
8344 return nil, false
8345 }
8346
8347
8348 func (p Place) AsResponse() (*Response, bool) {
8349 return nil, false
8350 }
8351
8352
8353 func (p Place) AsBasicResponse() (BasicResponse, bool) {
8354 return &p, true
8355 }
8356
8357
8358 func (p Place) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
8359 return nil, false
8360 }
8361
8362
8363 func (p Place) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
8364 return nil, false
8365 }
8366
8367
8368 func (p Place) AsIdentifiable() (*Identifiable, bool) {
8369 return nil, false
8370 }
8371
8372
8373 func (p Place) AsBasicIdentifiable() (BasicIdentifiable, bool) {
8374 return &p, true
8375 }
8376
8377
8378 func (p Place) AsAnswer() (*Answer, bool) {
8379 return nil, false
8380 }
8381
8382
8383 func (p Place) AsBasicAnswer() (BasicAnswer, bool) {
8384 return nil, false
8385 }
8386
8387
8388 func (p Place) AsErrorResponse() (*ErrorResponse, bool) {
8389 return nil, false
8390 }
8391
8392
8393 func (p Place) AsPostalAddress() (*PostalAddress, bool) {
8394 return nil, false
8395 }
8396
8397
8398 func (p Place) AsPlace() (*Place, bool) {
8399 return &p, true
8400 }
8401
8402
8403 func (p Place) AsBasicPlace() (BasicPlace, bool) {
8404 return &p, true
8405 }
8406
8407
8408 func (p Place) AsOrganization() (*Organization, bool) {
8409 return nil, false
8410 }
8411
8412
8413 func (p Place) AsCreativeWork() (*CreativeWork, bool) {
8414 return nil, false
8415 }
8416
8417
8418 func (p Place) AsBasicCreativeWork() (BasicCreativeWork, bool) {
8419 return nil, false
8420 }
8421
8422
8423 func (p Place) AsIntangible() (*Intangible, bool) {
8424 return nil, false
8425 }
8426
8427
8428 func (p Place) AsBasicIntangible() (BasicIntangible, bool) {
8429 return nil, false
8430 }
8431
8432
8433 func (p Place) AsMovieTheater() (*MovieTheater, bool) {
8434 return nil, false
8435 }
8436
8437
8438 func (p Place) AsMediaObject() (*MediaObject, bool) {
8439 return nil, false
8440 }
8441
8442
8443 func (p Place) AsBasicMediaObject() (BasicMediaObject, bool) {
8444 return nil, false
8445 }
8446
8447
8448 func (p Place) AsCivicStructure() (*CivicStructure, bool) {
8449 return nil, false
8450 }
8451
8452
8453 func (p Place) AsBasicCivicStructure() (BasicCivicStructure, bool) {
8454 return nil, false
8455 }
8456
8457
8458 func (p Place) AsLocalBusiness() (*LocalBusiness, bool) {
8459 return nil, false
8460 }
8461
8462
8463 func (p Place) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
8464 return nil, false
8465 }
8466
8467
8468 func (p Place) AsTouristAttraction() (*TouristAttraction, bool) {
8469 return nil, false
8470 }
8471
8472
8473 func (p Place) AsAirport() (*Airport, bool) {
8474 return nil, false
8475 }
8476
8477
8478 func (p Place) AsLicense() (*License, bool) {
8479 return nil, false
8480 }
8481
8482
8483 func (p Place) AsStructuredValue() (*StructuredValue, bool) {
8484 return nil, false
8485 }
8486
8487
8488 func (p Place) AsBasicStructuredValue() (BasicStructuredValue, bool) {
8489 return nil, false
8490 }
8491
8492
8493 func (p Place) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
8494 return nil, false
8495 }
8496
8497
8498 func (p Place) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
8499 return nil, false
8500 }
8501
8502
8503 func (p Place) AsFoodEstablishment() (*FoodEstablishment, bool) {
8504 return nil, false
8505 }
8506
8507
8508 func (p Place) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
8509 return nil, false
8510 }
8511
8512
8513 func (p Place) AsLodgingBusiness() (*LodgingBusiness, bool) {
8514 return nil, false
8515 }
8516
8517
8518 func (p Place) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
8519 return nil, false
8520 }
8521
8522
8523 func (p Place) AsRestaurant() (*Restaurant, bool) {
8524 return nil, false
8525 }
8526
8527
8528 func (p Place) AsHotel() (*Hotel, bool) {
8529 return nil, false
8530 }
8531
8532
8533 func (p Place) AsResponseBase() (*ResponseBase, bool) {
8534 return nil, false
8535 }
8536
8537
8538 func (p Place) AsBasicResponseBase() (BasicResponseBase, bool) {
8539 return &p, true
8540 }
8541
8542
8543 func (p *Place) UnmarshalJSON(body []byte) error {
8544 var m map[string]*json.RawMessage
8545 err := json.Unmarshal(body, &m)
8546 if err != nil {
8547 return err
8548 }
8549 for k, v := range m {
8550 switch k {
8551 case "address":
8552 if v != nil {
8553 var address PostalAddress
8554 err = json.Unmarshal(*v, &address)
8555 if err != nil {
8556 return err
8557 }
8558 p.Address = &address
8559 }
8560 case "telephone":
8561 if v != nil {
8562 var telephone string
8563 err = json.Unmarshal(*v, &telephone)
8564 if err != nil {
8565 return err
8566 }
8567 p.Telephone = &telephone
8568 }
8569 case "name":
8570 if v != nil {
8571 var name string
8572 err = json.Unmarshal(*v, &name)
8573 if err != nil {
8574 return err
8575 }
8576 p.Name = &name
8577 }
8578 case "url":
8579 if v != nil {
8580 var URL string
8581 err = json.Unmarshal(*v, &URL)
8582 if err != nil {
8583 return err
8584 }
8585 p.URL = &URL
8586 }
8587 case "image":
8588 if v != nil {
8589 var imageVar ImageObject
8590 err = json.Unmarshal(*v, &imageVar)
8591 if err != nil {
8592 return err
8593 }
8594 p.Image = &imageVar
8595 }
8596 case "description":
8597 if v != nil {
8598 var description string
8599 err = json.Unmarshal(*v, &description)
8600 if err != nil {
8601 return err
8602 }
8603 p.Description = &description
8604 }
8605 case "entityPresentationInfo":
8606 if v != nil {
8607 var entityPresentationInfo EntitiesEntityPresentationInfo
8608 err = json.Unmarshal(*v, &entityPresentationInfo)
8609 if err != nil {
8610 return err
8611 }
8612 p.EntityPresentationInfo = &entityPresentationInfo
8613 }
8614 case "bingId":
8615 if v != nil {
8616 var bingID string
8617 err = json.Unmarshal(*v, &bingID)
8618 if err != nil {
8619 return err
8620 }
8621 p.BingID = &bingID
8622 }
8623 case "contractualRules":
8624 if v != nil {
8625 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
8626 if err != nil {
8627 return err
8628 }
8629 p.ContractualRules = &contractualRules
8630 }
8631 case "webSearchUrl":
8632 if v != nil {
8633 var webSearchURL string
8634 err = json.Unmarshal(*v, &webSearchURL)
8635 if err != nil {
8636 return err
8637 }
8638 p.WebSearchURL = &webSearchURL
8639 }
8640 case "id":
8641 if v != nil {
8642 var ID string
8643 err = json.Unmarshal(*v, &ID)
8644 if err != nil {
8645 return err
8646 }
8647 p.ID = &ID
8648 }
8649 case "_type":
8650 if v != nil {
8651 var typeVar TypeBasicResponseBase
8652 err = json.Unmarshal(*v, &typeVar)
8653 if err != nil {
8654 return err
8655 }
8656 p.Type = typeVar
8657 }
8658 }
8659 }
8660
8661 return nil
8662 }
8663
8664
8665 type Places struct {
8666
8667 Value *[]BasicThing `json:"value,omitempty"`
8668
8669 QueryContext *QueryContext `json:"queryContext,omitempty"`
8670
8671 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
8672
8673 WebSearchURL *string `json:"webSearchUrl,omitempty"`
8674
8675 ID *string `json:"id,omitempty"`
8676
8677 Type TypeBasicResponseBase `json:"_type,omitempty"`
8678 }
8679
8680
8681 func (p Places) MarshalJSON() ([]byte, error) {
8682 p.Type = TypePlaces
8683 objectMap := make(map[string]interface{})
8684 if p.Value != nil {
8685 objectMap["value"] = p.Value
8686 }
8687 if p.Type != "" {
8688 objectMap["_type"] = p.Type
8689 }
8690 return json.Marshal(objectMap)
8691 }
8692
8693
8694 func (p Places) AsImageObject() (*ImageObject, bool) {
8695 return nil, false
8696 }
8697
8698
8699 func (p Places) AsThing() (*Thing, bool) {
8700 return nil, false
8701 }
8702
8703
8704 func (p Places) AsBasicThing() (BasicThing, bool) {
8705 return nil, false
8706 }
8707
8708
8709 func (p Places) AsEntities() (*Entities, bool) {
8710 return nil, false
8711 }
8712
8713
8714 func (p Places) AsPlaces() (*Places, bool) {
8715 return &p, true
8716 }
8717
8718
8719 func (p Places) AsSearchResponse() (*SearchResponse, bool) {
8720 return nil, false
8721 }
8722
8723
8724 func (p Places) AsResponse() (*Response, bool) {
8725 return nil, false
8726 }
8727
8728
8729 func (p Places) AsBasicResponse() (BasicResponse, bool) {
8730 return &p, true
8731 }
8732
8733
8734 func (p Places) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
8735 return nil, false
8736 }
8737
8738
8739 func (p Places) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
8740 return &p, true
8741 }
8742
8743
8744 func (p Places) AsIdentifiable() (*Identifiable, bool) {
8745 return nil, false
8746 }
8747
8748
8749 func (p Places) AsBasicIdentifiable() (BasicIdentifiable, bool) {
8750 return &p, true
8751 }
8752
8753
8754 func (p Places) AsAnswer() (*Answer, bool) {
8755 return nil, false
8756 }
8757
8758
8759 func (p Places) AsBasicAnswer() (BasicAnswer, bool) {
8760 return &p, true
8761 }
8762
8763
8764 func (p Places) AsErrorResponse() (*ErrorResponse, bool) {
8765 return nil, false
8766 }
8767
8768
8769 func (p Places) AsPostalAddress() (*PostalAddress, bool) {
8770 return nil, false
8771 }
8772
8773
8774 func (p Places) AsPlace() (*Place, bool) {
8775 return nil, false
8776 }
8777
8778
8779 func (p Places) AsBasicPlace() (BasicPlace, bool) {
8780 return nil, false
8781 }
8782
8783
8784 func (p Places) AsOrganization() (*Organization, bool) {
8785 return nil, false
8786 }
8787
8788
8789 func (p Places) AsCreativeWork() (*CreativeWork, bool) {
8790 return nil, false
8791 }
8792
8793
8794 func (p Places) AsBasicCreativeWork() (BasicCreativeWork, bool) {
8795 return nil, false
8796 }
8797
8798
8799 func (p Places) AsIntangible() (*Intangible, bool) {
8800 return nil, false
8801 }
8802
8803
8804 func (p Places) AsBasicIntangible() (BasicIntangible, bool) {
8805 return nil, false
8806 }
8807
8808
8809 func (p Places) AsMovieTheater() (*MovieTheater, bool) {
8810 return nil, false
8811 }
8812
8813
8814 func (p Places) AsMediaObject() (*MediaObject, bool) {
8815 return nil, false
8816 }
8817
8818
8819 func (p Places) AsBasicMediaObject() (BasicMediaObject, bool) {
8820 return nil, false
8821 }
8822
8823
8824 func (p Places) AsCivicStructure() (*CivicStructure, bool) {
8825 return nil, false
8826 }
8827
8828
8829 func (p Places) AsBasicCivicStructure() (BasicCivicStructure, bool) {
8830 return nil, false
8831 }
8832
8833
8834 func (p Places) AsLocalBusiness() (*LocalBusiness, bool) {
8835 return nil, false
8836 }
8837
8838
8839 func (p Places) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
8840 return nil, false
8841 }
8842
8843
8844 func (p Places) AsTouristAttraction() (*TouristAttraction, bool) {
8845 return nil, false
8846 }
8847
8848
8849 func (p Places) AsAirport() (*Airport, bool) {
8850 return nil, false
8851 }
8852
8853
8854 func (p Places) AsLicense() (*License, bool) {
8855 return nil, false
8856 }
8857
8858
8859 func (p Places) AsStructuredValue() (*StructuredValue, bool) {
8860 return nil, false
8861 }
8862
8863
8864 func (p Places) AsBasicStructuredValue() (BasicStructuredValue, bool) {
8865 return nil, false
8866 }
8867
8868
8869 func (p Places) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
8870 return nil, false
8871 }
8872
8873
8874 func (p Places) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
8875 return nil, false
8876 }
8877
8878
8879 func (p Places) AsFoodEstablishment() (*FoodEstablishment, bool) {
8880 return nil, false
8881 }
8882
8883
8884 func (p Places) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
8885 return nil, false
8886 }
8887
8888
8889 func (p Places) AsLodgingBusiness() (*LodgingBusiness, bool) {
8890 return nil, false
8891 }
8892
8893
8894 func (p Places) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
8895 return nil, false
8896 }
8897
8898
8899 func (p Places) AsRestaurant() (*Restaurant, bool) {
8900 return nil, false
8901 }
8902
8903
8904 func (p Places) AsHotel() (*Hotel, bool) {
8905 return nil, false
8906 }
8907
8908
8909 func (p Places) AsResponseBase() (*ResponseBase, bool) {
8910 return nil, false
8911 }
8912
8913
8914 func (p Places) AsBasicResponseBase() (BasicResponseBase, bool) {
8915 return &p, true
8916 }
8917
8918
8919 func (p *Places) UnmarshalJSON(body []byte) error {
8920 var m map[string]*json.RawMessage
8921 err := json.Unmarshal(body, &m)
8922 if err != nil {
8923 return err
8924 }
8925 for k, v := range m {
8926 switch k {
8927 case "value":
8928 if v != nil {
8929 value, err := unmarshalBasicThingArray(*v)
8930 if err != nil {
8931 return err
8932 }
8933 p.Value = &value
8934 }
8935 case "queryContext":
8936 if v != nil {
8937 var queryContext QueryContext
8938 err = json.Unmarshal(*v, &queryContext)
8939 if err != nil {
8940 return err
8941 }
8942 p.QueryContext = &queryContext
8943 }
8944 case "contractualRules":
8945 if v != nil {
8946 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
8947 if err != nil {
8948 return err
8949 }
8950 p.ContractualRules = &contractualRules
8951 }
8952 case "webSearchUrl":
8953 if v != nil {
8954 var webSearchURL string
8955 err = json.Unmarshal(*v, &webSearchURL)
8956 if err != nil {
8957 return err
8958 }
8959 p.WebSearchURL = &webSearchURL
8960 }
8961 case "id":
8962 if v != nil {
8963 var ID string
8964 err = json.Unmarshal(*v, &ID)
8965 if err != nil {
8966 return err
8967 }
8968 p.ID = &ID
8969 }
8970 case "_type":
8971 if v != nil {
8972 var typeVar TypeBasicResponseBase
8973 err = json.Unmarshal(*v, &typeVar)
8974 if err != nil {
8975 return err
8976 }
8977 p.Type = typeVar
8978 }
8979 }
8980 }
8981
8982 return nil
8983 }
8984
8985
8986 type PostalAddress struct {
8987
8988 StreetAddress *string `json:"streetAddress,omitempty"`
8989
8990 AddressLocality *string `json:"addressLocality,omitempty"`
8991
8992 AddressSubregion *string `json:"addressSubregion,omitempty"`
8993
8994 AddressRegion *string `json:"addressRegion,omitempty"`
8995
8996 PostalCode *string `json:"postalCode,omitempty"`
8997
8998 PostOfficeBoxNumber *string `json:"postOfficeBoxNumber,omitempty"`
8999
9000 AddressCountry *string `json:"addressCountry,omitempty"`
9001
9002 CountryIso *string `json:"countryIso,omitempty"`
9003
9004 Neighborhood *string `json:"neighborhood,omitempty"`
9005
9006 AddressRegionAbbreviation *string `json:"addressRegionAbbreviation,omitempty"`
9007
9008 Text *string `json:"text,omitempty"`
9009
9010 Name *string `json:"name,omitempty"`
9011
9012 URL *string `json:"url,omitempty"`
9013
9014 Image *ImageObject `json:"image,omitempty"`
9015
9016 Description *string `json:"description,omitempty"`
9017
9018 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
9019
9020 BingID *string `json:"bingId,omitempty"`
9021
9022 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
9023
9024 WebSearchURL *string `json:"webSearchUrl,omitempty"`
9025
9026 ID *string `json:"id,omitempty"`
9027
9028 Type TypeBasicResponseBase `json:"_type,omitempty"`
9029 }
9030
9031
9032 func (pa PostalAddress) MarshalJSON() ([]byte, error) {
9033 pa.Type = TypePostalAddress
9034 objectMap := make(map[string]interface{})
9035 if pa.Type != "" {
9036 objectMap["_type"] = pa.Type
9037 }
9038 return json.Marshal(objectMap)
9039 }
9040
9041
9042 func (pa PostalAddress) AsImageObject() (*ImageObject, bool) {
9043 return nil, false
9044 }
9045
9046
9047 func (pa PostalAddress) AsThing() (*Thing, bool) {
9048 return nil, false
9049 }
9050
9051
9052 func (pa PostalAddress) AsBasicThing() (BasicThing, bool) {
9053 return &pa, true
9054 }
9055
9056
9057 func (pa PostalAddress) AsEntities() (*Entities, bool) {
9058 return nil, false
9059 }
9060
9061
9062 func (pa PostalAddress) AsPlaces() (*Places, bool) {
9063 return nil, false
9064 }
9065
9066
9067 func (pa PostalAddress) AsSearchResponse() (*SearchResponse, bool) {
9068 return nil, false
9069 }
9070
9071
9072 func (pa PostalAddress) AsResponse() (*Response, bool) {
9073 return nil, false
9074 }
9075
9076
9077 func (pa PostalAddress) AsBasicResponse() (BasicResponse, bool) {
9078 return &pa, true
9079 }
9080
9081
9082 func (pa PostalAddress) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
9083 return nil, false
9084 }
9085
9086
9087 func (pa PostalAddress) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
9088 return nil, false
9089 }
9090
9091
9092 func (pa PostalAddress) AsIdentifiable() (*Identifiable, bool) {
9093 return nil, false
9094 }
9095
9096
9097 func (pa PostalAddress) AsBasicIdentifiable() (BasicIdentifiable, bool) {
9098 return &pa, true
9099 }
9100
9101
9102 func (pa PostalAddress) AsAnswer() (*Answer, bool) {
9103 return nil, false
9104 }
9105
9106
9107 func (pa PostalAddress) AsBasicAnswer() (BasicAnswer, bool) {
9108 return nil, false
9109 }
9110
9111
9112 func (pa PostalAddress) AsErrorResponse() (*ErrorResponse, bool) {
9113 return nil, false
9114 }
9115
9116
9117 func (pa PostalAddress) AsPostalAddress() (*PostalAddress, bool) {
9118 return &pa, true
9119 }
9120
9121
9122 func (pa PostalAddress) AsPlace() (*Place, bool) {
9123 return nil, false
9124 }
9125
9126
9127 func (pa PostalAddress) AsBasicPlace() (BasicPlace, bool) {
9128 return nil, false
9129 }
9130
9131
9132 func (pa PostalAddress) AsOrganization() (*Organization, bool) {
9133 return nil, false
9134 }
9135
9136
9137 func (pa PostalAddress) AsCreativeWork() (*CreativeWork, bool) {
9138 return nil, false
9139 }
9140
9141
9142 func (pa PostalAddress) AsBasicCreativeWork() (BasicCreativeWork, bool) {
9143 return nil, false
9144 }
9145
9146
9147 func (pa PostalAddress) AsIntangible() (*Intangible, bool) {
9148 return nil, false
9149 }
9150
9151
9152 func (pa PostalAddress) AsBasicIntangible() (BasicIntangible, bool) {
9153 return &pa, true
9154 }
9155
9156
9157 func (pa PostalAddress) AsMovieTheater() (*MovieTheater, bool) {
9158 return nil, false
9159 }
9160
9161
9162 func (pa PostalAddress) AsMediaObject() (*MediaObject, bool) {
9163 return nil, false
9164 }
9165
9166
9167 func (pa PostalAddress) AsBasicMediaObject() (BasicMediaObject, bool) {
9168 return nil, false
9169 }
9170
9171
9172 func (pa PostalAddress) AsCivicStructure() (*CivicStructure, bool) {
9173 return nil, false
9174 }
9175
9176
9177 func (pa PostalAddress) AsBasicCivicStructure() (BasicCivicStructure, bool) {
9178 return nil, false
9179 }
9180
9181
9182 func (pa PostalAddress) AsLocalBusiness() (*LocalBusiness, bool) {
9183 return nil, false
9184 }
9185
9186
9187 func (pa PostalAddress) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
9188 return nil, false
9189 }
9190
9191
9192 func (pa PostalAddress) AsTouristAttraction() (*TouristAttraction, bool) {
9193 return nil, false
9194 }
9195
9196
9197 func (pa PostalAddress) AsAirport() (*Airport, bool) {
9198 return nil, false
9199 }
9200
9201
9202 func (pa PostalAddress) AsLicense() (*License, bool) {
9203 return nil, false
9204 }
9205
9206
9207 func (pa PostalAddress) AsStructuredValue() (*StructuredValue, bool) {
9208 return nil, false
9209 }
9210
9211
9212 func (pa PostalAddress) AsBasicStructuredValue() (BasicStructuredValue, bool) {
9213 return &pa, true
9214 }
9215
9216
9217 func (pa PostalAddress) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
9218 return nil, false
9219 }
9220
9221
9222 func (pa PostalAddress) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
9223 return nil, false
9224 }
9225
9226
9227 func (pa PostalAddress) AsFoodEstablishment() (*FoodEstablishment, bool) {
9228 return nil, false
9229 }
9230
9231
9232 func (pa PostalAddress) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
9233 return nil, false
9234 }
9235
9236
9237 func (pa PostalAddress) AsLodgingBusiness() (*LodgingBusiness, bool) {
9238 return nil, false
9239 }
9240
9241
9242 func (pa PostalAddress) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
9243 return nil, false
9244 }
9245
9246
9247 func (pa PostalAddress) AsRestaurant() (*Restaurant, bool) {
9248 return nil, false
9249 }
9250
9251
9252 func (pa PostalAddress) AsHotel() (*Hotel, bool) {
9253 return nil, false
9254 }
9255
9256
9257 func (pa PostalAddress) AsResponseBase() (*ResponseBase, bool) {
9258 return nil, false
9259 }
9260
9261
9262 func (pa PostalAddress) AsBasicResponseBase() (BasicResponseBase, bool) {
9263 return &pa, true
9264 }
9265
9266
9267 func (pa *PostalAddress) UnmarshalJSON(body []byte) error {
9268 var m map[string]*json.RawMessage
9269 err := json.Unmarshal(body, &m)
9270 if err != nil {
9271 return err
9272 }
9273 for k, v := range m {
9274 switch k {
9275 case "streetAddress":
9276 if v != nil {
9277 var streetAddress string
9278 err = json.Unmarshal(*v, &streetAddress)
9279 if err != nil {
9280 return err
9281 }
9282 pa.StreetAddress = &streetAddress
9283 }
9284 case "addressLocality":
9285 if v != nil {
9286 var addressLocality string
9287 err = json.Unmarshal(*v, &addressLocality)
9288 if err != nil {
9289 return err
9290 }
9291 pa.AddressLocality = &addressLocality
9292 }
9293 case "addressSubregion":
9294 if v != nil {
9295 var addressSubregion string
9296 err = json.Unmarshal(*v, &addressSubregion)
9297 if err != nil {
9298 return err
9299 }
9300 pa.AddressSubregion = &addressSubregion
9301 }
9302 case "addressRegion":
9303 if v != nil {
9304 var addressRegion string
9305 err = json.Unmarshal(*v, &addressRegion)
9306 if err != nil {
9307 return err
9308 }
9309 pa.AddressRegion = &addressRegion
9310 }
9311 case "postalCode":
9312 if v != nil {
9313 var postalCode string
9314 err = json.Unmarshal(*v, &postalCode)
9315 if err != nil {
9316 return err
9317 }
9318 pa.PostalCode = &postalCode
9319 }
9320 case "postOfficeBoxNumber":
9321 if v != nil {
9322 var postOfficeBoxNumber string
9323 err = json.Unmarshal(*v, &postOfficeBoxNumber)
9324 if err != nil {
9325 return err
9326 }
9327 pa.PostOfficeBoxNumber = &postOfficeBoxNumber
9328 }
9329 case "addressCountry":
9330 if v != nil {
9331 var addressCountry string
9332 err = json.Unmarshal(*v, &addressCountry)
9333 if err != nil {
9334 return err
9335 }
9336 pa.AddressCountry = &addressCountry
9337 }
9338 case "countryIso":
9339 if v != nil {
9340 var countryIso string
9341 err = json.Unmarshal(*v, &countryIso)
9342 if err != nil {
9343 return err
9344 }
9345 pa.CountryIso = &countryIso
9346 }
9347 case "neighborhood":
9348 if v != nil {
9349 var neighborhood string
9350 err = json.Unmarshal(*v, &neighborhood)
9351 if err != nil {
9352 return err
9353 }
9354 pa.Neighborhood = &neighborhood
9355 }
9356 case "addressRegionAbbreviation":
9357 if v != nil {
9358 var addressRegionAbbreviation string
9359 err = json.Unmarshal(*v, &addressRegionAbbreviation)
9360 if err != nil {
9361 return err
9362 }
9363 pa.AddressRegionAbbreviation = &addressRegionAbbreviation
9364 }
9365 case "text":
9366 if v != nil {
9367 var textVar string
9368 err = json.Unmarshal(*v, &textVar)
9369 if err != nil {
9370 return err
9371 }
9372 pa.Text = &textVar
9373 }
9374 case "name":
9375 if v != nil {
9376 var name string
9377 err = json.Unmarshal(*v, &name)
9378 if err != nil {
9379 return err
9380 }
9381 pa.Name = &name
9382 }
9383 case "url":
9384 if v != nil {
9385 var URL string
9386 err = json.Unmarshal(*v, &URL)
9387 if err != nil {
9388 return err
9389 }
9390 pa.URL = &URL
9391 }
9392 case "image":
9393 if v != nil {
9394 var imageVar ImageObject
9395 err = json.Unmarshal(*v, &imageVar)
9396 if err != nil {
9397 return err
9398 }
9399 pa.Image = &imageVar
9400 }
9401 case "description":
9402 if v != nil {
9403 var description string
9404 err = json.Unmarshal(*v, &description)
9405 if err != nil {
9406 return err
9407 }
9408 pa.Description = &description
9409 }
9410 case "entityPresentationInfo":
9411 if v != nil {
9412 var entityPresentationInfo EntitiesEntityPresentationInfo
9413 err = json.Unmarshal(*v, &entityPresentationInfo)
9414 if err != nil {
9415 return err
9416 }
9417 pa.EntityPresentationInfo = &entityPresentationInfo
9418 }
9419 case "bingId":
9420 if v != nil {
9421 var bingID string
9422 err = json.Unmarshal(*v, &bingID)
9423 if err != nil {
9424 return err
9425 }
9426 pa.BingID = &bingID
9427 }
9428 case "contractualRules":
9429 if v != nil {
9430 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
9431 if err != nil {
9432 return err
9433 }
9434 pa.ContractualRules = &contractualRules
9435 }
9436 case "webSearchUrl":
9437 if v != nil {
9438 var webSearchURL string
9439 err = json.Unmarshal(*v, &webSearchURL)
9440 if err != nil {
9441 return err
9442 }
9443 pa.WebSearchURL = &webSearchURL
9444 }
9445 case "id":
9446 if v != nil {
9447 var ID string
9448 err = json.Unmarshal(*v, &ID)
9449 if err != nil {
9450 return err
9451 }
9452 pa.ID = &ID
9453 }
9454 case "_type":
9455 if v != nil {
9456 var typeVar TypeBasicResponseBase
9457 err = json.Unmarshal(*v, &typeVar)
9458 if err != nil {
9459 return err
9460 }
9461 pa.Type = typeVar
9462 }
9463 }
9464 }
9465
9466 return nil
9467 }
9468
9469
9470 type QueryContext struct {
9471
9472 OriginalQuery *string `json:"originalQuery,omitempty"`
9473
9474 AlteredQuery *string `json:"alteredQuery,omitempty"`
9475
9476 AlterationOverrideQuery *string `json:"alterationOverrideQuery,omitempty"`
9477
9478 AdultIntent *bool `json:"adultIntent,omitempty"`
9479
9480 AskUserForLocation *bool `json:"askUserForLocation,omitempty"`
9481 }
9482
9483
9484 func (qc QueryContext) MarshalJSON() ([]byte, error) {
9485 objectMap := make(map[string]interface{})
9486 if qc.OriginalQuery != nil {
9487 objectMap["originalQuery"] = qc.OriginalQuery
9488 }
9489 return json.Marshal(objectMap)
9490 }
9491
9492
9493
9494 type BasicResponse interface {
9495 AsImageObject() (*ImageObject, bool)
9496 AsThing() (*Thing, bool)
9497 AsBasicThing() (BasicThing, bool)
9498 AsEntities() (*Entities, bool)
9499 AsPlaces() (*Places, bool)
9500 AsSearchResponse() (*SearchResponse, bool)
9501 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
9502 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
9503 AsAnswer() (*Answer, bool)
9504 AsBasicAnswer() (BasicAnswer, bool)
9505 AsErrorResponse() (*ErrorResponse, bool)
9506 AsPostalAddress() (*PostalAddress, bool)
9507 AsPlace() (*Place, bool)
9508 AsBasicPlace() (BasicPlace, bool)
9509 AsOrganization() (*Organization, bool)
9510 AsCreativeWork() (*CreativeWork, bool)
9511 AsBasicCreativeWork() (BasicCreativeWork, bool)
9512 AsIntangible() (*Intangible, bool)
9513 AsBasicIntangible() (BasicIntangible, bool)
9514 AsMovieTheater() (*MovieTheater, bool)
9515 AsMediaObject() (*MediaObject, bool)
9516 AsBasicMediaObject() (BasicMediaObject, bool)
9517 AsCivicStructure() (*CivicStructure, bool)
9518 AsBasicCivicStructure() (BasicCivicStructure, bool)
9519 AsLocalBusiness() (*LocalBusiness, bool)
9520 AsBasicLocalBusiness() (BasicLocalBusiness, bool)
9521 AsTouristAttraction() (*TouristAttraction, bool)
9522 AsAirport() (*Airport, bool)
9523 AsLicense() (*License, bool)
9524 AsStructuredValue() (*StructuredValue, bool)
9525 AsBasicStructuredValue() (BasicStructuredValue, bool)
9526 AsEntertainmentBusiness() (*EntertainmentBusiness, bool)
9527 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool)
9528 AsFoodEstablishment() (*FoodEstablishment, bool)
9529 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool)
9530 AsLodgingBusiness() (*LodgingBusiness, bool)
9531 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool)
9532 AsRestaurant() (*Restaurant, bool)
9533 AsHotel() (*Hotel, bool)
9534 AsResponse() (*Response, bool)
9535 }
9536
9537
9538
9539 type Response struct {
9540
9541 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
9542
9543 WebSearchURL *string `json:"webSearchUrl,omitempty"`
9544
9545 ID *string `json:"id,omitempty"`
9546
9547 Type TypeBasicResponseBase `json:"_type,omitempty"`
9548 }
9549
9550 func unmarshalBasicResponse(body []byte) (BasicResponse, error) {
9551 var m map[string]interface{}
9552 err := json.Unmarshal(body, &m)
9553 if err != nil {
9554 return nil, err
9555 }
9556
9557 switch m["_type"] {
9558 case string(TypeImageObject):
9559 var ioVar ImageObject
9560 err := json.Unmarshal(body, &ioVar)
9561 return ioVar, err
9562 case string(TypeThing):
9563 var t Thing
9564 err := json.Unmarshal(body, &t)
9565 return t, err
9566 case string(TypeEntities):
9567 var e Entities
9568 err := json.Unmarshal(body, &e)
9569 return e, err
9570 case string(TypePlaces):
9571 var p Places
9572 err := json.Unmarshal(body, &p)
9573 return p, err
9574 case string(TypeSearchResponse):
9575 var sr SearchResponse
9576 err := json.Unmarshal(body, &sr)
9577 return sr, err
9578 case string(TypeSearchResultsAnswer):
9579 var sra SearchResultsAnswer
9580 err := json.Unmarshal(body, &sra)
9581 return sra, err
9582 case string(TypeAnswer):
9583 var a Answer
9584 err := json.Unmarshal(body, &a)
9585 return a, err
9586 case string(TypeErrorResponse):
9587 var er ErrorResponse
9588 err := json.Unmarshal(body, &er)
9589 return er, err
9590 case string(TypePostalAddress):
9591 var pa PostalAddress
9592 err := json.Unmarshal(body, &pa)
9593 return pa, err
9594 case string(TypePlace):
9595 var p Place
9596 err := json.Unmarshal(body, &p)
9597 return p, err
9598 case string(TypeOrganization):
9599 var o Organization
9600 err := json.Unmarshal(body, &o)
9601 return o, err
9602 case string(TypeCreativeWork):
9603 var cw CreativeWork
9604 err := json.Unmarshal(body, &cw)
9605 return cw, err
9606 case string(TypeIntangible):
9607 var i Intangible
9608 err := json.Unmarshal(body, &i)
9609 return i, err
9610 case string(TypeMovieTheater):
9611 var mt MovieTheater
9612 err := json.Unmarshal(body, &mt)
9613 return mt, err
9614 case string(TypeMediaObject):
9615 var mo MediaObject
9616 err := json.Unmarshal(body, &mo)
9617 return mo, err
9618 case string(TypeCivicStructure):
9619 var cs CivicStructure
9620 err := json.Unmarshal(body, &cs)
9621 return cs, err
9622 case string(TypeLocalBusiness):
9623 var lb LocalBusiness
9624 err := json.Unmarshal(body, &lb)
9625 return lb, err
9626 case string(TypeTouristAttraction):
9627 var ta TouristAttraction
9628 err := json.Unmarshal(body, &ta)
9629 return ta, err
9630 case string(TypeAirport):
9631 var a Airport
9632 err := json.Unmarshal(body, &a)
9633 return a, err
9634 case string(TypeLicense):
9635 var l License
9636 err := json.Unmarshal(body, &l)
9637 return l, err
9638 case string(TypeStructuredValue):
9639 var sv StructuredValue
9640 err := json.Unmarshal(body, &sv)
9641 return sv, err
9642 case string(TypeEntertainmentBusiness):
9643 var eb EntertainmentBusiness
9644 err := json.Unmarshal(body, &eb)
9645 return eb, err
9646 case string(TypeFoodEstablishment):
9647 var fe FoodEstablishment
9648 err := json.Unmarshal(body, &fe)
9649 return fe, err
9650 case string(TypeLodgingBusiness):
9651 var lb LodgingBusiness
9652 err := json.Unmarshal(body, &lb)
9653 return lb, err
9654 case string(TypeRestaurant):
9655 var r Restaurant
9656 err := json.Unmarshal(body, &r)
9657 return r, err
9658 case string(TypeHotel):
9659 var h Hotel
9660 err := json.Unmarshal(body, &h)
9661 return h, err
9662 default:
9663 var r Response
9664 err := json.Unmarshal(body, &r)
9665 return r, err
9666 }
9667 }
9668 func unmarshalBasicResponseArray(body []byte) ([]BasicResponse, error) {
9669 var rawMessages []*json.RawMessage
9670 err := json.Unmarshal(body, &rawMessages)
9671 if err != nil {
9672 return nil, err
9673 }
9674
9675 rArray := make([]BasicResponse, len(rawMessages))
9676
9677 for index, rawMessage := range rawMessages {
9678 r, err := unmarshalBasicResponse(*rawMessage)
9679 if err != nil {
9680 return nil, err
9681 }
9682 rArray[index] = r
9683 }
9684 return rArray, nil
9685 }
9686
9687
9688 func (r Response) MarshalJSON() ([]byte, error) {
9689 r.Type = TypeResponse
9690 objectMap := make(map[string]interface{})
9691 if r.Type != "" {
9692 objectMap["_type"] = r.Type
9693 }
9694 return json.Marshal(objectMap)
9695 }
9696
9697
9698 func (r Response) AsImageObject() (*ImageObject, bool) {
9699 return nil, false
9700 }
9701
9702
9703 func (r Response) AsThing() (*Thing, bool) {
9704 return nil, false
9705 }
9706
9707
9708 func (r Response) AsBasicThing() (BasicThing, bool) {
9709 return nil, false
9710 }
9711
9712
9713 func (r Response) AsEntities() (*Entities, bool) {
9714 return nil, false
9715 }
9716
9717
9718 func (r Response) AsPlaces() (*Places, bool) {
9719 return nil, false
9720 }
9721
9722
9723 func (r Response) AsSearchResponse() (*SearchResponse, bool) {
9724 return nil, false
9725 }
9726
9727
9728 func (r Response) AsResponse() (*Response, bool) {
9729 return &r, true
9730 }
9731
9732
9733 func (r Response) AsBasicResponse() (BasicResponse, bool) {
9734 return &r, true
9735 }
9736
9737
9738 func (r Response) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
9739 return nil, false
9740 }
9741
9742
9743 func (r Response) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
9744 return nil, false
9745 }
9746
9747
9748 func (r Response) AsIdentifiable() (*Identifiable, bool) {
9749 return nil, false
9750 }
9751
9752
9753 func (r Response) AsBasicIdentifiable() (BasicIdentifiable, bool) {
9754 return &r, true
9755 }
9756
9757
9758 func (r Response) AsAnswer() (*Answer, bool) {
9759 return nil, false
9760 }
9761
9762
9763 func (r Response) AsBasicAnswer() (BasicAnswer, bool) {
9764 return nil, false
9765 }
9766
9767
9768 func (r Response) AsErrorResponse() (*ErrorResponse, bool) {
9769 return nil, false
9770 }
9771
9772
9773 func (r Response) AsPostalAddress() (*PostalAddress, bool) {
9774 return nil, false
9775 }
9776
9777
9778 func (r Response) AsPlace() (*Place, bool) {
9779 return nil, false
9780 }
9781
9782
9783 func (r Response) AsBasicPlace() (BasicPlace, bool) {
9784 return nil, false
9785 }
9786
9787
9788 func (r Response) AsOrganization() (*Organization, bool) {
9789 return nil, false
9790 }
9791
9792
9793 func (r Response) AsCreativeWork() (*CreativeWork, bool) {
9794 return nil, false
9795 }
9796
9797
9798 func (r Response) AsBasicCreativeWork() (BasicCreativeWork, bool) {
9799 return nil, false
9800 }
9801
9802
9803 func (r Response) AsIntangible() (*Intangible, bool) {
9804 return nil, false
9805 }
9806
9807
9808 func (r Response) AsBasicIntangible() (BasicIntangible, bool) {
9809 return nil, false
9810 }
9811
9812
9813 func (r Response) AsMovieTheater() (*MovieTheater, bool) {
9814 return nil, false
9815 }
9816
9817
9818 func (r Response) AsMediaObject() (*MediaObject, bool) {
9819 return nil, false
9820 }
9821
9822
9823 func (r Response) AsBasicMediaObject() (BasicMediaObject, bool) {
9824 return nil, false
9825 }
9826
9827
9828 func (r Response) AsCivicStructure() (*CivicStructure, bool) {
9829 return nil, false
9830 }
9831
9832
9833 func (r Response) AsBasicCivicStructure() (BasicCivicStructure, bool) {
9834 return nil, false
9835 }
9836
9837
9838 func (r Response) AsLocalBusiness() (*LocalBusiness, bool) {
9839 return nil, false
9840 }
9841
9842
9843 func (r Response) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
9844 return nil, false
9845 }
9846
9847
9848 func (r Response) AsTouristAttraction() (*TouristAttraction, bool) {
9849 return nil, false
9850 }
9851
9852
9853 func (r Response) AsAirport() (*Airport, bool) {
9854 return nil, false
9855 }
9856
9857
9858 func (r Response) AsLicense() (*License, bool) {
9859 return nil, false
9860 }
9861
9862
9863 func (r Response) AsStructuredValue() (*StructuredValue, bool) {
9864 return nil, false
9865 }
9866
9867
9868 func (r Response) AsBasicStructuredValue() (BasicStructuredValue, bool) {
9869 return nil, false
9870 }
9871
9872
9873 func (r Response) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
9874 return nil, false
9875 }
9876
9877
9878 func (r Response) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
9879 return nil, false
9880 }
9881
9882
9883 func (r Response) AsFoodEstablishment() (*FoodEstablishment, bool) {
9884 return nil, false
9885 }
9886
9887
9888 func (r Response) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
9889 return nil, false
9890 }
9891
9892
9893 func (r Response) AsLodgingBusiness() (*LodgingBusiness, bool) {
9894 return nil, false
9895 }
9896
9897
9898 func (r Response) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
9899 return nil, false
9900 }
9901
9902
9903 func (r Response) AsRestaurant() (*Restaurant, bool) {
9904 return nil, false
9905 }
9906
9907
9908 func (r Response) AsHotel() (*Hotel, bool) {
9909 return nil, false
9910 }
9911
9912
9913 func (r Response) AsResponseBase() (*ResponseBase, bool) {
9914 return nil, false
9915 }
9916
9917
9918 func (r Response) AsBasicResponseBase() (BasicResponseBase, bool) {
9919 return &r, true
9920 }
9921
9922
9923 func (r *Response) UnmarshalJSON(body []byte) error {
9924 var m map[string]*json.RawMessage
9925 err := json.Unmarshal(body, &m)
9926 if err != nil {
9927 return err
9928 }
9929 for k, v := range m {
9930 switch k {
9931 case "contractualRules":
9932 if v != nil {
9933 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
9934 if err != nil {
9935 return err
9936 }
9937 r.ContractualRules = &contractualRules
9938 }
9939 case "webSearchUrl":
9940 if v != nil {
9941 var webSearchURL string
9942 err = json.Unmarshal(*v, &webSearchURL)
9943 if err != nil {
9944 return err
9945 }
9946 r.WebSearchURL = &webSearchURL
9947 }
9948 case "id":
9949 if v != nil {
9950 var ID string
9951 err = json.Unmarshal(*v, &ID)
9952 if err != nil {
9953 return err
9954 }
9955 r.ID = &ID
9956 }
9957 case "_type":
9958 if v != nil {
9959 var typeVar TypeBasicResponseBase
9960 err = json.Unmarshal(*v, &typeVar)
9961 if err != nil {
9962 return err
9963 }
9964 r.Type = typeVar
9965 }
9966 }
9967 }
9968
9969 return nil
9970 }
9971
9972
9973 type BasicResponseBase interface {
9974 AsImageObject() (*ImageObject, bool)
9975 AsThing() (*Thing, bool)
9976 AsBasicThing() (BasicThing, bool)
9977 AsEntities() (*Entities, bool)
9978 AsPlaces() (*Places, bool)
9979 AsSearchResponse() (*SearchResponse, bool)
9980 AsResponse() (*Response, bool)
9981 AsBasicResponse() (BasicResponse, bool)
9982 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
9983 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
9984 AsIdentifiable() (*Identifiable, bool)
9985 AsBasicIdentifiable() (BasicIdentifiable, bool)
9986 AsAnswer() (*Answer, bool)
9987 AsBasicAnswer() (BasicAnswer, bool)
9988 AsErrorResponse() (*ErrorResponse, bool)
9989 AsPostalAddress() (*PostalAddress, bool)
9990 AsPlace() (*Place, bool)
9991 AsBasicPlace() (BasicPlace, bool)
9992 AsOrganization() (*Organization, bool)
9993 AsCreativeWork() (*CreativeWork, bool)
9994 AsBasicCreativeWork() (BasicCreativeWork, bool)
9995 AsIntangible() (*Intangible, bool)
9996 AsBasicIntangible() (BasicIntangible, bool)
9997 AsMovieTheater() (*MovieTheater, bool)
9998 AsMediaObject() (*MediaObject, bool)
9999 AsBasicMediaObject() (BasicMediaObject, bool)
10000 AsCivicStructure() (*CivicStructure, bool)
10001 AsBasicCivicStructure() (BasicCivicStructure, bool)
10002 AsLocalBusiness() (*LocalBusiness, bool)
10003 AsBasicLocalBusiness() (BasicLocalBusiness, bool)
10004 AsTouristAttraction() (*TouristAttraction, bool)
10005 AsAirport() (*Airport, bool)
10006 AsLicense() (*License, bool)
10007 AsStructuredValue() (*StructuredValue, bool)
10008 AsBasicStructuredValue() (BasicStructuredValue, bool)
10009 AsEntertainmentBusiness() (*EntertainmentBusiness, bool)
10010 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool)
10011 AsFoodEstablishment() (*FoodEstablishment, bool)
10012 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool)
10013 AsLodgingBusiness() (*LodgingBusiness, bool)
10014 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool)
10015 AsRestaurant() (*Restaurant, bool)
10016 AsHotel() (*Hotel, bool)
10017 AsResponseBase() (*ResponseBase, bool)
10018 }
10019
10020
10021 type ResponseBase struct {
10022
10023 Type TypeBasicResponseBase `json:"_type,omitempty"`
10024 }
10025
10026 func unmarshalBasicResponseBase(body []byte) (BasicResponseBase, error) {
10027 var m map[string]interface{}
10028 err := json.Unmarshal(body, &m)
10029 if err != nil {
10030 return nil, err
10031 }
10032
10033 switch m["_type"] {
10034 case string(TypeImageObject):
10035 var ioVar ImageObject
10036 err := json.Unmarshal(body, &ioVar)
10037 return ioVar, err
10038 case string(TypeThing):
10039 var t Thing
10040 err := json.Unmarshal(body, &t)
10041 return t, err
10042 case string(TypeEntities):
10043 var e Entities
10044 err := json.Unmarshal(body, &e)
10045 return e, err
10046 case string(TypePlaces):
10047 var p Places
10048 err := json.Unmarshal(body, &p)
10049 return p, err
10050 case string(TypeSearchResponse):
10051 var sr SearchResponse
10052 err := json.Unmarshal(body, &sr)
10053 return sr, err
10054 case string(TypeResponse):
10055 var r Response
10056 err := json.Unmarshal(body, &r)
10057 return r, err
10058 case string(TypeSearchResultsAnswer):
10059 var sra SearchResultsAnswer
10060 err := json.Unmarshal(body, &sra)
10061 return sra, err
10062 case string(TypeIdentifiable):
10063 var i Identifiable
10064 err := json.Unmarshal(body, &i)
10065 return i, err
10066 case string(TypeAnswer):
10067 var a Answer
10068 err := json.Unmarshal(body, &a)
10069 return a, err
10070 case string(TypeErrorResponse):
10071 var er ErrorResponse
10072 err := json.Unmarshal(body, &er)
10073 return er, err
10074 case string(TypePostalAddress):
10075 var pa PostalAddress
10076 err := json.Unmarshal(body, &pa)
10077 return pa, err
10078 case string(TypePlace):
10079 var p Place
10080 err := json.Unmarshal(body, &p)
10081 return p, err
10082 case string(TypeOrganization):
10083 var o Organization
10084 err := json.Unmarshal(body, &o)
10085 return o, err
10086 case string(TypeCreativeWork):
10087 var cw CreativeWork
10088 err := json.Unmarshal(body, &cw)
10089 return cw, err
10090 case string(TypeIntangible):
10091 var i Intangible
10092 err := json.Unmarshal(body, &i)
10093 return i, err
10094 case string(TypeMovieTheater):
10095 var mt MovieTheater
10096 err := json.Unmarshal(body, &mt)
10097 return mt, err
10098 case string(TypeMediaObject):
10099 var mo MediaObject
10100 err := json.Unmarshal(body, &mo)
10101 return mo, err
10102 case string(TypeCivicStructure):
10103 var cs CivicStructure
10104 err := json.Unmarshal(body, &cs)
10105 return cs, err
10106 case string(TypeLocalBusiness):
10107 var lb LocalBusiness
10108 err := json.Unmarshal(body, &lb)
10109 return lb, err
10110 case string(TypeTouristAttraction):
10111 var ta TouristAttraction
10112 err := json.Unmarshal(body, &ta)
10113 return ta, err
10114 case string(TypeAirport):
10115 var a Airport
10116 err := json.Unmarshal(body, &a)
10117 return a, err
10118 case string(TypeLicense):
10119 var l License
10120 err := json.Unmarshal(body, &l)
10121 return l, err
10122 case string(TypeStructuredValue):
10123 var sv StructuredValue
10124 err := json.Unmarshal(body, &sv)
10125 return sv, err
10126 case string(TypeEntertainmentBusiness):
10127 var eb EntertainmentBusiness
10128 err := json.Unmarshal(body, &eb)
10129 return eb, err
10130 case string(TypeFoodEstablishment):
10131 var fe FoodEstablishment
10132 err := json.Unmarshal(body, &fe)
10133 return fe, err
10134 case string(TypeLodgingBusiness):
10135 var lb LodgingBusiness
10136 err := json.Unmarshal(body, &lb)
10137 return lb, err
10138 case string(TypeRestaurant):
10139 var r Restaurant
10140 err := json.Unmarshal(body, &r)
10141 return r, err
10142 case string(TypeHotel):
10143 var h Hotel
10144 err := json.Unmarshal(body, &h)
10145 return h, err
10146 default:
10147 var rb ResponseBase
10148 err := json.Unmarshal(body, &rb)
10149 return rb, err
10150 }
10151 }
10152 func unmarshalBasicResponseBaseArray(body []byte) ([]BasicResponseBase, error) {
10153 var rawMessages []*json.RawMessage
10154 err := json.Unmarshal(body, &rawMessages)
10155 if err != nil {
10156 return nil, err
10157 }
10158
10159 rbArray := make([]BasicResponseBase, len(rawMessages))
10160
10161 for index, rawMessage := range rawMessages {
10162 rb, err := unmarshalBasicResponseBase(*rawMessage)
10163 if err != nil {
10164 return nil, err
10165 }
10166 rbArray[index] = rb
10167 }
10168 return rbArray, nil
10169 }
10170
10171
10172 func (rb ResponseBase) MarshalJSON() ([]byte, error) {
10173 rb.Type = TypeResponseBase
10174 objectMap := make(map[string]interface{})
10175 if rb.Type != "" {
10176 objectMap["_type"] = rb.Type
10177 }
10178 return json.Marshal(objectMap)
10179 }
10180
10181
10182 func (rb ResponseBase) AsImageObject() (*ImageObject, bool) {
10183 return nil, false
10184 }
10185
10186
10187 func (rb ResponseBase) AsThing() (*Thing, bool) {
10188 return nil, false
10189 }
10190
10191
10192 func (rb ResponseBase) AsBasicThing() (BasicThing, bool) {
10193 return nil, false
10194 }
10195
10196
10197 func (rb ResponseBase) AsEntities() (*Entities, bool) {
10198 return nil, false
10199 }
10200
10201
10202 func (rb ResponseBase) AsPlaces() (*Places, bool) {
10203 return nil, false
10204 }
10205
10206
10207 func (rb ResponseBase) AsSearchResponse() (*SearchResponse, bool) {
10208 return nil, false
10209 }
10210
10211
10212 func (rb ResponseBase) AsResponse() (*Response, bool) {
10213 return nil, false
10214 }
10215
10216
10217 func (rb ResponseBase) AsBasicResponse() (BasicResponse, bool) {
10218 return nil, false
10219 }
10220
10221
10222 func (rb ResponseBase) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
10223 return nil, false
10224 }
10225
10226
10227 func (rb ResponseBase) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
10228 return nil, false
10229 }
10230
10231
10232 func (rb ResponseBase) AsIdentifiable() (*Identifiable, bool) {
10233 return nil, false
10234 }
10235
10236
10237 func (rb ResponseBase) AsBasicIdentifiable() (BasicIdentifiable, bool) {
10238 return nil, false
10239 }
10240
10241
10242 func (rb ResponseBase) AsAnswer() (*Answer, bool) {
10243 return nil, false
10244 }
10245
10246
10247 func (rb ResponseBase) AsBasicAnswer() (BasicAnswer, bool) {
10248 return nil, false
10249 }
10250
10251
10252 func (rb ResponseBase) AsErrorResponse() (*ErrorResponse, bool) {
10253 return nil, false
10254 }
10255
10256
10257 func (rb ResponseBase) AsPostalAddress() (*PostalAddress, bool) {
10258 return nil, false
10259 }
10260
10261
10262 func (rb ResponseBase) AsPlace() (*Place, bool) {
10263 return nil, false
10264 }
10265
10266
10267 func (rb ResponseBase) AsBasicPlace() (BasicPlace, bool) {
10268 return nil, false
10269 }
10270
10271
10272 func (rb ResponseBase) AsOrganization() (*Organization, bool) {
10273 return nil, false
10274 }
10275
10276
10277 func (rb ResponseBase) AsCreativeWork() (*CreativeWork, bool) {
10278 return nil, false
10279 }
10280
10281
10282 func (rb ResponseBase) AsBasicCreativeWork() (BasicCreativeWork, bool) {
10283 return nil, false
10284 }
10285
10286
10287 func (rb ResponseBase) AsIntangible() (*Intangible, bool) {
10288 return nil, false
10289 }
10290
10291
10292 func (rb ResponseBase) AsBasicIntangible() (BasicIntangible, bool) {
10293 return nil, false
10294 }
10295
10296
10297 func (rb ResponseBase) AsMovieTheater() (*MovieTheater, bool) {
10298 return nil, false
10299 }
10300
10301
10302 func (rb ResponseBase) AsMediaObject() (*MediaObject, bool) {
10303 return nil, false
10304 }
10305
10306
10307 func (rb ResponseBase) AsBasicMediaObject() (BasicMediaObject, bool) {
10308 return nil, false
10309 }
10310
10311
10312 func (rb ResponseBase) AsCivicStructure() (*CivicStructure, bool) {
10313 return nil, false
10314 }
10315
10316
10317 func (rb ResponseBase) AsBasicCivicStructure() (BasicCivicStructure, bool) {
10318 return nil, false
10319 }
10320
10321
10322 func (rb ResponseBase) AsLocalBusiness() (*LocalBusiness, bool) {
10323 return nil, false
10324 }
10325
10326
10327 func (rb ResponseBase) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
10328 return nil, false
10329 }
10330
10331
10332 func (rb ResponseBase) AsTouristAttraction() (*TouristAttraction, bool) {
10333 return nil, false
10334 }
10335
10336
10337 func (rb ResponseBase) AsAirport() (*Airport, bool) {
10338 return nil, false
10339 }
10340
10341
10342 func (rb ResponseBase) AsLicense() (*License, bool) {
10343 return nil, false
10344 }
10345
10346
10347 func (rb ResponseBase) AsStructuredValue() (*StructuredValue, bool) {
10348 return nil, false
10349 }
10350
10351
10352 func (rb ResponseBase) AsBasicStructuredValue() (BasicStructuredValue, bool) {
10353 return nil, false
10354 }
10355
10356
10357 func (rb ResponseBase) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
10358 return nil, false
10359 }
10360
10361
10362 func (rb ResponseBase) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
10363 return nil, false
10364 }
10365
10366
10367 func (rb ResponseBase) AsFoodEstablishment() (*FoodEstablishment, bool) {
10368 return nil, false
10369 }
10370
10371
10372 func (rb ResponseBase) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
10373 return nil, false
10374 }
10375
10376
10377 func (rb ResponseBase) AsLodgingBusiness() (*LodgingBusiness, bool) {
10378 return nil, false
10379 }
10380
10381
10382 func (rb ResponseBase) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
10383 return nil, false
10384 }
10385
10386
10387 func (rb ResponseBase) AsRestaurant() (*Restaurant, bool) {
10388 return nil, false
10389 }
10390
10391
10392 func (rb ResponseBase) AsHotel() (*Hotel, bool) {
10393 return nil, false
10394 }
10395
10396
10397 func (rb ResponseBase) AsResponseBase() (*ResponseBase, bool) {
10398 return &rb, true
10399 }
10400
10401
10402 func (rb ResponseBase) AsBasicResponseBase() (BasicResponseBase, bool) {
10403 return &rb, true
10404 }
10405
10406
10407 type Restaurant struct {
10408
10409 AcceptsReservations *bool `json:"acceptsReservations,omitempty"`
10410
10411 ReservationURL *string `json:"reservationUrl,omitempty"`
10412
10413 ServesCuisine *[]string `json:"servesCuisine,omitempty"`
10414
10415 MenuURL *string `json:"menuUrl,omitempty"`
10416
10417 PriceRange *string `json:"priceRange,omitempty"`
10418
10419 Panoramas *[]ImageObject `json:"panoramas,omitempty"`
10420
10421 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"`
10422
10423 TagLine *string `json:"tagLine,omitempty"`
10424
10425 Address *PostalAddress `json:"address,omitempty"`
10426
10427 Telephone *string `json:"telephone,omitempty"`
10428
10429 Name *string `json:"name,omitempty"`
10430
10431 URL *string `json:"url,omitempty"`
10432
10433 Image *ImageObject `json:"image,omitempty"`
10434
10435 Description *string `json:"description,omitempty"`
10436
10437 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
10438
10439 BingID *string `json:"bingId,omitempty"`
10440
10441 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
10442
10443 WebSearchURL *string `json:"webSearchUrl,omitempty"`
10444
10445 ID *string `json:"id,omitempty"`
10446
10447 Type TypeBasicResponseBase `json:"_type,omitempty"`
10448 }
10449
10450
10451 func (r Restaurant) MarshalJSON() ([]byte, error) {
10452 r.Type = TypeRestaurant
10453 objectMap := make(map[string]interface{})
10454 if r.Type != "" {
10455 objectMap["_type"] = r.Type
10456 }
10457 return json.Marshal(objectMap)
10458 }
10459
10460
10461 func (r Restaurant) AsImageObject() (*ImageObject, bool) {
10462 return nil, false
10463 }
10464
10465
10466 func (r Restaurant) AsThing() (*Thing, bool) {
10467 return nil, false
10468 }
10469
10470
10471 func (r Restaurant) AsBasicThing() (BasicThing, bool) {
10472 return &r, true
10473 }
10474
10475
10476 func (r Restaurant) AsEntities() (*Entities, bool) {
10477 return nil, false
10478 }
10479
10480
10481 func (r Restaurant) AsPlaces() (*Places, bool) {
10482 return nil, false
10483 }
10484
10485
10486 func (r Restaurant) AsSearchResponse() (*SearchResponse, bool) {
10487 return nil, false
10488 }
10489
10490
10491 func (r Restaurant) AsResponse() (*Response, bool) {
10492 return nil, false
10493 }
10494
10495
10496 func (r Restaurant) AsBasicResponse() (BasicResponse, bool) {
10497 return &r, true
10498 }
10499
10500
10501 func (r Restaurant) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
10502 return nil, false
10503 }
10504
10505
10506 func (r Restaurant) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
10507 return nil, false
10508 }
10509
10510
10511 func (r Restaurant) AsIdentifiable() (*Identifiable, bool) {
10512 return nil, false
10513 }
10514
10515
10516 func (r Restaurant) AsBasicIdentifiable() (BasicIdentifiable, bool) {
10517 return &r, true
10518 }
10519
10520
10521 func (r Restaurant) AsAnswer() (*Answer, bool) {
10522 return nil, false
10523 }
10524
10525
10526 func (r Restaurant) AsBasicAnswer() (BasicAnswer, bool) {
10527 return nil, false
10528 }
10529
10530
10531 func (r Restaurant) AsErrorResponse() (*ErrorResponse, bool) {
10532 return nil, false
10533 }
10534
10535
10536 func (r Restaurant) AsPostalAddress() (*PostalAddress, bool) {
10537 return nil, false
10538 }
10539
10540
10541 func (r Restaurant) AsPlace() (*Place, bool) {
10542 return nil, false
10543 }
10544
10545
10546 func (r Restaurant) AsBasicPlace() (BasicPlace, bool) {
10547 return &r, true
10548 }
10549
10550
10551 func (r Restaurant) AsOrganization() (*Organization, bool) {
10552 return nil, false
10553 }
10554
10555
10556 func (r Restaurant) AsCreativeWork() (*CreativeWork, bool) {
10557 return nil, false
10558 }
10559
10560
10561 func (r Restaurant) AsBasicCreativeWork() (BasicCreativeWork, bool) {
10562 return nil, false
10563 }
10564
10565
10566 func (r Restaurant) AsIntangible() (*Intangible, bool) {
10567 return nil, false
10568 }
10569
10570
10571 func (r Restaurant) AsBasicIntangible() (BasicIntangible, bool) {
10572 return nil, false
10573 }
10574
10575
10576 func (r Restaurant) AsMovieTheater() (*MovieTheater, bool) {
10577 return nil, false
10578 }
10579
10580
10581 func (r Restaurant) AsMediaObject() (*MediaObject, bool) {
10582 return nil, false
10583 }
10584
10585
10586 func (r Restaurant) AsBasicMediaObject() (BasicMediaObject, bool) {
10587 return nil, false
10588 }
10589
10590
10591 func (r Restaurant) AsCivicStructure() (*CivicStructure, bool) {
10592 return nil, false
10593 }
10594
10595
10596 func (r Restaurant) AsBasicCivicStructure() (BasicCivicStructure, bool) {
10597 return nil, false
10598 }
10599
10600
10601 func (r Restaurant) AsLocalBusiness() (*LocalBusiness, bool) {
10602 return nil, false
10603 }
10604
10605
10606 func (r Restaurant) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
10607 return &r, true
10608 }
10609
10610
10611 func (r Restaurant) AsTouristAttraction() (*TouristAttraction, bool) {
10612 return nil, false
10613 }
10614
10615
10616 func (r Restaurant) AsAirport() (*Airport, bool) {
10617 return nil, false
10618 }
10619
10620
10621 func (r Restaurant) AsLicense() (*License, bool) {
10622 return nil, false
10623 }
10624
10625
10626 func (r Restaurant) AsStructuredValue() (*StructuredValue, bool) {
10627 return nil, false
10628 }
10629
10630
10631 func (r Restaurant) AsBasicStructuredValue() (BasicStructuredValue, bool) {
10632 return nil, false
10633 }
10634
10635
10636 func (r Restaurant) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
10637 return nil, false
10638 }
10639
10640
10641 func (r Restaurant) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
10642 return nil, false
10643 }
10644
10645
10646 func (r Restaurant) AsFoodEstablishment() (*FoodEstablishment, bool) {
10647 return nil, false
10648 }
10649
10650
10651 func (r Restaurant) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
10652 return &r, true
10653 }
10654
10655
10656 func (r Restaurant) AsLodgingBusiness() (*LodgingBusiness, bool) {
10657 return nil, false
10658 }
10659
10660
10661 func (r Restaurant) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
10662 return nil, false
10663 }
10664
10665
10666 func (r Restaurant) AsRestaurant() (*Restaurant, bool) {
10667 return &r, true
10668 }
10669
10670
10671 func (r Restaurant) AsHotel() (*Hotel, bool) {
10672 return nil, false
10673 }
10674
10675
10676 func (r Restaurant) AsResponseBase() (*ResponseBase, bool) {
10677 return nil, false
10678 }
10679
10680
10681 func (r Restaurant) AsBasicResponseBase() (BasicResponseBase, bool) {
10682 return &r, true
10683 }
10684
10685
10686 func (r *Restaurant) UnmarshalJSON(body []byte) error {
10687 var m map[string]*json.RawMessage
10688 err := json.Unmarshal(body, &m)
10689 if err != nil {
10690 return err
10691 }
10692 for k, v := range m {
10693 switch k {
10694 case "acceptsReservations":
10695 if v != nil {
10696 var acceptsReservations bool
10697 err = json.Unmarshal(*v, &acceptsReservations)
10698 if err != nil {
10699 return err
10700 }
10701 r.AcceptsReservations = &acceptsReservations
10702 }
10703 case "reservationUrl":
10704 if v != nil {
10705 var reservationURL string
10706 err = json.Unmarshal(*v, &reservationURL)
10707 if err != nil {
10708 return err
10709 }
10710 r.ReservationURL = &reservationURL
10711 }
10712 case "servesCuisine":
10713 if v != nil {
10714 var servesCuisine []string
10715 err = json.Unmarshal(*v, &servesCuisine)
10716 if err != nil {
10717 return err
10718 }
10719 r.ServesCuisine = &servesCuisine
10720 }
10721 case "menuUrl":
10722 if v != nil {
10723 var menuURL string
10724 err = json.Unmarshal(*v, &menuURL)
10725 if err != nil {
10726 return err
10727 }
10728 r.MenuURL = &menuURL
10729 }
10730 case "priceRange":
10731 if v != nil {
10732 var priceRange string
10733 err = json.Unmarshal(*v, &priceRange)
10734 if err != nil {
10735 return err
10736 }
10737 r.PriceRange = &priceRange
10738 }
10739 case "panoramas":
10740 if v != nil {
10741 var panoramas []ImageObject
10742 err = json.Unmarshal(*v, &panoramas)
10743 if err != nil {
10744 return err
10745 }
10746 r.Panoramas = &panoramas
10747 }
10748 case "isPermanentlyClosed":
10749 if v != nil {
10750 var isPermanentlyClosed bool
10751 err = json.Unmarshal(*v, &isPermanentlyClosed)
10752 if err != nil {
10753 return err
10754 }
10755 r.IsPermanentlyClosed = &isPermanentlyClosed
10756 }
10757 case "tagLine":
10758 if v != nil {
10759 var tagLine string
10760 err = json.Unmarshal(*v, &tagLine)
10761 if err != nil {
10762 return err
10763 }
10764 r.TagLine = &tagLine
10765 }
10766 case "address":
10767 if v != nil {
10768 var address PostalAddress
10769 err = json.Unmarshal(*v, &address)
10770 if err != nil {
10771 return err
10772 }
10773 r.Address = &address
10774 }
10775 case "telephone":
10776 if v != nil {
10777 var telephone string
10778 err = json.Unmarshal(*v, &telephone)
10779 if err != nil {
10780 return err
10781 }
10782 r.Telephone = &telephone
10783 }
10784 case "name":
10785 if v != nil {
10786 var name string
10787 err = json.Unmarshal(*v, &name)
10788 if err != nil {
10789 return err
10790 }
10791 r.Name = &name
10792 }
10793 case "url":
10794 if v != nil {
10795 var URL string
10796 err = json.Unmarshal(*v, &URL)
10797 if err != nil {
10798 return err
10799 }
10800 r.URL = &URL
10801 }
10802 case "image":
10803 if v != nil {
10804 var imageVar ImageObject
10805 err = json.Unmarshal(*v, &imageVar)
10806 if err != nil {
10807 return err
10808 }
10809 r.Image = &imageVar
10810 }
10811 case "description":
10812 if v != nil {
10813 var description string
10814 err = json.Unmarshal(*v, &description)
10815 if err != nil {
10816 return err
10817 }
10818 r.Description = &description
10819 }
10820 case "entityPresentationInfo":
10821 if v != nil {
10822 var entityPresentationInfo EntitiesEntityPresentationInfo
10823 err = json.Unmarshal(*v, &entityPresentationInfo)
10824 if err != nil {
10825 return err
10826 }
10827 r.EntityPresentationInfo = &entityPresentationInfo
10828 }
10829 case "bingId":
10830 if v != nil {
10831 var bingID string
10832 err = json.Unmarshal(*v, &bingID)
10833 if err != nil {
10834 return err
10835 }
10836 r.BingID = &bingID
10837 }
10838 case "contractualRules":
10839 if v != nil {
10840 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
10841 if err != nil {
10842 return err
10843 }
10844 r.ContractualRules = &contractualRules
10845 }
10846 case "webSearchUrl":
10847 if v != nil {
10848 var webSearchURL string
10849 err = json.Unmarshal(*v, &webSearchURL)
10850 if err != nil {
10851 return err
10852 }
10853 r.WebSearchURL = &webSearchURL
10854 }
10855 case "id":
10856 if v != nil {
10857 var ID string
10858 err = json.Unmarshal(*v, &ID)
10859 if err != nil {
10860 return err
10861 }
10862 r.ID = &ID
10863 }
10864 case "_type":
10865 if v != nil {
10866 var typeVar TypeBasicResponseBase
10867 err = json.Unmarshal(*v, &typeVar)
10868 if err != nil {
10869 return err
10870 }
10871 r.Type = typeVar
10872 }
10873 }
10874 }
10875
10876 return nil
10877 }
10878
10879
10880 type SearchResponse struct {
10881 autorest.Response `json:"-"`
10882
10883 QueryContext *QueryContext `json:"queryContext,omitempty"`
10884
10885 Entities *Entities `json:"entities,omitempty"`
10886
10887 Places *Places `json:"places,omitempty"`
10888
10889 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
10890
10891 WebSearchURL *string `json:"webSearchUrl,omitempty"`
10892
10893 ID *string `json:"id,omitempty"`
10894
10895 Type TypeBasicResponseBase `json:"_type,omitempty"`
10896 }
10897
10898
10899 func (sr SearchResponse) MarshalJSON() ([]byte, error) {
10900 sr.Type = TypeSearchResponse
10901 objectMap := make(map[string]interface{})
10902 if sr.Type != "" {
10903 objectMap["_type"] = sr.Type
10904 }
10905 return json.Marshal(objectMap)
10906 }
10907
10908
10909 func (sr SearchResponse) AsImageObject() (*ImageObject, bool) {
10910 return nil, false
10911 }
10912
10913
10914 func (sr SearchResponse) AsThing() (*Thing, bool) {
10915 return nil, false
10916 }
10917
10918
10919 func (sr SearchResponse) AsBasicThing() (BasicThing, bool) {
10920 return nil, false
10921 }
10922
10923
10924 func (sr SearchResponse) AsEntities() (*Entities, bool) {
10925 return nil, false
10926 }
10927
10928
10929 func (sr SearchResponse) AsPlaces() (*Places, bool) {
10930 return nil, false
10931 }
10932
10933
10934 func (sr SearchResponse) AsSearchResponse() (*SearchResponse, bool) {
10935 return &sr, true
10936 }
10937
10938
10939 func (sr SearchResponse) AsResponse() (*Response, bool) {
10940 return nil, false
10941 }
10942
10943
10944 func (sr SearchResponse) AsBasicResponse() (BasicResponse, bool) {
10945 return &sr, true
10946 }
10947
10948
10949 func (sr SearchResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
10950 return nil, false
10951 }
10952
10953
10954 func (sr SearchResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
10955 return nil, false
10956 }
10957
10958
10959 func (sr SearchResponse) AsIdentifiable() (*Identifiable, bool) {
10960 return nil, false
10961 }
10962
10963
10964 func (sr SearchResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) {
10965 return &sr, true
10966 }
10967
10968
10969 func (sr SearchResponse) AsAnswer() (*Answer, bool) {
10970 return nil, false
10971 }
10972
10973
10974 func (sr SearchResponse) AsBasicAnswer() (BasicAnswer, bool) {
10975 return nil, false
10976 }
10977
10978
10979 func (sr SearchResponse) AsErrorResponse() (*ErrorResponse, bool) {
10980 return nil, false
10981 }
10982
10983
10984 func (sr SearchResponse) AsPostalAddress() (*PostalAddress, bool) {
10985 return nil, false
10986 }
10987
10988
10989 func (sr SearchResponse) AsPlace() (*Place, bool) {
10990 return nil, false
10991 }
10992
10993
10994 func (sr SearchResponse) AsBasicPlace() (BasicPlace, bool) {
10995 return nil, false
10996 }
10997
10998
10999 func (sr SearchResponse) AsOrganization() (*Organization, bool) {
11000 return nil, false
11001 }
11002
11003
11004 func (sr SearchResponse) AsCreativeWork() (*CreativeWork, bool) {
11005 return nil, false
11006 }
11007
11008
11009 func (sr SearchResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) {
11010 return nil, false
11011 }
11012
11013
11014 func (sr SearchResponse) AsIntangible() (*Intangible, bool) {
11015 return nil, false
11016 }
11017
11018
11019 func (sr SearchResponse) AsBasicIntangible() (BasicIntangible, bool) {
11020 return nil, false
11021 }
11022
11023
11024 func (sr SearchResponse) AsMovieTheater() (*MovieTheater, bool) {
11025 return nil, false
11026 }
11027
11028
11029 func (sr SearchResponse) AsMediaObject() (*MediaObject, bool) {
11030 return nil, false
11031 }
11032
11033
11034 func (sr SearchResponse) AsBasicMediaObject() (BasicMediaObject, bool) {
11035 return nil, false
11036 }
11037
11038
11039 func (sr SearchResponse) AsCivicStructure() (*CivicStructure, bool) {
11040 return nil, false
11041 }
11042
11043
11044 func (sr SearchResponse) AsBasicCivicStructure() (BasicCivicStructure, bool) {
11045 return nil, false
11046 }
11047
11048
11049 func (sr SearchResponse) AsLocalBusiness() (*LocalBusiness, bool) {
11050 return nil, false
11051 }
11052
11053
11054 func (sr SearchResponse) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
11055 return nil, false
11056 }
11057
11058
11059 func (sr SearchResponse) AsTouristAttraction() (*TouristAttraction, bool) {
11060 return nil, false
11061 }
11062
11063
11064 func (sr SearchResponse) AsAirport() (*Airport, bool) {
11065 return nil, false
11066 }
11067
11068
11069 func (sr SearchResponse) AsLicense() (*License, bool) {
11070 return nil, false
11071 }
11072
11073
11074 func (sr SearchResponse) AsStructuredValue() (*StructuredValue, bool) {
11075 return nil, false
11076 }
11077
11078
11079 func (sr SearchResponse) AsBasicStructuredValue() (BasicStructuredValue, bool) {
11080 return nil, false
11081 }
11082
11083
11084 func (sr SearchResponse) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
11085 return nil, false
11086 }
11087
11088
11089 func (sr SearchResponse) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
11090 return nil, false
11091 }
11092
11093
11094 func (sr SearchResponse) AsFoodEstablishment() (*FoodEstablishment, bool) {
11095 return nil, false
11096 }
11097
11098
11099 func (sr SearchResponse) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
11100 return nil, false
11101 }
11102
11103
11104 func (sr SearchResponse) AsLodgingBusiness() (*LodgingBusiness, bool) {
11105 return nil, false
11106 }
11107
11108
11109 func (sr SearchResponse) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
11110 return nil, false
11111 }
11112
11113
11114 func (sr SearchResponse) AsRestaurant() (*Restaurant, bool) {
11115 return nil, false
11116 }
11117
11118
11119 func (sr SearchResponse) AsHotel() (*Hotel, bool) {
11120 return nil, false
11121 }
11122
11123
11124 func (sr SearchResponse) AsResponseBase() (*ResponseBase, bool) {
11125 return nil, false
11126 }
11127
11128
11129 func (sr SearchResponse) AsBasicResponseBase() (BasicResponseBase, bool) {
11130 return &sr, true
11131 }
11132
11133
11134 func (sr *SearchResponse) UnmarshalJSON(body []byte) error {
11135 var m map[string]*json.RawMessage
11136 err := json.Unmarshal(body, &m)
11137 if err != nil {
11138 return err
11139 }
11140 for k, v := range m {
11141 switch k {
11142 case "queryContext":
11143 if v != nil {
11144 var queryContext QueryContext
11145 err = json.Unmarshal(*v, &queryContext)
11146 if err != nil {
11147 return err
11148 }
11149 sr.QueryContext = &queryContext
11150 }
11151 case "entities":
11152 if v != nil {
11153 var entities Entities
11154 err = json.Unmarshal(*v, &entities)
11155 if err != nil {
11156 return err
11157 }
11158 sr.Entities = &entities
11159 }
11160 case "places":
11161 if v != nil {
11162 var places Places
11163 err = json.Unmarshal(*v, &places)
11164 if err != nil {
11165 return err
11166 }
11167 sr.Places = &places
11168 }
11169 case "contractualRules":
11170 if v != nil {
11171 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
11172 if err != nil {
11173 return err
11174 }
11175 sr.ContractualRules = &contractualRules
11176 }
11177 case "webSearchUrl":
11178 if v != nil {
11179 var webSearchURL string
11180 err = json.Unmarshal(*v, &webSearchURL)
11181 if err != nil {
11182 return err
11183 }
11184 sr.WebSearchURL = &webSearchURL
11185 }
11186 case "id":
11187 if v != nil {
11188 var ID string
11189 err = json.Unmarshal(*v, &ID)
11190 if err != nil {
11191 return err
11192 }
11193 sr.ID = &ID
11194 }
11195 case "_type":
11196 if v != nil {
11197 var typeVar TypeBasicResponseBase
11198 err = json.Unmarshal(*v, &typeVar)
11199 if err != nil {
11200 return err
11201 }
11202 sr.Type = typeVar
11203 }
11204 }
11205 }
11206
11207 return nil
11208 }
11209
11210
11211 type BasicSearchResultsAnswer interface {
11212 AsEntities() (*Entities, bool)
11213 AsPlaces() (*Places, bool)
11214 AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
11215 }
11216
11217
11218 type SearchResultsAnswer struct {
11219
11220 QueryContext *QueryContext `json:"queryContext,omitempty"`
11221
11222 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
11223
11224 WebSearchURL *string `json:"webSearchUrl,omitempty"`
11225
11226 ID *string `json:"id,omitempty"`
11227
11228 Type TypeBasicResponseBase `json:"_type,omitempty"`
11229 }
11230
11231 func unmarshalBasicSearchResultsAnswer(body []byte) (BasicSearchResultsAnswer, error) {
11232 var m map[string]interface{}
11233 err := json.Unmarshal(body, &m)
11234 if err != nil {
11235 return nil, err
11236 }
11237
11238 switch m["_type"] {
11239 case string(TypeEntities):
11240 var e Entities
11241 err := json.Unmarshal(body, &e)
11242 return e, err
11243 case string(TypePlaces):
11244 var p Places
11245 err := json.Unmarshal(body, &p)
11246 return p, err
11247 default:
11248 var sra SearchResultsAnswer
11249 err := json.Unmarshal(body, &sra)
11250 return sra, err
11251 }
11252 }
11253 func unmarshalBasicSearchResultsAnswerArray(body []byte) ([]BasicSearchResultsAnswer, error) {
11254 var rawMessages []*json.RawMessage
11255 err := json.Unmarshal(body, &rawMessages)
11256 if err != nil {
11257 return nil, err
11258 }
11259
11260 sraArray := make([]BasicSearchResultsAnswer, len(rawMessages))
11261
11262 for index, rawMessage := range rawMessages {
11263 sra, err := unmarshalBasicSearchResultsAnswer(*rawMessage)
11264 if err != nil {
11265 return nil, err
11266 }
11267 sraArray[index] = sra
11268 }
11269 return sraArray, nil
11270 }
11271
11272
11273 func (sra SearchResultsAnswer) MarshalJSON() ([]byte, error) {
11274 sra.Type = TypeSearchResultsAnswer
11275 objectMap := make(map[string]interface{})
11276 if sra.Type != "" {
11277 objectMap["_type"] = sra.Type
11278 }
11279 return json.Marshal(objectMap)
11280 }
11281
11282
11283 func (sra SearchResultsAnswer) AsImageObject() (*ImageObject, bool) {
11284 return nil, false
11285 }
11286
11287
11288 func (sra SearchResultsAnswer) AsThing() (*Thing, bool) {
11289 return nil, false
11290 }
11291
11292
11293 func (sra SearchResultsAnswer) AsBasicThing() (BasicThing, bool) {
11294 return nil, false
11295 }
11296
11297
11298 func (sra SearchResultsAnswer) AsEntities() (*Entities, bool) {
11299 return nil, false
11300 }
11301
11302
11303 func (sra SearchResultsAnswer) AsPlaces() (*Places, bool) {
11304 return nil, false
11305 }
11306
11307
11308 func (sra SearchResultsAnswer) AsSearchResponse() (*SearchResponse, bool) {
11309 return nil, false
11310 }
11311
11312
11313 func (sra SearchResultsAnswer) AsResponse() (*Response, bool) {
11314 return nil, false
11315 }
11316
11317
11318 func (sra SearchResultsAnswer) AsBasicResponse() (BasicResponse, bool) {
11319 return &sra, true
11320 }
11321
11322
11323 func (sra SearchResultsAnswer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
11324 return &sra, true
11325 }
11326
11327
11328 func (sra SearchResultsAnswer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
11329 return &sra, true
11330 }
11331
11332
11333 func (sra SearchResultsAnswer) AsIdentifiable() (*Identifiable, bool) {
11334 return nil, false
11335 }
11336
11337
11338 func (sra SearchResultsAnswer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
11339 return &sra, true
11340 }
11341
11342
11343 func (sra SearchResultsAnswer) AsAnswer() (*Answer, bool) {
11344 return nil, false
11345 }
11346
11347
11348 func (sra SearchResultsAnswer) AsBasicAnswer() (BasicAnswer, bool) {
11349 return &sra, true
11350 }
11351
11352
11353 func (sra SearchResultsAnswer) AsErrorResponse() (*ErrorResponse, bool) {
11354 return nil, false
11355 }
11356
11357
11358 func (sra SearchResultsAnswer) AsPostalAddress() (*PostalAddress, bool) {
11359 return nil, false
11360 }
11361
11362
11363 func (sra SearchResultsAnswer) AsPlace() (*Place, bool) {
11364 return nil, false
11365 }
11366
11367
11368 func (sra SearchResultsAnswer) AsBasicPlace() (BasicPlace, bool) {
11369 return nil, false
11370 }
11371
11372
11373 func (sra SearchResultsAnswer) AsOrganization() (*Organization, bool) {
11374 return nil, false
11375 }
11376
11377
11378 func (sra SearchResultsAnswer) AsCreativeWork() (*CreativeWork, bool) {
11379 return nil, false
11380 }
11381
11382
11383 func (sra SearchResultsAnswer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
11384 return nil, false
11385 }
11386
11387
11388 func (sra SearchResultsAnswer) AsIntangible() (*Intangible, bool) {
11389 return nil, false
11390 }
11391
11392
11393 func (sra SearchResultsAnswer) AsBasicIntangible() (BasicIntangible, bool) {
11394 return nil, false
11395 }
11396
11397
11398 func (sra SearchResultsAnswer) AsMovieTheater() (*MovieTheater, bool) {
11399 return nil, false
11400 }
11401
11402
11403 func (sra SearchResultsAnswer) AsMediaObject() (*MediaObject, bool) {
11404 return nil, false
11405 }
11406
11407
11408 func (sra SearchResultsAnswer) AsBasicMediaObject() (BasicMediaObject, bool) {
11409 return nil, false
11410 }
11411
11412
11413 func (sra SearchResultsAnswer) AsCivicStructure() (*CivicStructure, bool) {
11414 return nil, false
11415 }
11416
11417
11418 func (sra SearchResultsAnswer) AsBasicCivicStructure() (BasicCivicStructure, bool) {
11419 return nil, false
11420 }
11421
11422
11423 func (sra SearchResultsAnswer) AsLocalBusiness() (*LocalBusiness, bool) {
11424 return nil, false
11425 }
11426
11427
11428 func (sra SearchResultsAnswer) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
11429 return nil, false
11430 }
11431
11432
11433 func (sra SearchResultsAnswer) AsTouristAttraction() (*TouristAttraction, bool) {
11434 return nil, false
11435 }
11436
11437
11438 func (sra SearchResultsAnswer) AsAirport() (*Airport, bool) {
11439 return nil, false
11440 }
11441
11442
11443 func (sra SearchResultsAnswer) AsLicense() (*License, bool) {
11444 return nil, false
11445 }
11446
11447
11448 func (sra SearchResultsAnswer) AsStructuredValue() (*StructuredValue, bool) {
11449 return nil, false
11450 }
11451
11452
11453 func (sra SearchResultsAnswer) AsBasicStructuredValue() (BasicStructuredValue, bool) {
11454 return nil, false
11455 }
11456
11457
11458 func (sra SearchResultsAnswer) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
11459 return nil, false
11460 }
11461
11462
11463 func (sra SearchResultsAnswer) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
11464 return nil, false
11465 }
11466
11467
11468 func (sra SearchResultsAnswer) AsFoodEstablishment() (*FoodEstablishment, bool) {
11469 return nil, false
11470 }
11471
11472
11473 func (sra SearchResultsAnswer) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
11474 return nil, false
11475 }
11476
11477
11478 func (sra SearchResultsAnswer) AsLodgingBusiness() (*LodgingBusiness, bool) {
11479 return nil, false
11480 }
11481
11482
11483 func (sra SearchResultsAnswer) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
11484 return nil, false
11485 }
11486
11487
11488 func (sra SearchResultsAnswer) AsRestaurant() (*Restaurant, bool) {
11489 return nil, false
11490 }
11491
11492
11493 func (sra SearchResultsAnswer) AsHotel() (*Hotel, bool) {
11494 return nil, false
11495 }
11496
11497
11498 func (sra SearchResultsAnswer) AsResponseBase() (*ResponseBase, bool) {
11499 return nil, false
11500 }
11501
11502
11503 func (sra SearchResultsAnswer) AsBasicResponseBase() (BasicResponseBase, bool) {
11504 return &sra, true
11505 }
11506
11507
11508 func (sra *SearchResultsAnswer) UnmarshalJSON(body []byte) error {
11509 var m map[string]*json.RawMessage
11510 err := json.Unmarshal(body, &m)
11511 if err != nil {
11512 return err
11513 }
11514 for k, v := range m {
11515 switch k {
11516 case "queryContext":
11517 if v != nil {
11518 var queryContext QueryContext
11519 err = json.Unmarshal(*v, &queryContext)
11520 if err != nil {
11521 return err
11522 }
11523 sra.QueryContext = &queryContext
11524 }
11525 case "contractualRules":
11526 if v != nil {
11527 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
11528 if err != nil {
11529 return err
11530 }
11531 sra.ContractualRules = &contractualRules
11532 }
11533 case "webSearchUrl":
11534 if v != nil {
11535 var webSearchURL string
11536 err = json.Unmarshal(*v, &webSearchURL)
11537 if err != nil {
11538 return err
11539 }
11540 sra.WebSearchURL = &webSearchURL
11541 }
11542 case "id":
11543 if v != nil {
11544 var ID string
11545 err = json.Unmarshal(*v, &ID)
11546 if err != nil {
11547 return err
11548 }
11549 sra.ID = &ID
11550 }
11551 case "_type":
11552 if v != nil {
11553 var typeVar TypeBasicResponseBase
11554 err = json.Unmarshal(*v, &typeVar)
11555 if err != nil {
11556 return err
11557 }
11558 sra.Type = typeVar
11559 }
11560 }
11561 }
11562
11563 return nil
11564 }
11565
11566
11567 type BasicStructuredValue interface {
11568 AsPostalAddress() (*PostalAddress, bool)
11569 AsStructuredValue() (*StructuredValue, bool)
11570 }
11571
11572
11573 type StructuredValue struct {
11574
11575 Name *string `json:"name,omitempty"`
11576
11577 URL *string `json:"url,omitempty"`
11578
11579 Image *ImageObject `json:"image,omitempty"`
11580
11581 Description *string `json:"description,omitempty"`
11582
11583 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
11584
11585 BingID *string `json:"bingId,omitempty"`
11586
11587 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
11588
11589 WebSearchURL *string `json:"webSearchUrl,omitempty"`
11590
11591 ID *string `json:"id,omitempty"`
11592
11593 Type TypeBasicResponseBase `json:"_type,omitempty"`
11594 }
11595
11596 func unmarshalBasicStructuredValue(body []byte) (BasicStructuredValue, error) {
11597 var m map[string]interface{}
11598 err := json.Unmarshal(body, &m)
11599 if err != nil {
11600 return nil, err
11601 }
11602
11603 switch m["_type"] {
11604 case string(TypePostalAddress):
11605 var pa PostalAddress
11606 err := json.Unmarshal(body, &pa)
11607 return pa, err
11608 default:
11609 var sv StructuredValue
11610 err := json.Unmarshal(body, &sv)
11611 return sv, err
11612 }
11613 }
11614 func unmarshalBasicStructuredValueArray(body []byte) ([]BasicStructuredValue, error) {
11615 var rawMessages []*json.RawMessage
11616 err := json.Unmarshal(body, &rawMessages)
11617 if err != nil {
11618 return nil, err
11619 }
11620
11621 svArray := make([]BasicStructuredValue, len(rawMessages))
11622
11623 for index, rawMessage := range rawMessages {
11624 sv, err := unmarshalBasicStructuredValue(*rawMessage)
11625 if err != nil {
11626 return nil, err
11627 }
11628 svArray[index] = sv
11629 }
11630 return svArray, nil
11631 }
11632
11633
11634 func (sv StructuredValue) MarshalJSON() ([]byte, error) {
11635 sv.Type = TypeStructuredValue
11636 objectMap := make(map[string]interface{})
11637 if sv.Type != "" {
11638 objectMap["_type"] = sv.Type
11639 }
11640 return json.Marshal(objectMap)
11641 }
11642
11643
11644 func (sv StructuredValue) AsImageObject() (*ImageObject, bool) {
11645 return nil, false
11646 }
11647
11648
11649 func (sv StructuredValue) AsThing() (*Thing, bool) {
11650 return nil, false
11651 }
11652
11653
11654 func (sv StructuredValue) AsBasicThing() (BasicThing, bool) {
11655 return &sv, true
11656 }
11657
11658
11659 func (sv StructuredValue) AsEntities() (*Entities, bool) {
11660 return nil, false
11661 }
11662
11663
11664 func (sv StructuredValue) AsPlaces() (*Places, bool) {
11665 return nil, false
11666 }
11667
11668
11669 func (sv StructuredValue) AsSearchResponse() (*SearchResponse, bool) {
11670 return nil, false
11671 }
11672
11673
11674 func (sv StructuredValue) AsResponse() (*Response, bool) {
11675 return nil, false
11676 }
11677
11678
11679 func (sv StructuredValue) AsBasicResponse() (BasicResponse, bool) {
11680 return &sv, true
11681 }
11682
11683
11684 func (sv StructuredValue) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
11685 return nil, false
11686 }
11687
11688
11689 func (sv StructuredValue) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
11690 return nil, false
11691 }
11692
11693
11694 func (sv StructuredValue) AsIdentifiable() (*Identifiable, bool) {
11695 return nil, false
11696 }
11697
11698
11699 func (sv StructuredValue) AsBasicIdentifiable() (BasicIdentifiable, bool) {
11700 return &sv, true
11701 }
11702
11703
11704 func (sv StructuredValue) AsAnswer() (*Answer, bool) {
11705 return nil, false
11706 }
11707
11708
11709 func (sv StructuredValue) AsBasicAnswer() (BasicAnswer, bool) {
11710 return nil, false
11711 }
11712
11713
11714 func (sv StructuredValue) AsErrorResponse() (*ErrorResponse, bool) {
11715 return nil, false
11716 }
11717
11718
11719 func (sv StructuredValue) AsPostalAddress() (*PostalAddress, bool) {
11720 return nil, false
11721 }
11722
11723
11724 func (sv StructuredValue) AsPlace() (*Place, bool) {
11725 return nil, false
11726 }
11727
11728
11729 func (sv StructuredValue) AsBasicPlace() (BasicPlace, bool) {
11730 return nil, false
11731 }
11732
11733
11734 func (sv StructuredValue) AsOrganization() (*Organization, bool) {
11735 return nil, false
11736 }
11737
11738
11739 func (sv StructuredValue) AsCreativeWork() (*CreativeWork, bool) {
11740 return nil, false
11741 }
11742
11743
11744 func (sv StructuredValue) AsBasicCreativeWork() (BasicCreativeWork, bool) {
11745 return nil, false
11746 }
11747
11748
11749 func (sv StructuredValue) AsIntangible() (*Intangible, bool) {
11750 return nil, false
11751 }
11752
11753
11754 func (sv StructuredValue) AsBasicIntangible() (BasicIntangible, bool) {
11755 return &sv, true
11756 }
11757
11758
11759 func (sv StructuredValue) AsMovieTheater() (*MovieTheater, bool) {
11760 return nil, false
11761 }
11762
11763
11764 func (sv StructuredValue) AsMediaObject() (*MediaObject, bool) {
11765 return nil, false
11766 }
11767
11768
11769 func (sv StructuredValue) AsBasicMediaObject() (BasicMediaObject, bool) {
11770 return nil, false
11771 }
11772
11773
11774 func (sv StructuredValue) AsCivicStructure() (*CivicStructure, bool) {
11775 return nil, false
11776 }
11777
11778
11779 func (sv StructuredValue) AsBasicCivicStructure() (BasicCivicStructure, bool) {
11780 return nil, false
11781 }
11782
11783
11784 func (sv StructuredValue) AsLocalBusiness() (*LocalBusiness, bool) {
11785 return nil, false
11786 }
11787
11788
11789 func (sv StructuredValue) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
11790 return nil, false
11791 }
11792
11793
11794 func (sv StructuredValue) AsTouristAttraction() (*TouristAttraction, bool) {
11795 return nil, false
11796 }
11797
11798
11799 func (sv StructuredValue) AsAirport() (*Airport, bool) {
11800 return nil, false
11801 }
11802
11803
11804 func (sv StructuredValue) AsLicense() (*License, bool) {
11805 return nil, false
11806 }
11807
11808
11809 func (sv StructuredValue) AsStructuredValue() (*StructuredValue, bool) {
11810 return &sv, true
11811 }
11812
11813
11814 func (sv StructuredValue) AsBasicStructuredValue() (BasicStructuredValue, bool) {
11815 return &sv, true
11816 }
11817
11818
11819 func (sv StructuredValue) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
11820 return nil, false
11821 }
11822
11823
11824 func (sv StructuredValue) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
11825 return nil, false
11826 }
11827
11828
11829 func (sv StructuredValue) AsFoodEstablishment() (*FoodEstablishment, bool) {
11830 return nil, false
11831 }
11832
11833
11834 func (sv StructuredValue) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
11835 return nil, false
11836 }
11837
11838
11839 func (sv StructuredValue) AsLodgingBusiness() (*LodgingBusiness, bool) {
11840 return nil, false
11841 }
11842
11843
11844 func (sv StructuredValue) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
11845 return nil, false
11846 }
11847
11848
11849 func (sv StructuredValue) AsRestaurant() (*Restaurant, bool) {
11850 return nil, false
11851 }
11852
11853
11854 func (sv StructuredValue) AsHotel() (*Hotel, bool) {
11855 return nil, false
11856 }
11857
11858
11859 func (sv StructuredValue) AsResponseBase() (*ResponseBase, bool) {
11860 return nil, false
11861 }
11862
11863
11864 func (sv StructuredValue) AsBasicResponseBase() (BasicResponseBase, bool) {
11865 return &sv, true
11866 }
11867
11868
11869 func (sv *StructuredValue) UnmarshalJSON(body []byte) error {
11870 var m map[string]*json.RawMessage
11871 err := json.Unmarshal(body, &m)
11872 if err != nil {
11873 return err
11874 }
11875 for k, v := range m {
11876 switch k {
11877 case "name":
11878 if v != nil {
11879 var name string
11880 err = json.Unmarshal(*v, &name)
11881 if err != nil {
11882 return err
11883 }
11884 sv.Name = &name
11885 }
11886 case "url":
11887 if v != nil {
11888 var URL string
11889 err = json.Unmarshal(*v, &URL)
11890 if err != nil {
11891 return err
11892 }
11893 sv.URL = &URL
11894 }
11895 case "image":
11896 if v != nil {
11897 var imageVar ImageObject
11898 err = json.Unmarshal(*v, &imageVar)
11899 if err != nil {
11900 return err
11901 }
11902 sv.Image = &imageVar
11903 }
11904 case "description":
11905 if v != nil {
11906 var description string
11907 err = json.Unmarshal(*v, &description)
11908 if err != nil {
11909 return err
11910 }
11911 sv.Description = &description
11912 }
11913 case "entityPresentationInfo":
11914 if v != nil {
11915 var entityPresentationInfo EntitiesEntityPresentationInfo
11916 err = json.Unmarshal(*v, &entityPresentationInfo)
11917 if err != nil {
11918 return err
11919 }
11920 sv.EntityPresentationInfo = &entityPresentationInfo
11921 }
11922 case "bingId":
11923 if v != nil {
11924 var bingID string
11925 err = json.Unmarshal(*v, &bingID)
11926 if err != nil {
11927 return err
11928 }
11929 sv.BingID = &bingID
11930 }
11931 case "contractualRules":
11932 if v != nil {
11933 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
11934 if err != nil {
11935 return err
11936 }
11937 sv.ContractualRules = &contractualRules
11938 }
11939 case "webSearchUrl":
11940 if v != nil {
11941 var webSearchURL string
11942 err = json.Unmarshal(*v, &webSearchURL)
11943 if err != nil {
11944 return err
11945 }
11946 sv.WebSearchURL = &webSearchURL
11947 }
11948 case "id":
11949 if v != nil {
11950 var ID string
11951 err = json.Unmarshal(*v, &ID)
11952 if err != nil {
11953 return err
11954 }
11955 sv.ID = &ID
11956 }
11957 case "_type":
11958 if v != nil {
11959 var typeVar TypeBasicResponseBase
11960 err = json.Unmarshal(*v, &typeVar)
11961 if err != nil {
11962 return err
11963 }
11964 sv.Type = typeVar
11965 }
11966 }
11967 }
11968
11969 return nil
11970 }
11971
11972
11973 type BasicThing interface {
11974 AsImageObject() (*ImageObject, bool)
11975 AsPostalAddress() (*PostalAddress, bool)
11976 AsPlace() (*Place, bool)
11977 AsBasicPlace() (BasicPlace, bool)
11978 AsOrganization() (*Organization, bool)
11979 AsCreativeWork() (*CreativeWork, bool)
11980 AsBasicCreativeWork() (BasicCreativeWork, bool)
11981 AsIntangible() (*Intangible, bool)
11982 AsBasicIntangible() (BasicIntangible, bool)
11983 AsMovieTheater() (*MovieTheater, bool)
11984 AsMediaObject() (*MediaObject, bool)
11985 AsBasicMediaObject() (BasicMediaObject, bool)
11986 AsCivicStructure() (*CivicStructure, bool)
11987 AsBasicCivicStructure() (BasicCivicStructure, bool)
11988 AsLocalBusiness() (*LocalBusiness, bool)
11989 AsBasicLocalBusiness() (BasicLocalBusiness, bool)
11990 AsTouristAttraction() (*TouristAttraction, bool)
11991 AsAirport() (*Airport, bool)
11992 AsLicense() (*License, bool)
11993 AsStructuredValue() (*StructuredValue, bool)
11994 AsBasicStructuredValue() (BasicStructuredValue, bool)
11995 AsEntertainmentBusiness() (*EntertainmentBusiness, bool)
11996 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool)
11997 AsFoodEstablishment() (*FoodEstablishment, bool)
11998 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool)
11999 AsLodgingBusiness() (*LodgingBusiness, bool)
12000 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool)
12001 AsRestaurant() (*Restaurant, bool)
12002 AsHotel() (*Hotel, bool)
12003 AsThing() (*Thing, bool)
12004 }
12005
12006
12007 type Thing struct {
12008
12009 Name *string `json:"name,omitempty"`
12010
12011 URL *string `json:"url,omitempty"`
12012
12013 Image *ImageObject `json:"image,omitempty"`
12014
12015 Description *string `json:"description,omitempty"`
12016
12017 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
12018
12019 BingID *string `json:"bingId,omitempty"`
12020
12021 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
12022
12023 WebSearchURL *string `json:"webSearchUrl,omitempty"`
12024
12025 ID *string `json:"id,omitempty"`
12026
12027 Type TypeBasicResponseBase `json:"_type,omitempty"`
12028 }
12029
12030 func unmarshalBasicThing(body []byte) (BasicThing, error) {
12031 var m map[string]interface{}
12032 err := json.Unmarshal(body, &m)
12033 if err != nil {
12034 return nil, err
12035 }
12036
12037 switch m["_type"] {
12038 case string(TypeImageObject):
12039 var ioVar ImageObject
12040 err := json.Unmarshal(body, &ioVar)
12041 return ioVar, err
12042 case string(TypePostalAddress):
12043 var pa PostalAddress
12044 err := json.Unmarshal(body, &pa)
12045 return pa, err
12046 case string(TypePlace):
12047 var p Place
12048 err := json.Unmarshal(body, &p)
12049 return p, err
12050 case string(TypeOrganization):
12051 var o Organization
12052 err := json.Unmarshal(body, &o)
12053 return o, err
12054 case string(TypeCreativeWork):
12055 var cw CreativeWork
12056 err := json.Unmarshal(body, &cw)
12057 return cw, err
12058 case string(TypeIntangible):
12059 var i Intangible
12060 err := json.Unmarshal(body, &i)
12061 return i, err
12062 case string(TypeMovieTheater):
12063 var mt MovieTheater
12064 err := json.Unmarshal(body, &mt)
12065 return mt, err
12066 case string(TypeMediaObject):
12067 var mo MediaObject
12068 err := json.Unmarshal(body, &mo)
12069 return mo, err
12070 case string(TypeCivicStructure):
12071 var cs CivicStructure
12072 err := json.Unmarshal(body, &cs)
12073 return cs, err
12074 case string(TypeLocalBusiness):
12075 var lb LocalBusiness
12076 err := json.Unmarshal(body, &lb)
12077 return lb, err
12078 case string(TypeTouristAttraction):
12079 var ta TouristAttraction
12080 err := json.Unmarshal(body, &ta)
12081 return ta, err
12082 case string(TypeAirport):
12083 var a Airport
12084 err := json.Unmarshal(body, &a)
12085 return a, err
12086 case string(TypeLicense):
12087 var l License
12088 err := json.Unmarshal(body, &l)
12089 return l, err
12090 case string(TypeStructuredValue):
12091 var sv StructuredValue
12092 err := json.Unmarshal(body, &sv)
12093 return sv, err
12094 case string(TypeEntertainmentBusiness):
12095 var eb EntertainmentBusiness
12096 err := json.Unmarshal(body, &eb)
12097 return eb, err
12098 case string(TypeFoodEstablishment):
12099 var fe FoodEstablishment
12100 err := json.Unmarshal(body, &fe)
12101 return fe, err
12102 case string(TypeLodgingBusiness):
12103 var lb LodgingBusiness
12104 err := json.Unmarshal(body, &lb)
12105 return lb, err
12106 case string(TypeRestaurant):
12107 var r Restaurant
12108 err := json.Unmarshal(body, &r)
12109 return r, err
12110 case string(TypeHotel):
12111 var h Hotel
12112 err := json.Unmarshal(body, &h)
12113 return h, err
12114 default:
12115 var t Thing
12116 err := json.Unmarshal(body, &t)
12117 return t, err
12118 }
12119 }
12120 func unmarshalBasicThingArray(body []byte) ([]BasicThing, error) {
12121 var rawMessages []*json.RawMessage
12122 err := json.Unmarshal(body, &rawMessages)
12123 if err != nil {
12124 return nil, err
12125 }
12126
12127 tArray := make([]BasicThing, len(rawMessages))
12128
12129 for index, rawMessage := range rawMessages {
12130 t, err := unmarshalBasicThing(*rawMessage)
12131 if err != nil {
12132 return nil, err
12133 }
12134 tArray[index] = t
12135 }
12136 return tArray, nil
12137 }
12138
12139
12140 func (t Thing) MarshalJSON() ([]byte, error) {
12141 t.Type = TypeThing
12142 objectMap := make(map[string]interface{})
12143 if t.Type != "" {
12144 objectMap["_type"] = t.Type
12145 }
12146 return json.Marshal(objectMap)
12147 }
12148
12149
12150 func (t Thing) AsImageObject() (*ImageObject, bool) {
12151 return nil, false
12152 }
12153
12154
12155 func (t Thing) AsThing() (*Thing, bool) {
12156 return &t, true
12157 }
12158
12159
12160 func (t Thing) AsBasicThing() (BasicThing, bool) {
12161 return &t, true
12162 }
12163
12164
12165 func (t Thing) AsEntities() (*Entities, bool) {
12166 return nil, false
12167 }
12168
12169
12170 func (t Thing) AsPlaces() (*Places, bool) {
12171 return nil, false
12172 }
12173
12174
12175 func (t Thing) AsSearchResponse() (*SearchResponse, bool) {
12176 return nil, false
12177 }
12178
12179
12180 func (t Thing) AsResponse() (*Response, bool) {
12181 return nil, false
12182 }
12183
12184
12185 func (t Thing) AsBasicResponse() (BasicResponse, bool) {
12186 return &t, true
12187 }
12188
12189
12190 func (t Thing) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
12191 return nil, false
12192 }
12193
12194
12195 func (t Thing) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
12196 return nil, false
12197 }
12198
12199
12200 func (t Thing) AsIdentifiable() (*Identifiable, bool) {
12201 return nil, false
12202 }
12203
12204
12205 func (t Thing) AsBasicIdentifiable() (BasicIdentifiable, bool) {
12206 return &t, true
12207 }
12208
12209
12210 func (t Thing) AsAnswer() (*Answer, bool) {
12211 return nil, false
12212 }
12213
12214
12215 func (t Thing) AsBasicAnswer() (BasicAnswer, bool) {
12216 return nil, false
12217 }
12218
12219
12220 func (t Thing) AsErrorResponse() (*ErrorResponse, bool) {
12221 return nil, false
12222 }
12223
12224
12225 func (t Thing) AsPostalAddress() (*PostalAddress, bool) {
12226 return nil, false
12227 }
12228
12229
12230 func (t Thing) AsPlace() (*Place, bool) {
12231 return nil, false
12232 }
12233
12234
12235 func (t Thing) AsBasicPlace() (BasicPlace, bool) {
12236 return nil, false
12237 }
12238
12239
12240 func (t Thing) AsOrganization() (*Organization, bool) {
12241 return nil, false
12242 }
12243
12244
12245 func (t Thing) AsCreativeWork() (*CreativeWork, bool) {
12246 return nil, false
12247 }
12248
12249
12250 func (t Thing) AsBasicCreativeWork() (BasicCreativeWork, bool) {
12251 return nil, false
12252 }
12253
12254
12255 func (t Thing) AsIntangible() (*Intangible, bool) {
12256 return nil, false
12257 }
12258
12259
12260 func (t Thing) AsBasicIntangible() (BasicIntangible, bool) {
12261 return nil, false
12262 }
12263
12264
12265 func (t Thing) AsMovieTheater() (*MovieTheater, bool) {
12266 return nil, false
12267 }
12268
12269
12270 func (t Thing) AsMediaObject() (*MediaObject, bool) {
12271 return nil, false
12272 }
12273
12274
12275 func (t Thing) AsBasicMediaObject() (BasicMediaObject, bool) {
12276 return nil, false
12277 }
12278
12279
12280 func (t Thing) AsCivicStructure() (*CivicStructure, bool) {
12281 return nil, false
12282 }
12283
12284
12285 func (t Thing) AsBasicCivicStructure() (BasicCivicStructure, bool) {
12286 return nil, false
12287 }
12288
12289
12290 func (t Thing) AsLocalBusiness() (*LocalBusiness, bool) {
12291 return nil, false
12292 }
12293
12294
12295 func (t Thing) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
12296 return nil, false
12297 }
12298
12299
12300 func (t Thing) AsTouristAttraction() (*TouristAttraction, bool) {
12301 return nil, false
12302 }
12303
12304
12305 func (t Thing) AsAirport() (*Airport, bool) {
12306 return nil, false
12307 }
12308
12309
12310 func (t Thing) AsLicense() (*License, bool) {
12311 return nil, false
12312 }
12313
12314
12315 func (t Thing) AsStructuredValue() (*StructuredValue, bool) {
12316 return nil, false
12317 }
12318
12319
12320 func (t Thing) AsBasicStructuredValue() (BasicStructuredValue, bool) {
12321 return nil, false
12322 }
12323
12324
12325 func (t Thing) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
12326 return nil, false
12327 }
12328
12329
12330 func (t Thing) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
12331 return nil, false
12332 }
12333
12334
12335 func (t Thing) AsFoodEstablishment() (*FoodEstablishment, bool) {
12336 return nil, false
12337 }
12338
12339
12340 func (t Thing) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
12341 return nil, false
12342 }
12343
12344
12345 func (t Thing) AsLodgingBusiness() (*LodgingBusiness, bool) {
12346 return nil, false
12347 }
12348
12349
12350 func (t Thing) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
12351 return nil, false
12352 }
12353
12354
12355 func (t Thing) AsRestaurant() (*Restaurant, bool) {
12356 return nil, false
12357 }
12358
12359
12360 func (t Thing) AsHotel() (*Hotel, bool) {
12361 return nil, false
12362 }
12363
12364
12365 func (t Thing) AsResponseBase() (*ResponseBase, bool) {
12366 return nil, false
12367 }
12368
12369
12370 func (t Thing) AsBasicResponseBase() (BasicResponseBase, bool) {
12371 return &t, true
12372 }
12373
12374
12375 func (t *Thing) UnmarshalJSON(body []byte) error {
12376 var m map[string]*json.RawMessage
12377 err := json.Unmarshal(body, &m)
12378 if err != nil {
12379 return err
12380 }
12381 for k, v := range m {
12382 switch k {
12383 case "name":
12384 if v != nil {
12385 var name string
12386 err = json.Unmarshal(*v, &name)
12387 if err != nil {
12388 return err
12389 }
12390 t.Name = &name
12391 }
12392 case "url":
12393 if v != nil {
12394 var URL string
12395 err = json.Unmarshal(*v, &URL)
12396 if err != nil {
12397 return err
12398 }
12399 t.URL = &URL
12400 }
12401 case "image":
12402 if v != nil {
12403 var imageVar ImageObject
12404 err = json.Unmarshal(*v, &imageVar)
12405 if err != nil {
12406 return err
12407 }
12408 t.Image = &imageVar
12409 }
12410 case "description":
12411 if v != nil {
12412 var description string
12413 err = json.Unmarshal(*v, &description)
12414 if err != nil {
12415 return err
12416 }
12417 t.Description = &description
12418 }
12419 case "entityPresentationInfo":
12420 if v != nil {
12421 var entityPresentationInfo EntitiesEntityPresentationInfo
12422 err = json.Unmarshal(*v, &entityPresentationInfo)
12423 if err != nil {
12424 return err
12425 }
12426 t.EntityPresentationInfo = &entityPresentationInfo
12427 }
12428 case "bingId":
12429 if v != nil {
12430 var bingID string
12431 err = json.Unmarshal(*v, &bingID)
12432 if err != nil {
12433 return err
12434 }
12435 t.BingID = &bingID
12436 }
12437 case "contractualRules":
12438 if v != nil {
12439 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
12440 if err != nil {
12441 return err
12442 }
12443 t.ContractualRules = &contractualRules
12444 }
12445 case "webSearchUrl":
12446 if v != nil {
12447 var webSearchURL string
12448 err = json.Unmarshal(*v, &webSearchURL)
12449 if err != nil {
12450 return err
12451 }
12452 t.WebSearchURL = &webSearchURL
12453 }
12454 case "id":
12455 if v != nil {
12456 var ID string
12457 err = json.Unmarshal(*v, &ID)
12458 if err != nil {
12459 return err
12460 }
12461 t.ID = &ID
12462 }
12463 case "_type":
12464 if v != nil {
12465 var typeVar TypeBasicResponseBase
12466 err = json.Unmarshal(*v, &typeVar)
12467 if err != nil {
12468 return err
12469 }
12470 t.Type = typeVar
12471 }
12472 }
12473 }
12474
12475 return nil
12476 }
12477
12478
12479 type TouristAttraction struct {
12480
12481 Address *PostalAddress `json:"address,omitempty"`
12482
12483 Telephone *string `json:"telephone,omitempty"`
12484
12485 Name *string `json:"name,omitempty"`
12486
12487 URL *string `json:"url,omitempty"`
12488
12489 Image *ImageObject `json:"image,omitempty"`
12490
12491 Description *string `json:"description,omitempty"`
12492
12493 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
12494
12495 BingID *string `json:"bingId,omitempty"`
12496
12497 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"`
12498
12499 WebSearchURL *string `json:"webSearchUrl,omitempty"`
12500
12501 ID *string `json:"id,omitempty"`
12502
12503 Type TypeBasicResponseBase `json:"_type,omitempty"`
12504 }
12505
12506
12507 func (ta TouristAttraction) MarshalJSON() ([]byte, error) {
12508 ta.Type = TypeTouristAttraction
12509 objectMap := make(map[string]interface{})
12510 if ta.Type != "" {
12511 objectMap["_type"] = ta.Type
12512 }
12513 return json.Marshal(objectMap)
12514 }
12515
12516
12517 func (ta TouristAttraction) AsImageObject() (*ImageObject, bool) {
12518 return nil, false
12519 }
12520
12521
12522 func (ta TouristAttraction) AsThing() (*Thing, bool) {
12523 return nil, false
12524 }
12525
12526
12527 func (ta TouristAttraction) AsBasicThing() (BasicThing, bool) {
12528 return &ta, true
12529 }
12530
12531
12532 func (ta TouristAttraction) AsEntities() (*Entities, bool) {
12533 return nil, false
12534 }
12535
12536
12537 func (ta TouristAttraction) AsPlaces() (*Places, bool) {
12538 return nil, false
12539 }
12540
12541
12542 func (ta TouristAttraction) AsSearchResponse() (*SearchResponse, bool) {
12543 return nil, false
12544 }
12545
12546
12547 func (ta TouristAttraction) AsResponse() (*Response, bool) {
12548 return nil, false
12549 }
12550
12551
12552 func (ta TouristAttraction) AsBasicResponse() (BasicResponse, bool) {
12553 return &ta, true
12554 }
12555
12556
12557 func (ta TouristAttraction) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
12558 return nil, false
12559 }
12560
12561
12562 func (ta TouristAttraction) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
12563 return nil, false
12564 }
12565
12566
12567 func (ta TouristAttraction) AsIdentifiable() (*Identifiable, bool) {
12568 return nil, false
12569 }
12570
12571
12572 func (ta TouristAttraction) AsBasicIdentifiable() (BasicIdentifiable, bool) {
12573 return &ta, true
12574 }
12575
12576
12577 func (ta TouristAttraction) AsAnswer() (*Answer, bool) {
12578 return nil, false
12579 }
12580
12581
12582 func (ta TouristAttraction) AsBasicAnswer() (BasicAnswer, bool) {
12583 return nil, false
12584 }
12585
12586
12587 func (ta TouristAttraction) AsErrorResponse() (*ErrorResponse, bool) {
12588 return nil, false
12589 }
12590
12591
12592 func (ta TouristAttraction) AsPostalAddress() (*PostalAddress, bool) {
12593 return nil, false
12594 }
12595
12596
12597 func (ta TouristAttraction) AsPlace() (*Place, bool) {
12598 return nil, false
12599 }
12600
12601
12602 func (ta TouristAttraction) AsBasicPlace() (BasicPlace, bool) {
12603 return &ta, true
12604 }
12605
12606
12607 func (ta TouristAttraction) AsOrganization() (*Organization, bool) {
12608 return nil, false
12609 }
12610
12611
12612 func (ta TouristAttraction) AsCreativeWork() (*CreativeWork, bool) {
12613 return nil, false
12614 }
12615
12616
12617 func (ta TouristAttraction) AsBasicCreativeWork() (BasicCreativeWork, bool) {
12618 return nil, false
12619 }
12620
12621
12622 func (ta TouristAttraction) AsIntangible() (*Intangible, bool) {
12623 return nil, false
12624 }
12625
12626
12627 func (ta TouristAttraction) AsBasicIntangible() (BasicIntangible, bool) {
12628 return nil, false
12629 }
12630
12631
12632 func (ta TouristAttraction) AsMovieTheater() (*MovieTheater, bool) {
12633 return nil, false
12634 }
12635
12636
12637 func (ta TouristAttraction) AsMediaObject() (*MediaObject, bool) {
12638 return nil, false
12639 }
12640
12641
12642 func (ta TouristAttraction) AsBasicMediaObject() (BasicMediaObject, bool) {
12643 return nil, false
12644 }
12645
12646
12647 func (ta TouristAttraction) AsCivicStructure() (*CivicStructure, bool) {
12648 return nil, false
12649 }
12650
12651
12652 func (ta TouristAttraction) AsBasicCivicStructure() (BasicCivicStructure, bool) {
12653 return nil, false
12654 }
12655
12656
12657 func (ta TouristAttraction) AsLocalBusiness() (*LocalBusiness, bool) {
12658 return nil, false
12659 }
12660
12661
12662 func (ta TouristAttraction) AsBasicLocalBusiness() (BasicLocalBusiness, bool) {
12663 return nil, false
12664 }
12665
12666
12667 func (ta TouristAttraction) AsTouristAttraction() (*TouristAttraction, bool) {
12668 return &ta, true
12669 }
12670
12671
12672 func (ta TouristAttraction) AsAirport() (*Airport, bool) {
12673 return nil, false
12674 }
12675
12676
12677 func (ta TouristAttraction) AsLicense() (*License, bool) {
12678 return nil, false
12679 }
12680
12681
12682 func (ta TouristAttraction) AsStructuredValue() (*StructuredValue, bool) {
12683 return nil, false
12684 }
12685
12686
12687 func (ta TouristAttraction) AsBasicStructuredValue() (BasicStructuredValue, bool) {
12688 return nil, false
12689 }
12690
12691
12692 func (ta TouristAttraction) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) {
12693 return nil, false
12694 }
12695
12696
12697 func (ta TouristAttraction) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) {
12698 return nil, false
12699 }
12700
12701
12702 func (ta TouristAttraction) AsFoodEstablishment() (*FoodEstablishment, bool) {
12703 return nil, false
12704 }
12705
12706
12707 func (ta TouristAttraction) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) {
12708 return nil, false
12709 }
12710
12711
12712 func (ta TouristAttraction) AsLodgingBusiness() (*LodgingBusiness, bool) {
12713 return nil, false
12714 }
12715
12716
12717 func (ta TouristAttraction) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) {
12718 return nil, false
12719 }
12720
12721
12722 func (ta TouristAttraction) AsRestaurant() (*Restaurant, bool) {
12723 return nil, false
12724 }
12725
12726
12727 func (ta TouristAttraction) AsHotel() (*Hotel, bool) {
12728 return nil, false
12729 }
12730
12731
12732 func (ta TouristAttraction) AsResponseBase() (*ResponseBase, bool) {
12733 return nil, false
12734 }
12735
12736
12737 func (ta TouristAttraction) AsBasicResponseBase() (BasicResponseBase, bool) {
12738 return &ta, true
12739 }
12740
12741
12742 func (ta *TouristAttraction) UnmarshalJSON(body []byte) error {
12743 var m map[string]*json.RawMessage
12744 err := json.Unmarshal(body, &m)
12745 if err != nil {
12746 return err
12747 }
12748 for k, v := range m {
12749 switch k {
12750 case "address":
12751 if v != nil {
12752 var address PostalAddress
12753 err = json.Unmarshal(*v, &address)
12754 if err != nil {
12755 return err
12756 }
12757 ta.Address = &address
12758 }
12759 case "telephone":
12760 if v != nil {
12761 var telephone string
12762 err = json.Unmarshal(*v, &telephone)
12763 if err != nil {
12764 return err
12765 }
12766 ta.Telephone = &telephone
12767 }
12768 case "name":
12769 if v != nil {
12770 var name string
12771 err = json.Unmarshal(*v, &name)
12772 if err != nil {
12773 return err
12774 }
12775 ta.Name = &name
12776 }
12777 case "url":
12778 if v != nil {
12779 var URL string
12780 err = json.Unmarshal(*v, &URL)
12781 if err != nil {
12782 return err
12783 }
12784 ta.URL = &URL
12785 }
12786 case "image":
12787 if v != nil {
12788 var imageVar ImageObject
12789 err = json.Unmarshal(*v, &imageVar)
12790 if err != nil {
12791 return err
12792 }
12793 ta.Image = &imageVar
12794 }
12795 case "description":
12796 if v != nil {
12797 var description string
12798 err = json.Unmarshal(*v, &description)
12799 if err != nil {
12800 return err
12801 }
12802 ta.Description = &description
12803 }
12804 case "entityPresentationInfo":
12805 if v != nil {
12806 var entityPresentationInfo EntitiesEntityPresentationInfo
12807 err = json.Unmarshal(*v, &entityPresentationInfo)
12808 if err != nil {
12809 return err
12810 }
12811 ta.EntityPresentationInfo = &entityPresentationInfo
12812 }
12813 case "bingId":
12814 if v != nil {
12815 var bingID string
12816 err = json.Unmarshal(*v, &bingID)
12817 if err != nil {
12818 return err
12819 }
12820 ta.BingID = &bingID
12821 }
12822 case "contractualRules":
12823 if v != nil {
12824 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v)
12825 if err != nil {
12826 return err
12827 }
12828 ta.ContractualRules = &contractualRules
12829 }
12830 case "webSearchUrl":
12831 if v != nil {
12832 var webSearchURL string
12833 err = json.Unmarshal(*v, &webSearchURL)
12834 if err != nil {
12835 return err
12836 }
12837 ta.WebSearchURL = &webSearchURL
12838 }
12839 case "id":
12840 if v != nil {
12841 var ID string
12842 err = json.Unmarshal(*v, &ID)
12843 if err != nil {
12844 return err
12845 }
12846 ta.ID = &ID
12847 }
12848 case "_type":
12849 if v != nil {
12850 var typeVar TypeBasicResponseBase
12851 err = json.Unmarshal(*v, &typeVar)
12852 if err != nil {
12853 return err
12854 }
12855 ta.Type = typeVar
12856 }
12857 }
12858 }
12859
12860 return nil
12861 }
12862
View as plain text