1package entitysearch 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "encoding/json" 22 "github.com/Azure/go-autorest/autorest" 23) 24 25// AnswerType enumerates the values for answer type. 26type AnswerType string 27 28const ( 29 // AnswerTypeEntities ... 30 AnswerTypeEntities AnswerType = "Entities" 31 // AnswerTypePlaces ... 32 AnswerTypePlaces AnswerType = "Places" 33) 34 35// PossibleAnswerTypeValues returns an array of possible values for the AnswerType const type. 36func PossibleAnswerTypeValues() []AnswerType { 37 return []AnswerType{AnswerTypeEntities, AnswerTypePlaces} 38} 39 40// EntityQueryScenario enumerates the values for entity query scenario. 41type EntityQueryScenario string 42 43const ( 44 // Disambiguation ... 45 Disambiguation EntityQueryScenario = "Disambiguation" 46 // DominantEntity ... 47 DominantEntity EntityQueryScenario = "DominantEntity" 48 // DominantEntityWithDisambiguation ... 49 DominantEntityWithDisambiguation EntityQueryScenario = "DominantEntityWithDisambiguation" 50 // List ... 51 List EntityQueryScenario = "List" 52 // ListWithPivot ... 53 ListWithPivot EntityQueryScenario = "ListWithPivot" 54) 55 56// PossibleEntityQueryScenarioValues returns an array of possible values for the EntityQueryScenario const type. 57func PossibleEntityQueryScenarioValues() []EntityQueryScenario { 58 return []EntityQueryScenario{Disambiguation, DominantEntity, DominantEntityWithDisambiguation, List, ListWithPivot} 59} 60 61// EntityScenario enumerates the values for entity scenario. 62type EntityScenario string 63 64const ( 65 // EntityScenarioDisambiguationItem ... 66 EntityScenarioDisambiguationItem EntityScenario = "DisambiguationItem" 67 // EntityScenarioDominantEntity ... 68 EntityScenarioDominantEntity EntityScenario = "DominantEntity" 69 // EntityScenarioListItem ... 70 EntityScenarioListItem EntityScenario = "ListItem" 71) 72 73// PossibleEntityScenarioValues returns an array of possible values for the EntityScenario const type. 74func PossibleEntityScenarioValues() []EntityScenario { 75 return []EntityScenario{EntityScenarioDisambiguationItem, EntityScenarioDominantEntity, EntityScenarioListItem} 76} 77 78// EntityType enumerates the values for entity type. 79type EntityType string 80 81const ( 82 // EntityTypeActor ... 83 EntityTypeActor EntityType = "Actor" 84 // EntityTypeAnimal ... 85 EntityTypeAnimal EntityType = "Animal" 86 // EntityTypeArtist ... 87 EntityTypeArtist EntityType = "Artist" 88 // EntityTypeAttorney ... 89 EntityTypeAttorney EntityType = "Attorney" 90 // EntityTypeAttraction ... 91 EntityTypeAttraction EntityType = "Attraction" 92 // EntityTypeBook ... 93 EntityTypeBook EntityType = "Book" 94 // EntityTypeCar ... 95 EntityTypeCar EntityType = "Car" 96 // EntityTypeCity ... 97 EntityTypeCity EntityType = "City" 98 // EntityTypeCollegeOrUniversity ... 99 EntityTypeCollegeOrUniversity EntityType = "CollegeOrUniversity" 100 // EntityTypeComposition ... 101 EntityTypeComposition EntityType = "Composition" 102 // EntityTypeContinent ... 103 EntityTypeContinent EntityType = "Continent" 104 // EntityTypeCountry ... 105 EntityTypeCountry EntityType = "Country" 106 // EntityTypeDrug ... 107 EntityTypeDrug EntityType = "Drug" 108 // EntityTypeEvent ... 109 EntityTypeEvent EntityType = "Event" 110 // EntityTypeFood ... 111 EntityTypeFood EntityType = "Food" 112 // EntityTypeGeneric ... 113 EntityTypeGeneric EntityType = "Generic" 114 // EntityTypeHotel ... 115 EntityTypeHotel EntityType = "Hotel" 116 // EntityTypeHouse ... 117 EntityTypeHouse EntityType = "House" 118 // EntityTypeLocalBusiness ... 119 EntityTypeLocalBusiness EntityType = "LocalBusiness" 120 // EntityTypeLocality ... 121 EntityTypeLocality EntityType = "Locality" 122 // EntityTypeMedia ... 123 EntityTypeMedia EntityType = "Media" 124 // EntityTypeMinorRegion ... 125 EntityTypeMinorRegion EntityType = "MinorRegion" 126 // EntityTypeMovie ... 127 EntityTypeMovie EntityType = "Movie" 128 // EntityTypeMusicAlbum ... 129 EntityTypeMusicAlbum EntityType = "MusicAlbum" 130 // EntityTypeMusicGroup ... 131 EntityTypeMusicGroup EntityType = "MusicGroup" 132 // EntityTypeMusicRecording ... 133 EntityTypeMusicRecording EntityType = "MusicRecording" 134 // EntityTypeNeighborhood ... 135 EntityTypeNeighborhood EntityType = "Neighborhood" 136 // EntityTypeOrganization ... 137 EntityTypeOrganization EntityType = "Organization" 138 // EntityTypeOther ... 139 EntityTypeOther EntityType = "Other" 140 // EntityTypePerson ... 141 EntityTypePerson EntityType = "Person" 142 // EntityTypePlace ... 143 EntityTypePlace EntityType = "Place" 144 // EntityTypePointOfInterest ... 145 EntityTypePointOfInterest EntityType = "PointOfInterest" 146 // EntityTypePostalCode ... 147 EntityTypePostalCode EntityType = "PostalCode" 148 // EntityTypeProduct ... 149 EntityTypeProduct EntityType = "Product" 150 // EntityTypeRadioStation ... 151 EntityTypeRadioStation EntityType = "RadioStation" 152 // EntityTypeRegion ... 153 EntityTypeRegion EntityType = "Region" 154 // EntityTypeRestaurant ... 155 EntityTypeRestaurant EntityType = "Restaurant" 156 // EntityTypeSchool ... 157 EntityTypeSchool EntityType = "School" 158 // EntityTypeSpeciality ... 159 EntityTypeSpeciality EntityType = "Speciality" 160 // EntityTypeSportsTeam ... 161 EntityTypeSportsTeam EntityType = "SportsTeam" 162 // EntityTypeState ... 163 EntityTypeState EntityType = "State" 164 // EntityTypeStreetAddress ... 165 EntityTypeStreetAddress EntityType = "StreetAddress" 166 // EntityTypeSubRegion ... 167 EntityTypeSubRegion EntityType = "SubRegion" 168 // EntityTypeTelevisionSeason ... 169 EntityTypeTelevisionSeason EntityType = "TelevisionSeason" 170 // EntityTypeTelevisionShow ... 171 EntityTypeTelevisionShow EntityType = "TelevisionShow" 172 // EntityTypeTheaterPlay ... 173 EntityTypeTheaterPlay EntityType = "TheaterPlay" 174 // EntityTypeTouristAttraction ... 175 EntityTypeTouristAttraction EntityType = "TouristAttraction" 176 // EntityTypeTravel ... 177 EntityTypeTravel EntityType = "Travel" 178 // EntityTypeVideoGame ... 179 EntityTypeVideoGame EntityType = "VideoGame" 180) 181 182// PossibleEntityTypeValues returns an array of possible values for the EntityType const type. 183func PossibleEntityTypeValues() []EntityType { 184 return []EntityType{EntityTypeActor, EntityTypeAnimal, EntityTypeArtist, EntityTypeAttorney, EntityTypeAttraction, EntityTypeBook, EntityTypeCar, EntityTypeCity, EntityTypeCollegeOrUniversity, EntityTypeComposition, EntityTypeContinent, EntityTypeCountry, EntityTypeDrug, EntityTypeEvent, EntityTypeFood, EntityTypeGeneric, EntityTypeHotel, EntityTypeHouse, EntityTypeLocalBusiness, EntityTypeLocality, EntityTypeMedia, EntityTypeMinorRegion, EntityTypeMovie, EntityTypeMusicAlbum, EntityTypeMusicGroup, EntityTypeMusicRecording, EntityTypeNeighborhood, EntityTypeOrganization, EntityTypeOther, EntityTypePerson, EntityTypePlace, EntityTypePointOfInterest, EntityTypePostalCode, EntityTypeProduct, EntityTypeRadioStation, EntityTypeRegion, EntityTypeRestaurant, EntityTypeSchool, EntityTypeSpeciality, EntityTypeSportsTeam, EntityTypeState, EntityTypeStreetAddress, EntityTypeSubRegion, EntityTypeTelevisionSeason, EntityTypeTelevisionShow, EntityTypeTheaterPlay, EntityTypeTouristAttraction, EntityTypeTravel, EntityTypeVideoGame} 185} 186 187// ErrorCode enumerates the values for error code. 188type ErrorCode string 189 190const ( 191 // InsufficientAuthorization ... 192 InsufficientAuthorization ErrorCode = "InsufficientAuthorization" 193 // InvalidAuthorization ... 194 InvalidAuthorization ErrorCode = "InvalidAuthorization" 195 // InvalidRequest ... 196 InvalidRequest ErrorCode = "InvalidRequest" 197 // None ... 198 None ErrorCode = "None" 199 // RateLimitExceeded ... 200 RateLimitExceeded ErrorCode = "RateLimitExceeded" 201 // ServerError ... 202 ServerError ErrorCode = "ServerError" 203) 204 205// PossibleErrorCodeValues returns an array of possible values for the ErrorCode const type. 206func PossibleErrorCodeValues() []ErrorCode { 207 return []ErrorCode{InsufficientAuthorization, InvalidAuthorization, InvalidRequest, None, RateLimitExceeded, ServerError} 208} 209 210// ErrorSubCode enumerates the values for error sub code. 211type ErrorSubCode string 212 213const ( 214 // AuthorizationDisabled ... 215 AuthorizationDisabled ErrorSubCode = "AuthorizationDisabled" 216 // AuthorizationExpired ... 217 AuthorizationExpired ErrorSubCode = "AuthorizationExpired" 218 // AuthorizationMissing ... 219 AuthorizationMissing ErrorSubCode = "AuthorizationMissing" 220 // AuthorizationRedundancy ... 221 AuthorizationRedundancy ErrorSubCode = "AuthorizationRedundancy" 222 // Blocked ... 223 Blocked ErrorSubCode = "Blocked" 224 // HTTPNotAllowed ... 225 HTTPNotAllowed ErrorSubCode = "HttpNotAllowed" 226 // NotImplemented ... 227 NotImplemented ErrorSubCode = "NotImplemented" 228 // ParameterInvalidValue ... 229 ParameterInvalidValue ErrorSubCode = "ParameterInvalidValue" 230 // ParameterMissing ... 231 ParameterMissing ErrorSubCode = "ParameterMissing" 232 // ResourceError ... 233 ResourceError ErrorSubCode = "ResourceError" 234 // UnexpectedError ... 235 UnexpectedError ErrorSubCode = "UnexpectedError" 236) 237 238// PossibleErrorSubCodeValues returns an array of possible values for the ErrorSubCode const type. 239func PossibleErrorSubCodeValues() []ErrorSubCode { 240 return []ErrorSubCode{AuthorizationDisabled, AuthorizationExpired, AuthorizationMissing, AuthorizationRedundancy, Blocked, HTTPNotAllowed, NotImplemented, ParameterInvalidValue, ParameterMissing, ResourceError, UnexpectedError} 241} 242 243// ResponseFormat enumerates the values for response format. 244type ResponseFormat string 245 246const ( 247 // JSON ... 248 JSON ResponseFormat = "Json" 249 // JSONLd ... 250 JSONLd ResponseFormat = "JsonLd" 251) 252 253// PossibleResponseFormatValues returns an array of possible values for the ResponseFormat const type. 254func PossibleResponseFormatValues() []ResponseFormat { 255 return []ResponseFormat{JSON, JSONLd} 256} 257 258// SafeSearch enumerates the values for safe search. 259type SafeSearch string 260 261const ( 262 // Moderate ... 263 Moderate SafeSearch = "Moderate" 264 // Off ... 265 Off SafeSearch = "Off" 266 // Strict ... 267 Strict SafeSearch = "Strict" 268) 269 270// PossibleSafeSearchValues returns an array of possible values for the SafeSearch const type. 271func PossibleSafeSearchValues() []SafeSearch { 272 return []SafeSearch{Moderate, Off, Strict} 273} 274 275// Type enumerates the values for type. 276type Type string 277 278const ( 279 // TypeContractualRulesAttribution ... 280 TypeContractualRulesAttribution Type = "ContractualRules/Attribution" 281 // TypeContractualRulesContractualRule ... 282 TypeContractualRulesContractualRule Type = "ContractualRules/ContractualRule" 283 // TypeContractualRulesLicenseAttribution ... 284 TypeContractualRulesLicenseAttribution Type = "ContractualRules/LicenseAttribution" 285 // TypeContractualRulesLinkAttribution ... 286 TypeContractualRulesLinkAttribution Type = "ContractualRules/LinkAttribution" 287 // TypeContractualRulesMediaAttribution ... 288 TypeContractualRulesMediaAttribution Type = "ContractualRules/MediaAttribution" 289 // TypeContractualRulesTextAttribution ... 290 TypeContractualRulesTextAttribution Type = "ContractualRules/TextAttribution" 291) 292 293// PossibleTypeValues returns an array of possible values for the Type const type. 294func PossibleTypeValues() []Type { 295 return []Type{TypeContractualRulesAttribution, TypeContractualRulesContractualRule, TypeContractualRulesLicenseAttribution, TypeContractualRulesLinkAttribution, TypeContractualRulesMediaAttribution, TypeContractualRulesTextAttribution} 296} 297 298// TypeBasicResponseBase enumerates the values for type basic response base. 299type TypeBasicResponseBase string 300 301const ( 302 // TypeAirport ... 303 TypeAirport TypeBasicResponseBase = "Airport" 304 // TypeAnswer ... 305 TypeAnswer TypeBasicResponseBase = "Answer" 306 // TypeCivicStructure ... 307 TypeCivicStructure TypeBasicResponseBase = "CivicStructure" 308 // TypeCreativeWork ... 309 TypeCreativeWork TypeBasicResponseBase = "CreativeWork" 310 // TypeEntertainmentBusiness ... 311 TypeEntertainmentBusiness TypeBasicResponseBase = "EntertainmentBusiness" 312 // TypeEntities ... 313 TypeEntities TypeBasicResponseBase = "Entities" 314 // TypeErrorResponse ... 315 TypeErrorResponse TypeBasicResponseBase = "ErrorResponse" 316 // TypeFoodEstablishment ... 317 TypeFoodEstablishment TypeBasicResponseBase = "FoodEstablishment" 318 // TypeHotel ... 319 TypeHotel TypeBasicResponseBase = "Hotel" 320 // TypeIdentifiable ... 321 TypeIdentifiable TypeBasicResponseBase = "Identifiable" 322 // TypeImageObject ... 323 TypeImageObject TypeBasicResponseBase = "ImageObject" 324 // TypeIntangible ... 325 TypeIntangible TypeBasicResponseBase = "Intangible" 326 // TypeLicense ... 327 TypeLicense TypeBasicResponseBase = "License" 328 // TypeLocalBusiness ... 329 TypeLocalBusiness TypeBasicResponseBase = "LocalBusiness" 330 // TypeLodgingBusiness ... 331 TypeLodgingBusiness TypeBasicResponseBase = "LodgingBusiness" 332 // TypeMediaObject ... 333 TypeMediaObject TypeBasicResponseBase = "MediaObject" 334 // TypeMovieTheater ... 335 TypeMovieTheater TypeBasicResponseBase = "MovieTheater" 336 // TypeOrganization ... 337 TypeOrganization TypeBasicResponseBase = "Organization" 338 // TypePlace ... 339 TypePlace TypeBasicResponseBase = "Place" 340 // TypePlaces ... 341 TypePlaces TypeBasicResponseBase = "Places" 342 // TypePostalAddress ... 343 TypePostalAddress TypeBasicResponseBase = "PostalAddress" 344 // TypeResponse ... 345 TypeResponse TypeBasicResponseBase = "Response" 346 // TypeResponseBase ... 347 TypeResponseBase TypeBasicResponseBase = "ResponseBase" 348 // TypeRestaurant ... 349 TypeRestaurant TypeBasicResponseBase = "Restaurant" 350 // TypeSearchResponse ... 351 TypeSearchResponse TypeBasicResponseBase = "SearchResponse" 352 // TypeSearchResultsAnswer ... 353 TypeSearchResultsAnswer TypeBasicResponseBase = "SearchResultsAnswer" 354 // TypeStructuredValue ... 355 TypeStructuredValue TypeBasicResponseBase = "StructuredValue" 356 // TypeThing ... 357 TypeThing TypeBasicResponseBase = "Thing" 358 // TypeTouristAttraction ... 359 TypeTouristAttraction TypeBasicResponseBase = "TouristAttraction" 360) 361 362// PossibleTypeBasicResponseBaseValues returns an array of possible values for the TypeBasicResponseBase const type. 363func PossibleTypeBasicResponseBaseValues() []TypeBasicResponseBase { 364 return []TypeBasicResponseBase{TypeAirport, TypeAnswer, TypeCivicStructure, TypeCreativeWork, TypeEntertainmentBusiness, TypeEntities, TypeErrorResponse, TypeFoodEstablishment, TypeHotel, TypeIdentifiable, TypeImageObject, TypeIntangible, TypeLicense, TypeLocalBusiness, TypeLodgingBusiness, TypeMediaObject, TypeMovieTheater, TypeOrganization, TypePlace, TypePlaces, TypePostalAddress, TypeResponse, TypeResponseBase, TypeRestaurant, TypeSearchResponse, TypeSearchResultsAnswer, TypeStructuredValue, TypeThing, TypeTouristAttraction} 365} 366 367// Airport ... 368type Airport struct { 369 IataCode *string `json:"iataCode,omitempty"` 370 IcaoCode *string `json:"icaoCode,omitempty"` 371 // Address - The postal address of where the entity is located 372 Address *PostalAddress `json:"address,omitempty"` 373 // Telephone - The entity's telephone number 374 Telephone *string `json:"telephone,omitempty"` 375 // Name - The name of the thing represented by this object. 376 Name *string `json:"name,omitempty"` 377 // URL - The URL to get more information about the thing represented by this object. 378 URL *string `json:"url,omitempty"` 379 Image *ImageObject `json:"image,omitempty"` 380 // Description - A short description of the item. 381 Description *string `json:"description,omitempty"` 382 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 383 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 384 // BingID - An ID that uniquely identifies this item. 385 BingID *string `json:"bingId,omitempty"` 386 // ContractualRules - A list of rules that you must adhere to if you display the item. 387 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 388 // WebSearchURL - The URL To Bing's search result for this item. 389 WebSearchURL *string `json:"webSearchUrl,omitempty"` 390 // ID - A String identifier. 391 ID *string `json:"id,omitempty"` 392 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 393 Type TypeBasicResponseBase `json:"_type,omitempty"` 394} 395 396// MarshalJSON is the custom marshaler for Airport. 397func (a Airport) MarshalJSON() ([]byte, error) { 398 a.Type = TypeAirport 399 objectMap := make(map[string]interface{}) 400 if a.IataCode != nil { 401 objectMap["iataCode"] = a.IataCode 402 } 403 if a.IcaoCode != nil { 404 objectMap["icaoCode"] = a.IcaoCode 405 } 406 if a.Address != nil { 407 objectMap["address"] = a.Address 408 } 409 if a.Telephone != nil { 410 objectMap["telephone"] = a.Telephone 411 } 412 if a.Name != nil { 413 objectMap["name"] = a.Name 414 } 415 if a.URL != nil { 416 objectMap["url"] = a.URL 417 } 418 if a.Image != nil { 419 objectMap["image"] = a.Image 420 } 421 if a.Description != nil { 422 objectMap["description"] = a.Description 423 } 424 if a.EntityPresentationInfo != nil { 425 objectMap["entityPresentationInfo"] = a.EntityPresentationInfo 426 } 427 if a.BingID != nil { 428 objectMap["bingId"] = a.BingID 429 } 430 if a.ContractualRules != nil { 431 objectMap["contractualRules"] = a.ContractualRules 432 } 433 if a.WebSearchURL != nil { 434 objectMap["webSearchUrl"] = a.WebSearchURL 435 } 436 if a.ID != nil { 437 objectMap["id"] = a.ID 438 } 439 if a.Type != "" { 440 objectMap["_type"] = a.Type 441 } 442 return json.Marshal(objectMap) 443} 444 445// AsImageObject is the BasicResponseBase implementation for Airport. 446func (a Airport) AsImageObject() (*ImageObject, bool) { 447 return nil, false 448} 449 450// AsThing is the BasicResponseBase implementation for Airport. 451func (a Airport) AsThing() (*Thing, bool) { 452 return nil, false 453} 454 455// AsBasicThing is the BasicResponseBase implementation for Airport. 456func (a Airport) AsBasicThing() (BasicThing, bool) { 457 return &a, true 458} 459 460// AsEntities is the BasicResponseBase implementation for Airport. 461func (a Airport) AsEntities() (*Entities, bool) { 462 return nil, false 463} 464 465// AsPlaces is the BasicResponseBase implementation for Airport. 466func (a Airport) AsPlaces() (*Places, bool) { 467 return nil, false 468} 469 470// AsSearchResponse is the BasicResponseBase implementation for Airport. 471func (a Airport) AsSearchResponse() (*SearchResponse, bool) { 472 return nil, false 473} 474 475// AsResponse is the BasicResponseBase implementation for Airport. 476func (a Airport) AsResponse() (*Response, bool) { 477 return nil, false 478} 479 480// AsBasicResponse is the BasicResponseBase implementation for Airport. 481func (a Airport) AsBasicResponse() (BasicResponse, bool) { 482 return &a, true 483} 484 485// AsSearchResultsAnswer is the BasicResponseBase implementation for Airport. 486func (a Airport) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 487 return nil, false 488} 489 490// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Airport. 491func (a Airport) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 492 return nil, false 493} 494 495// AsIdentifiable is the BasicResponseBase implementation for Airport. 496func (a Airport) AsIdentifiable() (*Identifiable, bool) { 497 return nil, false 498} 499 500// AsBasicIdentifiable is the BasicResponseBase implementation for Airport. 501func (a Airport) AsBasicIdentifiable() (BasicIdentifiable, bool) { 502 return &a, true 503} 504 505// AsAnswer is the BasicResponseBase implementation for Airport. 506func (a Airport) AsAnswer() (*Answer, bool) { 507 return nil, false 508} 509 510// AsBasicAnswer is the BasicResponseBase implementation for Airport. 511func (a Airport) AsBasicAnswer() (BasicAnswer, bool) { 512 return nil, false 513} 514 515// AsErrorResponse is the BasicResponseBase implementation for Airport. 516func (a Airport) AsErrorResponse() (*ErrorResponse, bool) { 517 return nil, false 518} 519 520// AsPostalAddress is the BasicResponseBase implementation for Airport. 521func (a Airport) AsPostalAddress() (*PostalAddress, bool) { 522 return nil, false 523} 524 525// AsPlace is the BasicResponseBase implementation for Airport. 526func (a Airport) AsPlace() (*Place, bool) { 527 return nil, false 528} 529 530// AsBasicPlace is the BasicResponseBase implementation for Airport. 531func (a Airport) AsBasicPlace() (BasicPlace, bool) { 532 return &a, true 533} 534 535// AsOrganization is the BasicResponseBase implementation for Airport. 536func (a Airport) AsOrganization() (*Organization, bool) { 537 return nil, false 538} 539 540// AsCreativeWork is the BasicResponseBase implementation for Airport. 541func (a Airport) AsCreativeWork() (*CreativeWork, bool) { 542 return nil, false 543} 544 545// AsBasicCreativeWork is the BasicResponseBase implementation for Airport. 546func (a Airport) AsBasicCreativeWork() (BasicCreativeWork, bool) { 547 return nil, false 548} 549 550// AsIntangible is the BasicResponseBase implementation for Airport. 551func (a Airport) AsIntangible() (*Intangible, bool) { 552 return nil, false 553} 554 555// AsBasicIntangible is the BasicResponseBase implementation for Airport. 556func (a Airport) AsBasicIntangible() (BasicIntangible, bool) { 557 return nil, false 558} 559 560// AsMovieTheater is the BasicResponseBase implementation for Airport. 561func (a Airport) AsMovieTheater() (*MovieTheater, bool) { 562 return nil, false 563} 564 565// AsMediaObject is the BasicResponseBase implementation for Airport. 566func (a Airport) AsMediaObject() (*MediaObject, bool) { 567 return nil, false 568} 569 570// AsBasicMediaObject is the BasicResponseBase implementation for Airport. 571func (a Airport) AsBasicMediaObject() (BasicMediaObject, bool) { 572 return nil, false 573} 574 575// AsCivicStructure is the BasicResponseBase implementation for Airport. 576func (a Airport) AsCivicStructure() (*CivicStructure, bool) { 577 return nil, false 578} 579 580// AsBasicCivicStructure is the BasicResponseBase implementation for Airport. 581func (a Airport) AsBasicCivicStructure() (BasicCivicStructure, bool) { 582 return &a, true 583} 584 585// AsLocalBusiness is the BasicResponseBase implementation for Airport. 586func (a Airport) AsLocalBusiness() (*LocalBusiness, bool) { 587 return nil, false 588} 589 590// AsBasicLocalBusiness is the BasicResponseBase implementation for Airport. 591func (a Airport) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 592 return nil, false 593} 594 595// AsTouristAttraction is the BasicResponseBase implementation for Airport. 596func (a Airport) AsTouristAttraction() (*TouristAttraction, bool) { 597 return nil, false 598} 599 600// AsAirport is the BasicResponseBase implementation for Airport. 601func (a Airport) AsAirport() (*Airport, bool) { 602 return &a, true 603} 604 605// AsLicense is the BasicResponseBase implementation for Airport. 606func (a Airport) AsLicense() (*License, bool) { 607 return nil, false 608} 609 610// AsStructuredValue is the BasicResponseBase implementation for Airport. 611func (a Airport) AsStructuredValue() (*StructuredValue, bool) { 612 return nil, false 613} 614 615// AsBasicStructuredValue is the BasicResponseBase implementation for Airport. 616func (a Airport) AsBasicStructuredValue() (BasicStructuredValue, bool) { 617 return nil, false 618} 619 620// AsEntertainmentBusiness is the BasicResponseBase implementation for Airport. 621func (a Airport) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 622 return nil, false 623} 624 625// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Airport. 626func (a Airport) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 627 return nil, false 628} 629 630// AsFoodEstablishment is the BasicResponseBase implementation for Airport. 631func (a Airport) AsFoodEstablishment() (*FoodEstablishment, bool) { 632 return nil, false 633} 634 635// AsBasicFoodEstablishment is the BasicResponseBase implementation for Airport. 636func (a Airport) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 637 return nil, false 638} 639 640// AsLodgingBusiness is the BasicResponseBase implementation for Airport. 641func (a Airport) AsLodgingBusiness() (*LodgingBusiness, bool) { 642 return nil, false 643} 644 645// AsBasicLodgingBusiness is the BasicResponseBase implementation for Airport. 646func (a Airport) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 647 return nil, false 648} 649 650// AsRestaurant is the BasicResponseBase implementation for Airport. 651func (a Airport) AsRestaurant() (*Restaurant, bool) { 652 return nil, false 653} 654 655// AsHotel is the BasicResponseBase implementation for Airport. 656func (a Airport) AsHotel() (*Hotel, bool) { 657 return nil, false 658} 659 660// AsResponseBase is the BasicResponseBase implementation for Airport. 661func (a Airport) AsResponseBase() (*ResponseBase, bool) { 662 return nil, false 663} 664 665// AsBasicResponseBase is the BasicResponseBase implementation for Airport. 666func (a Airport) AsBasicResponseBase() (BasicResponseBase, bool) { 667 return &a, true 668} 669 670// UnmarshalJSON is the custom unmarshaler for Airport struct. 671func (a *Airport) UnmarshalJSON(body []byte) error { 672 var m map[string]*json.RawMessage 673 err := json.Unmarshal(body, &m) 674 if err != nil { 675 return err 676 } 677 for k, v := range m { 678 switch k { 679 case "iataCode": 680 if v != nil { 681 var iataCode string 682 err = json.Unmarshal(*v, &iataCode) 683 if err != nil { 684 return err 685 } 686 a.IataCode = &iataCode 687 } 688 case "icaoCode": 689 if v != nil { 690 var icaoCode string 691 err = json.Unmarshal(*v, &icaoCode) 692 if err != nil { 693 return err 694 } 695 a.IcaoCode = &icaoCode 696 } 697 case "address": 698 if v != nil { 699 var address PostalAddress 700 err = json.Unmarshal(*v, &address) 701 if err != nil { 702 return err 703 } 704 a.Address = &address 705 } 706 case "telephone": 707 if v != nil { 708 var telephone string 709 err = json.Unmarshal(*v, &telephone) 710 if err != nil { 711 return err 712 } 713 a.Telephone = &telephone 714 } 715 case "name": 716 if v != nil { 717 var name string 718 err = json.Unmarshal(*v, &name) 719 if err != nil { 720 return err 721 } 722 a.Name = &name 723 } 724 case "url": 725 if v != nil { 726 var URL string 727 err = json.Unmarshal(*v, &URL) 728 if err != nil { 729 return err 730 } 731 a.URL = &URL 732 } 733 case "image": 734 if v != nil { 735 var imageVar ImageObject 736 err = json.Unmarshal(*v, &imageVar) 737 if err != nil { 738 return err 739 } 740 a.Image = &imageVar 741 } 742 case "description": 743 if v != nil { 744 var description string 745 err = json.Unmarshal(*v, &description) 746 if err != nil { 747 return err 748 } 749 a.Description = &description 750 } 751 case "entityPresentationInfo": 752 if v != nil { 753 var entityPresentationInfo EntitiesEntityPresentationInfo 754 err = json.Unmarshal(*v, &entityPresentationInfo) 755 if err != nil { 756 return err 757 } 758 a.EntityPresentationInfo = &entityPresentationInfo 759 } 760 case "bingId": 761 if v != nil { 762 var bingID string 763 err = json.Unmarshal(*v, &bingID) 764 if err != nil { 765 return err 766 } 767 a.BingID = &bingID 768 } 769 case "contractualRules": 770 if v != nil { 771 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 772 if err != nil { 773 return err 774 } 775 a.ContractualRules = &contractualRules 776 } 777 case "webSearchUrl": 778 if v != nil { 779 var webSearchURL string 780 err = json.Unmarshal(*v, &webSearchURL) 781 if err != nil { 782 return err 783 } 784 a.WebSearchURL = &webSearchURL 785 } 786 case "id": 787 if v != nil { 788 var ID string 789 err = json.Unmarshal(*v, &ID) 790 if err != nil { 791 return err 792 } 793 a.ID = &ID 794 } 795 case "_type": 796 if v != nil { 797 var typeVar TypeBasicResponseBase 798 err = json.Unmarshal(*v, &typeVar) 799 if err != nil { 800 return err 801 } 802 a.Type = typeVar 803 } 804 } 805 } 806 807 return nil 808} 809 810// BasicAnswer ... 811type BasicAnswer interface { 812 AsEntities() (*Entities, bool) 813 AsPlaces() (*Places, bool) 814 AsSearchResultsAnswer() (*SearchResultsAnswer, bool) 815 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) 816 AsAnswer() (*Answer, bool) 817} 818 819// Answer ... 820type Answer struct { 821 // ContractualRules - A list of rules that you must adhere to if you display the item. 822 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 823 // WebSearchURL - The URL To Bing's search result for this item. 824 WebSearchURL *string `json:"webSearchUrl,omitempty"` 825 // ID - A String identifier. 826 ID *string `json:"id,omitempty"` 827 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 828 Type TypeBasicResponseBase `json:"_type,omitempty"` 829} 830 831func unmarshalBasicAnswer(body []byte) (BasicAnswer, error) { 832 var m map[string]interface{} 833 err := json.Unmarshal(body, &m) 834 if err != nil { 835 return nil, err 836 } 837 838 switch m["_type"] { 839 case string(TypeEntities): 840 var e Entities 841 err := json.Unmarshal(body, &e) 842 return e, err 843 case string(TypePlaces): 844 var p Places 845 err := json.Unmarshal(body, &p) 846 return p, err 847 case string(TypeSearchResultsAnswer): 848 var sra SearchResultsAnswer 849 err := json.Unmarshal(body, &sra) 850 return sra, err 851 default: 852 var a Answer 853 err := json.Unmarshal(body, &a) 854 return a, err 855 } 856} 857func unmarshalBasicAnswerArray(body []byte) ([]BasicAnswer, error) { 858 var rawMessages []*json.RawMessage 859 err := json.Unmarshal(body, &rawMessages) 860 if err != nil { 861 return nil, err 862 } 863 864 aArray := make([]BasicAnswer, len(rawMessages)) 865 866 for index, rawMessage := range rawMessages { 867 a, err := unmarshalBasicAnswer(*rawMessage) 868 if err != nil { 869 return nil, err 870 } 871 aArray[index] = a 872 } 873 return aArray, nil 874} 875 876// MarshalJSON is the custom marshaler for Answer. 877func (a Answer) MarshalJSON() ([]byte, error) { 878 a.Type = TypeAnswer 879 objectMap := make(map[string]interface{}) 880 if a.ContractualRules != nil { 881 objectMap["contractualRules"] = a.ContractualRules 882 } 883 if a.WebSearchURL != nil { 884 objectMap["webSearchUrl"] = a.WebSearchURL 885 } 886 if a.ID != nil { 887 objectMap["id"] = a.ID 888 } 889 if a.Type != "" { 890 objectMap["_type"] = a.Type 891 } 892 return json.Marshal(objectMap) 893} 894 895// AsImageObject is the BasicResponseBase implementation for Answer. 896func (a Answer) AsImageObject() (*ImageObject, bool) { 897 return nil, false 898} 899 900// AsThing is the BasicResponseBase implementation for Answer. 901func (a Answer) AsThing() (*Thing, bool) { 902 return nil, false 903} 904 905// AsBasicThing is the BasicResponseBase implementation for Answer. 906func (a Answer) AsBasicThing() (BasicThing, bool) { 907 return nil, false 908} 909 910// AsEntities is the BasicResponseBase implementation for Answer. 911func (a Answer) AsEntities() (*Entities, bool) { 912 return nil, false 913} 914 915// AsPlaces is the BasicResponseBase implementation for Answer. 916func (a Answer) AsPlaces() (*Places, bool) { 917 return nil, false 918} 919 920// AsSearchResponse is the BasicResponseBase implementation for Answer. 921func (a Answer) AsSearchResponse() (*SearchResponse, bool) { 922 return nil, false 923} 924 925// AsResponse is the BasicResponseBase implementation for Answer. 926func (a Answer) AsResponse() (*Response, bool) { 927 return nil, false 928} 929 930// AsBasicResponse is the BasicResponseBase implementation for Answer. 931func (a Answer) AsBasicResponse() (BasicResponse, bool) { 932 return &a, true 933} 934 935// AsSearchResultsAnswer is the BasicResponseBase implementation for Answer. 936func (a Answer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 937 return nil, false 938} 939 940// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Answer. 941func (a Answer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 942 return nil, false 943} 944 945// AsIdentifiable is the BasicResponseBase implementation for Answer. 946func (a Answer) AsIdentifiable() (*Identifiable, bool) { 947 return nil, false 948} 949 950// AsBasicIdentifiable is the BasicResponseBase implementation for Answer. 951func (a Answer) AsBasicIdentifiable() (BasicIdentifiable, bool) { 952 return &a, true 953} 954 955// AsAnswer is the BasicResponseBase implementation for Answer. 956func (a Answer) AsAnswer() (*Answer, bool) { 957 return &a, true 958} 959 960// AsBasicAnswer is the BasicResponseBase implementation for Answer. 961func (a Answer) AsBasicAnswer() (BasicAnswer, bool) { 962 return &a, true 963} 964 965// AsErrorResponse is the BasicResponseBase implementation for Answer. 966func (a Answer) AsErrorResponse() (*ErrorResponse, bool) { 967 return nil, false 968} 969 970// AsPostalAddress is the BasicResponseBase implementation for Answer. 971func (a Answer) AsPostalAddress() (*PostalAddress, bool) { 972 return nil, false 973} 974 975// AsPlace is the BasicResponseBase implementation for Answer. 976func (a Answer) AsPlace() (*Place, bool) { 977 return nil, false 978} 979 980// AsBasicPlace is the BasicResponseBase implementation for Answer. 981func (a Answer) AsBasicPlace() (BasicPlace, bool) { 982 return nil, false 983} 984 985// AsOrganization is the BasicResponseBase implementation for Answer. 986func (a Answer) AsOrganization() (*Organization, bool) { 987 return nil, false 988} 989 990// AsCreativeWork is the BasicResponseBase implementation for Answer. 991func (a Answer) AsCreativeWork() (*CreativeWork, bool) { 992 return nil, false 993} 994 995// AsBasicCreativeWork is the BasicResponseBase implementation for Answer. 996func (a Answer) AsBasicCreativeWork() (BasicCreativeWork, bool) { 997 return nil, false 998} 999 1000// AsIntangible is the BasicResponseBase implementation for Answer. 1001func (a Answer) AsIntangible() (*Intangible, bool) { 1002 return nil, false 1003} 1004 1005// AsBasicIntangible is the BasicResponseBase implementation for Answer. 1006func (a Answer) AsBasicIntangible() (BasicIntangible, bool) { 1007 return nil, false 1008} 1009 1010// AsMovieTheater is the BasicResponseBase implementation for Answer. 1011func (a Answer) AsMovieTheater() (*MovieTheater, bool) { 1012 return nil, false 1013} 1014 1015// AsMediaObject is the BasicResponseBase implementation for Answer. 1016func (a Answer) AsMediaObject() (*MediaObject, bool) { 1017 return nil, false 1018} 1019 1020// AsBasicMediaObject is the BasicResponseBase implementation for Answer. 1021func (a Answer) AsBasicMediaObject() (BasicMediaObject, bool) { 1022 return nil, false 1023} 1024 1025// AsCivicStructure is the BasicResponseBase implementation for Answer. 1026func (a Answer) AsCivicStructure() (*CivicStructure, bool) { 1027 return nil, false 1028} 1029 1030// AsBasicCivicStructure is the BasicResponseBase implementation for Answer. 1031func (a Answer) AsBasicCivicStructure() (BasicCivicStructure, bool) { 1032 return nil, false 1033} 1034 1035// AsLocalBusiness is the BasicResponseBase implementation for Answer. 1036func (a Answer) AsLocalBusiness() (*LocalBusiness, bool) { 1037 return nil, false 1038} 1039 1040// AsBasicLocalBusiness is the BasicResponseBase implementation for Answer. 1041func (a Answer) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 1042 return nil, false 1043} 1044 1045// AsTouristAttraction is the BasicResponseBase implementation for Answer. 1046func (a Answer) AsTouristAttraction() (*TouristAttraction, bool) { 1047 return nil, false 1048} 1049 1050// AsAirport is the BasicResponseBase implementation for Answer. 1051func (a Answer) AsAirport() (*Airport, bool) { 1052 return nil, false 1053} 1054 1055// AsLicense is the BasicResponseBase implementation for Answer. 1056func (a Answer) AsLicense() (*License, bool) { 1057 return nil, false 1058} 1059 1060// AsStructuredValue is the BasicResponseBase implementation for Answer. 1061func (a Answer) AsStructuredValue() (*StructuredValue, bool) { 1062 return nil, false 1063} 1064 1065// AsBasicStructuredValue is the BasicResponseBase implementation for Answer. 1066func (a Answer) AsBasicStructuredValue() (BasicStructuredValue, bool) { 1067 return nil, false 1068} 1069 1070// AsEntertainmentBusiness is the BasicResponseBase implementation for Answer. 1071func (a Answer) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 1072 return nil, false 1073} 1074 1075// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Answer. 1076func (a Answer) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 1077 return nil, false 1078} 1079 1080// AsFoodEstablishment is the BasicResponseBase implementation for Answer. 1081func (a Answer) AsFoodEstablishment() (*FoodEstablishment, bool) { 1082 return nil, false 1083} 1084 1085// AsBasicFoodEstablishment is the BasicResponseBase implementation for Answer. 1086func (a Answer) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 1087 return nil, false 1088} 1089 1090// AsLodgingBusiness is the BasicResponseBase implementation for Answer. 1091func (a Answer) AsLodgingBusiness() (*LodgingBusiness, bool) { 1092 return nil, false 1093} 1094 1095// AsBasicLodgingBusiness is the BasicResponseBase implementation for Answer. 1096func (a Answer) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 1097 return nil, false 1098} 1099 1100// AsRestaurant is the BasicResponseBase implementation for Answer. 1101func (a Answer) AsRestaurant() (*Restaurant, bool) { 1102 return nil, false 1103} 1104 1105// AsHotel is the BasicResponseBase implementation for Answer. 1106func (a Answer) AsHotel() (*Hotel, bool) { 1107 return nil, false 1108} 1109 1110// AsResponseBase is the BasicResponseBase implementation for Answer. 1111func (a Answer) AsResponseBase() (*ResponseBase, bool) { 1112 return nil, false 1113} 1114 1115// AsBasicResponseBase is the BasicResponseBase implementation for Answer. 1116func (a Answer) AsBasicResponseBase() (BasicResponseBase, bool) { 1117 return &a, true 1118} 1119 1120// UnmarshalJSON is the custom unmarshaler for Answer struct. 1121func (a *Answer) UnmarshalJSON(body []byte) error { 1122 var m map[string]*json.RawMessage 1123 err := json.Unmarshal(body, &m) 1124 if err != nil { 1125 return err 1126 } 1127 for k, v := range m { 1128 switch k { 1129 case "contractualRules": 1130 if v != nil { 1131 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 1132 if err != nil { 1133 return err 1134 } 1135 a.ContractualRules = &contractualRules 1136 } 1137 case "webSearchUrl": 1138 if v != nil { 1139 var webSearchURL string 1140 err = json.Unmarshal(*v, &webSearchURL) 1141 if err != nil { 1142 return err 1143 } 1144 a.WebSearchURL = &webSearchURL 1145 } 1146 case "id": 1147 if v != nil { 1148 var ID string 1149 err = json.Unmarshal(*v, &ID) 1150 if err != nil { 1151 return err 1152 } 1153 a.ID = &ID 1154 } 1155 case "_type": 1156 if v != nil { 1157 var typeVar TypeBasicResponseBase 1158 err = json.Unmarshal(*v, &typeVar) 1159 if err != nil { 1160 return err 1161 } 1162 a.Type = typeVar 1163 } 1164 } 1165 } 1166 1167 return nil 1168} 1169 1170// BasicCivicStructure ... 1171type BasicCivicStructure interface { 1172 AsAirport() (*Airport, bool) 1173 AsCivicStructure() (*CivicStructure, bool) 1174} 1175 1176// CivicStructure ... 1177type CivicStructure struct { 1178 // Address - The postal address of where the entity is located 1179 Address *PostalAddress `json:"address,omitempty"` 1180 // Telephone - The entity's telephone number 1181 Telephone *string `json:"telephone,omitempty"` 1182 // Name - The name of the thing represented by this object. 1183 Name *string `json:"name,omitempty"` 1184 // URL - The URL to get more information about the thing represented by this object. 1185 URL *string `json:"url,omitempty"` 1186 Image *ImageObject `json:"image,omitempty"` 1187 // Description - A short description of the item. 1188 Description *string `json:"description,omitempty"` 1189 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 1190 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 1191 // BingID - An ID that uniquely identifies this item. 1192 BingID *string `json:"bingId,omitempty"` 1193 // ContractualRules - A list of rules that you must adhere to if you display the item. 1194 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 1195 // WebSearchURL - The URL To Bing's search result for this item. 1196 WebSearchURL *string `json:"webSearchUrl,omitempty"` 1197 // ID - A String identifier. 1198 ID *string `json:"id,omitempty"` 1199 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 1200 Type TypeBasicResponseBase `json:"_type,omitempty"` 1201} 1202 1203func unmarshalBasicCivicStructure(body []byte) (BasicCivicStructure, error) { 1204 var m map[string]interface{} 1205 err := json.Unmarshal(body, &m) 1206 if err != nil { 1207 return nil, err 1208 } 1209 1210 switch m["_type"] { 1211 case string(TypeAirport): 1212 var a Airport 1213 err := json.Unmarshal(body, &a) 1214 return a, err 1215 default: 1216 var cs CivicStructure 1217 err := json.Unmarshal(body, &cs) 1218 return cs, err 1219 } 1220} 1221func unmarshalBasicCivicStructureArray(body []byte) ([]BasicCivicStructure, error) { 1222 var rawMessages []*json.RawMessage 1223 err := json.Unmarshal(body, &rawMessages) 1224 if err != nil { 1225 return nil, err 1226 } 1227 1228 csArray := make([]BasicCivicStructure, len(rawMessages)) 1229 1230 for index, rawMessage := range rawMessages { 1231 cs, err := unmarshalBasicCivicStructure(*rawMessage) 1232 if err != nil { 1233 return nil, err 1234 } 1235 csArray[index] = cs 1236 } 1237 return csArray, nil 1238} 1239 1240// MarshalJSON is the custom marshaler for CivicStructure. 1241func (cs CivicStructure) MarshalJSON() ([]byte, error) { 1242 cs.Type = TypeCivicStructure 1243 objectMap := make(map[string]interface{}) 1244 if cs.Address != nil { 1245 objectMap["address"] = cs.Address 1246 } 1247 if cs.Telephone != nil { 1248 objectMap["telephone"] = cs.Telephone 1249 } 1250 if cs.Name != nil { 1251 objectMap["name"] = cs.Name 1252 } 1253 if cs.URL != nil { 1254 objectMap["url"] = cs.URL 1255 } 1256 if cs.Image != nil { 1257 objectMap["image"] = cs.Image 1258 } 1259 if cs.Description != nil { 1260 objectMap["description"] = cs.Description 1261 } 1262 if cs.EntityPresentationInfo != nil { 1263 objectMap["entityPresentationInfo"] = cs.EntityPresentationInfo 1264 } 1265 if cs.BingID != nil { 1266 objectMap["bingId"] = cs.BingID 1267 } 1268 if cs.ContractualRules != nil { 1269 objectMap["contractualRules"] = cs.ContractualRules 1270 } 1271 if cs.WebSearchURL != nil { 1272 objectMap["webSearchUrl"] = cs.WebSearchURL 1273 } 1274 if cs.ID != nil { 1275 objectMap["id"] = cs.ID 1276 } 1277 if cs.Type != "" { 1278 objectMap["_type"] = cs.Type 1279 } 1280 return json.Marshal(objectMap) 1281} 1282 1283// AsImageObject is the BasicResponseBase implementation for CivicStructure. 1284func (cs CivicStructure) AsImageObject() (*ImageObject, bool) { 1285 return nil, false 1286} 1287 1288// AsThing is the BasicResponseBase implementation for CivicStructure. 1289func (cs CivicStructure) AsThing() (*Thing, bool) { 1290 return nil, false 1291} 1292 1293// AsBasicThing is the BasicResponseBase implementation for CivicStructure. 1294func (cs CivicStructure) AsBasicThing() (BasicThing, bool) { 1295 return &cs, true 1296} 1297 1298// AsEntities is the BasicResponseBase implementation for CivicStructure. 1299func (cs CivicStructure) AsEntities() (*Entities, bool) { 1300 return nil, false 1301} 1302 1303// AsPlaces is the BasicResponseBase implementation for CivicStructure. 1304func (cs CivicStructure) AsPlaces() (*Places, bool) { 1305 return nil, false 1306} 1307 1308// AsSearchResponse is the BasicResponseBase implementation for CivicStructure. 1309func (cs CivicStructure) AsSearchResponse() (*SearchResponse, bool) { 1310 return nil, false 1311} 1312 1313// AsResponse is the BasicResponseBase implementation for CivicStructure. 1314func (cs CivicStructure) AsResponse() (*Response, bool) { 1315 return nil, false 1316} 1317 1318// AsBasicResponse is the BasicResponseBase implementation for CivicStructure. 1319func (cs CivicStructure) AsBasicResponse() (BasicResponse, bool) { 1320 return &cs, true 1321} 1322 1323// AsSearchResultsAnswer is the BasicResponseBase implementation for CivicStructure. 1324func (cs CivicStructure) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 1325 return nil, false 1326} 1327 1328// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for CivicStructure. 1329func (cs CivicStructure) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 1330 return nil, false 1331} 1332 1333// AsIdentifiable is the BasicResponseBase implementation for CivicStructure. 1334func (cs CivicStructure) AsIdentifiable() (*Identifiable, bool) { 1335 return nil, false 1336} 1337 1338// AsBasicIdentifiable is the BasicResponseBase implementation for CivicStructure. 1339func (cs CivicStructure) AsBasicIdentifiable() (BasicIdentifiable, bool) { 1340 return &cs, true 1341} 1342 1343// AsAnswer is the BasicResponseBase implementation for CivicStructure. 1344func (cs CivicStructure) AsAnswer() (*Answer, bool) { 1345 return nil, false 1346} 1347 1348// AsBasicAnswer is the BasicResponseBase implementation for CivicStructure. 1349func (cs CivicStructure) AsBasicAnswer() (BasicAnswer, bool) { 1350 return nil, false 1351} 1352 1353// AsErrorResponse is the BasicResponseBase implementation for CivicStructure. 1354func (cs CivicStructure) AsErrorResponse() (*ErrorResponse, bool) { 1355 return nil, false 1356} 1357 1358// AsPostalAddress is the BasicResponseBase implementation for CivicStructure. 1359func (cs CivicStructure) AsPostalAddress() (*PostalAddress, bool) { 1360 return nil, false 1361} 1362 1363// AsPlace is the BasicResponseBase implementation for CivicStructure. 1364func (cs CivicStructure) AsPlace() (*Place, bool) { 1365 return nil, false 1366} 1367 1368// AsBasicPlace is the BasicResponseBase implementation for CivicStructure. 1369func (cs CivicStructure) AsBasicPlace() (BasicPlace, bool) { 1370 return &cs, true 1371} 1372 1373// AsOrganization is the BasicResponseBase implementation for CivicStructure. 1374func (cs CivicStructure) AsOrganization() (*Organization, bool) { 1375 return nil, false 1376} 1377 1378// AsCreativeWork is the BasicResponseBase implementation for CivicStructure. 1379func (cs CivicStructure) AsCreativeWork() (*CreativeWork, bool) { 1380 return nil, false 1381} 1382 1383// AsBasicCreativeWork is the BasicResponseBase implementation for CivicStructure. 1384func (cs CivicStructure) AsBasicCreativeWork() (BasicCreativeWork, bool) { 1385 return nil, false 1386} 1387 1388// AsIntangible is the BasicResponseBase implementation for CivicStructure. 1389func (cs CivicStructure) AsIntangible() (*Intangible, bool) { 1390 return nil, false 1391} 1392 1393// AsBasicIntangible is the BasicResponseBase implementation for CivicStructure. 1394func (cs CivicStructure) AsBasicIntangible() (BasicIntangible, bool) { 1395 return nil, false 1396} 1397 1398// AsMovieTheater is the BasicResponseBase implementation for CivicStructure. 1399func (cs CivicStructure) AsMovieTheater() (*MovieTheater, bool) { 1400 return nil, false 1401} 1402 1403// AsMediaObject is the BasicResponseBase implementation for CivicStructure. 1404func (cs CivicStructure) AsMediaObject() (*MediaObject, bool) { 1405 return nil, false 1406} 1407 1408// AsBasicMediaObject is the BasicResponseBase implementation for CivicStructure. 1409func (cs CivicStructure) AsBasicMediaObject() (BasicMediaObject, bool) { 1410 return nil, false 1411} 1412 1413// AsCivicStructure is the BasicResponseBase implementation for CivicStructure. 1414func (cs CivicStructure) AsCivicStructure() (*CivicStructure, bool) { 1415 return &cs, true 1416} 1417 1418// AsBasicCivicStructure is the BasicResponseBase implementation for CivicStructure. 1419func (cs CivicStructure) AsBasicCivicStructure() (BasicCivicStructure, bool) { 1420 return &cs, true 1421} 1422 1423// AsLocalBusiness is the BasicResponseBase implementation for CivicStructure. 1424func (cs CivicStructure) AsLocalBusiness() (*LocalBusiness, bool) { 1425 return nil, false 1426} 1427 1428// AsBasicLocalBusiness is the BasicResponseBase implementation for CivicStructure. 1429func (cs CivicStructure) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 1430 return nil, false 1431} 1432 1433// AsTouristAttraction is the BasicResponseBase implementation for CivicStructure. 1434func (cs CivicStructure) AsTouristAttraction() (*TouristAttraction, bool) { 1435 return nil, false 1436} 1437 1438// AsAirport is the BasicResponseBase implementation for CivicStructure. 1439func (cs CivicStructure) AsAirport() (*Airport, bool) { 1440 return nil, false 1441} 1442 1443// AsLicense is the BasicResponseBase implementation for CivicStructure. 1444func (cs CivicStructure) AsLicense() (*License, bool) { 1445 return nil, false 1446} 1447 1448// AsStructuredValue is the BasicResponseBase implementation for CivicStructure. 1449func (cs CivicStructure) AsStructuredValue() (*StructuredValue, bool) { 1450 return nil, false 1451} 1452 1453// AsBasicStructuredValue is the BasicResponseBase implementation for CivicStructure. 1454func (cs CivicStructure) AsBasicStructuredValue() (BasicStructuredValue, bool) { 1455 return nil, false 1456} 1457 1458// AsEntertainmentBusiness is the BasicResponseBase implementation for CivicStructure. 1459func (cs CivicStructure) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 1460 return nil, false 1461} 1462 1463// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for CivicStructure. 1464func (cs CivicStructure) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 1465 return nil, false 1466} 1467 1468// AsFoodEstablishment is the BasicResponseBase implementation for CivicStructure. 1469func (cs CivicStructure) AsFoodEstablishment() (*FoodEstablishment, bool) { 1470 return nil, false 1471} 1472 1473// AsBasicFoodEstablishment is the BasicResponseBase implementation for CivicStructure. 1474func (cs CivicStructure) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 1475 return nil, false 1476} 1477 1478// AsLodgingBusiness is the BasicResponseBase implementation for CivicStructure. 1479func (cs CivicStructure) AsLodgingBusiness() (*LodgingBusiness, bool) { 1480 return nil, false 1481} 1482 1483// AsBasicLodgingBusiness is the BasicResponseBase implementation for CivicStructure. 1484func (cs CivicStructure) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 1485 return nil, false 1486} 1487 1488// AsRestaurant is the BasicResponseBase implementation for CivicStructure. 1489func (cs CivicStructure) AsRestaurant() (*Restaurant, bool) { 1490 return nil, false 1491} 1492 1493// AsHotel is the BasicResponseBase implementation for CivicStructure. 1494func (cs CivicStructure) AsHotel() (*Hotel, bool) { 1495 return nil, false 1496} 1497 1498// AsResponseBase is the BasicResponseBase implementation for CivicStructure. 1499func (cs CivicStructure) AsResponseBase() (*ResponseBase, bool) { 1500 return nil, false 1501} 1502 1503// AsBasicResponseBase is the BasicResponseBase implementation for CivicStructure. 1504func (cs CivicStructure) AsBasicResponseBase() (BasicResponseBase, bool) { 1505 return &cs, true 1506} 1507 1508// UnmarshalJSON is the custom unmarshaler for CivicStructure struct. 1509func (cs *CivicStructure) UnmarshalJSON(body []byte) error { 1510 var m map[string]*json.RawMessage 1511 err := json.Unmarshal(body, &m) 1512 if err != nil { 1513 return err 1514 } 1515 for k, v := range m { 1516 switch k { 1517 case "address": 1518 if v != nil { 1519 var address PostalAddress 1520 err = json.Unmarshal(*v, &address) 1521 if err != nil { 1522 return err 1523 } 1524 cs.Address = &address 1525 } 1526 case "telephone": 1527 if v != nil { 1528 var telephone string 1529 err = json.Unmarshal(*v, &telephone) 1530 if err != nil { 1531 return err 1532 } 1533 cs.Telephone = &telephone 1534 } 1535 case "name": 1536 if v != nil { 1537 var name string 1538 err = json.Unmarshal(*v, &name) 1539 if err != nil { 1540 return err 1541 } 1542 cs.Name = &name 1543 } 1544 case "url": 1545 if v != nil { 1546 var URL string 1547 err = json.Unmarshal(*v, &URL) 1548 if err != nil { 1549 return err 1550 } 1551 cs.URL = &URL 1552 } 1553 case "image": 1554 if v != nil { 1555 var imageVar ImageObject 1556 err = json.Unmarshal(*v, &imageVar) 1557 if err != nil { 1558 return err 1559 } 1560 cs.Image = &imageVar 1561 } 1562 case "description": 1563 if v != nil { 1564 var description string 1565 err = json.Unmarshal(*v, &description) 1566 if err != nil { 1567 return err 1568 } 1569 cs.Description = &description 1570 } 1571 case "entityPresentationInfo": 1572 if v != nil { 1573 var entityPresentationInfo EntitiesEntityPresentationInfo 1574 err = json.Unmarshal(*v, &entityPresentationInfo) 1575 if err != nil { 1576 return err 1577 } 1578 cs.EntityPresentationInfo = &entityPresentationInfo 1579 } 1580 case "bingId": 1581 if v != nil { 1582 var bingID string 1583 err = json.Unmarshal(*v, &bingID) 1584 if err != nil { 1585 return err 1586 } 1587 cs.BingID = &bingID 1588 } 1589 case "contractualRules": 1590 if v != nil { 1591 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 1592 if err != nil { 1593 return err 1594 } 1595 cs.ContractualRules = &contractualRules 1596 } 1597 case "webSearchUrl": 1598 if v != nil { 1599 var webSearchURL string 1600 err = json.Unmarshal(*v, &webSearchURL) 1601 if err != nil { 1602 return err 1603 } 1604 cs.WebSearchURL = &webSearchURL 1605 } 1606 case "id": 1607 if v != nil { 1608 var ID string 1609 err = json.Unmarshal(*v, &ID) 1610 if err != nil { 1611 return err 1612 } 1613 cs.ID = &ID 1614 } 1615 case "_type": 1616 if v != nil { 1617 var typeVar TypeBasicResponseBase 1618 err = json.Unmarshal(*v, &typeVar) 1619 if err != nil { 1620 return err 1621 } 1622 cs.Type = typeVar 1623 } 1624 } 1625 } 1626 1627 return nil 1628} 1629 1630// BasicContractualRulesAttribution ... 1631type BasicContractualRulesAttribution interface { 1632 AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) 1633 AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) 1634 AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) 1635 AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) 1636 AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) 1637} 1638 1639// ContractualRulesAttribution ... 1640type ContractualRulesAttribution struct { 1641 // MustBeCloseToContent - A Boolean value that determines whether the contents of the rule must be placed in close proximity to the field that the rule applies to. If true, the contents must be placed in close proximity. If false, or this field does not exist, the contents may be placed at the caller's discretion. 1642 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"` 1643 // TargetPropertyName - The name of the field that the rule applies to. 1644 TargetPropertyName *string `json:"targetPropertyName,omitempty"` 1645 // Type - Possible values include: 'TypeContractualRulesContractualRule', 'TypeContractualRulesAttribution', 'TypeContractualRulesLicenseAttribution', 'TypeContractualRulesLinkAttribution', 'TypeContractualRulesMediaAttribution', 'TypeContractualRulesTextAttribution' 1646 Type Type `json:"_type,omitempty"` 1647} 1648 1649func unmarshalBasicContractualRulesAttribution(body []byte) (BasicContractualRulesAttribution, error) { 1650 var m map[string]interface{} 1651 err := json.Unmarshal(body, &m) 1652 if err != nil { 1653 return nil, err 1654 } 1655 1656 switch m["_type"] { 1657 case string(TypeContractualRulesLicenseAttribution): 1658 var crla ContractualRulesLicenseAttribution 1659 err := json.Unmarshal(body, &crla) 1660 return crla, err 1661 case string(TypeContractualRulesLinkAttribution): 1662 var crla ContractualRulesLinkAttribution 1663 err := json.Unmarshal(body, &crla) 1664 return crla, err 1665 case string(TypeContractualRulesMediaAttribution): 1666 var crma ContractualRulesMediaAttribution 1667 err := json.Unmarshal(body, &crma) 1668 return crma, err 1669 case string(TypeContractualRulesTextAttribution): 1670 var crta ContractualRulesTextAttribution 1671 err := json.Unmarshal(body, &crta) 1672 return crta, err 1673 default: 1674 var cra ContractualRulesAttribution 1675 err := json.Unmarshal(body, &cra) 1676 return cra, err 1677 } 1678} 1679func unmarshalBasicContractualRulesAttributionArray(body []byte) ([]BasicContractualRulesAttribution, error) { 1680 var rawMessages []*json.RawMessage 1681 err := json.Unmarshal(body, &rawMessages) 1682 if err != nil { 1683 return nil, err 1684 } 1685 1686 craArray := make([]BasicContractualRulesAttribution, len(rawMessages)) 1687 1688 for index, rawMessage := range rawMessages { 1689 cra, err := unmarshalBasicContractualRulesAttribution(*rawMessage) 1690 if err != nil { 1691 return nil, err 1692 } 1693 craArray[index] = cra 1694 } 1695 return craArray, nil 1696} 1697 1698// MarshalJSON is the custom marshaler for ContractualRulesAttribution. 1699func (cra ContractualRulesAttribution) MarshalJSON() ([]byte, error) { 1700 cra.Type = TypeContractualRulesAttribution 1701 objectMap := make(map[string]interface{}) 1702 if cra.MustBeCloseToContent != nil { 1703 objectMap["mustBeCloseToContent"] = cra.MustBeCloseToContent 1704 } 1705 if cra.TargetPropertyName != nil { 1706 objectMap["targetPropertyName"] = cra.TargetPropertyName 1707 } 1708 if cra.Type != "" { 1709 objectMap["_type"] = cra.Type 1710 } 1711 return json.Marshal(objectMap) 1712} 1713 1714// AsContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesAttribution. 1715func (cra ContractualRulesAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) { 1716 return &cra, true 1717} 1718 1719// AsBasicContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesAttribution. 1720func (cra ContractualRulesAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) { 1721 return &cra, true 1722} 1723 1724// AsContractualRulesLicenseAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesAttribution. 1725func (cra ContractualRulesAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) { 1726 return nil, false 1727} 1728 1729// AsContractualRulesLinkAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesAttribution. 1730func (cra ContractualRulesAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) { 1731 return nil, false 1732} 1733 1734// AsContractualRulesMediaAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesAttribution. 1735func (cra ContractualRulesAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) { 1736 return nil, false 1737} 1738 1739// AsContractualRulesTextAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesAttribution. 1740func (cra ContractualRulesAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) { 1741 return nil, false 1742} 1743 1744// AsContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesAttribution. 1745func (cra ContractualRulesAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) { 1746 return nil, false 1747} 1748 1749// AsBasicContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesAttribution. 1750func (cra ContractualRulesAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) { 1751 return &cra, true 1752} 1753 1754// BasicContractualRulesContractualRule ... 1755type BasicContractualRulesContractualRule interface { 1756 AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) 1757 AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) 1758 AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) 1759 AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) 1760 AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) 1761 AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) 1762 AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) 1763} 1764 1765// ContractualRulesContractualRule ... 1766type ContractualRulesContractualRule struct { 1767 // TargetPropertyName - The name of the field that the rule applies to. 1768 TargetPropertyName *string `json:"targetPropertyName,omitempty"` 1769 // Type - Possible values include: 'TypeContractualRulesContractualRule', 'TypeContractualRulesAttribution', 'TypeContractualRulesLicenseAttribution', 'TypeContractualRulesLinkAttribution', 'TypeContractualRulesMediaAttribution', 'TypeContractualRulesTextAttribution' 1770 Type Type `json:"_type,omitempty"` 1771} 1772 1773func unmarshalBasicContractualRulesContractualRule(body []byte) (BasicContractualRulesContractualRule, error) { 1774 var m map[string]interface{} 1775 err := json.Unmarshal(body, &m) 1776 if err != nil { 1777 return nil, err 1778 } 1779 1780 switch m["_type"] { 1781 case string(TypeContractualRulesAttribution): 1782 var cra ContractualRulesAttribution 1783 err := json.Unmarshal(body, &cra) 1784 return cra, err 1785 case string(TypeContractualRulesLicenseAttribution): 1786 var crla ContractualRulesLicenseAttribution 1787 err := json.Unmarshal(body, &crla) 1788 return crla, err 1789 case string(TypeContractualRulesLinkAttribution): 1790 var crla ContractualRulesLinkAttribution 1791 err := json.Unmarshal(body, &crla) 1792 return crla, err 1793 case string(TypeContractualRulesMediaAttribution): 1794 var crma ContractualRulesMediaAttribution 1795 err := json.Unmarshal(body, &crma) 1796 return crma, err 1797 case string(TypeContractualRulesTextAttribution): 1798 var crta ContractualRulesTextAttribution 1799 err := json.Unmarshal(body, &crta) 1800 return crta, err 1801 default: 1802 var crcr ContractualRulesContractualRule 1803 err := json.Unmarshal(body, &crcr) 1804 return crcr, err 1805 } 1806} 1807func unmarshalBasicContractualRulesContractualRuleArray(body []byte) ([]BasicContractualRulesContractualRule, error) { 1808 var rawMessages []*json.RawMessage 1809 err := json.Unmarshal(body, &rawMessages) 1810 if err != nil { 1811 return nil, err 1812 } 1813 1814 crcrArray := make([]BasicContractualRulesContractualRule, len(rawMessages)) 1815 1816 for index, rawMessage := range rawMessages { 1817 crcr, err := unmarshalBasicContractualRulesContractualRule(*rawMessage) 1818 if err != nil { 1819 return nil, err 1820 } 1821 crcrArray[index] = crcr 1822 } 1823 return crcrArray, nil 1824} 1825 1826// MarshalJSON is the custom marshaler for ContractualRulesContractualRule. 1827func (crcr ContractualRulesContractualRule) MarshalJSON() ([]byte, error) { 1828 crcr.Type = TypeContractualRulesContractualRule 1829 objectMap := make(map[string]interface{}) 1830 if crcr.TargetPropertyName != nil { 1831 objectMap["targetPropertyName"] = crcr.TargetPropertyName 1832 } 1833 if crcr.Type != "" { 1834 objectMap["_type"] = crcr.Type 1835 } 1836 return json.Marshal(objectMap) 1837} 1838 1839// AsContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesContractualRule. 1840func (crcr ContractualRulesContractualRule) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) { 1841 return nil, false 1842} 1843 1844// AsBasicContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesContractualRule. 1845func (crcr ContractualRulesContractualRule) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) { 1846 return nil, false 1847} 1848 1849// AsContractualRulesLicenseAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesContractualRule. 1850func (crcr ContractualRulesContractualRule) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) { 1851 return nil, false 1852} 1853 1854// AsContractualRulesLinkAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesContractualRule. 1855func (crcr ContractualRulesContractualRule) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) { 1856 return nil, false 1857} 1858 1859// AsContractualRulesMediaAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesContractualRule. 1860func (crcr ContractualRulesContractualRule) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) { 1861 return nil, false 1862} 1863 1864// AsContractualRulesTextAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesContractualRule. 1865func (crcr ContractualRulesContractualRule) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) { 1866 return nil, false 1867} 1868 1869// AsContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesContractualRule. 1870func (crcr ContractualRulesContractualRule) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) { 1871 return &crcr, true 1872} 1873 1874// AsBasicContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesContractualRule. 1875func (crcr ContractualRulesContractualRule) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) { 1876 return &crcr, true 1877} 1878 1879// ContractualRulesLicenseAttribution defines a contractual rule for license attribution. 1880type ContractualRulesLicenseAttribution struct { 1881 // License - The license under which the content may be used. 1882 License *License `json:"license,omitempty"` 1883 // LicenseNotice - The license to display next to the targeted field. 1884 LicenseNotice *string `json:"licenseNotice,omitempty"` 1885 // MustBeCloseToContent - A Boolean value that determines whether the contents of the rule must be placed in close proximity to the field that the rule applies to. If true, the contents must be placed in close proximity. If false, or this field does not exist, the contents may be placed at the caller's discretion. 1886 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"` 1887 // TargetPropertyName - The name of the field that the rule applies to. 1888 TargetPropertyName *string `json:"targetPropertyName,omitempty"` 1889 // Type - Possible values include: 'TypeContractualRulesContractualRule', 'TypeContractualRulesAttribution', 'TypeContractualRulesLicenseAttribution', 'TypeContractualRulesLinkAttribution', 'TypeContractualRulesMediaAttribution', 'TypeContractualRulesTextAttribution' 1890 Type Type `json:"_type,omitempty"` 1891} 1892 1893// MarshalJSON is the custom marshaler for ContractualRulesLicenseAttribution. 1894func (crla ContractualRulesLicenseAttribution) MarshalJSON() ([]byte, error) { 1895 crla.Type = TypeContractualRulesLicenseAttribution 1896 objectMap := make(map[string]interface{}) 1897 if crla.License != nil { 1898 objectMap["license"] = crla.License 1899 } 1900 if crla.LicenseNotice != nil { 1901 objectMap["licenseNotice"] = crla.LicenseNotice 1902 } 1903 if crla.MustBeCloseToContent != nil { 1904 objectMap["mustBeCloseToContent"] = crla.MustBeCloseToContent 1905 } 1906 if crla.TargetPropertyName != nil { 1907 objectMap["targetPropertyName"] = crla.TargetPropertyName 1908 } 1909 if crla.Type != "" { 1910 objectMap["_type"] = crla.Type 1911 } 1912 return json.Marshal(objectMap) 1913} 1914 1915// AsContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLicenseAttribution. 1916func (crla ContractualRulesLicenseAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) { 1917 return nil, false 1918} 1919 1920// AsBasicContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLicenseAttribution. 1921func (crla ContractualRulesLicenseAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) { 1922 return &crla, true 1923} 1924 1925// AsContractualRulesLicenseAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLicenseAttribution. 1926func (crla ContractualRulesLicenseAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) { 1927 return &crla, true 1928} 1929 1930// AsContractualRulesLinkAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLicenseAttribution. 1931func (crla ContractualRulesLicenseAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) { 1932 return nil, false 1933} 1934 1935// AsContractualRulesMediaAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLicenseAttribution. 1936func (crla ContractualRulesLicenseAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) { 1937 return nil, false 1938} 1939 1940// AsContractualRulesTextAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLicenseAttribution. 1941func (crla ContractualRulesLicenseAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) { 1942 return nil, false 1943} 1944 1945// AsContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesLicenseAttribution. 1946func (crla ContractualRulesLicenseAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) { 1947 return nil, false 1948} 1949 1950// AsBasicContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesLicenseAttribution. 1951func (crla ContractualRulesLicenseAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) { 1952 return &crla, true 1953} 1954 1955// ContractualRulesLinkAttribution defines a contractual rule for link attribution. 1956type ContractualRulesLinkAttribution struct { 1957 // Text - The attribution text. 1958 Text *string `json:"text,omitempty"` 1959 // URL - The URL to the provider's website. Use text and URL to create the hyperlink. 1960 URL *string `json:"url,omitempty"` 1961 // OptionalForListDisplay - Indicates whether this provider's attribution is optional. 1962 OptionalForListDisplay *bool `json:"optionalForListDisplay,omitempty"` 1963 // MustBeCloseToContent - A Boolean value that determines whether the contents of the rule must be placed in close proximity to the field that the rule applies to. If true, the contents must be placed in close proximity. If false, or this field does not exist, the contents may be placed at the caller's discretion. 1964 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"` 1965 // TargetPropertyName - The name of the field that the rule applies to. 1966 TargetPropertyName *string `json:"targetPropertyName,omitempty"` 1967 // Type - Possible values include: 'TypeContractualRulesContractualRule', 'TypeContractualRulesAttribution', 'TypeContractualRulesLicenseAttribution', 'TypeContractualRulesLinkAttribution', 'TypeContractualRulesMediaAttribution', 'TypeContractualRulesTextAttribution' 1968 Type Type `json:"_type,omitempty"` 1969} 1970 1971// MarshalJSON is the custom marshaler for ContractualRulesLinkAttribution. 1972func (crla ContractualRulesLinkAttribution) MarshalJSON() ([]byte, error) { 1973 crla.Type = TypeContractualRulesLinkAttribution 1974 objectMap := make(map[string]interface{}) 1975 if crla.Text != nil { 1976 objectMap["text"] = crla.Text 1977 } 1978 if crla.URL != nil { 1979 objectMap["url"] = crla.URL 1980 } 1981 if crla.OptionalForListDisplay != nil { 1982 objectMap["optionalForListDisplay"] = crla.OptionalForListDisplay 1983 } 1984 if crla.MustBeCloseToContent != nil { 1985 objectMap["mustBeCloseToContent"] = crla.MustBeCloseToContent 1986 } 1987 if crla.TargetPropertyName != nil { 1988 objectMap["targetPropertyName"] = crla.TargetPropertyName 1989 } 1990 if crla.Type != "" { 1991 objectMap["_type"] = crla.Type 1992 } 1993 return json.Marshal(objectMap) 1994} 1995 1996// AsContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLinkAttribution. 1997func (crla ContractualRulesLinkAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) { 1998 return nil, false 1999} 2000 2001// AsBasicContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLinkAttribution. 2002func (crla ContractualRulesLinkAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) { 2003 return &crla, true 2004} 2005 2006// AsContractualRulesLicenseAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLinkAttribution. 2007func (crla ContractualRulesLinkAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) { 2008 return nil, false 2009} 2010 2011// AsContractualRulesLinkAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLinkAttribution. 2012func (crla ContractualRulesLinkAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) { 2013 return &crla, true 2014} 2015 2016// AsContractualRulesMediaAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLinkAttribution. 2017func (crla ContractualRulesLinkAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) { 2018 return nil, false 2019} 2020 2021// AsContractualRulesTextAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesLinkAttribution. 2022func (crla ContractualRulesLinkAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) { 2023 return nil, false 2024} 2025 2026// AsContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesLinkAttribution. 2027func (crla ContractualRulesLinkAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) { 2028 return nil, false 2029} 2030 2031// AsBasicContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesLinkAttribution. 2032func (crla ContractualRulesLinkAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) { 2033 return &crla, true 2034} 2035 2036// ContractualRulesMediaAttribution defines a contractual rule for media attribution. 2037type ContractualRulesMediaAttribution struct { 2038 // URL - The URL that you use to create of hyperlink of the media content. For example, if the target is an image, you would use the URL to make the image clickable. 2039 URL *string `json:"url,omitempty"` 2040 // MustBeCloseToContent - A Boolean value that determines whether the contents of the rule must be placed in close proximity to the field that the rule applies to. If true, the contents must be placed in close proximity. If false, or this field does not exist, the contents may be placed at the caller's discretion. 2041 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"` 2042 // TargetPropertyName - The name of the field that the rule applies to. 2043 TargetPropertyName *string `json:"targetPropertyName,omitempty"` 2044 // Type - Possible values include: 'TypeContractualRulesContractualRule', 'TypeContractualRulesAttribution', 'TypeContractualRulesLicenseAttribution', 'TypeContractualRulesLinkAttribution', 'TypeContractualRulesMediaAttribution', 'TypeContractualRulesTextAttribution' 2045 Type Type `json:"_type,omitempty"` 2046} 2047 2048// MarshalJSON is the custom marshaler for ContractualRulesMediaAttribution. 2049func (crma ContractualRulesMediaAttribution) MarshalJSON() ([]byte, error) { 2050 crma.Type = TypeContractualRulesMediaAttribution 2051 objectMap := make(map[string]interface{}) 2052 if crma.URL != nil { 2053 objectMap["url"] = crma.URL 2054 } 2055 if crma.MustBeCloseToContent != nil { 2056 objectMap["mustBeCloseToContent"] = crma.MustBeCloseToContent 2057 } 2058 if crma.TargetPropertyName != nil { 2059 objectMap["targetPropertyName"] = crma.TargetPropertyName 2060 } 2061 if crma.Type != "" { 2062 objectMap["_type"] = crma.Type 2063 } 2064 return json.Marshal(objectMap) 2065} 2066 2067// AsContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesMediaAttribution. 2068func (crma ContractualRulesMediaAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) { 2069 return nil, false 2070} 2071 2072// AsBasicContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesMediaAttribution. 2073func (crma ContractualRulesMediaAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) { 2074 return &crma, true 2075} 2076 2077// AsContractualRulesLicenseAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesMediaAttribution. 2078func (crma ContractualRulesMediaAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) { 2079 return nil, false 2080} 2081 2082// AsContractualRulesLinkAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesMediaAttribution. 2083func (crma ContractualRulesMediaAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) { 2084 return nil, false 2085} 2086 2087// AsContractualRulesMediaAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesMediaAttribution. 2088func (crma ContractualRulesMediaAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) { 2089 return &crma, true 2090} 2091 2092// AsContractualRulesTextAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesMediaAttribution. 2093func (crma ContractualRulesMediaAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) { 2094 return nil, false 2095} 2096 2097// AsContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesMediaAttribution. 2098func (crma ContractualRulesMediaAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) { 2099 return nil, false 2100} 2101 2102// AsBasicContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesMediaAttribution. 2103func (crma ContractualRulesMediaAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) { 2104 return &crma, true 2105} 2106 2107// ContractualRulesTextAttribution defines a contractual rule for text attribution. 2108type ContractualRulesTextAttribution struct { 2109 // Text - The attribution text. Text attribution applies to the entity as a whole and should be displayed immediately following the entity presentation. If there are multiple text or link attribution rules that do not specify a target, you should concatenate them and display them using a "Data from:" label. 2110 Text *string `json:"text,omitempty"` 2111 // OptionalForListDisplay - Indicates whether this provider's attribution is optional. 2112 OptionalForListDisplay *bool `json:"optionalForListDisplay,omitempty"` 2113 // MustBeCloseToContent - A Boolean value that determines whether the contents of the rule must be placed in close proximity to the field that the rule applies to. If true, the contents must be placed in close proximity. If false, or this field does not exist, the contents may be placed at the caller's discretion. 2114 MustBeCloseToContent *bool `json:"mustBeCloseToContent,omitempty"` 2115 // TargetPropertyName - The name of the field that the rule applies to. 2116 TargetPropertyName *string `json:"targetPropertyName,omitempty"` 2117 // Type - Possible values include: 'TypeContractualRulesContractualRule', 'TypeContractualRulesAttribution', 'TypeContractualRulesLicenseAttribution', 'TypeContractualRulesLinkAttribution', 'TypeContractualRulesMediaAttribution', 'TypeContractualRulesTextAttribution' 2118 Type Type `json:"_type,omitempty"` 2119} 2120 2121// MarshalJSON is the custom marshaler for ContractualRulesTextAttribution. 2122func (crta ContractualRulesTextAttribution) MarshalJSON() ([]byte, error) { 2123 crta.Type = TypeContractualRulesTextAttribution 2124 objectMap := make(map[string]interface{}) 2125 if crta.Text != nil { 2126 objectMap["text"] = crta.Text 2127 } 2128 if crta.OptionalForListDisplay != nil { 2129 objectMap["optionalForListDisplay"] = crta.OptionalForListDisplay 2130 } 2131 if crta.MustBeCloseToContent != nil { 2132 objectMap["mustBeCloseToContent"] = crta.MustBeCloseToContent 2133 } 2134 if crta.TargetPropertyName != nil { 2135 objectMap["targetPropertyName"] = crta.TargetPropertyName 2136 } 2137 if crta.Type != "" { 2138 objectMap["_type"] = crta.Type 2139 } 2140 return json.Marshal(objectMap) 2141} 2142 2143// AsContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesTextAttribution. 2144func (crta ContractualRulesTextAttribution) AsContractualRulesAttribution() (*ContractualRulesAttribution, bool) { 2145 return nil, false 2146} 2147 2148// AsBasicContractualRulesAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesTextAttribution. 2149func (crta ContractualRulesTextAttribution) AsBasicContractualRulesAttribution() (BasicContractualRulesAttribution, bool) { 2150 return &crta, true 2151} 2152 2153// AsContractualRulesLicenseAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesTextAttribution. 2154func (crta ContractualRulesTextAttribution) AsContractualRulesLicenseAttribution() (*ContractualRulesLicenseAttribution, bool) { 2155 return nil, false 2156} 2157 2158// AsContractualRulesLinkAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesTextAttribution. 2159func (crta ContractualRulesTextAttribution) AsContractualRulesLinkAttribution() (*ContractualRulesLinkAttribution, bool) { 2160 return nil, false 2161} 2162 2163// AsContractualRulesMediaAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesTextAttribution. 2164func (crta ContractualRulesTextAttribution) AsContractualRulesMediaAttribution() (*ContractualRulesMediaAttribution, bool) { 2165 return nil, false 2166} 2167 2168// AsContractualRulesTextAttribution is the BasicContractualRulesContractualRule implementation for ContractualRulesTextAttribution. 2169func (crta ContractualRulesTextAttribution) AsContractualRulesTextAttribution() (*ContractualRulesTextAttribution, bool) { 2170 return &crta, true 2171} 2172 2173// AsContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesTextAttribution. 2174func (crta ContractualRulesTextAttribution) AsContractualRulesContractualRule() (*ContractualRulesContractualRule, bool) { 2175 return nil, false 2176} 2177 2178// AsBasicContractualRulesContractualRule is the BasicContractualRulesContractualRule implementation for ContractualRulesTextAttribution. 2179func (crta ContractualRulesTextAttribution) AsBasicContractualRulesContractualRule() (BasicContractualRulesContractualRule, bool) { 2180 return &crta, true 2181} 2182 2183// BasicCreativeWork ... 2184type BasicCreativeWork interface { 2185 AsImageObject() (*ImageObject, bool) 2186 AsMediaObject() (*MediaObject, bool) 2187 AsBasicMediaObject() (BasicMediaObject, bool) 2188 AsLicense() (*License, bool) 2189 AsCreativeWork() (*CreativeWork, bool) 2190} 2191 2192// CreativeWork ... 2193type CreativeWork struct { 2194 // ThumbnailURL - The URL to a thumbnail of the item. 2195 ThumbnailURL *string `json:"thumbnailUrl,omitempty"` 2196 // Provider - The source of the creative work. 2197 Provider *[]BasicThing `json:"provider,omitempty"` 2198 Text *string `json:"text,omitempty"` 2199 // Name - The name of the thing represented by this object. 2200 Name *string `json:"name,omitempty"` 2201 // URL - The URL to get more information about the thing represented by this object. 2202 URL *string `json:"url,omitempty"` 2203 Image *ImageObject `json:"image,omitempty"` 2204 // Description - A short description of the item. 2205 Description *string `json:"description,omitempty"` 2206 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 2207 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 2208 // BingID - An ID that uniquely identifies this item. 2209 BingID *string `json:"bingId,omitempty"` 2210 // ContractualRules - A list of rules that you must adhere to if you display the item. 2211 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 2212 // WebSearchURL - The URL To Bing's search result for this item. 2213 WebSearchURL *string `json:"webSearchUrl,omitempty"` 2214 // ID - A String identifier. 2215 ID *string `json:"id,omitempty"` 2216 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 2217 Type TypeBasicResponseBase `json:"_type,omitempty"` 2218} 2219 2220func unmarshalBasicCreativeWork(body []byte) (BasicCreativeWork, error) { 2221 var m map[string]interface{} 2222 err := json.Unmarshal(body, &m) 2223 if err != nil { 2224 return nil, err 2225 } 2226 2227 switch m["_type"] { 2228 case string(TypeImageObject): 2229 var ioVar ImageObject 2230 err := json.Unmarshal(body, &ioVar) 2231 return ioVar, err 2232 case string(TypeMediaObject): 2233 var mo MediaObject 2234 err := json.Unmarshal(body, &mo) 2235 return mo, err 2236 case string(TypeLicense): 2237 var l License 2238 err := json.Unmarshal(body, &l) 2239 return l, err 2240 default: 2241 var cw CreativeWork 2242 err := json.Unmarshal(body, &cw) 2243 return cw, err 2244 } 2245} 2246func unmarshalBasicCreativeWorkArray(body []byte) ([]BasicCreativeWork, error) { 2247 var rawMessages []*json.RawMessage 2248 err := json.Unmarshal(body, &rawMessages) 2249 if err != nil { 2250 return nil, err 2251 } 2252 2253 cwArray := make([]BasicCreativeWork, len(rawMessages)) 2254 2255 for index, rawMessage := range rawMessages { 2256 cw, err := unmarshalBasicCreativeWork(*rawMessage) 2257 if err != nil { 2258 return nil, err 2259 } 2260 cwArray[index] = cw 2261 } 2262 return cwArray, nil 2263} 2264 2265// MarshalJSON is the custom marshaler for CreativeWork. 2266func (cw CreativeWork) MarshalJSON() ([]byte, error) { 2267 cw.Type = TypeCreativeWork 2268 objectMap := make(map[string]interface{}) 2269 if cw.ThumbnailURL != nil { 2270 objectMap["thumbnailUrl"] = cw.ThumbnailURL 2271 } 2272 if cw.Provider != nil { 2273 objectMap["provider"] = cw.Provider 2274 } 2275 if cw.Text != nil { 2276 objectMap["text"] = cw.Text 2277 } 2278 if cw.Name != nil { 2279 objectMap["name"] = cw.Name 2280 } 2281 if cw.URL != nil { 2282 objectMap["url"] = cw.URL 2283 } 2284 if cw.Image != nil { 2285 objectMap["image"] = cw.Image 2286 } 2287 if cw.Description != nil { 2288 objectMap["description"] = cw.Description 2289 } 2290 if cw.EntityPresentationInfo != nil { 2291 objectMap["entityPresentationInfo"] = cw.EntityPresentationInfo 2292 } 2293 if cw.BingID != nil { 2294 objectMap["bingId"] = cw.BingID 2295 } 2296 if cw.ContractualRules != nil { 2297 objectMap["contractualRules"] = cw.ContractualRules 2298 } 2299 if cw.WebSearchURL != nil { 2300 objectMap["webSearchUrl"] = cw.WebSearchURL 2301 } 2302 if cw.ID != nil { 2303 objectMap["id"] = cw.ID 2304 } 2305 if cw.Type != "" { 2306 objectMap["_type"] = cw.Type 2307 } 2308 return json.Marshal(objectMap) 2309} 2310 2311// AsImageObject is the BasicResponseBase implementation for CreativeWork. 2312func (cw CreativeWork) AsImageObject() (*ImageObject, bool) { 2313 return nil, false 2314} 2315 2316// AsThing is the BasicResponseBase implementation for CreativeWork. 2317func (cw CreativeWork) AsThing() (*Thing, bool) { 2318 return nil, false 2319} 2320 2321// AsBasicThing is the BasicResponseBase implementation for CreativeWork. 2322func (cw CreativeWork) AsBasicThing() (BasicThing, bool) { 2323 return &cw, true 2324} 2325 2326// AsEntities is the BasicResponseBase implementation for CreativeWork. 2327func (cw CreativeWork) AsEntities() (*Entities, bool) { 2328 return nil, false 2329} 2330 2331// AsPlaces is the BasicResponseBase implementation for CreativeWork. 2332func (cw CreativeWork) AsPlaces() (*Places, bool) { 2333 return nil, false 2334} 2335 2336// AsSearchResponse is the BasicResponseBase implementation for CreativeWork. 2337func (cw CreativeWork) AsSearchResponse() (*SearchResponse, bool) { 2338 return nil, false 2339} 2340 2341// AsResponse is the BasicResponseBase implementation for CreativeWork. 2342func (cw CreativeWork) AsResponse() (*Response, bool) { 2343 return nil, false 2344} 2345 2346// AsBasicResponse is the BasicResponseBase implementation for CreativeWork. 2347func (cw CreativeWork) AsBasicResponse() (BasicResponse, bool) { 2348 return &cw, true 2349} 2350 2351// AsSearchResultsAnswer is the BasicResponseBase implementation for CreativeWork. 2352func (cw CreativeWork) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 2353 return nil, false 2354} 2355 2356// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for CreativeWork. 2357func (cw CreativeWork) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 2358 return nil, false 2359} 2360 2361// AsIdentifiable is the BasicResponseBase implementation for CreativeWork. 2362func (cw CreativeWork) AsIdentifiable() (*Identifiable, bool) { 2363 return nil, false 2364} 2365 2366// AsBasicIdentifiable is the BasicResponseBase implementation for CreativeWork. 2367func (cw CreativeWork) AsBasicIdentifiable() (BasicIdentifiable, bool) { 2368 return &cw, true 2369} 2370 2371// AsAnswer is the BasicResponseBase implementation for CreativeWork. 2372func (cw CreativeWork) AsAnswer() (*Answer, bool) { 2373 return nil, false 2374} 2375 2376// AsBasicAnswer is the BasicResponseBase implementation for CreativeWork. 2377func (cw CreativeWork) AsBasicAnswer() (BasicAnswer, bool) { 2378 return nil, false 2379} 2380 2381// AsErrorResponse is the BasicResponseBase implementation for CreativeWork. 2382func (cw CreativeWork) AsErrorResponse() (*ErrorResponse, bool) { 2383 return nil, false 2384} 2385 2386// AsPostalAddress is the BasicResponseBase implementation for CreativeWork. 2387func (cw CreativeWork) AsPostalAddress() (*PostalAddress, bool) { 2388 return nil, false 2389} 2390 2391// AsPlace is the BasicResponseBase implementation for CreativeWork. 2392func (cw CreativeWork) AsPlace() (*Place, bool) { 2393 return nil, false 2394} 2395 2396// AsBasicPlace is the BasicResponseBase implementation for CreativeWork. 2397func (cw CreativeWork) AsBasicPlace() (BasicPlace, bool) { 2398 return nil, false 2399} 2400 2401// AsOrganization is the BasicResponseBase implementation for CreativeWork. 2402func (cw CreativeWork) AsOrganization() (*Organization, bool) { 2403 return nil, false 2404} 2405 2406// AsCreativeWork is the BasicResponseBase implementation for CreativeWork. 2407func (cw CreativeWork) AsCreativeWork() (*CreativeWork, bool) { 2408 return &cw, true 2409} 2410 2411// AsBasicCreativeWork is the BasicResponseBase implementation for CreativeWork. 2412func (cw CreativeWork) AsBasicCreativeWork() (BasicCreativeWork, bool) { 2413 return &cw, true 2414} 2415 2416// AsIntangible is the BasicResponseBase implementation for CreativeWork. 2417func (cw CreativeWork) AsIntangible() (*Intangible, bool) { 2418 return nil, false 2419} 2420 2421// AsBasicIntangible is the BasicResponseBase implementation for CreativeWork. 2422func (cw CreativeWork) AsBasicIntangible() (BasicIntangible, bool) { 2423 return nil, false 2424} 2425 2426// AsMovieTheater is the BasicResponseBase implementation for CreativeWork. 2427func (cw CreativeWork) AsMovieTheater() (*MovieTheater, bool) { 2428 return nil, false 2429} 2430 2431// AsMediaObject is the BasicResponseBase implementation for CreativeWork. 2432func (cw CreativeWork) AsMediaObject() (*MediaObject, bool) { 2433 return nil, false 2434} 2435 2436// AsBasicMediaObject is the BasicResponseBase implementation for CreativeWork. 2437func (cw CreativeWork) AsBasicMediaObject() (BasicMediaObject, bool) { 2438 return nil, false 2439} 2440 2441// AsCivicStructure is the BasicResponseBase implementation for CreativeWork. 2442func (cw CreativeWork) AsCivicStructure() (*CivicStructure, bool) { 2443 return nil, false 2444} 2445 2446// AsBasicCivicStructure is the BasicResponseBase implementation for CreativeWork. 2447func (cw CreativeWork) AsBasicCivicStructure() (BasicCivicStructure, bool) { 2448 return nil, false 2449} 2450 2451// AsLocalBusiness is the BasicResponseBase implementation for CreativeWork. 2452func (cw CreativeWork) AsLocalBusiness() (*LocalBusiness, bool) { 2453 return nil, false 2454} 2455 2456// AsBasicLocalBusiness is the BasicResponseBase implementation for CreativeWork. 2457func (cw CreativeWork) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 2458 return nil, false 2459} 2460 2461// AsTouristAttraction is the BasicResponseBase implementation for CreativeWork. 2462func (cw CreativeWork) AsTouristAttraction() (*TouristAttraction, bool) { 2463 return nil, false 2464} 2465 2466// AsAirport is the BasicResponseBase implementation for CreativeWork. 2467func (cw CreativeWork) AsAirport() (*Airport, bool) { 2468 return nil, false 2469} 2470 2471// AsLicense is the BasicResponseBase implementation for CreativeWork. 2472func (cw CreativeWork) AsLicense() (*License, bool) { 2473 return nil, false 2474} 2475 2476// AsStructuredValue is the BasicResponseBase implementation for CreativeWork. 2477func (cw CreativeWork) AsStructuredValue() (*StructuredValue, bool) { 2478 return nil, false 2479} 2480 2481// AsBasicStructuredValue is the BasicResponseBase implementation for CreativeWork. 2482func (cw CreativeWork) AsBasicStructuredValue() (BasicStructuredValue, bool) { 2483 return nil, false 2484} 2485 2486// AsEntertainmentBusiness is the BasicResponseBase implementation for CreativeWork. 2487func (cw CreativeWork) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 2488 return nil, false 2489} 2490 2491// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for CreativeWork. 2492func (cw CreativeWork) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 2493 return nil, false 2494} 2495 2496// AsFoodEstablishment is the BasicResponseBase implementation for CreativeWork. 2497func (cw CreativeWork) AsFoodEstablishment() (*FoodEstablishment, bool) { 2498 return nil, false 2499} 2500 2501// AsBasicFoodEstablishment is the BasicResponseBase implementation for CreativeWork. 2502func (cw CreativeWork) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 2503 return nil, false 2504} 2505 2506// AsLodgingBusiness is the BasicResponseBase implementation for CreativeWork. 2507func (cw CreativeWork) AsLodgingBusiness() (*LodgingBusiness, bool) { 2508 return nil, false 2509} 2510 2511// AsBasicLodgingBusiness is the BasicResponseBase implementation for CreativeWork. 2512func (cw CreativeWork) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 2513 return nil, false 2514} 2515 2516// AsRestaurant is the BasicResponseBase implementation for CreativeWork. 2517func (cw CreativeWork) AsRestaurant() (*Restaurant, bool) { 2518 return nil, false 2519} 2520 2521// AsHotel is the BasicResponseBase implementation for CreativeWork. 2522func (cw CreativeWork) AsHotel() (*Hotel, bool) { 2523 return nil, false 2524} 2525 2526// AsResponseBase is the BasicResponseBase implementation for CreativeWork. 2527func (cw CreativeWork) AsResponseBase() (*ResponseBase, bool) { 2528 return nil, false 2529} 2530 2531// AsBasicResponseBase is the BasicResponseBase implementation for CreativeWork. 2532func (cw CreativeWork) AsBasicResponseBase() (BasicResponseBase, bool) { 2533 return &cw, true 2534} 2535 2536// UnmarshalJSON is the custom unmarshaler for CreativeWork struct. 2537func (cw *CreativeWork) UnmarshalJSON(body []byte) error { 2538 var m map[string]*json.RawMessage 2539 err := json.Unmarshal(body, &m) 2540 if err != nil { 2541 return err 2542 } 2543 for k, v := range m { 2544 switch k { 2545 case "thumbnailUrl": 2546 if v != nil { 2547 var thumbnailURL string 2548 err = json.Unmarshal(*v, &thumbnailURL) 2549 if err != nil { 2550 return err 2551 } 2552 cw.ThumbnailURL = &thumbnailURL 2553 } 2554 case "provider": 2555 if v != nil { 2556 provider, err := unmarshalBasicThingArray(*v) 2557 if err != nil { 2558 return err 2559 } 2560 cw.Provider = &provider 2561 } 2562 case "text": 2563 if v != nil { 2564 var textVar string 2565 err = json.Unmarshal(*v, &textVar) 2566 if err != nil { 2567 return err 2568 } 2569 cw.Text = &textVar 2570 } 2571 case "name": 2572 if v != nil { 2573 var name string 2574 err = json.Unmarshal(*v, &name) 2575 if err != nil { 2576 return err 2577 } 2578 cw.Name = &name 2579 } 2580 case "url": 2581 if v != nil { 2582 var URL string 2583 err = json.Unmarshal(*v, &URL) 2584 if err != nil { 2585 return err 2586 } 2587 cw.URL = &URL 2588 } 2589 case "image": 2590 if v != nil { 2591 var imageVar ImageObject 2592 err = json.Unmarshal(*v, &imageVar) 2593 if err != nil { 2594 return err 2595 } 2596 cw.Image = &imageVar 2597 } 2598 case "description": 2599 if v != nil { 2600 var description string 2601 err = json.Unmarshal(*v, &description) 2602 if err != nil { 2603 return err 2604 } 2605 cw.Description = &description 2606 } 2607 case "entityPresentationInfo": 2608 if v != nil { 2609 var entityPresentationInfo EntitiesEntityPresentationInfo 2610 err = json.Unmarshal(*v, &entityPresentationInfo) 2611 if err != nil { 2612 return err 2613 } 2614 cw.EntityPresentationInfo = &entityPresentationInfo 2615 } 2616 case "bingId": 2617 if v != nil { 2618 var bingID string 2619 err = json.Unmarshal(*v, &bingID) 2620 if err != nil { 2621 return err 2622 } 2623 cw.BingID = &bingID 2624 } 2625 case "contractualRules": 2626 if v != nil { 2627 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 2628 if err != nil { 2629 return err 2630 } 2631 cw.ContractualRules = &contractualRules 2632 } 2633 case "webSearchUrl": 2634 if v != nil { 2635 var webSearchURL string 2636 err = json.Unmarshal(*v, &webSearchURL) 2637 if err != nil { 2638 return err 2639 } 2640 cw.WebSearchURL = &webSearchURL 2641 } 2642 case "id": 2643 if v != nil { 2644 var ID string 2645 err = json.Unmarshal(*v, &ID) 2646 if err != nil { 2647 return err 2648 } 2649 cw.ID = &ID 2650 } 2651 case "_type": 2652 if v != nil { 2653 var typeVar TypeBasicResponseBase 2654 err = json.Unmarshal(*v, &typeVar) 2655 if err != nil { 2656 return err 2657 } 2658 cw.Type = typeVar 2659 } 2660 } 2661 } 2662 2663 return nil 2664} 2665 2666// BasicEntertainmentBusiness ... 2667type BasicEntertainmentBusiness interface { 2668 AsMovieTheater() (*MovieTheater, bool) 2669 AsEntertainmentBusiness() (*EntertainmentBusiness, bool) 2670} 2671 2672// EntertainmentBusiness ... 2673type EntertainmentBusiness struct { 2674 // PriceRange - $$. 2675 PriceRange *string `json:"priceRange,omitempty"` 2676 Panoramas *[]ImageObject `json:"panoramas,omitempty"` 2677 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"` 2678 TagLine *string `json:"tagLine,omitempty"` 2679 // Address - The postal address of where the entity is located 2680 Address *PostalAddress `json:"address,omitempty"` 2681 // Telephone - The entity's telephone number 2682 Telephone *string `json:"telephone,omitempty"` 2683 // Name - The name of the thing represented by this object. 2684 Name *string `json:"name,omitempty"` 2685 // URL - The URL to get more information about the thing represented by this object. 2686 URL *string `json:"url,omitempty"` 2687 Image *ImageObject `json:"image,omitempty"` 2688 // Description - A short description of the item. 2689 Description *string `json:"description,omitempty"` 2690 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 2691 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 2692 // BingID - An ID that uniquely identifies this item. 2693 BingID *string `json:"bingId,omitempty"` 2694 // ContractualRules - A list of rules that you must adhere to if you display the item. 2695 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 2696 // WebSearchURL - The URL To Bing's search result for this item. 2697 WebSearchURL *string `json:"webSearchUrl,omitempty"` 2698 // ID - A String identifier. 2699 ID *string `json:"id,omitempty"` 2700 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 2701 Type TypeBasicResponseBase `json:"_type,omitempty"` 2702} 2703 2704func unmarshalBasicEntertainmentBusiness(body []byte) (BasicEntertainmentBusiness, error) { 2705 var m map[string]interface{} 2706 err := json.Unmarshal(body, &m) 2707 if err != nil { 2708 return nil, err 2709 } 2710 2711 switch m["_type"] { 2712 case string(TypeMovieTheater): 2713 var mt MovieTheater 2714 err := json.Unmarshal(body, &mt) 2715 return mt, err 2716 default: 2717 var eb EntertainmentBusiness 2718 err := json.Unmarshal(body, &eb) 2719 return eb, err 2720 } 2721} 2722func unmarshalBasicEntertainmentBusinessArray(body []byte) ([]BasicEntertainmentBusiness, error) { 2723 var rawMessages []*json.RawMessage 2724 err := json.Unmarshal(body, &rawMessages) 2725 if err != nil { 2726 return nil, err 2727 } 2728 2729 ebArray := make([]BasicEntertainmentBusiness, len(rawMessages)) 2730 2731 for index, rawMessage := range rawMessages { 2732 eb, err := unmarshalBasicEntertainmentBusiness(*rawMessage) 2733 if err != nil { 2734 return nil, err 2735 } 2736 ebArray[index] = eb 2737 } 2738 return ebArray, nil 2739} 2740 2741// MarshalJSON is the custom marshaler for EntertainmentBusiness. 2742func (eb EntertainmentBusiness) MarshalJSON() ([]byte, error) { 2743 eb.Type = TypeEntertainmentBusiness 2744 objectMap := make(map[string]interface{}) 2745 if eb.PriceRange != nil { 2746 objectMap["priceRange"] = eb.PriceRange 2747 } 2748 if eb.Panoramas != nil { 2749 objectMap["panoramas"] = eb.Panoramas 2750 } 2751 if eb.IsPermanentlyClosed != nil { 2752 objectMap["isPermanentlyClosed"] = eb.IsPermanentlyClosed 2753 } 2754 if eb.TagLine != nil { 2755 objectMap["tagLine"] = eb.TagLine 2756 } 2757 if eb.Address != nil { 2758 objectMap["address"] = eb.Address 2759 } 2760 if eb.Telephone != nil { 2761 objectMap["telephone"] = eb.Telephone 2762 } 2763 if eb.Name != nil { 2764 objectMap["name"] = eb.Name 2765 } 2766 if eb.URL != nil { 2767 objectMap["url"] = eb.URL 2768 } 2769 if eb.Image != nil { 2770 objectMap["image"] = eb.Image 2771 } 2772 if eb.Description != nil { 2773 objectMap["description"] = eb.Description 2774 } 2775 if eb.EntityPresentationInfo != nil { 2776 objectMap["entityPresentationInfo"] = eb.EntityPresentationInfo 2777 } 2778 if eb.BingID != nil { 2779 objectMap["bingId"] = eb.BingID 2780 } 2781 if eb.ContractualRules != nil { 2782 objectMap["contractualRules"] = eb.ContractualRules 2783 } 2784 if eb.WebSearchURL != nil { 2785 objectMap["webSearchUrl"] = eb.WebSearchURL 2786 } 2787 if eb.ID != nil { 2788 objectMap["id"] = eb.ID 2789 } 2790 if eb.Type != "" { 2791 objectMap["_type"] = eb.Type 2792 } 2793 return json.Marshal(objectMap) 2794} 2795 2796// AsImageObject is the BasicResponseBase implementation for EntertainmentBusiness. 2797func (eb EntertainmentBusiness) AsImageObject() (*ImageObject, bool) { 2798 return nil, false 2799} 2800 2801// AsThing is the BasicResponseBase implementation for EntertainmentBusiness. 2802func (eb EntertainmentBusiness) AsThing() (*Thing, bool) { 2803 return nil, false 2804} 2805 2806// AsBasicThing is the BasicResponseBase implementation for EntertainmentBusiness. 2807func (eb EntertainmentBusiness) AsBasicThing() (BasicThing, bool) { 2808 return &eb, true 2809} 2810 2811// AsEntities is the BasicResponseBase implementation for EntertainmentBusiness. 2812func (eb EntertainmentBusiness) AsEntities() (*Entities, bool) { 2813 return nil, false 2814} 2815 2816// AsPlaces is the BasicResponseBase implementation for EntertainmentBusiness. 2817func (eb EntertainmentBusiness) AsPlaces() (*Places, bool) { 2818 return nil, false 2819} 2820 2821// AsSearchResponse is the BasicResponseBase implementation for EntertainmentBusiness. 2822func (eb EntertainmentBusiness) AsSearchResponse() (*SearchResponse, bool) { 2823 return nil, false 2824} 2825 2826// AsResponse is the BasicResponseBase implementation for EntertainmentBusiness. 2827func (eb EntertainmentBusiness) AsResponse() (*Response, bool) { 2828 return nil, false 2829} 2830 2831// AsBasicResponse is the BasicResponseBase implementation for EntertainmentBusiness. 2832func (eb EntertainmentBusiness) AsBasicResponse() (BasicResponse, bool) { 2833 return &eb, true 2834} 2835 2836// AsSearchResultsAnswer is the BasicResponseBase implementation for EntertainmentBusiness. 2837func (eb EntertainmentBusiness) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 2838 return nil, false 2839} 2840 2841// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for EntertainmentBusiness. 2842func (eb EntertainmentBusiness) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 2843 return nil, false 2844} 2845 2846// AsIdentifiable is the BasicResponseBase implementation for EntertainmentBusiness. 2847func (eb EntertainmentBusiness) AsIdentifiable() (*Identifiable, bool) { 2848 return nil, false 2849} 2850 2851// AsBasicIdentifiable is the BasicResponseBase implementation for EntertainmentBusiness. 2852func (eb EntertainmentBusiness) AsBasicIdentifiable() (BasicIdentifiable, bool) { 2853 return &eb, true 2854} 2855 2856// AsAnswer is the BasicResponseBase implementation for EntertainmentBusiness. 2857func (eb EntertainmentBusiness) AsAnswer() (*Answer, bool) { 2858 return nil, false 2859} 2860 2861// AsBasicAnswer is the BasicResponseBase implementation for EntertainmentBusiness. 2862func (eb EntertainmentBusiness) AsBasicAnswer() (BasicAnswer, bool) { 2863 return nil, false 2864} 2865 2866// AsErrorResponse is the BasicResponseBase implementation for EntertainmentBusiness. 2867func (eb EntertainmentBusiness) AsErrorResponse() (*ErrorResponse, bool) { 2868 return nil, false 2869} 2870 2871// AsPostalAddress is the BasicResponseBase implementation for EntertainmentBusiness. 2872func (eb EntertainmentBusiness) AsPostalAddress() (*PostalAddress, bool) { 2873 return nil, false 2874} 2875 2876// AsPlace is the BasicResponseBase implementation for EntertainmentBusiness. 2877func (eb EntertainmentBusiness) AsPlace() (*Place, bool) { 2878 return nil, false 2879} 2880 2881// AsBasicPlace is the BasicResponseBase implementation for EntertainmentBusiness. 2882func (eb EntertainmentBusiness) AsBasicPlace() (BasicPlace, bool) { 2883 return &eb, true 2884} 2885 2886// AsOrganization is the BasicResponseBase implementation for EntertainmentBusiness. 2887func (eb EntertainmentBusiness) AsOrganization() (*Organization, bool) { 2888 return nil, false 2889} 2890 2891// AsCreativeWork is the BasicResponseBase implementation for EntertainmentBusiness. 2892func (eb EntertainmentBusiness) AsCreativeWork() (*CreativeWork, bool) { 2893 return nil, false 2894} 2895 2896// AsBasicCreativeWork is the BasicResponseBase implementation for EntertainmentBusiness. 2897func (eb EntertainmentBusiness) AsBasicCreativeWork() (BasicCreativeWork, bool) { 2898 return nil, false 2899} 2900 2901// AsIntangible is the BasicResponseBase implementation for EntertainmentBusiness. 2902func (eb EntertainmentBusiness) AsIntangible() (*Intangible, bool) { 2903 return nil, false 2904} 2905 2906// AsBasicIntangible is the BasicResponseBase implementation for EntertainmentBusiness. 2907func (eb EntertainmentBusiness) AsBasicIntangible() (BasicIntangible, bool) { 2908 return nil, false 2909} 2910 2911// AsMovieTheater is the BasicResponseBase implementation for EntertainmentBusiness. 2912func (eb EntertainmentBusiness) AsMovieTheater() (*MovieTheater, bool) { 2913 return nil, false 2914} 2915 2916// AsMediaObject is the BasicResponseBase implementation for EntertainmentBusiness. 2917func (eb EntertainmentBusiness) AsMediaObject() (*MediaObject, bool) { 2918 return nil, false 2919} 2920 2921// AsBasicMediaObject is the BasicResponseBase implementation for EntertainmentBusiness. 2922func (eb EntertainmentBusiness) AsBasicMediaObject() (BasicMediaObject, bool) { 2923 return nil, false 2924} 2925 2926// AsCivicStructure is the BasicResponseBase implementation for EntertainmentBusiness. 2927func (eb EntertainmentBusiness) AsCivicStructure() (*CivicStructure, bool) { 2928 return nil, false 2929} 2930 2931// AsBasicCivicStructure is the BasicResponseBase implementation for EntertainmentBusiness. 2932func (eb EntertainmentBusiness) AsBasicCivicStructure() (BasicCivicStructure, bool) { 2933 return nil, false 2934} 2935 2936// AsLocalBusiness is the BasicResponseBase implementation for EntertainmentBusiness. 2937func (eb EntertainmentBusiness) AsLocalBusiness() (*LocalBusiness, bool) { 2938 return nil, false 2939} 2940 2941// AsBasicLocalBusiness is the BasicResponseBase implementation for EntertainmentBusiness. 2942func (eb EntertainmentBusiness) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 2943 return &eb, true 2944} 2945 2946// AsTouristAttraction is the BasicResponseBase implementation for EntertainmentBusiness. 2947func (eb EntertainmentBusiness) AsTouristAttraction() (*TouristAttraction, bool) { 2948 return nil, false 2949} 2950 2951// AsAirport is the BasicResponseBase implementation for EntertainmentBusiness. 2952func (eb EntertainmentBusiness) AsAirport() (*Airport, bool) { 2953 return nil, false 2954} 2955 2956// AsLicense is the BasicResponseBase implementation for EntertainmentBusiness. 2957func (eb EntertainmentBusiness) AsLicense() (*License, bool) { 2958 return nil, false 2959} 2960 2961// AsStructuredValue is the BasicResponseBase implementation for EntertainmentBusiness. 2962func (eb EntertainmentBusiness) AsStructuredValue() (*StructuredValue, bool) { 2963 return nil, false 2964} 2965 2966// AsBasicStructuredValue is the BasicResponseBase implementation for EntertainmentBusiness. 2967func (eb EntertainmentBusiness) AsBasicStructuredValue() (BasicStructuredValue, bool) { 2968 return nil, false 2969} 2970 2971// AsEntertainmentBusiness is the BasicResponseBase implementation for EntertainmentBusiness. 2972func (eb EntertainmentBusiness) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 2973 return &eb, true 2974} 2975 2976// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for EntertainmentBusiness. 2977func (eb EntertainmentBusiness) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 2978 return &eb, true 2979} 2980 2981// AsFoodEstablishment is the BasicResponseBase implementation for EntertainmentBusiness. 2982func (eb EntertainmentBusiness) AsFoodEstablishment() (*FoodEstablishment, bool) { 2983 return nil, false 2984} 2985 2986// AsBasicFoodEstablishment is the BasicResponseBase implementation for EntertainmentBusiness. 2987func (eb EntertainmentBusiness) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 2988 return nil, false 2989} 2990 2991// AsLodgingBusiness is the BasicResponseBase implementation for EntertainmentBusiness. 2992func (eb EntertainmentBusiness) AsLodgingBusiness() (*LodgingBusiness, bool) { 2993 return nil, false 2994} 2995 2996// AsBasicLodgingBusiness is the BasicResponseBase implementation for EntertainmentBusiness. 2997func (eb EntertainmentBusiness) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 2998 return nil, false 2999} 3000 3001// AsRestaurant is the BasicResponseBase implementation for EntertainmentBusiness. 3002func (eb EntertainmentBusiness) AsRestaurant() (*Restaurant, bool) { 3003 return nil, false 3004} 3005 3006// AsHotel is the BasicResponseBase implementation for EntertainmentBusiness. 3007func (eb EntertainmentBusiness) AsHotel() (*Hotel, bool) { 3008 return nil, false 3009} 3010 3011// AsResponseBase is the BasicResponseBase implementation for EntertainmentBusiness. 3012func (eb EntertainmentBusiness) AsResponseBase() (*ResponseBase, bool) { 3013 return nil, false 3014} 3015 3016// AsBasicResponseBase is the BasicResponseBase implementation for EntertainmentBusiness. 3017func (eb EntertainmentBusiness) AsBasicResponseBase() (BasicResponseBase, bool) { 3018 return &eb, true 3019} 3020 3021// UnmarshalJSON is the custom unmarshaler for EntertainmentBusiness struct. 3022func (eb *EntertainmentBusiness) UnmarshalJSON(body []byte) error { 3023 var m map[string]*json.RawMessage 3024 err := json.Unmarshal(body, &m) 3025 if err != nil { 3026 return err 3027 } 3028 for k, v := range m { 3029 switch k { 3030 case "priceRange": 3031 if v != nil { 3032 var priceRange string 3033 err = json.Unmarshal(*v, &priceRange) 3034 if err != nil { 3035 return err 3036 } 3037 eb.PriceRange = &priceRange 3038 } 3039 case "panoramas": 3040 if v != nil { 3041 var panoramas []ImageObject 3042 err = json.Unmarshal(*v, &panoramas) 3043 if err != nil { 3044 return err 3045 } 3046 eb.Panoramas = &panoramas 3047 } 3048 case "isPermanentlyClosed": 3049 if v != nil { 3050 var isPermanentlyClosed bool 3051 err = json.Unmarshal(*v, &isPermanentlyClosed) 3052 if err != nil { 3053 return err 3054 } 3055 eb.IsPermanentlyClosed = &isPermanentlyClosed 3056 } 3057 case "tagLine": 3058 if v != nil { 3059 var tagLine string 3060 err = json.Unmarshal(*v, &tagLine) 3061 if err != nil { 3062 return err 3063 } 3064 eb.TagLine = &tagLine 3065 } 3066 case "address": 3067 if v != nil { 3068 var address PostalAddress 3069 err = json.Unmarshal(*v, &address) 3070 if err != nil { 3071 return err 3072 } 3073 eb.Address = &address 3074 } 3075 case "telephone": 3076 if v != nil { 3077 var telephone string 3078 err = json.Unmarshal(*v, &telephone) 3079 if err != nil { 3080 return err 3081 } 3082 eb.Telephone = &telephone 3083 } 3084 case "name": 3085 if v != nil { 3086 var name string 3087 err = json.Unmarshal(*v, &name) 3088 if err != nil { 3089 return err 3090 } 3091 eb.Name = &name 3092 } 3093 case "url": 3094 if v != nil { 3095 var URL string 3096 err = json.Unmarshal(*v, &URL) 3097 if err != nil { 3098 return err 3099 } 3100 eb.URL = &URL 3101 } 3102 case "image": 3103 if v != nil { 3104 var imageVar ImageObject 3105 err = json.Unmarshal(*v, &imageVar) 3106 if err != nil { 3107 return err 3108 } 3109 eb.Image = &imageVar 3110 } 3111 case "description": 3112 if v != nil { 3113 var description string 3114 err = json.Unmarshal(*v, &description) 3115 if err != nil { 3116 return err 3117 } 3118 eb.Description = &description 3119 } 3120 case "entityPresentationInfo": 3121 if v != nil { 3122 var entityPresentationInfo EntitiesEntityPresentationInfo 3123 err = json.Unmarshal(*v, &entityPresentationInfo) 3124 if err != nil { 3125 return err 3126 } 3127 eb.EntityPresentationInfo = &entityPresentationInfo 3128 } 3129 case "bingId": 3130 if v != nil { 3131 var bingID string 3132 err = json.Unmarshal(*v, &bingID) 3133 if err != nil { 3134 return err 3135 } 3136 eb.BingID = &bingID 3137 } 3138 case "contractualRules": 3139 if v != nil { 3140 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 3141 if err != nil { 3142 return err 3143 } 3144 eb.ContractualRules = &contractualRules 3145 } 3146 case "webSearchUrl": 3147 if v != nil { 3148 var webSearchURL string 3149 err = json.Unmarshal(*v, &webSearchURL) 3150 if err != nil { 3151 return err 3152 } 3153 eb.WebSearchURL = &webSearchURL 3154 } 3155 case "id": 3156 if v != nil { 3157 var ID string 3158 err = json.Unmarshal(*v, &ID) 3159 if err != nil { 3160 return err 3161 } 3162 eb.ID = &ID 3163 } 3164 case "_type": 3165 if v != nil { 3166 var typeVar TypeBasicResponseBase 3167 err = json.Unmarshal(*v, &typeVar) 3168 if err != nil { 3169 return err 3170 } 3171 eb.Type = typeVar 3172 } 3173 } 3174 } 3175 3176 return nil 3177} 3178 3179// Entities defines an entity answer. 3180type Entities struct { 3181 // QueryScenario - The supported query scenario. This field is set to DominantEntity or DisambiguationItem. The field is set to DominantEntity if Bing determines that only a single entity satisfies the request. For example, a book, movie, person, or attraction. If multiple entities could satisfy the request, the field is set to DisambiguationItem. For example, if the request uses the generic title of a movie franchise, the entity's type would likely be DisambiguationItem. But, if the request specifies a specific title from the franchise, the entity's type would likely be DominantEntity. Possible values include: 'DominantEntity', 'DominantEntityWithDisambiguation', 'Disambiguation', 'List', 'ListWithPivot' 3182 QueryScenario EntityQueryScenario `json:"queryScenario,omitempty"` 3183 // Value - A list of entities. 3184 Value *[]BasicThing `json:"value,omitempty"` 3185 QueryContext *QueryContext `json:"queryContext,omitempty"` 3186 // ContractualRules - A list of rules that you must adhere to if you display the item. 3187 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 3188 // WebSearchURL - The URL To Bing's search result for this item. 3189 WebSearchURL *string `json:"webSearchUrl,omitempty"` 3190 // ID - A String identifier. 3191 ID *string `json:"id,omitempty"` 3192 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 3193 Type TypeBasicResponseBase `json:"_type,omitempty"` 3194} 3195 3196// MarshalJSON is the custom marshaler for Entities. 3197func (e Entities) MarshalJSON() ([]byte, error) { 3198 e.Type = TypeEntities 3199 objectMap := make(map[string]interface{}) 3200 if e.QueryScenario != "" { 3201 objectMap["queryScenario"] = e.QueryScenario 3202 } 3203 if e.Value != nil { 3204 objectMap["value"] = e.Value 3205 } 3206 if e.QueryContext != nil { 3207 objectMap["queryContext"] = e.QueryContext 3208 } 3209 if e.ContractualRules != nil { 3210 objectMap["contractualRules"] = e.ContractualRules 3211 } 3212 if e.WebSearchURL != nil { 3213 objectMap["webSearchUrl"] = e.WebSearchURL 3214 } 3215 if e.ID != nil { 3216 objectMap["id"] = e.ID 3217 } 3218 if e.Type != "" { 3219 objectMap["_type"] = e.Type 3220 } 3221 return json.Marshal(objectMap) 3222} 3223 3224// AsImageObject is the BasicResponseBase implementation for Entities. 3225func (e Entities) AsImageObject() (*ImageObject, bool) { 3226 return nil, false 3227} 3228 3229// AsThing is the BasicResponseBase implementation for Entities. 3230func (e Entities) AsThing() (*Thing, bool) { 3231 return nil, false 3232} 3233 3234// AsBasicThing is the BasicResponseBase implementation for Entities. 3235func (e Entities) AsBasicThing() (BasicThing, bool) { 3236 return nil, false 3237} 3238 3239// AsEntities is the BasicResponseBase implementation for Entities. 3240func (e Entities) AsEntities() (*Entities, bool) { 3241 return &e, true 3242} 3243 3244// AsPlaces is the BasicResponseBase implementation for Entities. 3245func (e Entities) AsPlaces() (*Places, bool) { 3246 return nil, false 3247} 3248 3249// AsSearchResponse is the BasicResponseBase implementation for Entities. 3250func (e Entities) AsSearchResponse() (*SearchResponse, bool) { 3251 return nil, false 3252} 3253 3254// AsResponse is the BasicResponseBase implementation for Entities. 3255func (e Entities) AsResponse() (*Response, bool) { 3256 return nil, false 3257} 3258 3259// AsBasicResponse is the BasicResponseBase implementation for Entities. 3260func (e Entities) AsBasicResponse() (BasicResponse, bool) { 3261 return &e, true 3262} 3263 3264// AsSearchResultsAnswer is the BasicResponseBase implementation for Entities. 3265func (e Entities) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 3266 return nil, false 3267} 3268 3269// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Entities. 3270func (e Entities) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 3271 return &e, true 3272} 3273 3274// AsIdentifiable is the BasicResponseBase implementation for Entities. 3275func (e Entities) AsIdentifiable() (*Identifiable, bool) { 3276 return nil, false 3277} 3278 3279// AsBasicIdentifiable is the BasicResponseBase implementation for Entities. 3280func (e Entities) AsBasicIdentifiable() (BasicIdentifiable, bool) { 3281 return &e, true 3282} 3283 3284// AsAnswer is the BasicResponseBase implementation for Entities. 3285func (e Entities) AsAnswer() (*Answer, bool) { 3286 return nil, false 3287} 3288 3289// AsBasicAnswer is the BasicResponseBase implementation for Entities. 3290func (e Entities) AsBasicAnswer() (BasicAnswer, bool) { 3291 return &e, true 3292} 3293 3294// AsErrorResponse is the BasicResponseBase implementation for Entities. 3295func (e Entities) AsErrorResponse() (*ErrorResponse, bool) { 3296 return nil, false 3297} 3298 3299// AsPostalAddress is the BasicResponseBase implementation for Entities. 3300func (e Entities) AsPostalAddress() (*PostalAddress, bool) { 3301 return nil, false 3302} 3303 3304// AsPlace is the BasicResponseBase implementation for Entities. 3305func (e Entities) AsPlace() (*Place, bool) { 3306 return nil, false 3307} 3308 3309// AsBasicPlace is the BasicResponseBase implementation for Entities. 3310func (e Entities) AsBasicPlace() (BasicPlace, bool) { 3311 return nil, false 3312} 3313 3314// AsOrganization is the BasicResponseBase implementation for Entities. 3315func (e Entities) AsOrganization() (*Organization, bool) { 3316 return nil, false 3317} 3318 3319// AsCreativeWork is the BasicResponseBase implementation for Entities. 3320func (e Entities) AsCreativeWork() (*CreativeWork, bool) { 3321 return nil, false 3322} 3323 3324// AsBasicCreativeWork is the BasicResponseBase implementation for Entities. 3325func (e Entities) AsBasicCreativeWork() (BasicCreativeWork, bool) { 3326 return nil, false 3327} 3328 3329// AsIntangible is the BasicResponseBase implementation for Entities. 3330func (e Entities) AsIntangible() (*Intangible, bool) { 3331 return nil, false 3332} 3333 3334// AsBasicIntangible is the BasicResponseBase implementation for Entities. 3335func (e Entities) AsBasicIntangible() (BasicIntangible, bool) { 3336 return nil, false 3337} 3338 3339// AsMovieTheater is the BasicResponseBase implementation for Entities. 3340func (e Entities) AsMovieTheater() (*MovieTheater, bool) { 3341 return nil, false 3342} 3343 3344// AsMediaObject is the BasicResponseBase implementation for Entities. 3345func (e Entities) AsMediaObject() (*MediaObject, bool) { 3346 return nil, false 3347} 3348 3349// AsBasicMediaObject is the BasicResponseBase implementation for Entities. 3350func (e Entities) AsBasicMediaObject() (BasicMediaObject, bool) { 3351 return nil, false 3352} 3353 3354// AsCivicStructure is the BasicResponseBase implementation for Entities. 3355func (e Entities) AsCivicStructure() (*CivicStructure, bool) { 3356 return nil, false 3357} 3358 3359// AsBasicCivicStructure is the BasicResponseBase implementation for Entities. 3360func (e Entities) AsBasicCivicStructure() (BasicCivicStructure, bool) { 3361 return nil, false 3362} 3363 3364// AsLocalBusiness is the BasicResponseBase implementation for Entities. 3365func (e Entities) AsLocalBusiness() (*LocalBusiness, bool) { 3366 return nil, false 3367} 3368 3369// AsBasicLocalBusiness is the BasicResponseBase implementation for Entities. 3370func (e Entities) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 3371 return nil, false 3372} 3373 3374// AsTouristAttraction is the BasicResponseBase implementation for Entities. 3375func (e Entities) AsTouristAttraction() (*TouristAttraction, bool) { 3376 return nil, false 3377} 3378 3379// AsAirport is the BasicResponseBase implementation for Entities. 3380func (e Entities) AsAirport() (*Airport, bool) { 3381 return nil, false 3382} 3383 3384// AsLicense is the BasicResponseBase implementation for Entities. 3385func (e Entities) AsLicense() (*License, bool) { 3386 return nil, false 3387} 3388 3389// AsStructuredValue is the BasicResponseBase implementation for Entities. 3390func (e Entities) AsStructuredValue() (*StructuredValue, bool) { 3391 return nil, false 3392} 3393 3394// AsBasicStructuredValue is the BasicResponseBase implementation for Entities. 3395func (e Entities) AsBasicStructuredValue() (BasicStructuredValue, bool) { 3396 return nil, false 3397} 3398 3399// AsEntertainmentBusiness is the BasicResponseBase implementation for Entities. 3400func (e Entities) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 3401 return nil, false 3402} 3403 3404// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Entities. 3405func (e Entities) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 3406 return nil, false 3407} 3408 3409// AsFoodEstablishment is the BasicResponseBase implementation for Entities. 3410func (e Entities) AsFoodEstablishment() (*FoodEstablishment, bool) { 3411 return nil, false 3412} 3413 3414// AsBasicFoodEstablishment is the BasicResponseBase implementation for Entities. 3415func (e Entities) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 3416 return nil, false 3417} 3418 3419// AsLodgingBusiness is the BasicResponseBase implementation for Entities. 3420func (e Entities) AsLodgingBusiness() (*LodgingBusiness, bool) { 3421 return nil, false 3422} 3423 3424// AsBasicLodgingBusiness is the BasicResponseBase implementation for Entities. 3425func (e Entities) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 3426 return nil, false 3427} 3428 3429// AsRestaurant is the BasicResponseBase implementation for Entities. 3430func (e Entities) AsRestaurant() (*Restaurant, bool) { 3431 return nil, false 3432} 3433 3434// AsHotel is the BasicResponseBase implementation for Entities. 3435func (e Entities) AsHotel() (*Hotel, bool) { 3436 return nil, false 3437} 3438 3439// AsResponseBase is the BasicResponseBase implementation for Entities. 3440func (e Entities) AsResponseBase() (*ResponseBase, bool) { 3441 return nil, false 3442} 3443 3444// AsBasicResponseBase is the BasicResponseBase implementation for Entities. 3445func (e Entities) AsBasicResponseBase() (BasicResponseBase, bool) { 3446 return &e, true 3447} 3448 3449// UnmarshalJSON is the custom unmarshaler for Entities struct. 3450func (e *Entities) UnmarshalJSON(body []byte) error { 3451 var m map[string]*json.RawMessage 3452 err := json.Unmarshal(body, &m) 3453 if err != nil { 3454 return err 3455 } 3456 for k, v := range m { 3457 switch k { 3458 case "queryScenario": 3459 if v != nil { 3460 var queryScenario EntityQueryScenario 3461 err = json.Unmarshal(*v, &queryScenario) 3462 if err != nil { 3463 return err 3464 } 3465 e.QueryScenario = queryScenario 3466 } 3467 case "value": 3468 if v != nil { 3469 value, err := unmarshalBasicThingArray(*v) 3470 if err != nil { 3471 return err 3472 } 3473 e.Value = &value 3474 } 3475 case "queryContext": 3476 if v != nil { 3477 var queryContext QueryContext 3478 err = json.Unmarshal(*v, &queryContext) 3479 if err != nil { 3480 return err 3481 } 3482 e.QueryContext = &queryContext 3483 } 3484 case "contractualRules": 3485 if v != nil { 3486 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 3487 if err != nil { 3488 return err 3489 } 3490 e.ContractualRules = &contractualRules 3491 } 3492 case "webSearchUrl": 3493 if v != nil { 3494 var webSearchURL string 3495 err = json.Unmarshal(*v, &webSearchURL) 3496 if err != nil { 3497 return err 3498 } 3499 e.WebSearchURL = &webSearchURL 3500 } 3501 case "id": 3502 if v != nil { 3503 var ID string 3504 err = json.Unmarshal(*v, &ID) 3505 if err != nil { 3506 return err 3507 } 3508 e.ID = &ID 3509 } 3510 case "_type": 3511 if v != nil { 3512 var typeVar TypeBasicResponseBase 3513 err = json.Unmarshal(*v, &typeVar) 3514 if err != nil { 3515 return err 3516 } 3517 e.Type = typeVar 3518 } 3519 } 3520 } 3521 3522 return nil 3523} 3524 3525// EntitiesEntityPresentationInfo defines additional information about an entity such as type hints. 3526type EntitiesEntityPresentationInfo struct { 3527 // EntityScenario - The supported scenario. Possible values include: 'EntityScenarioDominantEntity', 'EntityScenarioDisambiguationItem', 'EntityScenarioListItem' 3528 EntityScenario EntityScenario `json:"entityScenario,omitempty"` 3529 // EntityTypeHints - A list of hints that indicate the entity's type. The list could contain a single hint such as Movie or a list of hints such as Place, LocalBusiness, Restaurant. Each successive hint in the array narrows the entity's type. 3530 EntityTypeHints *[]EntityType `json:"entityTypeHints,omitempty"` 3531 // EntityTypeDisplayHint - A display version of the entity hint. For example, if entityTypeHints is Artist, this field may be set to American Singer. 3532 EntityTypeDisplayHint *string `json:"entityTypeDisplayHint,omitempty"` 3533} 3534 3535// Error defines the error that occurred. 3536type Error struct { 3537 // Code - The error code that identifies the category of error. Possible values include: 'None', 'ServerError', 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization' 3538 Code ErrorCode `json:"code,omitempty"` 3539 // SubCode - The error code that further helps to identify the error. Possible values include: 'UnexpectedError', 'ResourceError', 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', 'HTTPNotAllowed', 'Blocked', 'AuthorizationMissing', 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired' 3540 SubCode ErrorSubCode `json:"subCode,omitempty"` 3541 // Message - A description of the error. 3542 Message *string `json:"message,omitempty"` 3543 // MoreDetails - A description that provides additional information about the error. 3544 MoreDetails *string `json:"moreDetails,omitempty"` 3545 // Parameter - The parameter in the request that caused the error. 3546 Parameter *string `json:"parameter,omitempty"` 3547 // Value - The parameter's value in the request that was not valid. 3548 Value *string `json:"value,omitempty"` 3549} 3550 3551// ErrorResponse the top-level response that represents a failed request. 3552type ErrorResponse struct { 3553 // Errors - A list of errors that describe the reasons why the request failed. 3554 Errors *[]Error `json:"errors,omitempty"` 3555 // ContractualRules - A list of rules that you must adhere to if you display the item. 3556 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 3557 // WebSearchURL - The URL To Bing's search result for this item. 3558 WebSearchURL *string `json:"webSearchUrl,omitempty"` 3559 // ID - A String identifier. 3560 ID *string `json:"id,omitempty"` 3561 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 3562 Type TypeBasicResponseBase `json:"_type,omitempty"` 3563} 3564 3565// MarshalJSON is the custom marshaler for ErrorResponse. 3566func (er ErrorResponse) MarshalJSON() ([]byte, error) { 3567 er.Type = TypeErrorResponse 3568 objectMap := make(map[string]interface{}) 3569 if er.Errors != nil { 3570 objectMap["errors"] = er.Errors 3571 } 3572 if er.ContractualRules != nil { 3573 objectMap["contractualRules"] = er.ContractualRules 3574 } 3575 if er.WebSearchURL != nil { 3576 objectMap["webSearchUrl"] = er.WebSearchURL 3577 } 3578 if er.ID != nil { 3579 objectMap["id"] = er.ID 3580 } 3581 if er.Type != "" { 3582 objectMap["_type"] = er.Type 3583 } 3584 return json.Marshal(objectMap) 3585} 3586 3587// AsImageObject is the BasicResponseBase implementation for ErrorResponse. 3588func (er ErrorResponse) AsImageObject() (*ImageObject, bool) { 3589 return nil, false 3590} 3591 3592// AsThing is the BasicResponseBase implementation for ErrorResponse. 3593func (er ErrorResponse) AsThing() (*Thing, bool) { 3594 return nil, false 3595} 3596 3597// AsBasicThing is the BasicResponseBase implementation for ErrorResponse. 3598func (er ErrorResponse) AsBasicThing() (BasicThing, bool) { 3599 return nil, false 3600} 3601 3602// AsEntities is the BasicResponseBase implementation for ErrorResponse. 3603func (er ErrorResponse) AsEntities() (*Entities, bool) { 3604 return nil, false 3605} 3606 3607// AsPlaces is the BasicResponseBase implementation for ErrorResponse. 3608func (er ErrorResponse) AsPlaces() (*Places, bool) { 3609 return nil, false 3610} 3611 3612// AsSearchResponse is the BasicResponseBase implementation for ErrorResponse. 3613func (er ErrorResponse) AsSearchResponse() (*SearchResponse, bool) { 3614 return nil, false 3615} 3616 3617// AsResponse is the BasicResponseBase implementation for ErrorResponse. 3618func (er ErrorResponse) AsResponse() (*Response, bool) { 3619 return nil, false 3620} 3621 3622// AsBasicResponse is the BasicResponseBase implementation for ErrorResponse. 3623func (er ErrorResponse) AsBasicResponse() (BasicResponse, bool) { 3624 return &er, true 3625} 3626 3627// AsSearchResultsAnswer is the BasicResponseBase implementation for ErrorResponse. 3628func (er ErrorResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 3629 return nil, false 3630} 3631 3632// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ErrorResponse. 3633func (er ErrorResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 3634 return nil, false 3635} 3636 3637// AsIdentifiable is the BasicResponseBase implementation for ErrorResponse. 3638func (er ErrorResponse) AsIdentifiable() (*Identifiable, bool) { 3639 return nil, false 3640} 3641 3642// AsBasicIdentifiable is the BasicResponseBase implementation for ErrorResponse. 3643func (er ErrorResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) { 3644 return &er, true 3645} 3646 3647// AsAnswer is the BasicResponseBase implementation for ErrorResponse. 3648func (er ErrorResponse) AsAnswer() (*Answer, bool) { 3649 return nil, false 3650} 3651 3652// AsBasicAnswer is the BasicResponseBase implementation for ErrorResponse. 3653func (er ErrorResponse) AsBasicAnswer() (BasicAnswer, bool) { 3654 return nil, false 3655} 3656 3657// AsErrorResponse is the BasicResponseBase implementation for ErrorResponse. 3658func (er ErrorResponse) AsErrorResponse() (*ErrorResponse, bool) { 3659 return &er, true 3660} 3661 3662// AsPostalAddress is the BasicResponseBase implementation for ErrorResponse. 3663func (er ErrorResponse) AsPostalAddress() (*PostalAddress, bool) { 3664 return nil, false 3665} 3666 3667// AsPlace is the BasicResponseBase implementation for ErrorResponse. 3668func (er ErrorResponse) AsPlace() (*Place, bool) { 3669 return nil, false 3670} 3671 3672// AsBasicPlace is the BasicResponseBase implementation for ErrorResponse. 3673func (er ErrorResponse) AsBasicPlace() (BasicPlace, bool) { 3674 return nil, false 3675} 3676 3677// AsOrganization is the BasicResponseBase implementation for ErrorResponse. 3678func (er ErrorResponse) AsOrganization() (*Organization, bool) { 3679 return nil, false 3680} 3681 3682// AsCreativeWork is the BasicResponseBase implementation for ErrorResponse. 3683func (er ErrorResponse) AsCreativeWork() (*CreativeWork, bool) { 3684 return nil, false 3685} 3686 3687// AsBasicCreativeWork is the BasicResponseBase implementation for ErrorResponse. 3688func (er ErrorResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) { 3689 return nil, false 3690} 3691 3692// AsIntangible is the BasicResponseBase implementation for ErrorResponse. 3693func (er ErrorResponse) AsIntangible() (*Intangible, bool) { 3694 return nil, false 3695} 3696 3697// AsBasicIntangible is the BasicResponseBase implementation for ErrorResponse. 3698func (er ErrorResponse) AsBasicIntangible() (BasicIntangible, bool) { 3699 return nil, false 3700} 3701 3702// AsMovieTheater is the BasicResponseBase implementation for ErrorResponse. 3703func (er ErrorResponse) AsMovieTheater() (*MovieTheater, bool) { 3704 return nil, false 3705} 3706 3707// AsMediaObject is the BasicResponseBase implementation for ErrorResponse. 3708func (er ErrorResponse) AsMediaObject() (*MediaObject, bool) { 3709 return nil, false 3710} 3711 3712// AsBasicMediaObject is the BasicResponseBase implementation for ErrorResponse. 3713func (er ErrorResponse) AsBasicMediaObject() (BasicMediaObject, bool) { 3714 return nil, false 3715} 3716 3717// AsCivicStructure is the BasicResponseBase implementation for ErrorResponse. 3718func (er ErrorResponse) AsCivicStructure() (*CivicStructure, bool) { 3719 return nil, false 3720} 3721 3722// AsBasicCivicStructure is the BasicResponseBase implementation for ErrorResponse. 3723func (er ErrorResponse) AsBasicCivicStructure() (BasicCivicStructure, bool) { 3724 return nil, false 3725} 3726 3727// AsLocalBusiness is the BasicResponseBase implementation for ErrorResponse. 3728func (er ErrorResponse) AsLocalBusiness() (*LocalBusiness, bool) { 3729 return nil, false 3730} 3731 3732// AsBasicLocalBusiness is the BasicResponseBase implementation for ErrorResponse. 3733func (er ErrorResponse) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 3734 return nil, false 3735} 3736 3737// AsTouristAttraction is the BasicResponseBase implementation for ErrorResponse. 3738func (er ErrorResponse) AsTouristAttraction() (*TouristAttraction, bool) { 3739 return nil, false 3740} 3741 3742// AsAirport is the BasicResponseBase implementation for ErrorResponse. 3743func (er ErrorResponse) AsAirport() (*Airport, bool) { 3744 return nil, false 3745} 3746 3747// AsLicense is the BasicResponseBase implementation for ErrorResponse. 3748func (er ErrorResponse) AsLicense() (*License, bool) { 3749 return nil, false 3750} 3751 3752// AsStructuredValue is the BasicResponseBase implementation for ErrorResponse. 3753func (er ErrorResponse) AsStructuredValue() (*StructuredValue, bool) { 3754 return nil, false 3755} 3756 3757// AsBasicStructuredValue is the BasicResponseBase implementation for ErrorResponse. 3758func (er ErrorResponse) AsBasicStructuredValue() (BasicStructuredValue, bool) { 3759 return nil, false 3760} 3761 3762// AsEntertainmentBusiness is the BasicResponseBase implementation for ErrorResponse. 3763func (er ErrorResponse) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 3764 return nil, false 3765} 3766 3767// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for ErrorResponse. 3768func (er ErrorResponse) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 3769 return nil, false 3770} 3771 3772// AsFoodEstablishment is the BasicResponseBase implementation for ErrorResponse. 3773func (er ErrorResponse) AsFoodEstablishment() (*FoodEstablishment, bool) { 3774 return nil, false 3775} 3776 3777// AsBasicFoodEstablishment is the BasicResponseBase implementation for ErrorResponse. 3778func (er ErrorResponse) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 3779 return nil, false 3780} 3781 3782// AsLodgingBusiness is the BasicResponseBase implementation for ErrorResponse. 3783func (er ErrorResponse) AsLodgingBusiness() (*LodgingBusiness, bool) { 3784 return nil, false 3785} 3786 3787// AsBasicLodgingBusiness is the BasicResponseBase implementation for ErrorResponse. 3788func (er ErrorResponse) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 3789 return nil, false 3790} 3791 3792// AsRestaurant is the BasicResponseBase implementation for ErrorResponse. 3793func (er ErrorResponse) AsRestaurant() (*Restaurant, bool) { 3794 return nil, false 3795} 3796 3797// AsHotel is the BasicResponseBase implementation for ErrorResponse. 3798func (er ErrorResponse) AsHotel() (*Hotel, bool) { 3799 return nil, false 3800} 3801 3802// AsResponseBase is the BasicResponseBase implementation for ErrorResponse. 3803func (er ErrorResponse) AsResponseBase() (*ResponseBase, bool) { 3804 return nil, false 3805} 3806 3807// AsBasicResponseBase is the BasicResponseBase implementation for ErrorResponse. 3808func (er ErrorResponse) AsBasicResponseBase() (BasicResponseBase, bool) { 3809 return &er, true 3810} 3811 3812// UnmarshalJSON is the custom unmarshaler for ErrorResponse struct. 3813func (er *ErrorResponse) UnmarshalJSON(body []byte) error { 3814 var m map[string]*json.RawMessage 3815 err := json.Unmarshal(body, &m) 3816 if err != nil { 3817 return err 3818 } 3819 for k, v := range m { 3820 switch k { 3821 case "errors": 3822 if v != nil { 3823 var errorsVar []Error 3824 err = json.Unmarshal(*v, &errorsVar) 3825 if err != nil { 3826 return err 3827 } 3828 er.Errors = &errorsVar 3829 } 3830 case "contractualRules": 3831 if v != nil { 3832 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 3833 if err != nil { 3834 return err 3835 } 3836 er.ContractualRules = &contractualRules 3837 } 3838 case "webSearchUrl": 3839 if v != nil { 3840 var webSearchURL string 3841 err = json.Unmarshal(*v, &webSearchURL) 3842 if err != nil { 3843 return err 3844 } 3845 er.WebSearchURL = &webSearchURL 3846 } 3847 case "id": 3848 if v != nil { 3849 var ID string 3850 err = json.Unmarshal(*v, &ID) 3851 if err != nil { 3852 return err 3853 } 3854 er.ID = &ID 3855 } 3856 case "_type": 3857 if v != nil { 3858 var typeVar TypeBasicResponseBase 3859 err = json.Unmarshal(*v, &typeVar) 3860 if err != nil { 3861 return err 3862 } 3863 er.Type = typeVar 3864 } 3865 } 3866 } 3867 3868 return nil 3869} 3870 3871// BasicFoodEstablishment ... 3872type BasicFoodEstablishment interface { 3873 AsRestaurant() (*Restaurant, bool) 3874 AsFoodEstablishment() (*FoodEstablishment, bool) 3875} 3876 3877// FoodEstablishment ... 3878type FoodEstablishment struct { 3879 // PriceRange - $$. 3880 PriceRange *string `json:"priceRange,omitempty"` 3881 Panoramas *[]ImageObject `json:"panoramas,omitempty"` 3882 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"` 3883 TagLine *string `json:"tagLine,omitempty"` 3884 // Address - The postal address of where the entity is located 3885 Address *PostalAddress `json:"address,omitempty"` 3886 // Telephone - The entity's telephone number 3887 Telephone *string `json:"telephone,omitempty"` 3888 // Name - The name of the thing represented by this object. 3889 Name *string `json:"name,omitempty"` 3890 // URL - The URL to get more information about the thing represented by this object. 3891 URL *string `json:"url,omitempty"` 3892 Image *ImageObject `json:"image,omitempty"` 3893 // Description - A short description of the item. 3894 Description *string `json:"description,omitempty"` 3895 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 3896 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 3897 // BingID - An ID that uniquely identifies this item. 3898 BingID *string `json:"bingId,omitempty"` 3899 // ContractualRules - A list of rules that you must adhere to if you display the item. 3900 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 3901 // WebSearchURL - The URL To Bing's search result for this item. 3902 WebSearchURL *string `json:"webSearchUrl,omitempty"` 3903 // ID - A String identifier. 3904 ID *string `json:"id,omitempty"` 3905 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 3906 Type TypeBasicResponseBase `json:"_type,omitempty"` 3907} 3908 3909func unmarshalBasicFoodEstablishment(body []byte) (BasicFoodEstablishment, error) { 3910 var m map[string]interface{} 3911 err := json.Unmarshal(body, &m) 3912 if err != nil { 3913 return nil, err 3914 } 3915 3916 switch m["_type"] { 3917 case string(TypeRestaurant): 3918 var r Restaurant 3919 err := json.Unmarshal(body, &r) 3920 return r, err 3921 default: 3922 var fe FoodEstablishment 3923 err := json.Unmarshal(body, &fe) 3924 return fe, err 3925 } 3926} 3927func unmarshalBasicFoodEstablishmentArray(body []byte) ([]BasicFoodEstablishment, error) { 3928 var rawMessages []*json.RawMessage 3929 err := json.Unmarshal(body, &rawMessages) 3930 if err != nil { 3931 return nil, err 3932 } 3933 3934 feArray := make([]BasicFoodEstablishment, len(rawMessages)) 3935 3936 for index, rawMessage := range rawMessages { 3937 fe, err := unmarshalBasicFoodEstablishment(*rawMessage) 3938 if err != nil { 3939 return nil, err 3940 } 3941 feArray[index] = fe 3942 } 3943 return feArray, nil 3944} 3945 3946// MarshalJSON is the custom marshaler for FoodEstablishment. 3947func (fe FoodEstablishment) MarshalJSON() ([]byte, error) { 3948 fe.Type = TypeFoodEstablishment 3949 objectMap := make(map[string]interface{}) 3950 if fe.PriceRange != nil { 3951 objectMap["priceRange"] = fe.PriceRange 3952 } 3953 if fe.Panoramas != nil { 3954 objectMap["panoramas"] = fe.Panoramas 3955 } 3956 if fe.IsPermanentlyClosed != nil { 3957 objectMap["isPermanentlyClosed"] = fe.IsPermanentlyClosed 3958 } 3959 if fe.TagLine != nil { 3960 objectMap["tagLine"] = fe.TagLine 3961 } 3962 if fe.Address != nil { 3963 objectMap["address"] = fe.Address 3964 } 3965 if fe.Telephone != nil { 3966 objectMap["telephone"] = fe.Telephone 3967 } 3968 if fe.Name != nil { 3969 objectMap["name"] = fe.Name 3970 } 3971 if fe.URL != nil { 3972 objectMap["url"] = fe.URL 3973 } 3974 if fe.Image != nil { 3975 objectMap["image"] = fe.Image 3976 } 3977 if fe.Description != nil { 3978 objectMap["description"] = fe.Description 3979 } 3980 if fe.EntityPresentationInfo != nil { 3981 objectMap["entityPresentationInfo"] = fe.EntityPresentationInfo 3982 } 3983 if fe.BingID != nil { 3984 objectMap["bingId"] = fe.BingID 3985 } 3986 if fe.ContractualRules != nil { 3987 objectMap["contractualRules"] = fe.ContractualRules 3988 } 3989 if fe.WebSearchURL != nil { 3990 objectMap["webSearchUrl"] = fe.WebSearchURL 3991 } 3992 if fe.ID != nil { 3993 objectMap["id"] = fe.ID 3994 } 3995 if fe.Type != "" { 3996 objectMap["_type"] = fe.Type 3997 } 3998 return json.Marshal(objectMap) 3999} 4000 4001// AsImageObject is the BasicResponseBase implementation for FoodEstablishment. 4002func (fe FoodEstablishment) AsImageObject() (*ImageObject, bool) { 4003 return nil, false 4004} 4005 4006// AsThing is the BasicResponseBase implementation for FoodEstablishment. 4007func (fe FoodEstablishment) AsThing() (*Thing, bool) { 4008 return nil, false 4009} 4010 4011// AsBasicThing is the BasicResponseBase implementation for FoodEstablishment. 4012func (fe FoodEstablishment) AsBasicThing() (BasicThing, bool) { 4013 return &fe, true 4014} 4015 4016// AsEntities is the BasicResponseBase implementation for FoodEstablishment. 4017func (fe FoodEstablishment) AsEntities() (*Entities, bool) { 4018 return nil, false 4019} 4020 4021// AsPlaces is the BasicResponseBase implementation for FoodEstablishment. 4022func (fe FoodEstablishment) AsPlaces() (*Places, bool) { 4023 return nil, false 4024} 4025 4026// AsSearchResponse is the BasicResponseBase implementation for FoodEstablishment. 4027func (fe FoodEstablishment) AsSearchResponse() (*SearchResponse, bool) { 4028 return nil, false 4029} 4030 4031// AsResponse is the BasicResponseBase implementation for FoodEstablishment. 4032func (fe FoodEstablishment) AsResponse() (*Response, bool) { 4033 return nil, false 4034} 4035 4036// AsBasicResponse is the BasicResponseBase implementation for FoodEstablishment. 4037func (fe FoodEstablishment) AsBasicResponse() (BasicResponse, bool) { 4038 return &fe, true 4039} 4040 4041// AsSearchResultsAnswer is the BasicResponseBase implementation for FoodEstablishment. 4042func (fe FoodEstablishment) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 4043 return nil, false 4044} 4045 4046// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for FoodEstablishment. 4047func (fe FoodEstablishment) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 4048 return nil, false 4049} 4050 4051// AsIdentifiable is the BasicResponseBase implementation for FoodEstablishment. 4052func (fe FoodEstablishment) AsIdentifiable() (*Identifiable, bool) { 4053 return nil, false 4054} 4055 4056// AsBasicIdentifiable is the BasicResponseBase implementation for FoodEstablishment. 4057func (fe FoodEstablishment) AsBasicIdentifiable() (BasicIdentifiable, bool) { 4058 return &fe, true 4059} 4060 4061// AsAnswer is the BasicResponseBase implementation for FoodEstablishment. 4062func (fe FoodEstablishment) AsAnswer() (*Answer, bool) { 4063 return nil, false 4064} 4065 4066// AsBasicAnswer is the BasicResponseBase implementation for FoodEstablishment. 4067func (fe FoodEstablishment) AsBasicAnswer() (BasicAnswer, bool) { 4068 return nil, false 4069} 4070 4071// AsErrorResponse is the BasicResponseBase implementation for FoodEstablishment. 4072func (fe FoodEstablishment) AsErrorResponse() (*ErrorResponse, bool) { 4073 return nil, false 4074} 4075 4076// AsPostalAddress is the BasicResponseBase implementation for FoodEstablishment. 4077func (fe FoodEstablishment) AsPostalAddress() (*PostalAddress, bool) { 4078 return nil, false 4079} 4080 4081// AsPlace is the BasicResponseBase implementation for FoodEstablishment. 4082func (fe FoodEstablishment) AsPlace() (*Place, bool) { 4083 return nil, false 4084} 4085 4086// AsBasicPlace is the BasicResponseBase implementation for FoodEstablishment. 4087func (fe FoodEstablishment) AsBasicPlace() (BasicPlace, bool) { 4088 return &fe, true 4089} 4090 4091// AsOrganization is the BasicResponseBase implementation for FoodEstablishment. 4092func (fe FoodEstablishment) AsOrganization() (*Organization, bool) { 4093 return nil, false 4094} 4095 4096// AsCreativeWork is the BasicResponseBase implementation for FoodEstablishment. 4097func (fe FoodEstablishment) AsCreativeWork() (*CreativeWork, bool) { 4098 return nil, false 4099} 4100 4101// AsBasicCreativeWork is the BasicResponseBase implementation for FoodEstablishment. 4102func (fe FoodEstablishment) AsBasicCreativeWork() (BasicCreativeWork, bool) { 4103 return nil, false 4104} 4105 4106// AsIntangible is the BasicResponseBase implementation for FoodEstablishment. 4107func (fe FoodEstablishment) AsIntangible() (*Intangible, bool) { 4108 return nil, false 4109} 4110 4111// AsBasicIntangible is the BasicResponseBase implementation for FoodEstablishment. 4112func (fe FoodEstablishment) AsBasicIntangible() (BasicIntangible, bool) { 4113 return nil, false 4114} 4115 4116// AsMovieTheater is the BasicResponseBase implementation for FoodEstablishment. 4117func (fe FoodEstablishment) AsMovieTheater() (*MovieTheater, bool) { 4118 return nil, false 4119} 4120 4121// AsMediaObject is the BasicResponseBase implementation for FoodEstablishment. 4122func (fe FoodEstablishment) AsMediaObject() (*MediaObject, bool) { 4123 return nil, false 4124} 4125 4126// AsBasicMediaObject is the BasicResponseBase implementation for FoodEstablishment. 4127func (fe FoodEstablishment) AsBasicMediaObject() (BasicMediaObject, bool) { 4128 return nil, false 4129} 4130 4131// AsCivicStructure is the BasicResponseBase implementation for FoodEstablishment. 4132func (fe FoodEstablishment) AsCivicStructure() (*CivicStructure, bool) { 4133 return nil, false 4134} 4135 4136// AsBasicCivicStructure is the BasicResponseBase implementation for FoodEstablishment. 4137func (fe FoodEstablishment) AsBasicCivicStructure() (BasicCivicStructure, bool) { 4138 return nil, false 4139} 4140 4141// AsLocalBusiness is the BasicResponseBase implementation for FoodEstablishment. 4142func (fe FoodEstablishment) AsLocalBusiness() (*LocalBusiness, bool) { 4143 return nil, false 4144} 4145 4146// AsBasicLocalBusiness is the BasicResponseBase implementation for FoodEstablishment. 4147func (fe FoodEstablishment) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 4148 return &fe, true 4149} 4150 4151// AsTouristAttraction is the BasicResponseBase implementation for FoodEstablishment. 4152func (fe FoodEstablishment) AsTouristAttraction() (*TouristAttraction, bool) { 4153 return nil, false 4154} 4155 4156// AsAirport is the BasicResponseBase implementation for FoodEstablishment. 4157func (fe FoodEstablishment) AsAirport() (*Airport, bool) { 4158 return nil, false 4159} 4160 4161// AsLicense is the BasicResponseBase implementation for FoodEstablishment. 4162func (fe FoodEstablishment) AsLicense() (*License, bool) { 4163 return nil, false 4164} 4165 4166// AsStructuredValue is the BasicResponseBase implementation for FoodEstablishment. 4167func (fe FoodEstablishment) AsStructuredValue() (*StructuredValue, bool) { 4168 return nil, false 4169} 4170 4171// AsBasicStructuredValue is the BasicResponseBase implementation for FoodEstablishment. 4172func (fe FoodEstablishment) AsBasicStructuredValue() (BasicStructuredValue, bool) { 4173 return nil, false 4174} 4175 4176// AsEntertainmentBusiness is the BasicResponseBase implementation for FoodEstablishment. 4177func (fe FoodEstablishment) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 4178 return nil, false 4179} 4180 4181// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for FoodEstablishment. 4182func (fe FoodEstablishment) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 4183 return nil, false 4184} 4185 4186// AsFoodEstablishment is the BasicResponseBase implementation for FoodEstablishment. 4187func (fe FoodEstablishment) AsFoodEstablishment() (*FoodEstablishment, bool) { 4188 return &fe, true 4189} 4190 4191// AsBasicFoodEstablishment is the BasicResponseBase implementation for FoodEstablishment. 4192func (fe FoodEstablishment) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 4193 return &fe, true 4194} 4195 4196// AsLodgingBusiness is the BasicResponseBase implementation for FoodEstablishment. 4197func (fe FoodEstablishment) AsLodgingBusiness() (*LodgingBusiness, bool) { 4198 return nil, false 4199} 4200 4201// AsBasicLodgingBusiness is the BasicResponseBase implementation for FoodEstablishment. 4202func (fe FoodEstablishment) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 4203 return nil, false 4204} 4205 4206// AsRestaurant is the BasicResponseBase implementation for FoodEstablishment. 4207func (fe FoodEstablishment) AsRestaurant() (*Restaurant, bool) { 4208 return nil, false 4209} 4210 4211// AsHotel is the BasicResponseBase implementation for FoodEstablishment. 4212func (fe FoodEstablishment) AsHotel() (*Hotel, bool) { 4213 return nil, false 4214} 4215 4216// AsResponseBase is the BasicResponseBase implementation for FoodEstablishment. 4217func (fe FoodEstablishment) AsResponseBase() (*ResponseBase, bool) { 4218 return nil, false 4219} 4220 4221// AsBasicResponseBase is the BasicResponseBase implementation for FoodEstablishment. 4222func (fe FoodEstablishment) AsBasicResponseBase() (BasicResponseBase, bool) { 4223 return &fe, true 4224} 4225 4226// UnmarshalJSON is the custom unmarshaler for FoodEstablishment struct. 4227func (fe *FoodEstablishment) UnmarshalJSON(body []byte) error { 4228 var m map[string]*json.RawMessage 4229 err := json.Unmarshal(body, &m) 4230 if err != nil { 4231 return err 4232 } 4233 for k, v := range m { 4234 switch k { 4235 case "priceRange": 4236 if v != nil { 4237 var priceRange string 4238 err = json.Unmarshal(*v, &priceRange) 4239 if err != nil { 4240 return err 4241 } 4242 fe.PriceRange = &priceRange 4243 } 4244 case "panoramas": 4245 if v != nil { 4246 var panoramas []ImageObject 4247 err = json.Unmarshal(*v, &panoramas) 4248 if err != nil { 4249 return err 4250 } 4251 fe.Panoramas = &panoramas 4252 } 4253 case "isPermanentlyClosed": 4254 if v != nil { 4255 var isPermanentlyClosed bool 4256 err = json.Unmarshal(*v, &isPermanentlyClosed) 4257 if err != nil { 4258 return err 4259 } 4260 fe.IsPermanentlyClosed = &isPermanentlyClosed 4261 } 4262 case "tagLine": 4263 if v != nil { 4264 var tagLine string 4265 err = json.Unmarshal(*v, &tagLine) 4266 if err != nil { 4267 return err 4268 } 4269 fe.TagLine = &tagLine 4270 } 4271 case "address": 4272 if v != nil { 4273 var address PostalAddress 4274 err = json.Unmarshal(*v, &address) 4275 if err != nil { 4276 return err 4277 } 4278 fe.Address = &address 4279 } 4280 case "telephone": 4281 if v != nil { 4282 var telephone string 4283 err = json.Unmarshal(*v, &telephone) 4284 if err != nil { 4285 return err 4286 } 4287 fe.Telephone = &telephone 4288 } 4289 case "name": 4290 if v != nil { 4291 var name string 4292 err = json.Unmarshal(*v, &name) 4293 if err != nil { 4294 return err 4295 } 4296 fe.Name = &name 4297 } 4298 case "url": 4299 if v != nil { 4300 var URL string 4301 err = json.Unmarshal(*v, &URL) 4302 if err != nil { 4303 return err 4304 } 4305 fe.URL = &URL 4306 } 4307 case "image": 4308 if v != nil { 4309 var imageVar ImageObject 4310 err = json.Unmarshal(*v, &imageVar) 4311 if err != nil { 4312 return err 4313 } 4314 fe.Image = &imageVar 4315 } 4316 case "description": 4317 if v != nil { 4318 var description string 4319 err = json.Unmarshal(*v, &description) 4320 if err != nil { 4321 return err 4322 } 4323 fe.Description = &description 4324 } 4325 case "entityPresentationInfo": 4326 if v != nil { 4327 var entityPresentationInfo EntitiesEntityPresentationInfo 4328 err = json.Unmarshal(*v, &entityPresentationInfo) 4329 if err != nil { 4330 return err 4331 } 4332 fe.EntityPresentationInfo = &entityPresentationInfo 4333 } 4334 case "bingId": 4335 if v != nil { 4336 var bingID string 4337 err = json.Unmarshal(*v, &bingID) 4338 if err != nil { 4339 return err 4340 } 4341 fe.BingID = &bingID 4342 } 4343 case "contractualRules": 4344 if v != nil { 4345 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 4346 if err != nil { 4347 return err 4348 } 4349 fe.ContractualRules = &contractualRules 4350 } 4351 case "webSearchUrl": 4352 if v != nil { 4353 var webSearchURL string 4354 err = json.Unmarshal(*v, &webSearchURL) 4355 if err != nil { 4356 return err 4357 } 4358 fe.WebSearchURL = &webSearchURL 4359 } 4360 case "id": 4361 if v != nil { 4362 var ID string 4363 err = json.Unmarshal(*v, &ID) 4364 if err != nil { 4365 return err 4366 } 4367 fe.ID = &ID 4368 } 4369 case "_type": 4370 if v != nil { 4371 var typeVar TypeBasicResponseBase 4372 err = json.Unmarshal(*v, &typeVar) 4373 if err != nil { 4374 return err 4375 } 4376 fe.Type = typeVar 4377 } 4378 } 4379 } 4380 4381 return nil 4382} 4383 4384// Hotel ... 4385type Hotel struct { 4386 HotelClass *string `json:"hotelClass,omitempty"` 4387 Amenities *[]string `json:"amenities,omitempty"` 4388 // PriceRange - $$. 4389 PriceRange *string `json:"priceRange,omitempty"` 4390 Panoramas *[]ImageObject `json:"panoramas,omitempty"` 4391 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"` 4392 TagLine *string `json:"tagLine,omitempty"` 4393 // Address - The postal address of where the entity is located 4394 Address *PostalAddress `json:"address,omitempty"` 4395 // Telephone - The entity's telephone number 4396 Telephone *string `json:"telephone,omitempty"` 4397 // Name - The name of the thing represented by this object. 4398 Name *string `json:"name,omitempty"` 4399 // URL - The URL to get more information about the thing represented by this object. 4400 URL *string `json:"url,omitempty"` 4401 Image *ImageObject `json:"image,omitempty"` 4402 // Description - A short description of the item. 4403 Description *string `json:"description,omitempty"` 4404 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 4405 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 4406 // BingID - An ID that uniquely identifies this item. 4407 BingID *string `json:"bingId,omitempty"` 4408 // ContractualRules - A list of rules that you must adhere to if you display the item. 4409 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 4410 // WebSearchURL - The URL To Bing's search result for this item. 4411 WebSearchURL *string `json:"webSearchUrl,omitempty"` 4412 // ID - A String identifier. 4413 ID *string `json:"id,omitempty"` 4414 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 4415 Type TypeBasicResponseBase `json:"_type,omitempty"` 4416} 4417 4418// MarshalJSON is the custom marshaler for Hotel. 4419func (h Hotel) MarshalJSON() ([]byte, error) { 4420 h.Type = TypeHotel 4421 objectMap := make(map[string]interface{}) 4422 if h.HotelClass != nil { 4423 objectMap["hotelClass"] = h.HotelClass 4424 } 4425 if h.Amenities != nil { 4426 objectMap["amenities"] = h.Amenities 4427 } 4428 if h.PriceRange != nil { 4429 objectMap["priceRange"] = h.PriceRange 4430 } 4431 if h.Panoramas != nil { 4432 objectMap["panoramas"] = h.Panoramas 4433 } 4434 if h.IsPermanentlyClosed != nil { 4435 objectMap["isPermanentlyClosed"] = h.IsPermanentlyClosed 4436 } 4437 if h.TagLine != nil { 4438 objectMap["tagLine"] = h.TagLine 4439 } 4440 if h.Address != nil { 4441 objectMap["address"] = h.Address 4442 } 4443 if h.Telephone != nil { 4444 objectMap["telephone"] = h.Telephone 4445 } 4446 if h.Name != nil { 4447 objectMap["name"] = h.Name 4448 } 4449 if h.URL != nil { 4450 objectMap["url"] = h.URL 4451 } 4452 if h.Image != nil { 4453 objectMap["image"] = h.Image 4454 } 4455 if h.Description != nil { 4456 objectMap["description"] = h.Description 4457 } 4458 if h.EntityPresentationInfo != nil { 4459 objectMap["entityPresentationInfo"] = h.EntityPresentationInfo 4460 } 4461 if h.BingID != nil { 4462 objectMap["bingId"] = h.BingID 4463 } 4464 if h.ContractualRules != nil { 4465 objectMap["contractualRules"] = h.ContractualRules 4466 } 4467 if h.WebSearchURL != nil { 4468 objectMap["webSearchUrl"] = h.WebSearchURL 4469 } 4470 if h.ID != nil { 4471 objectMap["id"] = h.ID 4472 } 4473 if h.Type != "" { 4474 objectMap["_type"] = h.Type 4475 } 4476 return json.Marshal(objectMap) 4477} 4478 4479// AsImageObject is the BasicResponseBase implementation for Hotel. 4480func (h Hotel) AsImageObject() (*ImageObject, bool) { 4481 return nil, false 4482} 4483 4484// AsThing is the BasicResponseBase implementation for Hotel. 4485func (h Hotel) AsThing() (*Thing, bool) { 4486 return nil, false 4487} 4488 4489// AsBasicThing is the BasicResponseBase implementation for Hotel. 4490func (h Hotel) AsBasicThing() (BasicThing, bool) { 4491 return &h, true 4492} 4493 4494// AsEntities is the BasicResponseBase implementation for Hotel. 4495func (h Hotel) AsEntities() (*Entities, bool) { 4496 return nil, false 4497} 4498 4499// AsPlaces is the BasicResponseBase implementation for Hotel. 4500func (h Hotel) AsPlaces() (*Places, bool) { 4501 return nil, false 4502} 4503 4504// AsSearchResponse is the BasicResponseBase implementation for Hotel. 4505func (h Hotel) AsSearchResponse() (*SearchResponse, bool) { 4506 return nil, false 4507} 4508 4509// AsResponse is the BasicResponseBase implementation for Hotel. 4510func (h Hotel) AsResponse() (*Response, bool) { 4511 return nil, false 4512} 4513 4514// AsBasicResponse is the BasicResponseBase implementation for Hotel. 4515func (h Hotel) AsBasicResponse() (BasicResponse, bool) { 4516 return &h, true 4517} 4518 4519// AsSearchResultsAnswer is the BasicResponseBase implementation for Hotel. 4520func (h Hotel) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 4521 return nil, false 4522} 4523 4524// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Hotel. 4525func (h Hotel) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 4526 return nil, false 4527} 4528 4529// AsIdentifiable is the BasicResponseBase implementation for Hotel. 4530func (h Hotel) AsIdentifiable() (*Identifiable, bool) { 4531 return nil, false 4532} 4533 4534// AsBasicIdentifiable is the BasicResponseBase implementation for Hotel. 4535func (h Hotel) AsBasicIdentifiable() (BasicIdentifiable, bool) { 4536 return &h, true 4537} 4538 4539// AsAnswer is the BasicResponseBase implementation for Hotel. 4540func (h Hotel) AsAnswer() (*Answer, bool) { 4541 return nil, false 4542} 4543 4544// AsBasicAnswer is the BasicResponseBase implementation for Hotel. 4545func (h Hotel) AsBasicAnswer() (BasicAnswer, bool) { 4546 return nil, false 4547} 4548 4549// AsErrorResponse is the BasicResponseBase implementation for Hotel. 4550func (h Hotel) AsErrorResponse() (*ErrorResponse, bool) { 4551 return nil, false 4552} 4553 4554// AsPostalAddress is the BasicResponseBase implementation for Hotel. 4555func (h Hotel) AsPostalAddress() (*PostalAddress, bool) { 4556 return nil, false 4557} 4558 4559// AsPlace is the BasicResponseBase implementation for Hotel. 4560func (h Hotel) AsPlace() (*Place, bool) { 4561 return nil, false 4562} 4563 4564// AsBasicPlace is the BasicResponseBase implementation for Hotel. 4565func (h Hotel) AsBasicPlace() (BasicPlace, bool) { 4566 return &h, true 4567} 4568 4569// AsOrganization is the BasicResponseBase implementation for Hotel. 4570func (h Hotel) AsOrganization() (*Organization, bool) { 4571 return nil, false 4572} 4573 4574// AsCreativeWork is the BasicResponseBase implementation for Hotel. 4575func (h Hotel) AsCreativeWork() (*CreativeWork, bool) { 4576 return nil, false 4577} 4578 4579// AsBasicCreativeWork is the BasicResponseBase implementation for Hotel. 4580func (h Hotel) AsBasicCreativeWork() (BasicCreativeWork, bool) { 4581 return nil, false 4582} 4583 4584// AsIntangible is the BasicResponseBase implementation for Hotel. 4585func (h Hotel) AsIntangible() (*Intangible, bool) { 4586 return nil, false 4587} 4588 4589// AsBasicIntangible is the BasicResponseBase implementation for Hotel. 4590func (h Hotel) AsBasicIntangible() (BasicIntangible, bool) { 4591 return nil, false 4592} 4593 4594// AsMovieTheater is the BasicResponseBase implementation for Hotel. 4595func (h Hotel) AsMovieTheater() (*MovieTheater, bool) { 4596 return nil, false 4597} 4598 4599// AsMediaObject is the BasicResponseBase implementation for Hotel. 4600func (h Hotel) AsMediaObject() (*MediaObject, bool) { 4601 return nil, false 4602} 4603 4604// AsBasicMediaObject is the BasicResponseBase implementation for Hotel. 4605func (h Hotel) AsBasicMediaObject() (BasicMediaObject, bool) { 4606 return nil, false 4607} 4608 4609// AsCivicStructure is the BasicResponseBase implementation for Hotel. 4610func (h Hotel) AsCivicStructure() (*CivicStructure, bool) { 4611 return nil, false 4612} 4613 4614// AsBasicCivicStructure is the BasicResponseBase implementation for Hotel. 4615func (h Hotel) AsBasicCivicStructure() (BasicCivicStructure, bool) { 4616 return nil, false 4617} 4618 4619// AsLocalBusiness is the BasicResponseBase implementation for Hotel. 4620func (h Hotel) AsLocalBusiness() (*LocalBusiness, bool) { 4621 return nil, false 4622} 4623 4624// AsBasicLocalBusiness is the BasicResponseBase implementation for Hotel. 4625func (h Hotel) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 4626 return &h, true 4627} 4628 4629// AsTouristAttraction is the BasicResponseBase implementation for Hotel. 4630func (h Hotel) AsTouristAttraction() (*TouristAttraction, bool) { 4631 return nil, false 4632} 4633 4634// AsAirport is the BasicResponseBase implementation for Hotel. 4635func (h Hotel) AsAirport() (*Airport, bool) { 4636 return nil, false 4637} 4638 4639// AsLicense is the BasicResponseBase implementation for Hotel. 4640func (h Hotel) AsLicense() (*License, bool) { 4641 return nil, false 4642} 4643 4644// AsStructuredValue is the BasicResponseBase implementation for Hotel. 4645func (h Hotel) AsStructuredValue() (*StructuredValue, bool) { 4646 return nil, false 4647} 4648 4649// AsBasicStructuredValue is the BasicResponseBase implementation for Hotel. 4650func (h Hotel) AsBasicStructuredValue() (BasicStructuredValue, bool) { 4651 return nil, false 4652} 4653 4654// AsEntertainmentBusiness is the BasicResponseBase implementation for Hotel. 4655func (h Hotel) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 4656 return nil, false 4657} 4658 4659// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Hotel. 4660func (h Hotel) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 4661 return nil, false 4662} 4663 4664// AsFoodEstablishment is the BasicResponseBase implementation for Hotel. 4665func (h Hotel) AsFoodEstablishment() (*FoodEstablishment, bool) { 4666 return nil, false 4667} 4668 4669// AsBasicFoodEstablishment is the BasicResponseBase implementation for Hotel. 4670func (h Hotel) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 4671 return nil, false 4672} 4673 4674// AsLodgingBusiness is the BasicResponseBase implementation for Hotel. 4675func (h Hotel) AsLodgingBusiness() (*LodgingBusiness, bool) { 4676 return nil, false 4677} 4678 4679// AsBasicLodgingBusiness is the BasicResponseBase implementation for Hotel. 4680func (h Hotel) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 4681 return &h, true 4682} 4683 4684// AsRestaurant is the BasicResponseBase implementation for Hotel. 4685func (h Hotel) AsRestaurant() (*Restaurant, bool) { 4686 return nil, false 4687} 4688 4689// AsHotel is the BasicResponseBase implementation for Hotel. 4690func (h Hotel) AsHotel() (*Hotel, bool) { 4691 return &h, true 4692} 4693 4694// AsResponseBase is the BasicResponseBase implementation for Hotel. 4695func (h Hotel) AsResponseBase() (*ResponseBase, bool) { 4696 return nil, false 4697} 4698 4699// AsBasicResponseBase is the BasicResponseBase implementation for Hotel. 4700func (h Hotel) AsBasicResponseBase() (BasicResponseBase, bool) { 4701 return &h, true 4702} 4703 4704// UnmarshalJSON is the custom unmarshaler for Hotel struct. 4705func (h *Hotel) UnmarshalJSON(body []byte) error { 4706 var m map[string]*json.RawMessage 4707 err := json.Unmarshal(body, &m) 4708 if err != nil { 4709 return err 4710 } 4711 for k, v := range m { 4712 switch k { 4713 case "hotelClass": 4714 if v != nil { 4715 var hotelClass string 4716 err = json.Unmarshal(*v, &hotelClass) 4717 if err != nil { 4718 return err 4719 } 4720 h.HotelClass = &hotelClass 4721 } 4722 case "amenities": 4723 if v != nil { 4724 var amenities []string 4725 err = json.Unmarshal(*v, &amenities) 4726 if err != nil { 4727 return err 4728 } 4729 h.Amenities = &amenities 4730 } 4731 case "priceRange": 4732 if v != nil { 4733 var priceRange string 4734 err = json.Unmarshal(*v, &priceRange) 4735 if err != nil { 4736 return err 4737 } 4738 h.PriceRange = &priceRange 4739 } 4740 case "panoramas": 4741 if v != nil { 4742 var panoramas []ImageObject 4743 err = json.Unmarshal(*v, &panoramas) 4744 if err != nil { 4745 return err 4746 } 4747 h.Panoramas = &panoramas 4748 } 4749 case "isPermanentlyClosed": 4750 if v != nil { 4751 var isPermanentlyClosed bool 4752 err = json.Unmarshal(*v, &isPermanentlyClosed) 4753 if err != nil { 4754 return err 4755 } 4756 h.IsPermanentlyClosed = &isPermanentlyClosed 4757 } 4758 case "tagLine": 4759 if v != nil { 4760 var tagLine string 4761 err = json.Unmarshal(*v, &tagLine) 4762 if err != nil { 4763 return err 4764 } 4765 h.TagLine = &tagLine 4766 } 4767 case "address": 4768 if v != nil { 4769 var address PostalAddress 4770 err = json.Unmarshal(*v, &address) 4771 if err != nil { 4772 return err 4773 } 4774 h.Address = &address 4775 } 4776 case "telephone": 4777 if v != nil { 4778 var telephone string 4779 err = json.Unmarshal(*v, &telephone) 4780 if err != nil { 4781 return err 4782 } 4783 h.Telephone = &telephone 4784 } 4785 case "name": 4786 if v != nil { 4787 var name string 4788 err = json.Unmarshal(*v, &name) 4789 if err != nil { 4790 return err 4791 } 4792 h.Name = &name 4793 } 4794 case "url": 4795 if v != nil { 4796 var URL string 4797 err = json.Unmarshal(*v, &URL) 4798 if err != nil { 4799 return err 4800 } 4801 h.URL = &URL 4802 } 4803 case "image": 4804 if v != nil { 4805 var imageVar ImageObject 4806 err = json.Unmarshal(*v, &imageVar) 4807 if err != nil { 4808 return err 4809 } 4810 h.Image = &imageVar 4811 } 4812 case "description": 4813 if v != nil { 4814 var description string 4815 err = json.Unmarshal(*v, &description) 4816 if err != nil { 4817 return err 4818 } 4819 h.Description = &description 4820 } 4821 case "entityPresentationInfo": 4822 if v != nil { 4823 var entityPresentationInfo EntitiesEntityPresentationInfo 4824 err = json.Unmarshal(*v, &entityPresentationInfo) 4825 if err != nil { 4826 return err 4827 } 4828 h.EntityPresentationInfo = &entityPresentationInfo 4829 } 4830 case "bingId": 4831 if v != nil { 4832 var bingID string 4833 err = json.Unmarshal(*v, &bingID) 4834 if err != nil { 4835 return err 4836 } 4837 h.BingID = &bingID 4838 } 4839 case "contractualRules": 4840 if v != nil { 4841 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 4842 if err != nil { 4843 return err 4844 } 4845 h.ContractualRules = &contractualRules 4846 } 4847 case "webSearchUrl": 4848 if v != nil { 4849 var webSearchURL string 4850 err = json.Unmarshal(*v, &webSearchURL) 4851 if err != nil { 4852 return err 4853 } 4854 h.WebSearchURL = &webSearchURL 4855 } 4856 case "id": 4857 if v != nil { 4858 var ID string 4859 err = json.Unmarshal(*v, &ID) 4860 if err != nil { 4861 return err 4862 } 4863 h.ID = &ID 4864 } 4865 case "_type": 4866 if v != nil { 4867 var typeVar TypeBasicResponseBase 4868 err = json.Unmarshal(*v, &typeVar) 4869 if err != nil { 4870 return err 4871 } 4872 h.Type = typeVar 4873 } 4874 } 4875 } 4876 4877 return nil 4878} 4879 4880// BasicIdentifiable defines the identity of a resource. 4881type BasicIdentifiable interface { 4882 AsImageObject() (*ImageObject, bool) 4883 AsThing() (*Thing, bool) 4884 AsBasicThing() (BasicThing, bool) 4885 AsEntities() (*Entities, bool) 4886 AsPlaces() (*Places, bool) 4887 AsSearchResponse() (*SearchResponse, bool) 4888 AsResponse() (*Response, bool) 4889 AsBasicResponse() (BasicResponse, bool) 4890 AsSearchResultsAnswer() (*SearchResultsAnswer, bool) 4891 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) 4892 AsAnswer() (*Answer, bool) 4893 AsBasicAnswer() (BasicAnswer, bool) 4894 AsErrorResponse() (*ErrorResponse, bool) 4895 AsPostalAddress() (*PostalAddress, bool) 4896 AsPlace() (*Place, bool) 4897 AsBasicPlace() (BasicPlace, bool) 4898 AsOrganization() (*Organization, bool) 4899 AsCreativeWork() (*CreativeWork, bool) 4900 AsBasicCreativeWork() (BasicCreativeWork, bool) 4901 AsIntangible() (*Intangible, bool) 4902 AsBasicIntangible() (BasicIntangible, bool) 4903 AsMovieTheater() (*MovieTheater, bool) 4904 AsMediaObject() (*MediaObject, bool) 4905 AsBasicMediaObject() (BasicMediaObject, bool) 4906 AsCivicStructure() (*CivicStructure, bool) 4907 AsBasicCivicStructure() (BasicCivicStructure, bool) 4908 AsLocalBusiness() (*LocalBusiness, bool) 4909 AsBasicLocalBusiness() (BasicLocalBusiness, bool) 4910 AsTouristAttraction() (*TouristAttraction, bool) 4911 AsAirport() (*Airport, bool) 4912 AsLicense() (*License, bool) 4913 AsStructuredValue() (*StructuredValue, bool) 4914 AsBasicStructuredValue() (BasicStructuredValue, bool) 4915 AsEntertainmentBusiness() (*EntertainmentBusiness, bool) 4916 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) 4917 AsFoodEstablishment() (*FoodEstablishment, bool) 4918 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) 4919 AsLodgingBusiness() (*LodgingBusiness, bool) 4920 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) 4921 AsRestaurant() (*Restaurant, bool) 4922 AsHotel() (*Hotel, bool) 4923 AsIdentifiable() (*Identifiable, bool) 4924} 4925 4926// Identifiable defines the identity of a resource. 4927type Identifiable struct { 4928 // ID - A String identifier. 4929 ID *string `json:"id,omitempty"` 4930 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 4931 Type TypeBasicResponseBase `json:"_type,omitempty"` 4932} 4933 4934func unmarshalBasicIdentifiable(body []byte) (BasicIdentifiable, error) { 4935 var m map[string]interface{} 4936 err := json.Unmarshal(body, &m) 4937 if err != nil { 4938 return nil, err 4939 } 4940 4941 switch m["_type"] { 4942 case string(TypeImageObject): 4943 var ioVar ImageObject 4944 err := json.Unmarshal(body, &ioVar) 4945 return ioVar, err 4946 case string(TypeThing): 4947 var t Thing 4948 err := json.Unmarshal(body, &t) 4949 return t, err 4950 case string(TypeEntities): 4951 var e Entities 4952 err := json.Unmarshal(body, &e) 4953 return e, err 4954 case string(TypePlaces): 4955 var p Places 4956 err := json.Unmarshal(body, &p) 4957 return p, err 4958 case string(TypeSearchResponse): 4959 var sr SearchResponse 4960 err := json.Unmarshal(body, &sr) 4961 return sr, err 4962 case string(TypeResponse): 4963 var r Response 4964 err := json.Unmarshal(body, &r) 4965 return r, err 4966 case string(TypeSearchResultsAnswer): 4967 var sra SearchResultsAnswer 4968 err := json.Unmarshal(body, &sra) 4969 return sra, err 4970 case string(TypeAnswer): 4971 var a Answer 4972 err := json.Unmarshal(body, &a) 4973 return a, err 4974 case string(TypeErrorResponse): 4975 var er ErrorResponse 4976 err := json.Unmarshal(body, &er) 4977 return er, err 4978 case string(TypePostalAddress): 4979 var pa PostalAddress 4980 err := json.Unmarshal(body, &pa) 4981 return pa, err 4982 case string(TypePlace): 4983 var p Place 4984 err := json.Unmarshal(body, &p) 4985 return p, err 4986 case string(TypeOrganization): 4987 var o Organization 4988 err := json.Unmarshal(body, &o) 4989 return o, err 4990 case string(TypeCreativeWork): 4991 var cw CreativeWork 4992 err := json.Unmarshal(body, &cw) 4993 return cw, err 4994 case string(TypeIntangible): 4995 var i Intangible 4996 err := json.Unmarshal(body, &i) 4997 return i, err 4998 case string(TypeMovieTheater): 4999 var mt MovieTheater 5000 err := json.Unmarshal(body, &mt) 5001 return mt, err 5002 case string(TypeMediaObject): 5003 var mo MediaObject 5004 err := json.Unmarshal(body, &mo) 5005 return mo, err 5006 case string(TypeCivicStructure): 5007 var cs CivicStructure 5008 err := json.Unmarshal(body, &cs) 5009 return cs, err 5010 case string(TypeLocalBusiness): 5011 var lb LocalBusiness 5012 err := json.Unmarshal(body, &lb) 5013 return lb, err 5014 case string(TypeTouristAttraction): 5015 var ta TouristAttraction 5016 err := json.Unmarshal(body, &ta) 5017 return ta, err 5018 case string(TypeAirport): 5019 var a Airport 5020 err := json.Unmarshal(body, &a) 5021 return a, err 5022 case string(TypeLicense): 5023 var l License 5024 err := json.Unmarshal(body, &l) 5025 return l, err 5026 case string(TypeStructuredValue): 5027 var sv StructuredValue 5028 err := json.Unmarshal(body, &sv) 5029 return sv, err 5030 case string(TypeEntertainmentBusiness): 5031 var eb EntertainmentBusiness 5032 err := json.Unmarshal(body, &eb) 5033 return eb, err 5034 case string(TypeFoodEstablishment): 5035 var fe FoodEstablishment 5036 err := json.Unmarshal(body, &fe) 5037 return fe, err 5038 case string(TypeLodgingBusiness): 5039 var lb LodgingBusiness 5040 err := json.Unmarshal(body, &lb) 5041 return lb, err 5042 case string(TypeRestaurant): 5043 var r Restaurant 5044 err := json.Unmarshal(body, &r) 5045 return r, err 5046 case string(TypeHotel): 5047 var h Hotel 5048 err := json.Unmarshal(body, &h) 5049 return h, err 5050 default: 5051 var i Identifiable 5052 err := json.Unmarshal(body, &i) 5053 return i, err 5054 } 5055} 5056func unmarshalBasicIdentifiableArray(body []byte) ([]BasicIdentifiable, error) { 5057 var rawMessages []*json.RawMessage 5058 err := json.Unmarshal(body, &rawMessages) 5059 if err != nil { 5060 return nil, err 5061 } 5062 5063 iArray := make([]BasicIdentifiable, len(rawMessages)) 5064 5065 for index, rawMessage := range rawMessages { 5066 i, err := unmarshalBasicIdentifiable(*rawMessage) 5067 if err != nil { 5068 return nil, err 5069 } 5070 iArray[index] = i 5071 } 5072 return iArray, nil 5073} 5074 5075// MarshalJSON is the custom marshaler for Identifiable. 5076func (i Identifiable) MarshalJSON() ([]byte, error) { 5077 i.Type = TypeIdentifiable 5078 objectMap := make(map[string]interface{}) 5079 if i.ID != nil { 5080 objectMap["id"] = i.ID 5081 } 5082 if i.Type != "" { 5083 objectMap["_type"] = i.Type 5084 } 5085 return json.Marshal(objectMap) 5086} 5087 5088// AsImageObject is the BasicResponseBase implementation for Identifiable. 5089func (i Identifiable) AsImageObject() (*ImageObject, bool) { 5090 return nil, false 5091} 5092 5093// AsThing is the BasicResponseBase implementation for Identifiable. 5094func (i Identifiable) AsThing() (*Thing, bool) { 5095 return nil, false 5096} 5097 5098// AsBasicThing is the BasicResponseBase implementation for Identifiable. 5099func (i Identifiable) AsBasicThing() (BasicThing, bool) { 5100 return nil, false 5101} 5102 5103// AsEntities is the BasicResponseBase implementation for Identifiable. 5104func (i Identifiable) AsEntities() (*Entities, bool) { 5105 return nil, false 5106} 5107 5108// AsPlaces is the BasicResponseBase implementation for Identifiable. 5109func (i Identifiable) AsPlaces() (*Places, bool) { 5110 return nil, false 5111} 5112 5113// AsSearchResponse is the BasicResponseBase implementation for Identifiable. 5114func (i Identifiable) AsSearchResponse() (*SearchResponse, bool) { 5115 return nil, false 5116} 5117 5118// AsResponse is the BasicResponseBase implementation for Identifiable. 5119func (i Identifiable) AsResponse() (*Response, bool) { 5120 return nil, false 5121} 5122 5123// AsBasicResponse is the BasicResponseBase implementation for Identifiable. 5124func (i Identifiable) AsBasicResponse() (BasicResponse, bool) { 5125 return nil, false 5126} 5127 5128// AsSearchResultsAnswer is the BasicResponseBase implementation for Identifiable. 5129func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 5130 return nil, false 5131} 5132 5133// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Identifiable. 5134func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 5135 return nil, false 5136} 5137 5138// AsIdentifiable is the BasicResponseBase implementation for Identifiable. 5139func (i Identifiable) AsIdentifiable() (*Identifiable, bool) { 5140 return &i, true 5141} 5142 5143// AsBasicIdentifiable is the BasicResponseBase implementation for Identifiable. 5144func (i Identifiable) AsBasicIdentifiable() (BasicIdentifiable, bool) { 5145 return &i, true 5146} 5147 5148// AsAnswer is the BasicResponseBase implementation for Identifiable. 5149func (i Identifiable) AsAnswer() (*Answer, bool) { 5150 return nil, false 5151} 5152 5153// AsBasicAnswer is the BasicResponseBase implementation for Identifiable. 5154func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) { 5155 return nil, false 5156} 5157 5158// AsErrorResponse is the BasicResponseBase implementation for Identifiable. 5159func (i Identifiable) AsErrorResponse() (*ErrorResponse, bool) { 5160 return nil, false 5161} 5162 5163// AsPostalAddress is the BasicResponseBase implementation for Identifiable. 5164func (i Identifiable) AsPostalAddress() (*PostalAddress, bool) { 5165 return nil, false 5166} 5167 5168// AsPlace is the BasicResponseBase implementation for Identifiable. 5169func (i Identifiable) AsPlace() (*Place, bool) { 5170 return nil, false 5171} 5172 5173// AsBasicPlace is the BasicResponseBase implementation for Identifiable. 5174func (i Identifiable) AsBasicPlace() (BasicPlace, bool) { 5175 return nil, false 5176} 5177 5178// AsOrganization is the BasicResponseBase implementation for Identifiable. 5179func (i Identifiable) AsOrganization() (*Organization, bool) { 5180 return nil, false 5181} 5182 5183// AsCreativeWork is the BasicResponseBase implementation for Identifiable. 5184func (i Identifiable) AsCreativeWork() (*CreativeWork, bool) { 5185 return nil, false 5186} 5187 5188// AsBasicCreativeWork is the BasicResponseBase implementation for Identifiable. 5189func (i Identifiable) AsBasicCreativeWork() (BasicCreativeWork, bool) { 5190 return nil, false 5191} 5192 5193// AsIntangible is the BasicResponseBase implementation for Identifiable. 5194func (i Identifiable) AsIntangible() (*Intangible, bool) { 5195 return nil, false 5196} 5197 5198// AsBasicIntangible is the BasicResponseBase implementation for Identifiable. 5199func (i Identifiable) AsBasicIntangible() (BasicIntangible, bool) { 5200 return nil, false 5201} 5202 5203// AsMovieTheater is the BasicResponseBase implementation for Identifiable. 5204func (i Identifiable) AsMovieTheater() (*MovieTheater, bool) { 5205 return nil, false 5206} 5207 5208// AsMediaObject is the BasicResponseBase implementation for Identifiable. 5209func (i Identifiable) AsMediaObject() (*MediaObject, bool) { 5210 return nil, false 5211} 5212 5213// AsBasicMediaObject is the BasicResponseBase implementation for Identifiable. 5214func (i Identifiable) AsBasicMediaObject() (BasicMediaObject, bool) { 5215 return nil, false 5216} 5217 5218// AsCivicStructure is the BasicResponseBase implementation for Identifiable. 5219func (i Identifiable) AsCivicStructure() (*CivicStructure, bool) { 5220 return nil, false 5221} 5222 5223// AsBasicCivicStructure is the BasicResponseBase implementation for Identifiable. 5224func (i Identifiable) AsBasicCivicStructure() (BasicCivicStructure, bool) { 5225 return nil, false 5226} 5227 5228// AsLocalBusiness is the BasicResponseBase implementation for Identifiable. 5229func (i Identifiable) AsLocalBusiness() (*LocalBusiness, bool) { 5230 return nil, false 5231} 5232 5233// AsBasicLocalBusiness is the BasicResponseBase implementation for Identifiable. 5234func (i Identifiable) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 5235 return nil, false 5236} 5237 5238// AsTouristAttraction is the BasicResponseBase implementation for Identifiable. 5239func (i Identifiable) AsTouristAttraction() (*TouristAttraction, bool) { 5240 return nil, false 5241} 5242 5243// AsAirport is the BasicResponseBase implementation for Identifiable. 5244func (i Identifiable) AsAirport() (*Airport, bool) { 5245 return nil, false 5246} 5247 5248// AsLicense is the BasicResponseBase implementation for Identifiable. 5249func (i Identifiable) AsLicense() (*License, bool) { 5250 return nil, false 5251} 5252 5253// AsStructuredValue is the BasicResponseBase implementation for Identifiable. 5254func (i Identifiable) AsStructuredValue() (*StructuredValue, bool) { 5255 return nil, false 5256} 5257 5258// AsBasicStructuredValue is the BasicResponseBase implementation for Identifiable. 5259func (i Identifiable) AsBasicStructuredValue() (BasicStructuredValue, bool) { 5260 return nil, false 5261} 5262 5263// AsEntertainmentBusiness is the BasicResponseBase implementation for Identifiable. 5264func (i Identifiable) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 5265 return nil, false 5266} 5267 5268// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Identifiable. 5269func (i Identifiable) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 5270 return nil, false 5271} 5272 5273// AsFoodEstablishment is the BasicResponseBase implementation for Identifiable. 5274func (i Identifiable) AsFoodEstablishment() (*FoodEstablishment, bool) { 5275 return nil, false 5276} 5277 5278// AsBasicFoodEstablishment is the BasicResponseBase implementation for Identifiable. 5279func (i Identifiable) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 5280 return nil, false 5281} 5282 5283// AsLodgingBusiness is the BasicResponseBase implementation for Identifiable. 5284func (i Identifiable) AsLodgingBusiness() (*LodgingBusiness, bool) { 5285 return nil, false 5286} 5287 5288// AsBasicLodgingBusiness is the BasicResponseBase implementation for Identifiable. 5289func (i Identifiable) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 5290 return nil, false 5291} 5292 5293// AsRestaurant is the BasicResponseBase implementation for Identifiable. 5294func (i Identifiable) AsRestaurant() (*Restaurant, bool) { 5295 return nil, false 5296} 5297 5298// AsHotel is the BasicResponseBase implementation for Identifiable. 5299func (i Identifiable) AsHotel() (*Hotel, bool) { 5300 return nil, false 5301} 5302 5303// AsResponseBase is the BasicResponseBase implementation for Identifiable. 5304func (i Identifiable) AsResponseBase() (*ResponseBase, bool) { 5305 return nil, false 5306} 5307 5308// AsBasicResponseBase is the BasicResponseBase implementation for Identifiable. 5309func (i Identifiable) AsBasicResponseBase() (BasicResponseBase, bool) { 5310 return &i, true 5311} 5312 5313// ImageObject defines an image 5314type ImageObject struct { 5315 // Thumbnail - The URL to a thumbnail of the image 5316 Thumbnail *ImageObject `json:"thumbnail,omitempty"` 5317 // ContentURL - Original URL to retrieve the source (file) for the media object (e.g the source URL for the image). 5318 ContentURL *string `json:"contentUrl,omitempty"` 5319 // HostPageURL - URL of the page that hosts the media object. 5320 HostPageURL *string `json:"hostPageUrl,omitempty"` 5321 // Width - The width of the source media object, in pixels. 5322 Width *int32 `json:"width,omitempty"` 5323 // Height - The height of the source media object, in pixels. 5324 Height *int32 `json:"height,omitempty"` 5325 // ThumbnailURL - The URL to a thumbnail of the item. 5326 ThumbnailURL *string `json:"thumbnailUrl,omitempty"` 5327 // Provider - The source of the creative work. 5328 Provider *[]BasicThing `json:"provider,omitempty"` 5329 Text *string `json:"text,omitempty"` 5330 // Name - The name of the thing represented by this object. 5331 Name *string `json:"name,omitempty"` 5332 // URL - The URL to get more information about the thing represented by this object. 5333 URL *string `json:"url,omitempty"` 5334 Image *ImageObject `json:"image,omitempty"` 5335 // Description - A short description of the item. 5336 Description *string `json:"description,omitempty"` 5337 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 5338 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 5339 // BingID - An ID that uniquely identifies this item. 5340 BingID *string `json:"bingId,omitempty"` 5341 // ContractualRules - A list of rules that you must adhere to if you display the item. 5342 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 5343 // WebSearchURL - The URL To Bing's search result for this item. 5344 WebSearchURL *string `json:"webSearchUrl,omitempty"` 5345 // ID - A String identifier. 5346 ID *string `json:"id,omitempty"` 5347 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 5348 Type TypeBasicResponseBase `json:"_type,omitempty"` 5349} 5350 5351// MarshalJSON is the custom marshaler for ImageObject. 5352func (ioVar ImageObject) MarshalJSON() ([]byte, error) { 5353 ioVar.Type = TypeImageObject 5354 objectMap := make(map[string]interface{}) 5355 if ioVar.Thumbnail != nil { 5356 objectMap["thumbnail"] = ioVar.Thumbnail 5357 } 5358 if ioVar.ContentURL != nil { 5359 objectMap["contentUrl"] = ioVar.ContentURL 5360 } 5361 if ioVar.HostPageURL != nil { 5362 objectMap["hostPageUrl"] = ioVar.HostPageURL 5363 } 5364 if ioVar.Width != nil { 5365 objectMap["width"] = ioVar.Width 5366 } 5367 if ioVar.Height != nil { 5368 objectMap["height"] = ioVar.Height 5369 } 5370 if ioVar.ThumbnailURL != nil { 5371 objectMap["thumbnailUrl"] = ioVar.ThumbnailURL 5372 } 5373 if ioVar.Provider != nil { 5374 objectMap["provider"] = ioVar.Provider 5375 } 5376 if ioVar.Text != nil { 5377 objectMap["text"] = ioVar.Text 5378 } 5379 if ioVar.Name != nil { 5380 objectMap["name"] = ioVar.Name 5381 } 5382 if ioVar.URL != nil { 5383 objectMap["url"] = ioVar.URL 5384 } 5385 if ioVar.Image != nil { 5386 objectMap["image"] = ioVar.Image 5387 } 5388 if ioVar.Description != nil { 5389 objectMap["description"] = ioVar.Description 5390 } 5391 if ioVar.EntityPresentationInfo != nil { 5392 objectMap["entityPresentationInfo"] = ioVar.EntityPresentationInfo 5393 } 5394 if ioVar.BingID != nil { 5395 objectMap["bingId"] = ioVar.BingID 5396 } 5397 if ioVar.ContractualRules != nil { 5398 objectMap["contractualRules"] = ioVar.ContractualRules 5399 } 5400 if ioVar.WebSearchURL != nil { 5401 objectMap["webSearchUrl"] = ioVar.WebSearchURL 5402 } 5403 if ioVar.ID != nil { 5404 objectMap["id"] = ioVar.ID 5405 } 5406 if ioVar.Type != "" { 5407 objectMap["_type"] = ioVar.Type 5408 } 5409 return json.Marshal(objectMap) 5410} 5411 5412// AsImageObject is the BasicResponseBase implementation for ImageObject. 5413func (ioVar ImageObject) AsImageObject() (*ImageObject, bool) { 5414 return &ioVar, true 5415} 5416 5417// AsThing is the BasicResponseBase implementation for ImageObject. 5418func (ioVar ImageObject) AsThing() (*Thing, bool) { 5419 return nil, false 5420} 5421 5422// AsBasicThing is the BasicResponseBase implementation for ImageObject. 5423func (ioVar ImageObject) AsBasicThing() (BasicThing, bool) { 5424 return &ioVar, true 5425} 5426 5427// AsEntities is the BasicResponseBase implementation for ImageObject. 5428func (ioVar ImageObject) AsEntities() (*Entities, bool) { 5429 return nil, false 5430} 5431 5432// AsPlaces is the BasicResponseBase implementation for ImageObject. 5433func (ioVar ImageObject) AsPlaces() (*Places, bool) { 5434 return nil, false 5435} 5436 5437// AsSearchResponse is the BasicResponseBase implementation for ImageObject. 5438func (ioVar ImageObject) AsSearchResponse() (*SearchResponse, bool) { 5439 return nil, false 5440} 5441 5442// AsResponse is the BasicResponseBase implementation for ImageObject. 5443func (ioVar ImageObject) AsResponse() (*Response, bool) { 5444 return nil, false 5445} 5446 5447// AsBasicResponse is the BasicResponseBase implementation for ImageObject. 5448func (ioVar ImageObject) AsBasicResponse() (BasicResponse, bool) { 5449 return &ioVar, true 5450} 5451 5452// AsSearchResultsAnswer is the BasicResponseBase implementation for ImageObject. 5453func (ioVar ImageObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 5454 return nil, false 5455} 5456 5457// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ImageObject. 5458func (ioVar ImageObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 5459 return nil, false 5460} 5461 5462// AsIdentifiable is the BasicResponseBase implementation for ImageObject. 5463func (ioVar ImageObject) AsIdentifiable() (*Identifiable, bool) { 5464 return nil, false 5465} 5466 5467// AsBasicIdentifiable is the BasicResponseBase implementation for ImageObject. 5468func (ioVar ImageObject) AsBasicIdentifiable() (BasicIdentifiable, bool) { 5469 return &ioVar, true 5470} 5471 5472// AsAnswer is the BasicResponseBase implementation for ImageObject. 5473func (ioVar ImageObject) AsAnswer() (*Answer, bool) { 5474 return nil, false 5475} 5476 5477// AsBasicAnswer is the BasicResponseBase implementation for ImageObject. 5478func (ioVar ImageObject) AsBasicAnswer() (BasicAnswer, bool) { 5479 return nil, false 5480} 5481 5482// AsErrorResponse is the BasicResponseBase implementation for ImageObject. 5483func (ioVar ImageObject) AsErrorResponse() (*ErrorResponse, bool) { 5484 return nil, false 5485} 5486 5487// AsPostalAddress is the BasicResponseBase implementation for ImageObject. 5488func (ioVar ImageObject) AsPostalAddress() (*PostalAddress, bool) { 5489 return nil, false 5490} 5491 5492// AsPlace is the BasicResponseBase implementation for ImageObject. 5493func (ioVar ImageObject) AsPlace() (*Place, bool) { 5494 return nil, false 5495} 5496 5497// AsBasicPlace is the BasicResponseBase implementation for ImageObject. 5498func (ioVar ImageObject) AsBasicPlace() (BasicPlace, bool) { 5499 return nil, false 5500} 5501 5502// AsOrganization is the BasicResponseBase implementation for ImageObject. 5503func (ioVar ImageObject) AsOrganization() (*Organization, bool) { 5504 return nil, false 5505} 5506 5507// AsCreativeWork is the BasicResponseBase implementation for ImageObject. 5508func (ioVar ImageObject) AsCreativeWork() (*CreativeWork, bool) { 5509 return nil, false 5510} 5511 5512// AsBasicCreativeWork is the BasicResponseBase implementation for ImageObject. 5513func (ioVar ImageObject) AsBasicCreativeWork() (BasicCreativeWork, bool) { 5514 return &ioVar, true 5515} 5516 5517// AsIntangible is the BasicResponseBase implementation for ImageObject. 5518func (ioVar ImageObject) AsIntangible() (*Intangible, bool) { 5519 return nil, false 5520} 5521 5522// AsBasicIntangible is the BasicResponseBase implementation for ImageObject. 5523func (ioVar ImageObject) AsBasicIntangible() (BasicIntangible, bool) { 5524 return nil, false 5525} 5526 5527// AsMovieTheater is the BasicResponseBase implementation for ImageObject. 5528func (ioVar ImageObject) AsMovieTheater() (*MovieTheater, bool) { 5529 return nil, false 5530} 5531 5532// AsMediaObject is the BasicResponseBase implementation for ImageObject. 5533func (ioVar ImageObject) AsMediaObject() (*MediaObject, bool) { 5534 return nil, false 5535} 5536 5537// AsBasicMediaObject is the BasicResponseBase implementation for ImageObject. 5538func (ioVar ImageObject) AsBasicMediaObject() (BasicMediaObject, bool) { 5539 return &ioVar, true 5540} 5541 5542// AsCivicStructure is the BasicResponseBase implementation for ImageObject. 5543func (ioVar ImageObject) AsCivicStructure() (*CivicStructure, bool) { 5544 return nil, false 5545} 5546 5547// AsBasicCivicStructure is the BasicResponseBase implementation for ImageObject. 5548func (ioVar ImageObject) AsBasicCivicStructure() (BasicCivicStructure, bool) { 5549 return nil, false 5550} 5551 5552// AsLocalBusiness is the BasicResponseBase implementation for ImageObject. 5553func (ioVar ImageObject) AsLocalBusiness() (*LocalBusiness, bool) { 5554 return nil, false 5555} 5556 5557// AsBasicLocalBusiness is the BasicResponseBase implementation for ImageObject. 5558func (ioVar ImageObject) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 5559 return nil, false 5560} 5561 5562// AsTouristAttraction is the BasicResponseBase implementation for ImageObject. 5563func (ioVar ImageObject) AsTouristAttraction() (*TouristAttraction, bool) { 5564 return nil, false 5565} 5566 5567// AsAirport is the BasicResponseBase implementation for ImageObject. 5568func (ioVar ImageObject) AsAirport() (*Airport, bool) { 5569 return nil, false 5570} 5571 5572// AsLicense is the BasicResponseBase implementation for ImageObject. 5573func (ioVar ImageObject) AsLicense() (*License, bool) { 5574 return nil, false 5575} 5576 5577// AsStructuredValue is the BasicResponseBase implementation for ImageObject. 5578func (ioVar ImageObject) AsStructuredValue() (*StructuredValue, bool) { 5579 return nil, false 5580} 5581 5582// AsBasicStructuredValue is the BasicResponseBase implementation for ImageObject. 5583func (ioVar ImageObject) AsBasicStructuredValue() (BasicStructuredValue, bool) { 5584 return nil, false 5585} 5586 5587// AsEntertainmentBusiness is the BasicResponseBase implementation for ImageObject. 5588func (ioVar ImageObject) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 5589 return nil, false 5590} 5591 5592// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for ImageObject. 5593func (ioVar ImageObject) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 5594 return nil, false 5595} 5596 5597// AsFoodEstablishment is the BasicResponseBase implementation for ImageObject. 5598func (ioVar ImageObject) AsFoodEstablishment() (*FoodEstablishment, bool) { 5599 return nil, false 5600} 5601 5602// AsBasicFoodEstablishment is the BasicResponseBase implementation for ImageObject. 5603func (ioVar ImageObject) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 5604 return nil, false 5605} 5606 5607// AsLodgingBusiness is the BasicResponseBase implementation for ImageObject. 5608func (ioVar ImageObject) AsLodgingBusiness() (*LodgingBusiness, bool) { 5609 return nil, false 5610} 5611 5612// AsBasicLodgingBusiness is the BasicResponseBase implementation for ImageObject. 5613func (ioVar ImageObject) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 5614 return nil, false 5615} 5616 5617// AsRestaurant is the BasicResponseBase implementation for ImageObject. 5618func (ioVar ImageObject) AsRestaurant() (*Restaurant, bool) { 5619 return nil, false 5620} 5621 5622// AsHotel is the BasicResponseBase implementation for ImageObject. 5623func (ioVar ImageObject) AsHotel() (*Hotel, bool) { 5624 return nil, false 5625} 5626 5627// AsResponseBase is the BasicResponseBase implementation for ImageObject. 5628func (ioVar ImageObject) AsResponseBase() (*ResponseBase, bool) { 5629 return nil, false 5630} 5631 5632// AsBasicResponseBase is the BasicResponseBase implementation for ImageObject. 5633func (ioVar ImageObject) AsBasicResponseBase() (BasicResponseBase, bool) { 5634 return &ioVar, true 5635} 5636 5637// UnmarshalJSON is the custom unmarshaler for ImageObject struct. 5638func (ioVar *ImageObject) UnmarshalJSON(body []byte) error { 5639 var m map[string]*json.RawMessage 5640 err := json.Unmarshal(body, &m) 5641 if err != nil { 5642 return err 5643 } 5644 for k, v := range m { 5645 switch k { 5646 case "thumbnail": 5647 if v != nil { 5648 var thumbnail ImageObject 5649 err = json.Unmarshal(*v, &thumbnail) 5650 if err != nil { 5651 return err 5652 } 5653 ioVar.Thumbnail = &thumbnail 5654 } 5655 case "contentUrl": 5656 if v != nil { 5657 var contentURL string 5658 err = json.Unmarshal(*v, &contentURL) 5659 if err != nil { 5660 return err 5661 } 5662 ioVar.ContentURL = &contentURL 5663 } 5664 case "hostPageUrl": 5665 if v != nil { 5666 var hostPageURL string 5667 err = json.Unmarshal(*v, &hostPageURL) 5668 if err != nil { 5669 return err 5670 } 5671 ioVar.HostPageURL = &hostPageURL 5672 } 5673 case "width": 5674 if v != nil { 5675 var width int32 5676 err = json.Unmarshal(*v, &width) 5677 if err != nil { 5678 return err 5679 } 5680 ioVar.Width = &width 5681 } 5682 case "height": 5683 if v != nil { 5684 var height int32 5685 err = json.Unmarshal(*v, &height) 5686 if err != nil { 5687 return err 5688 } 5689 ioVar.Height = &height 5690 } 5691 case "thumbnailUrl": 5692 if v != nil { 5693 var thumbnailURL string 5694 err = json.Unmarshal(*v, &thumbnailURL) 5695 if err != nil { 5696 return err 5697 } 5698 ioVar.ThumbnailURL = &thumbnailURL 5699 } 5700 case "provider": 5701 if v != nil { 5702 provider, err := unmarshalBasicThingArray(*v) 5703 if err != nil { 5704 return err 5705 } 5706 ioVar.Provider = &provider 5707 } 5708 case "text": 5709 if v != nil { 5710 var textVar string 5711 err = json.Unmarshal(*v, &textVar) 5712 if err != nil { 5713 return err 5714 } 5715 ioVar.Text = &textVar 5716 } 5717 case "name": 5718 if v != nil { 5719 var name string 5720 err = json.Unmarshal(*v, &name) 5721 if err != nil { 5722 return err 5723 } 5724 ioVar.Name = &name 5725 } 5726 case "url": 5727 if v != nil { 5728 var URL string 5729 err = json.Unmarshal(*v, &URL) 5730 if err != nil { 5731 return err 5732 } 5733 ioVar.URL = &URL 5734 } 5735 case "image": 5736 if v != nil { 5737 var imageVar ImageObject 5738 err = json.Unmarshal(*v, &imageVar) 5739 if err != nil { 5740 return err 5741 } 5742 ioVar.Image = &imageVar 5743 } 5744 case "description": 5745 if v != nil { 5746 var description string 5747 err = json.Unmarshal(*v, &description) 5748 if err != nil { 5749 return err 5750 } 5751 ioVar.Description = &description 5752 } 5753 case "entityPresentationInfo": 5754 if v != nil { 5755 var entityPresentationInfo EntitiesEntityPresentationInfo 5756 err = json.Unmarshal(*v, &entityPresentationInfo) 5757 if err != nil { 5758 return err 5759 } 5760 ioVar.EntityPresentationInfo = &entityPresentationInfo 5761 } 5762 case "bingId": 5763 if v != nil { 5764 var bingID string 5765 err = json.Unmarshal(*v, &bingID) 5766 if err != nil { 5767 return err 5768 } 5769 ioVar.BingID = &bingID 5770 } 5771 case "contractualRules": 5772 if v != nil { 5773 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 5774 if err != nil { 5775 return err 5776 } 5777 ioVar.ContractualRules = &contractualRules 5778 } 5779 case "webSearchUrl": 5780 if v != nil { 5781 var webSearchURL string 5782 err = json.Unmarshal(*v, &webSearchURL) 5783 if err != nil { 5784 return err 5785 } 5786 ioVar.WebSearchURL = &webSearchURL 5787 } 5788 case "id": 5789 if v != nil { 5790 var ID string 5791 err = json.Unmarshal(*v, &ID) 5792 if err != nil { 5793 return err 5794 } 5795 ioVar.ID = &ID 5796 } 5797 case "_type": 5798 if v != nil { 5799 var typeVar TypeBasicResponseBase 5800 err = json.Unmarshal(*v, &typeVar) 5801 if err != nil { 5802 return err 5803 } 5804 ioVar.Type = typeVar 5805 } 5806 } 5807 } 5808 5809 return nil 5810} 5811 5812// BasicIntangible ... 5813type BasicIntangible interface { 5814 AsPostalAddress() (*PostalAddress, bool) 5815 AsStructuredValue() (*StructuredValue, bool) 5816 AsBasicStructuredValue() (BasicStructuredValue, bool) 5817 AsIntangible() (*Intangible, bool) 5818} 5819 5820// Intangible ... 5821type Intangible struct { 5822 // Name - The name of the thing represented by this object. 5823 Name *string `json:"name,omitempty"` 5824 // URL - The URL to get more information about the thing represented by this object. 5825 URL *string `json:"url,omitempty"` 5826 Image *ImageObject `json:"image,omitempty"` 5827 // Description - A short description of the item. 5828 Description *string `json:"description,omitempty"` 5829 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 5830 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 5831 // BingID - An ID that uniquely identifies this item. 5832 BingID *string `json:"bingId,omitempty"` 5833 // ContractualRules - A list of rules that you must adhere to if you display the item. 5834 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 5835 // WebSearchURL - The URL To Bing's search result for this item. 5836 WebSearchURL *string `json:"webSearchUrl,omitempty"` 5837 // ID - A String identifier. 5838 ID *string `json:"id,omitempty"` 5839 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 5840 Type TypeBasicResponseBase `json:"_type,omitempty"` 5841} 5842 5843func unmarshalBasicIntangible(body []byte) (BasicIntangible, error) { 5844 var m map[string]interface{} 5845 err := json.Unmarshal(body, &m) 5846 if err != nil { 5847 return nil, err 5848 } 5849 5850 switch m["_type"] { 5851 case string(TypePostalAddress): 5852 var pa PostalAddress 5853 err := json.Unmarshal(body, &pa) 5854 return pa, err 5855 case string(TypeStructuredValue): 5856 var sv StructuredValue 5857 err := json.Unmarshal(body, &sv) 5858 return sv, err 5859 default: 5860 var i Intangible 5861 err := json.Unmarshal(body, &i) 5862 return i, err 5863 } 5864} 5865func unmarshalBasicIntangibleArray(body []byte) ([]BasicIntangible, error) { 5866 var rawMessages []*json.RawMessage 5867 err := json.Unmarshal(body, &rawMessages) 5868 if err != nil { 5869 return nil, err 5870 } 5871 5872 iArray := make([]BasicIntangible, len(rawMessages)) 5873 5874 for index, rawMessage := range rawMessages { 5875 i, err := unmarshalBasicIntangible(*rawMessage) 5876 if err != nil { 5877 return nil, err 5878 } 5879 iArray[index] = i 5880 } 5881 return iArray, nil 5882} 5883 5884// MarshalJSON is the custom marshaler for Intangible. 5885func (i Intangible) MarshalJSON() ([]byte, error) { 5886 i.Type = TypeIntangible 5887 objectMap := make(map[string]interface{}) 5888 if i.Name != nil { 5889 objectMap["name"] = i.Name 5890 } 5891 if i.URL != nil { 5892 objectMap["url"] = i.URL 5893 } 5894 if i.Image != nil { 5895 objectMap["image"] = i.Image 5896 } 5897 if i.Description != nil { 5898 objectMap["description"] = i.Description 5899 } 5900 if i.EntityPresentationInfo != nil { 5901 objectMap["entityPresentationInfo"] = i.EntityPresentationInfo 5902 } 5903 if i.BingID != nil { 5904 objectMap["bingId"] = i.BingID 5905 } 5906 if i.ContractualRules != nil { 5907 objectMap["contractualRules"] = i.ContractualRules 5908 } 5909 if i.WebSearchURL != nil { 5910 objectMap["webSearchUrl"] = i.WebSearchURL 5911 } 5912 if i.ID != nil { 5913 objectMap["id"] = i.ID 5914 } 5915 if i.Type != "" { 5916 objectMap["_type"] = i.Type 5917 } 5918 return json.Marshal(objectMap) 5919} 5920 5921// AsImageObject is the BasicResponseBase implementation for Intangible. 5922func (i Intangible) AsImageObject() (*ImageObject, bool) { 5923 return nil, false 5924} 5925 5926// AsThing is the BasicResponseBase implementation for Intangible. 5927func (i Intangible) AsThing() (*Thing, bool) { 5928 return nil, false 5929} 5930 5931// AsBasicThing is the BasicResponseBase implementation for Intangible. 5932func (i Intangible) AsBasicThing() (BasicThing, bool) { 5933 return &i, true 5934} 5935 5936// AsEntities is the BasicResponseBase implementation for Intangible. 5937func (i Intangible) AsEntities() (*Entities, bool) { 5938 return nil, false 5939} 5940 5941// AsPlaces is the BasicResponseBase implementation for Intangible. 5942func (i Intangible) AsPlaces() (*Places, bool) { 5943 return nil, false 5944} 5945 5946// AsSearchResponse is the BasicResponseBase implementation for Intangible. 5947func (i Intangible) AsSearchResponse() (*SearchResponse, bool) { 5948 return nil, false 5949} 5950 5951// AsResponse is the BasicResponseBase implementation for Intangible. 5952func (i Intangible) AsResponse() (*Response, bool) { 5953 return nil, false 5954} 5955 5956// AsBasicResponse is the BasicResponseBase implementation for Intangible. 5957func (i Intangible) AsBasicResponse() (BasicResponse, bool) { 5958 return &i, true 5959} 5960 5961// AsSearchResultsAnswer is the BasicResponseBase implementation for Intangible. 5962func (i Intangible) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 5963 return nil, false 5964} 5965 5966// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Intangible. 5967func (i Intangible) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 5968 return nil, false 5969} 5970 5971// AsIdentifiable is the BasicResponseBase implementation for Intangible. 5972func (i Intangible) AsIdentifiable() (*Identifiable, bool) { 5973 return nil, false 5974} 5975 5976// AsBasicIdentifiable is the BasicResponseBase implementation for Intangible. 5977func (i Intangible) AsBasicIdentifiable() (BasicIdentifiable, bool) { 5978 return &i, true 5979} 5980 5981// AsAnswer is the BasicResponseBase implementation for Intangible. 5982func (i Intangible) AsAnswer() (*Answer, bool) { 5983 return nil, false 5984} 5985 5986// AsBasicAnswer is the BasicResponseBase implementation for Intangible. 5987func (i Intangible) AsBasicAnswer() (BasicAnswer, bool) { 5988 return nil, false 5989} 5990 5991// AsErrorResponse is the BasicResponseBase implementation for Intangible. 5992func (i Intangible) AsErrorResponse() (*ErrorResponse, bool) { 5993 return nil, false 5994} 5995 5996// AsPostalAddress is the BasicResponseBase implementation for Intangible. 5997func (i Intangible) AsPostalAddress() (*PostalAddress, bool) { 5998 return nil, false 5999} 6000 6001// AsPlace is the BasicResponseBase implementation for Intangible. 6002func (i Intangible) AsPlace() (*Place, bool) { 6003 return nil, false 6004} 6005 6006// AsBasicPlace is the BasicResponseBase implementation for Intangible. 6007func (i Intangible) AsBasicPlace() (BasicPlace, bool) { 6008 return nil, false 6009} 6010 6011// AsOrganization is the BasicResponseBase implementation for Intangible. 6012func (i Intangible) AsOrganization() (*Organization, bool) { 6013 return nil, false 6014} 6015 6016// AsCreativeWork is the BasicResponseBase implementation for Intangible. 6017func (i Intangible) AsCreativeWork() (*CreativeWork, bool) { 6018 return nil, false 6019} 6020 6021// AsBasicCreativeWork is the BasicResponseBase implementation for Intangible. 6022func (i Intangible) AsBasicCreativeWork() (BasicCreativeWork, bool) { 6023 return nil, false 6024} 6025 6026// AsIntangible is the BasicResponseBase implementation for Intangible. 6027func (i Intangible) AsIntangible() (*Intangible, bool) { 6028 return &i, true 6029} 6030 6031// AsBasicIntangible is the BasicResponseBase implementation for Intangible. 6032func (i Intangible) AsBasicIntangible() (BasicIntangible, bool) { 6033 return &i, true 6034} 6035 6036// AsMovieTheater is the BasicResponseBase implementation for Intangible. 6037func (i Intangible) AsMovieTheater() (*MovieTheater, bool) { 6038 return nil, false 6039} 6040 6041// AsMediaObject is the BasicResponseBase implementation for Intangible. 6042func (i Intangible) AsMediaObject() (*MediaObject, bool) { 6043 return nil, false 6044} 6045 6046// AsBasicMediaObject is the BasicResponseBase implementation for Intangible. 6047func (i Intangible) AsBasicMediaObject() (BasicMediaObject, bool) { 6048 return nil, false 6049} 6050 6051// AsCivicStructure is the BasicResponseBase implementation for Intangible. 6052func (i Intangible) AsCivicStructure() (*CivicStructure, bool) { 6053 return nil, false 6054} 6055 6056// AsBasicCivicStructure is the BasicResponseBase implementation for Intangible. 6057func (i Intangible) AsBasicCivicStructure() (BasicCivicStructure, bool) { 6058 return nil, false 6059} 6060 6061// AsLocalBusiness is the BasicResponseBase implementation for Intangible. 6062func (i Intangible) AsLocalBusiness() (*LocalBusiness, bool) { 6063 return nil, false 6064} 6065 6066// AsBasicLocalBusiness is the BasicResponseBase implementation for Intangible. 6067func (i Intangible) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 6068 return nil, false 6069} 6070 6071// AsTouristAttraction is the BasicResponseBase implementation for Intangible. 6072func (i Intangible) AsTouristAttraction() (*TouristAttraction, bool) { 6073 return nil, false 6074} 6075 6076// AsAirport is the BasicResponseBase implementation for Intangible. 6077func (i Intangible) AsAirport() (*Airport, bool) { 6078 return nil, false 6079} 6080 6081// AsLicense is the BasicResponseBase implementation for Intangible. 6082func (i Intangible) AsLicense() (*License, bool) { 6083 return nil, false 6084} 6085 6086// AsStructuredValue is the BasicResponseBase implementation for Intangible. 6087func (i Intangible) AsStructuredValue() (*StructuredValue, bool) { 6088 return nil, false 6089} 6090 6091// AsBasicStructuredValue is the BasicResponseBase implementation for Intangible. 6092func (i Intangible) AsBasicStructuredValue() (BasicStructuredValue, bool) { 6093 return nil, false 6094} 6095 6096// AsEntertainmentBusiness is the BasicResponseBase implementation for Intangible. 6097func (i Intangible) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 6098 return nil, false 6099} 6100 6101// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Intangible. 6102func (i Intangible) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 6103 return nil, false 6104} 6105 6106// AsFoodEstablishment is the BasicResponseBase implementation for Intangible. 6107func (i Intangible) AsFoodEstablishment() (*FoodEstablishment, bool) { 6108 return nil, false 6109} 6110 6111// AsBasicFoodEstablishment is the BasicResponseBase implementation for Intangible. 6112func (i Intangible) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 6113 return nil, false 6114} 6115 6116// AsLodgingBusiness is the BasicResponseBase implementation for Intangible. 6117func (i Intangible) AsLodgingBusiness() (*LodgingBusiness, bool) { 6118 return nil, false 6119} 6120 6121// AsBasicLodgingBusiness is the BasicResponseBase implementation for Intangible. 6122func (i Intangible) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 6123 return nil, false 6124} 6125 6126// AsRestaurant is the BasicResponseBase implementation for Intangible. 6127func (i Intangible) AsRestaurant() (*Restaurant, bool) { 6128 return nil, false 6129} 6130 6131// AsHotel is the BasicResponseBase implementation for Intangible. 6132func (i Intangible) AsHotel() (*Hotel, bool) { 6133 return nil, false 6134} 6135 6136// AsResponseBase is the BasicResponseBase implementation for Intangible. 6137func (i Intangible) AsResponseBase() (*ResponseBase, bool) { 6138 return nil, false 6139} 6140 6141// AsBasicResponseBase is the BasicResponseBase implementation for Intangible. 6142func (i Intangible) AsBasicResponseBase() (BasicResponseBase, bool) { 6143 return &i, true 6144} 6145 6146// UnmarshalJSON is the custom unmarshaler for Intangible struct. 6147func (i *Intangible) UnmarshalJSON(body []byte) error { 6148 var m map[string]*json.RawMessage 6149 err := json.Unmarshal(body, &m) 6150 if err != nil { 6151 return err 6152 } 6153 for k, v := range m { 6154 switch k { 6155 case "name": 6156 if v != nil { 6157 var name string 6158 err = json.Unmarshal(*v, &name) 6159 if err != nil { 6160 return err 6161 } 6162 i.Name = &name 6163 } 6164 case "url": 6165 if v != nil { 6166 var URL string 6167 err = json.Unmarshal(*v, &URL) 6168 if err != nil { 6169 return err 6170 } 6171 i.URL = &URL 6172 } 6173 case "image": 6174 if v != nil { 6175 var imageVar ImageObject 6176 err = json.Unmarshal(*v, &imageVar) 6177 if err != nil { 6178 return err 6179 } 6180 i.Image = &imageVar 6181 } 6182 case "description": 6183 if v != nil { 6184 var description string 6185 err = json.Unmarshal(*v, &description) 6186 if err != nil { 6187 return err 6188 } 6189 i.Description = &description 6190 } 6191 case "entityPresentationInfo": 6192 if v != nil { 6193 var entityPresentationInfo EntitiesEntityPresentationInfo 6194 err = json.Unmarshal(*v, &entityPresentationInfo) 6195 if err != nil { 6196 return err 6197 } 6198 i.EntityPresentationInfo = &entityPresentationInfo 6199 } 6200 case "bingId": 6201 if v != nil { 6202 var bingID string 6203 err = json.Unmarshal(*v, &bingID) 6204 if err != nil { 6205 return err 6206 } 6207 i.BingID = &bingID 6208 } 6209 case "contractualRules": 6210 if v != nil { 6211 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 6212 if err != nil { 6213 return err 6214 } 6215 i.ContractualRules = &contractualRules 6216 } 6217 case "webSearchUrl": 6218 if v != nil { 6219 var webSearchURL string 6220 err = json.Unmarshal(*v, &webSearchURL) 6221 if err != nil { 6222 return err 6223 } 6224 i.WebSearchURL = &webSearchURL 6225 } 6226 case "id": 6227 if v != nil { 6228 var ID string 6229 err = json.Unmarshal(*v, &ID) 6230 if err != nil { 6231 return err 6232 } 6233 i.ID = &ID 6234 } 6235 case "_type": 6236 if v != nil { 6237 var typeVar TypeBasicResponseBase 6238 err = json.Unmarshal(*v, &typeVar) 6239 if err != nil { 6240 return err 6241 } 6242 i.Type = typeVar 6243 } 6244 } 6245 } 6246 6247 return nil 6248} 6249 6250// License defines the license under which the text or photo may be used. 6251type License struct { 6252 // ThumbnailURL - The URL to a thumbnail of the item. 6253 ThumbnailURL *string `json:"thumbnailUrl,omitempty"` 6254 // Provider - The source of the creative work. 6255 Provider *[]BasicThing `json:"provider,omitempty"` 6256 Text *string `json:"text,omitempty"` 6257 // Name - The name of the thing represented by this object. 6258 Name *string `json:"name,omitempty"` 6259 // URL - The URL to get more information about the thing represented by this object. 6260 URL *string `json:"url,omitempty"` 6261 Image *ImageObject `json:"image,omitempty"` 6262 // Description - A short description of the item. 6263 Description *string `json:"description,omitempty"` 6264 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 6265 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 6266 // BingID - An ID that uniquely identifies this item. 6267 BingID *string `json:"bingId,omitempty"` 6268 // ContractualRules - A list of rules that you must adhere to if you display the item. 6269 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 6270 // WebSearchURL - The URL To Bing's search result for this item. 6271 WebSearchURL *string `json:"webSearchUrl,omitempty"` 6272 // ID - A String identifier. 6273 ID *string `json:"id,omitempty"` 6274 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 6275 Type TypeBasicResponseBase `json:"_type,omitempty"` 6276} 6277 6278// MarshalJSON is the custom marshaler for License. 6279func (l License) MarshalJSON() ([]byte, error) { 6280 l.Type = TypeLicense 6281 objectMap := make(map[string]interface{}) 6282 if l.ThumbnailURL != nil { 6283 objectMap["thumbnailUrl"] = l.ThumbnailURL 6284 } 6285 if l.Provider != nil { 6286 objectMap["provider"] = l.Provider 6287 } 6288 if l.Text != nil { 6289 objectMap["text"] = l.Text 6290 } 6291 if l.Name != nil { 6292 objectMap["name"] = l.Name 6293 } 6294 if l.URL != nil { 6295 objectMap["url"] = l.URL 6296 } 6297 if l.Image != nil { 6298 objectMap["image"] = l.Image 6299 } 6300 if l.Description != nil { 6301 objectMap["description"] = l.Description 6302 } 6303 if l.EntityPresentationInfo != nil { 6304 objectMap["entityPresentationInfo"] = l.EntityPresentationInfo 6305 } 6306 if l.BingID != nil { 6307 objectMap["bingId"] = l.BingID 6308 } 6309 if l.ContractualRules != nil { 6310 objectMap["contractualRules"] = l.ContractualRules 6311 } 6312 if l.WebSearchURL != nil { 6313 objectMap["webSearchUrl"] = l.WebSearchURL 6314 } 6315 if l.ID != nil { 6316 objectMap["id"] = l.ID 6317 } 6318 if l.Type != "" { 6319 objectMap["_type"] = l.Type 6320 } 6321 return json.Marshal(objectMap) 6322} 6323 6324// AsImageObject is the BasicResponseBase implementation for License. 6325func (l License) AsImageObject() (*ImageObject, bool) { 6326 return nil, false 6327} 6328 6329// AsThing is the BasicResponseBase implementation for License. 6330func (l License) AsThing() (*Thing, bool) { 6331 return nil, false 6332} 6333 6334// AsBasicThing is the BasicResponseBase implementation for License. 6335func (l License) AsBasicThing() (BasicThing, bool) { 6336 return &l, true 6337} 6338 6339// AsEntities is the BasicResponseBase implementation for License. 6340func (l License) AsEntities() (*Entities, bool) { 6341 return nil, false 6342} 6343 6344// AsPlaces is the BasicResponseBase implementation for License. 6345func (l License) AsPlaces() (*Places, bool) { 6346 return nil, false 6347} 6348 6349// AsSearchResponse is the BasicResponseBase implementation for License. 6350func (l License) AsSearchResponse() (*SearchResponse, bool) { 6351 return nil, false 6352} 6353 6354// AsResponse is the BasicResponseBase implementation for License. 6355func (l License) AsResponse() (*Response, bool) { 6356 return nil, false 6357} 6358 6359// AsBasicResponse is the BasicResponseBase implementation for License. 6360func (l License) AsBasicResponse() (BasicResponse, bool) { 6361 return &l, true 6362} 6363 6364// AsSearchResultsAnswer is the BasicResponseBase implementation for License. 6365func (l License) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 6366 return nil, false 6367} 6368 6369// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for License. 6370func (l License) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 6371 return nil, false 6372} 6373 6374// AsIdentifiable is the BasicResponseBase implementation for License. 6375func (l License) AsIdentifiable() (*Identifiable, bool) { 6376 return nil, false 6377} 6378 6379// AsBasicIdentifiable is the BasicResponseBase implementation for License. 6380func (l License) AsBasicIdentifiable() (BasicIdentifiable, bool) { 6381 return &l, true 6382} 6383 6384// AsAnswer is the BasicResponseBase implementation for License. 6385func (l License) AsAnswer() (*Answer, bool) { 6386 return nil, false 6387} 6388 6389// AsBasicAnswer is the BasicResponseBase implementation for License. 6390func (l License) AsBasicAnswer() (BasicAnswer, bool) { 6391 return nil, false 6392} 6393 6394// AsErrorResponse is the BasicResponseBase implementation for License. 6395func (l License) AsErrorResponse() (*ErrorResponse, bool) { 6396 return nil, false 6397} 6398 6399// AsPostalAddress is the BasicResponseBase implementation for License. 6400func (l License) AsPostalAddress() (*PostalAddress, bool) { 6401 return nil, false 6402} 6403 6404// AsPlace is the BasicResponseBase implementation for License. 6405func (l License) AsPlace() (*Place, bool) { 6406 return nil, false 6407} 6408 6409// AsBasicPlace is the BasicResponseBase implementation for License. 6410func (l License) AsBasicPlace() (BasicPlace, bool) { 6411 return nil, false 6412} 6413 6414// AsOrganization is the BasicResponseBase implementation for License. 6415func (l License) AsOrganization() (*Organization, bool) { 6416 return nil, false 6417} 6418 6419// AsCreativeWork is the BasicResponseBase implementation for License. 6420func (l License) AsCreativeWork() (*CreativeWork, bool) { 6421 return nil, false 6422} 6423 6424// AsBasicCreativeWork is the BasicResponseBase implementation for License. 6425func (l License) AsBasicCreativeWork() (BasicCreativeWork, bool) { 6426 return &l, true 6427} 6428 6429// AsIntangible is the BasicResponseBase implementation for License. 6430func (l License) AsIntangible() (*Intangible, bool) { 6431 return nil, false 6432} 6433 6434// AsBasicIntangible is the BasicResponseBase implementation for License. 6435func (l License) AsBasicIntangible() (BasicIntangible, bool) { 6436 return nil, false 6437} 6438 6439// AsMovieTheater is the BasicResponseBase implementation for License. 6440func (l License) AsMovieTheater() (*MovieTheater, bool) { 6441 return nil, false 6442} 6443 6444// AsMediaObject is the BasicResponseBase implementation for License. 6445func (l License) AsMediaObject() (*MediaObject, bool) { 6446 return nil, false 6447} 6448 6449// AsBasicMediaObject is the BasicResponseBase implementation for License. 6450func (l License) AsBasicMediaObject() (BasicMediaObject, bool) { 6451 return nil, false 6452} 6453 6454// AsCivicStructure is the BasicResponseBase implementation for License. 6455func (l License) AsCivicStructure() (*CivicStructure, bool) { 6456 return nil, false 6457} 6458 6459// AsBasicCivicStructure is the BasicResponseBase implementation for License. 6460func (l License) AsBasicCivicStructure() (BasicCivicStructure, bool) { 6461 return nil, false 6462} 6463 6464// AsLocalBusiness is the BasicResponseBase implementation for License. 6465func (l License) AsLocalBusiness() (*LocalBusiness, bool) { 6466 return nil, false 6467} 6468 6469// AsBasicLocalBusiness is the BasicResponseBase implementation for License. 6470func (l License) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 6471 return nil, false 6472} 6473 6474// AsTouristAttraction is the BasicResponseBase implementation for License. 6475func (l License) AsTouristAttraction() (*TouristAttraction, bool) { 6476 return nil, false 6477} 6478 6479// AsAirport is the BasicResponseBase implementation for License. 6480func (l License) AsAirport() (*Airport, bool) { 6481 return nil, false 6482} 6483 6484// AsLicense is the BasicResponseBase implementation for License. 6485func (l License) AsLicense() (*License, bool) { 6486 return &l, true 6487} 6488 6489// AsStructuredValue is the BasicResponseBase implementation for License. 6490func (l License) AsStructuredValue() (*StructuredValue, bool) { 6491 return nil, false 6492} 6493 6494// AsBasicStructuredValue is the BasicResponseBase implementation for License. 6495func (l License) AsBasicStructuredValue() (BasicStructuredValue, bool) { 6496 return nil, false 6497} 6498 6499// AsEntertainmentBusiness is the BasicResponseBase implementation for License. 6500func (l License) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 6501 return nil, false 6502} 6503 6504// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for License. 6505func (l License) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 6506 return nil, false 6507} 6508 6509// AsFoodEstablishment is the BasicResponseBase implementation for License. 6510func (l License) AsFoodEstablishment() (*FoodEstablishment, bool) { 6511 return nil, false 6512} 6513 6514// AsBasicFoodEstablishment is the BasicResponseBase implementation for License. 6515func (l License) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 6516 return nil, false 6517} 6518 6519// AsLodgingBusiness is the BasicResponseBase implementation for License. 6520func (l License) AsLodgingBusiness() (*LodgingBusiness, bool) { 6521 return nil, false 6522} 6523 6524// AsBasicLodgingBusiness is the BasicResponseBase implementation for License. 6525func (l License) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 6526 return nil, false 6527} 6528 6529// AsRestaurant is the BasicResponseBase implementation for License. 6530func (l License) AsRestaurant() (*Restaurant, bool) { 6531 return nil, false 6532} 6533 6534// AsHotel is the BasicResponseBase implementation for License. 6535func (l License) AsHotel() (*Hotel, bool) { 6536 return nil, false 6537} 6538 6539// AsResponseBase is the BasicResponseBase implementation for License. 6540func (l License) AsResponseBase() (*ResponseBase, bool) { 6541 return nil, false 6542} 6543 6544// AsBasicResponseBase is the BasicResponseBase implementation for License. 6545func (l License) AsBasicResponseBase() (BasicResponseBase, bool) { 6546 return &l, true 6547} 6548 6549// UnmarshalJSON is the custom unmarshaler for License struct. 6550func (l *License) UnmarshalJSON(body []byte) error { 6551 var m map[string]*json.RawMessage 6552 err := json.Unmarshal(body, &m) 6553 if err != nil { 6554 return err 6555 } 6556 for k, v := range m { 6557 switch k { 6558 case "thumbnailUrl": 6559 if v != nil { 6560 var thumbnailURL string 6561 err = json.Unmarshal(*v, &thumbnailURL) 6562 if err != nil { 6563 return err 6564 } 6565 l.ThumbnailURL = &thumbnailURL 6566 } 6567 case "provider": 6568 if v != nil { 6569 provider, err := unmarshalBasicThingArray(*v) 6570 if err != nil { 6571 return err 6572 } 6573 l.Provider = &provider 6574 } 6575 case "text": 6576 if v != nil { 6577 var textVar string 6578 err = json.Unmarshal(*v, &textVar) 6579 if err != nil { 6580 return err 6581 } 6582 l.Text = &textVar 6583 } 6584 case "name": 6585 if v != nil { 6586 var name string 6587 err = json.Unmarshal(*v, &name) 6588 if err != nil { 6589 return err 6590 } 6591 l.Name = &name 6592 } 6593 case "url": 6594 if v != nil { 6595 var URL string 6596 err = json.Unmarshal(*v, &URL) 6597 if err != nil { 6598 return err 6599 } 6600 l.URL = &URL 6601 } 6602 case "image": 6603 if v != nil { 6604 var imageVar ImageObject 6605 err = json.Unmarshal(*v, &imageVar) 6606 if err != nil { 6607 return err 6608 } 6609 l.Image = &imageVar 6610 } 6611 case "description": 6612 if v != nil { 6613 var description string 6614 err = json.Unmarshal(*v, &description) 6615 if err != nil { 6616 return err 6617 } 6618 l.Description = &description 6619 } 6620 case "entityPresentationInfo": 6621 if v != nil { 6622 var entityPresentationInfo EntitiesEntityPresentationInfo 6623 err = json.Unmarshal(*v, &entityPresentationInfo) 6624 if err != nil { 6625 return err 6626 } 6627 l.EntityPresentationInfo = &entityPresentationInfo 6628 } 6629 case "bingId": 6630 if v != nil { 6631 var bingID string 6632 err = json.Unmarshal(*v, &bingID) 6633 if err != nil { 6634 return err 6635 } 6636 l.BingID = &bingID 6637 } 6638 case "contractualRules": 6639 if v != nil { 6640 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 6641 if err != nil { 6642 return err 6643 } 6644 l.ContractualRules = &contractualRules 6645 } 6646 case "webSearchUrl": 6647 if v != nil { 6648 var webSearchURL string 6649 err = json.Unmarshal(*v, &webSearchURL) 6650 if err != nil { 6651 return err 6652 } 6653 l.WebSearchURL = &webSearchURL 6654 } 6655 case "id": 6656 if v != nil { 6657 var ID string 6658 err = json.Unmarshal(*v, &ID) 6659 if err != nil { 6660 return err 6661 } 6662 l.ID = &ID 6663 } 6664 case "_type": 6665 if v != nil { 6666 var typeVar TypeBasicResponseBase 6667 err = json.Unmarshal(*v, &typeVar) 6668 if err != nil { 6669 return err 6670 } 6671 l.Type = typeVar 6672 } 6673 } 6674 } 6675 6676 return nil 6677} 6678 6679// BasicLocalBusiness ... 6680type BasicLocalBusiness interface { 6681 AsMovieTheater() (*MovieTheater, bool) 6682 AsEntertainmentBusiness() (*EntertainmentBusiness, bool) 6683 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) 6684 AsFoodEstablishment() (*FoodEstablishment, bool) 6685 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) 6686 AsLodgingBusiness() (*LodgingBusiness, bool) 6687 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) 6688 AsRestaurant() (*Restaurant, bool) 6689 AsHotel() (*Hotel, bool) 6690 AsLocalBusiness() (*LocalBusiness, bool) 6691} 6692 6693// LocalBusiness ... 6694type LocalBusiness struct { 6695 // PriceRange - $$. 6696 PriceRange *string `json:"priceRange,omitempty"` 6697 Panoramas *[]ImageObject `json:"panoramas,omitempty"` 6698 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"` 6699 TagLine *string `json:"tagLine,omitempty"` 6700 // Address - The postal address of where the entity is located 6701 Address *PostalAddress `json:"address,omitempty"` 6702 // Telephone - The entity's telephone number 6703 Telephone *string `json:"telephone,omitempty"` 6704 // Name - The name of the thing represented by this object. 6705 Name *string `json:"name,omitempty"` 6706 // URL - The URL to get more information about the thing represented by this object. 6707 URL *string `json:"url,omitempty"` 6708 Image *ImageObject `json:"image,omitempty"` 6709 // Description - A short description of the item. 6710 Description *string `json:"description,omitempty"` 6711 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 6712 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 6713 // BingID - An ID that uniquely identifies this item. 6714 BingID *string `json:"bingId,omitempty"` 6715 // ContractualRules - A list of rules that you must adhere to if you display the item. 6716 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 6717 // WebSearchURL - The URL To Bing's search result for this item. 6718 WebSearchURL *string `json:"webSearchUrl,omitempty"` 6719 // ID - A String identifier. 6720 ID *string `json:"id,omitempty"` 6721 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 6722 Type TypeBasicResponseBase `json:"_type,omitempty"` 6723} 6724 6725func unmarshalBasicLocalBusiness(body []byte) (BasicLocalBusiness, error) { 6726 var m map[string]interface{} 6727 err := json.Unmarshal(body, &m) 6728 if err != nil { 6729 return nil, err 6730 } 6731 6732 switch m["_type"] { 6733 case string(TypeMovieTheater): 6734 var mt MovieTheater 6735 err := json.Unmarshal(body, &mt) 6736 return mt, err 6737 case string(TypeEntertainmentBusiness): 6738 var eb EntertainmentBusiness 6739 err := json.Unmarshal(body, &eb) 6740 return eb, err 6741 case string(TypeFoodEstablishment): 6742 var fe FoodEstablishment 6743 err := json.Unmarshal(body, &fe) 6744 return fe, err 6745 case string(TypeLodgingBusiness): 6746 var lb LodgingBusiness 6747 err := json.Unmarshal(body, &lb) 6748 return lb, err 6749 case string(TypeRestaurant): 6750 var r Restaurant 6751 err := json.Unmarshal(body, &r) 6752 return r, err 6753 case string(TypeHotel): 6754 var h Hotel 6755 err := json.Unmarshal(body, &h) 6756 return h, err 6757 default: 6758 var lb LocalBusiness 6759 err := json.Unmarshal(body, &lb) 6760 return lb, err 6761 } 6762} 6763func unmarshalBasicLocalBusinessArray(body []byte) ([]BasicLocalBusiness, error) { 6764 var rawMessages []*json.RawMessage 6765 err := json.Unmarshal(body, &rawMessages) 6766 if err != nil { 6767 return nil, err 6768 } 6769 6770 lbArray := make([]BasicLocalBusiness, len(rawMessages)) 6771 6772 for index, rawMessage := range rawMessages { 6773 lb, err := unmarshalBasicLocalBusiness(*rawMessage) 6774 if err != nil { 6775 return nil, err 6776 } 6777 lbArray[index] = lb 6778 } 6779 return lbArray, nil 6780} 6781 6782// MarshalJSON is the custom marshaler for LocalBusiness. 6783func (lb LocalBusiness) MarshalJSON() ([]byte, error) { 6784 lb.Type = TypeLocalBusiness 6785 objectMap := make(map[string]interface{}) 6786 if lb.PriceRange != nil { 6787 objectMap["priceRange"] = lb.PriceRange 6788 } 6789 if lb.Panoramas != nil { 6790 objectMap["panoramas"] = lb.Panoramas 6791 } 6792 if lb.IsPermanentlyClosed != nil { 6793 objectMap["isPermanentlyClosed"] = lb.IsPermanentlyClosed 6794 } 6795 if lb.TagLine != nil { 6796 objectMap["tagLine"] = lb.TagLine 6797 } 6798 if lb.Address != nil { 6799 objectMap["address"] = lb.Address 6800 } 6801 if lb.Telephone != nil { 6802 objectMap["telephone"] = lb.Telephone 6803 } 6804 if lb.Name != nil { 6805 objectMap["name"] = lb.Name 6806 } 6807 if lb.URL != nil { 6808 objectMap["url"] = lb.URL 6809 } 6810 if lb.Image != nil { 6811 objectMap["image"] = lb.Image 6812 } 6813 if lb.Description != nil { 6814 objectMap["description"] = lb.Description 6815 } 6816 if lb.EntityPresentationInfo != nil { 6817 objectMap["entityPresentationInfo"] = lb.EntityPresentationInfo 6818 } 6819 if lb.BingID != nil { 6820 objectMap["bingId"] = lb.BingID 6821 } 6822 if lb.ContractualRules != nil { 6823 objectMap["contractualRules"] = lb.ContractualRules 6824 } 6825 if lb.WebSearchURL != nil { 6826 objectMap["webSearchUrl"] = lb.WebSearchURL 6827 } 6828 if lb.ID != nil { 6829 objectMap["id"] = lb.ID 6830 } 6831 if lb.Type != "" { 6832 objectMap["_type"] = lb.Type 6833 } 6834 return json.Marshal(objectMap) 6835} 6836 6837// AsImageObject is the BasicResponseBase implementation for LocalBusiness. 6838func (lb LocalBusiness) AsImageObject() (*ImageObject, bool) { 6839 return nil, false 6840} 6841 6842// AsThing is the BasicResponseBase implementation for LocalBusiness. 6843func (lb LocalBusiness) AsThing() (*Thing, bool) { 6844 return nil, false 6845} 6846 6847// AsBasicThing is the BasicResponseBase implementation for LocalBusiness. 6848func (lb LocalBusiness) AsBasicThing() (BasicThing, bool) { 6849 return &lb, true 6850} 6851 6852// AsEntities is the BasicResponseBase implementation for LocalBusiness. 6853func (lb LocalBusiness) AsEntities() (*Entities, bool) { 6854 return nil, false 6855} 6856 6857// AsPlaces is the BasicResponseBase implementation for LocalBusiness. 6858func (lb LocalBusiness) AsPlaces() (*Places, bool) { 6859 return nil, false 6860} 6861 6862// AsSearchResponse is the BasicResponseBase implementation for LocalBusiness. 6863func (lb LocalBusiness) AsSearchResponse() (*SearchResponse, bool) { 6864 return nil, false 6865} 6866 6867// AsResponse is the BasicResponseBase implementation for LocalBusiness. 6868func (lb LocalBusiness) AsResponse() (*Response, bool) { 6869 return nil, false 6870} 6871 6872// AsBasicResponse is the BasicResponseBase implementation for LocalBusiness. 6873func (lb LocalBusiness) AsBasicResponse() (BasicResponse, bool) { 6874 return &lb, true 6875} 6876 6877// AsSearchResultsAnswer is the BasicResponseBase implementation for LocalBusiness. 6878func (lb LocalBusiness) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 6879 return nil, false 6880} 6881 6882// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for LocalBusiness. 6883func (lb LocalBusiness) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 6884 return nil, false 6885} 6886 6887// AsIdentifiable is the BasicResponseBase implementation for LocalBusiness. 6888func (lb LocalBusiness) AsIdentifiable() (*Identifiable, bool) { 6889 return nil, false 6890} 6891 6892// AsBasicIdentifiable is the BasicResponseBase implementation for LocalBusiness. 6893func (lb LocalBusiness) AsBasicIdentifiable() (BasicIdentifiable, bool) { 6894 return &lb, true 6895} 6896 6897// AsAnswer is the BasicResponseBase implementation for LocalBusiness. 6898func (lb LocalBusiness) AsAnswer() (*Answer, bool) { 6899 return nil, false 6900} 6901 6902// AsBasicAnswer is the BasicResponseBase implementation for LocalBusiness. 6903func (lb LocalBusiness) AsBasicAnswer() (BasicAnswer, bool) { 6904 return nil, false 6905} 6906 6907// AsErrorResponse is the BasicResponseBase implementation for LocalBusiness. 6908func (lb LocalBusiness) AsErrorResponse() (*ErrorResponse, bool) { 6909 return nil, false 6910} 6911 6912// AsPostalAddress is the BasicResponseBase implementation for LocalBusiness. 6913func (lb LocalBusiness) AsPostalAddress() (*PostalAddress, bool) { 6914 return nil, false 6915} 6916 6917// AsPlace is the BasicResponseBase implementation for LocalBusiness. 6918func (lb LocalBusiness) AsPlace() (*Place, bool) { 6919 return nil, false 6920} 6921 6922// AsBasicPlace is the BasicResponseBase implementation for LocalBusiness. 6923func (lb LocalBusiness) AsBasicPlace() (BasicPlace, bool) { 6924 return &lb, true 6925} 6926 6927// AsOrganization is the BasicResponseBase implementation for LocalBusiness. 6928func (lb LocalBusiness) AsOrganization() (*Organization, bool) { 6929 return nil, false 6930} 6931 6932// AsCreativeWork is the BasicResponseBase implementation for LocalBusiness. 6933func (lb LocalBusiness) AsCreativeWork() (*CreativeWork, bool) { 6934 return nil, false 6935} 6936 6937// AsBasicCreativeWork is the BasicResponseBase implementation for LocalBusiness. 6938func (lb LocalBusiness) AsBasicCreativeWork() (BasicCreativeWork, bool) { 6939 return nil, false 6940} 6941 6942// AsIntangible is the BasicResponseBase implementation for LocalBusiness. 6943func (lb LocalBusiness) AsIntangible() (*Intangible, bool) { 6944 return nil, false 6945} 6946 6947// AsBasicIntangible is the BasicResponseBase implementation for LocalBusiness. 6948func (lb LocalBusiness) AsBasicIntangible() (BasicIntangible, bool) { 6949 return nil, false 6950} 6951 6952// AsMovieTheater is the BasicResponseBase implementation for LocalBusiness. 6953func (lb LocalBusiness) AsMovieTheater() (*MovieTheater, bool) { 6954 return nil, false 6955} 6956 6957// AsMediaObject is the BasicResponseBase implementation for LocalBusiness. 6958func (lb LocalBusiness) AsMediaObject() (*MediaObject, bool) { 6959 return nil, false 6960} 6961 6962// AsBasicMediaObject is the BasicResponseBase implementation for LocalBusiness. 6963func (lb LocalBusiness) AsBasicMediaObject() (BasicMediaObject, bool) { 6964 return nil, false 6965} 6966 6967// AsCivicStructure is the BasicResponseBase implementation for LocalBusiness. 6968func (lb LocalBusiness) AsCivicStructure() (*CivicStructure, bool) { 6969 return nil, false 6970} 6971 6972// AsBasicCivicStructure is the BasicResponseBase implementation for LocalBusiness. 6973func (lb LocalBusiness) AsBasicCivicStructure() (BasicCivicStructure, bool) { 6974 return nil, false 6975} 6976 6977// AsLocalBusiness is the BasicResponseBase implementation for LocalBusiness. 6978func (lb LocalBusiness) AsLocalBusiness() (*LocalBusiness, bool) { 6979 return &lb, true 6980} 6981 6982// AsBasicLocalBusiness is the BasicResponseBase implementation for LocalBusiness. 6983func (lb LocalBusiness) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 6984 return &lb, true 6985} 6986 6987// AsTouristAttraction is the BasicResponseBase implementation for LocalBusiness. 6988func (lb LocalBusiness) AsTouristAttraction() (*TouristAttraction, bool) { 6989 return nil, false 6990} 6991 6992// AsAirport is the BasicResponseBase implementation for LocalBusiness. 6993func (lb LocalBusiness) AsAirport() (*Airport, bool) { 6994 return nil, false 6995} 6996 6997// AsLicense is the BasicResponseBase implementation for LocalBusiness. 6998func (lb LocalBusiness) AsLicense() (*License, bool) { 6999 return nil, false 7000} 7001 7002// AsStructuredValue is the BasicResponseBase implementation for LocalBusiness. 7003func (lb LocalBusiness) AsStructuredValue() (*StructuredValue, bool) { 7004 return nil, false 7005} 7006 7007// AsBasicStructuredValue is the BasicResponseBase implementation for LocalBusiness. 7008func (lb LocalBusiness) AsBasicStructuredValue() (BasicStructuredValue, bool) { 7009 return nil, false 7010} 7011 7012// AsEntertainmentBusiness is the BasicResponseBase implementation for LocalBusiness. 7013func (lb LocalBusiness) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 7014 return nil, false 7015} 7016 7017// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for LocalBusiness. 7018func (lb LocalBusiness) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 7019 return nil, false 7020} 7021 7022// AsFoodEstablishment is the BasicResponseBase implementation for LocalBusiness. 7023func (lb LocalBusiness) AsFoodEstablishment() (*FoodEstablishment, bool) { 7024 return nil, false 7025} 7026 7027// AsBasicFoodEstablishment is the BasicResponseBase implementation for LocalBusiness. 7028func (lb LocalBusiness) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 7029 return nil, false 7030} 7031 7032// AsLodgingBusiness is the BasicResponseBase implementation for LocalBusiness. 7033func (lb LocalBusiness) AsLodgingBusiness() (*LodgingBusiness, bool) { 7034 return nil, false 7035} 7036 7037// AsBasicLodgingBusiness is the BasicResponseBase implementation for LocalBusiness. 7038func (lb LocalBusiness) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 7039 return nil, false 7040} 7041 7042// AsRestaurant is the BasicResponseBase implementation for LocalBusiness. 7043func (lb LocalBusiness) AsRestaurant() (*Restaurant, bool) { 7044 return nil, false 7045} 7046 7047// AsHotel is the BasicResponseBase implementation for LocalBusiness. 7048func (lb LocalBusiness) AsHotel() (*Hotel, bool) { 7049 return nil, false 7050} 7051 7052// AsResponseBase is the BasicResponseBase implementation for LocalBusiness. 7053func (lb LocalBusiness) AsResponseBase() (*ResponseBase, bool) { 7054 return nil, false 7055} 7056 7057// AsBasicResponseBase is the BasicResponseBase implementation for LocalBusiness. 7058func (lb LocalBusiness) AsBasicResponseBase() (BasicResponseBase, bool) { 7059 return &lb, true 7060} 7061 7062// UnmarshalJSON is the custom unmarshaler for LocalBusiness struct. 7063func (lb *LocalBusiness) UnmarshalJSON(body []byte) error { 7064 var m map[string]*json.RawMessage 7065 err := json.Unmarshal(body, &m) 7066 if err != nil { 7067 return err 7068 } 7069 for k, v := range m { 7070 switch k { 7071 case "priceRange": 7072 if v != nil { 7073 var priceRange string 7074 err = json.Unmarshal(*v, &priceRange) 7075 if err != nil { 7076 return err 7077 } 7078 lb.PriceRange = &priceRange 7079 } 7080 case "panoramas": 7081 if v != nil { 7082 var panoramas []ImageObject 7083 err = json.Unmarshal(*v, &panoramas) 7084 if err != nil { 7085 return err 7086 } 7087 lb.Panoramas = &panoramas 7088 } 7089 case "isPermanentlyClosed": 7090 if v != nil { 7091 var isPermanentlyClosed bool 7092 err = json.Unmarshal(*v, &isPermanentlyClosed) 7093 if err != nil { 7094 return err 7095 } 7096 lb.IsPermanentlyClosed = &isPermanentlyClosed 7097 } 7098 case "tagLine": 7099 if v != nil { 7100 var tagLine string 7101 err = json.Unmarshal(*v, &tagLine) 7102 if err != nil { 7103 return err 7104 } 7105 lb.TagLine = &tagLine 7106 } 7107 case "address": 7108 if v != nil { 7109 var address PostalAddress 7110 err = json.Unmarshal(*v, &address) 7111 if err != nil { 7112 return err 7113 } 7114 lb.Address = &address 7115 } 7116 case "telephone": 7117 if v != nil { 7118 var telephone string 7119 err = json.Unmarshal(*v, &telephone) 7120 if err != nil { 7121 return err 7122 } 7123 lb.Telephone = &telephone 7124 } 7125 case "name": 7126 if v != nil { 7127 var name string 7128 err = json.Unmarshal(*v, &name) 7129 if err != nil { 7130 return err 7131 } 7132 lb.Name = &name 7133 } 7134 case "url": 7135 if v != nil { 7136 var URL string 7137 err = json.Unmarshal(*v, &URL) 7138 if err != nil { 7139 return err 7140 } 7141 lb.URL = &URL 7142 } 7143 case "image": 7144 if v != nil { 7145 var imageVar ImageObject 7146 err = json.Unmarshal(*v, &imageVar) 7147 if err != nil { 7148 return err 7149 } 7150 lb.Image = &imageVar 7151 } 7152 case "description": 7153 if v != nil { 7154 var description string 7155 err = json.Unmarshal(*v, &description) 7156 if err != nil { 7157 return err 7158 } 7159 lb.Description = &description 7160 } 7161 case "entityPresentationInfo": 7162 if v != nil { 7163 var entityPresentationInfo EntitiesEntityPresentationInfo 7164 err = json.Unmarshal(*v, &entityPresentationInfo) 7165 if err != nil { 7166 return err 7167 } 7168 lb.EntityPresentationInfo = &entityPresentationInfo 7169 } 7170 case "bingId": 7171 if v != nil { 7172 var bingID string 7173 err = json.Unmarshal(*v, &bingID) 7174 if err != nil { 7175 return err 7176 } 7177 lb.BingID = &bingID 7178 } 7179 case "contractualRules": 7180 if v != nil { 7181 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 7182 if err != nil { 7183 return err 7184 } 7185 lb.ContractualRules = &contractualRules 7186 } 7187 case "webSearchUrl": 7188 if v != nil { 7189 var webSearchURL string 7190 err = json.Unmarshal(*v, &webSearchURL) 7191 if err != nil { 7192 return err 7193 } 7194 lb.WebSearchURL = &webSearchURL 7195 } 7196 case "id": 7197 if v != nil { 7198 var ID string 7199 err = json.Unmarshal(*v, &ID) 7200 if err != nil { 7201 return err 7202 } 7203 lb.ID = &ID 7204 } 7205 case "_type": 7206 if v != nil { 7207 var typeVar TypeBasicResponseBase 7208 err = json.Unmarshal(*v, &typeVar) 7209 if err != nil { 7210 return err 7211 } 7212 lb.Type = typeVar 7213 } 7214 } 7215 } 7216 7217 return nil 7218} 7219 7220// BasicLodgingBusiness ... 7221type BasicLodgingBusiness interface { 7222 AsHotel() (*Hotel, bool) 7223 AsLodgingBusiness() (*LodgingBusiness, bool) 7224} 7225 7226// LodgingBusiness ... 7227type LodgingBusiness struct { 7228 // PriceRange - $$. 7229 PriceRange *string `json:"priceRange,omitempty"` 7230 Panoramas *[]ImageObject `json:"panoramas,omitempty"` 7231 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"` 7232 TagLine *string `json:"tagLine,omitempty"` 7233 // Address - The postal address of where the entity is located 7234 Address *PostalAddress `json:"address,omitempty"` 7235 // Telephone - The entity's telephone number 7236 Telephone *string `json:"telephone,omitempty"` 7237 // Name - The name of the thing represented by this object. 7238 Name *string `json:"name,omitempty"` 7239 // URL - The URL to get more information about the thing represented by this object. 7240 URL *string `json:"url,omitempty"` 7241 Image *ImageObject `json:"image,omitempty"` 7242 // Description - A short description of the item. 7243 Description *string `json:"description,omitempty"` 7244 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 7245 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 7246 // BingID - An ID that uniquely identifies this item. 7247 BingID *string `json:"bingId,omitempty"` 7248 // ContractualRules - A list of rules that you must adhere to if you display the item. 7249 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 7250 // WebSearchURL - The URL To Bing's search result for this item. 7251 WebSearchURL *string `json:"webSearchUrl,omitempty"` 7252 // ID - A String identifier. 7253 ID *string `json:"id,omitempty"` 7254 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 7255 Type TypeBasicResponseBase `json:"_type,omitempty"` 7256} 7257 7258func unmarshalBasicLodgingBusiness(body []byte) (BasicLodgingBusiness, error) { 7259 var m map[string]interface{} 7260 err := json.Unmarshal(body, &m) 7261 if err != nil { 7262 return nil, err 7263 } 7264 7265 switch m["_type"] { 7266 case string(TypeHotel): 7267 var h Hotel 7268 err := json.Unmarshal(body, &h) 7269 return h, err 7270 default: 7271 var lb LodgingBusiness 7272 err := json.Unmarshal(body, &lb) 7273 return lb, err 7274 } 7275} 7276func unmarshalBasicLodgingBusinessArray(body []byte) ([]BasicLodgingBusiness, error) { 7277 var rawMessages []*json.RawMessage 7278 err := json.Unmarshal(body, &rawMessages) 7279 if err != nil { 7280 return nil, err 7281 } 7282 7283 lbArray := make([]BasicLodgingBusiness, len(rawMessages)) 7284 7285 for index, rawMessage := range rawMessages { 7286 lb, err := unmarshalBasicLodgingBusiness(*rawMessage) 7287 if err != nil { 7288 return nil, err 7289 } 7290 lbArray[index] = lb 7291 } 7292 return lbArray, nil 7293} 7294 7295// MarshalJSON is the custom marshaler for LodgingBusiness. 7296func (lb LodgingBusiness) MarshalJSON() ([]byte, error) { 7297 lb.Type = TypeLodgingBusiness 7298 objectMap := make(map[string]interface{}) 7299 if lb.PriceRange != nil { 7300 objectMap["priceRange"] = lb.PriceRange 7301 } 7302 if lb.Panoramas != nil { 7303 objectMap["panoramas"] = lb.Panoramas 7304 } 7305 if lb.IsPermanentlyClosed != nil { 7306 objectMap["isPermanentlyClosed"] = lb.IsPermanentlyClosed 7307 } 7308 if lb.TagLine != nil { 7309 objectMap["tagLine"] = lb.TagLine 7310 } 7311 if lb.Address != nil { 7312 objectMap["address"] = lb.Address 7313 } 7314 if lb.Telephone != nil { 7315 objectMap["telephone"] = lb.Telephone 7316 } 7317 if lb.Name != nil { 7318 objectMap["name"] = lb.Name 7319 } 7320 if lb.URL != nil { 7321 objectMap["url"] = lb.URL 7322 } 7323 if lb.Image != nil { 7324 objectMap["image"] = lb.Image 7325 } 7326 if lb.Description != nil { 7327 objectMap["description"] = lb.Description 7328 } 7329 if lb.EntityPresentationInfo != nil { 7330 objectMap["entityPresentationInfo"] = lb.EntityPresentationInfo 7331 } 7332 if lb.BingID != nil { 7333 objectMap["bingId"] = lb.BingID 7334 } 7335 if lb.ContractualRules != nil { 7336 objectMap["contractualRules"] = lb.ContractualRules 7337 } 7338 if lb.WebSearchURL != nil { 7339 objectMap["webSearchUrl"] = lb.WebSearchURL 7340 } 7341 if lb.ID != nil { 7342 objectMap["id"] = lb.ID 7343 } 7344 if lb.Type != "" { 7345 objectMap["_type"] = lb.Type 7346 } 7347 return json.Marshal(objectMap) 7348} 7349 7350// AsImageObject is the BasicResponseBase implementation for LodgingBusiness. 7351func (lb LodgingBusiness) AsImageObject() (*ImageObject, bool) { 7352 return nil, false 7353} 7354 7355// AsThing is the BasicResponseBase implementation for LodgingBusiness. 7356func (lb LodgingBusiness) AsThing() (*Thing, bool) { 7357 return nil, false 7358} 7359 7360// AsBasicThing is the BasicResponseBase implementation for LodgingBusiness. 7361func (lb LodgingBusiness) AsBasicThing() (BasicThing, bool) { 7362 return &lb, true 7363} 7364 7365// AsEntities is the BasicResponseBase implementation for LodgingBusiness. 7366func (lb LodgingBusiness) AsEntities() (*Entities, bool) { 7367 return nil, false 7368} 7369 7370// AsPlaces is the BasicResponseBase implementation for LodgingBusiness. 7371func (lb LodgingBusiness) AsPlaces() (*Places, bool) { 7372 return nil, false 7373} 7374 7375// AsSearchResponse is the BasicResponseBase implementation for LodgingBusiness. 7376func (lb LodgingBusiness) AsSearchResponse() (*SearchResponse, bool) { 7377 return nil, false 7378} 7379 7380// AsResponse is the BasicResponseBase implementation for LodgingBusiness. 7381func (lb LodgingBusiness) AsResponse() (*Response, bool) { 7382 return nil, false 7383} 7384 7385// AsBasicResponse is the BasicResponseBase implementation for LodgingBusiness. 7386func (lb LodgingBusiness) AsBasicResponse() (BasicResponse, bool) { 7387 return &lb, true 7388} 7389 7390// AsSearchResultsAnswer is the BasicResponseBase implementation for LodgingBusiness. 7391func (lb LodgingBusiness) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 7392 return nil, false 7393} 7394 7395// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for LodgingBusiness. 7396func (lb LodgingBusiness) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 7397 return nil, false 7398} 7399 7400// AsIdentifiable is the BasicResponseBase implementation for LodgingBusiness. 7401func (lb LodgingBusiness) AsIdentifiable() (*Identifiable, bool) { 7402 return nil, false 7403} 7404 7405// AsBasicIdentifiable is the BasicResponseBase implementation for LodgingBusiness. 7406func (lb LodgingBusiness) AsBasicIdentifiable() (BasicIdentifiable, bool) { 7407 return &lb, true 7408} 7409 7410// AsAnswer is the BasicResponseBase implementation for LodgingBusiness. 7411func (lb LodgingBusiness) AsAnswer() (*Answer, bool) { 7412 return nil, false 7413} 7414 7415// AsBasicAnswer is the BasicResponseBase implementation for LodgingBusiness. 7416func (lb LodgingBusiness) AsBasicAnswer() (BasicAnswer, bool) { 7417 return nil, false 7418} 7419 7420// AsErrorResponse is the BasicResponseBase implementation for LodgingBusiness. 7421func (lb LodgingBusiness) AsErrorResponse() (*ErrorResponse, bool) { 7422 return nil, false 7423} 7424 7425// AsPostalAddress is the BasicResponseBase implementation for LodgingBusiness. 7426func (lb LodgingBusiness) AsPostalAddress() (*PostalAddress, bool) { 7427 return nil, false 7428} 7429 7430// AsPlace is the BasicResponseBase implementation for LodgingBusiness. 7431func (lb LodgingBusiness) AsPlace() (*Place, bool) { 7432 return nil, false 7433} 7434 7435// AsBasicPlace is the BasicResponseBase implementation for LodgingBusiness. 7436func (lb LodgingBusiness) AsBasicPlace() (BasicPlace, bool) { 7437 return &lb, true 7438} 7439 7440// AsOrganization is the BasicResponseBase implementation for LodgingBusiness. 7441func (lb LodgingBusiness) AsOrganization() (*Organization, bool) { 7442 return nil, false 7443} 7444 7445// AsCreativeWork is the BasicResponseBase implementation for LodgingBusiness. 7446func (lb LodgingBusiness) AsCreativeWork() (*CreativeWork, bool) { 7447 return nil, false 7448} 7449 7450// AsBasicCreativeWork is the BasicResponseBase implementation for LodgingBusiness. 7451func (lb LodgingBusiness) AsBasicCreativeWork() (BasicCreativeWork, bool) { 7452 return nil, false 7453} 7454 7455// AsIntangible is the BasicResponseBase implementation for LodgingBusiness. 7456func (lb LodgingBusiness) AsIntangible() (*Intangible, bool) { 7457 return nil, false 7458} 7459 7460// AsBasicIntangible is the BasicResponseBase implementation for LodgingBusiness. 7461func (lb LodgingBusiness) AsBasicIntangible() (BasicIntangible, bool) { 7462 return nil, false 7463} 7464 7465// AsMovieTheater is the BasicResponseBase implementation for LodgingBusiness. 7466func (lb LodgingBusiness) AsMovieTheater() (*MovieTheater, bool) { 7467 return nil, false 7468} 7469 7470// AsMediaObject is the BasicResponseBase implementation for LodgingBusiness. 7471func (lb LodgingBusiness) AsMediaObject() (*MediaObject, bool) { 7472 return nil, false 7473} 7474 7475// AsBasicMediaObject is the BasicResponseBase implementation for LodgingBusiness. 7476func (lb LodgingBusiness) AsBasicMediaObject() (BasicMediaObject, bool) { 7477 return nil, false 7478} 7479 7480// AsCivicStructure is the BasicResponseBase implementation for LodgingBusiness. 7481func (lb LodgingBusiness) AsCivicStructure() (*CivicStructure, bool) { 7482 return nil, false 7483} 7484 7485// AsBasicCivicStructure is the BasicResponseBase implementation for LodgingBusiness. 7486func (lb LodgingBusiness) AsBasicCivicStructure() (BasicCivicStructure, bool) { 7487 return nil, false 7488} 7489 7490// AsLocalBusiness is the BasicResponseBase implementation for LodgingBusiness. 7491func (lb LodgingBusiness) AsLocalBusiness() (*LocalBusiness, bool) { 7492 return nil, false 7493} 7494 7495// AsBasicLocalBusiness is the BasicResponseBase implementation for LodgingBusiness. 7496func (lb LodgingBusiness) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 7497 return &lb, true 7498} 7499 7500// AsTouristAttraction is the BasicResponseBase implementation for LodgingBusiness. 7501func (lb LodgingBusiness) AsTouristAttraction() (*TouristAttraction, bool) { 7502 return nil, false 7503} 7504 7505// AsAirport is the BasicResponseBase implementation for LodgingBusiness. 7506func (lb LodgingBusiness) AsAirport() (*Airport, bool) { 7507 return nil, false 7508} 7509 7510// AsLicense is the BasicResponseBase implementation for LodgingBusiness. 7511func (lb LodgingBusiness) AsLicense() (*License, bool) { 7512 return nil, false 7513} 7514 7515// AsStructuredValue is the BasicResponseBase implementation for LodgingBusiness. 7516func (lb LodgingBusiness) AsStructuredValue() (*StructuredValue, bool) { 7517 return nil, false 7518} 7519 7520// AsBasicStructuredValue is the BasicResponseBase implementation for LodgingBusiness. 7521func (lb LodgingBusiness) AsBasicStructuredValue() (BasicStructuredValue, bool) { 7522 return nil, false 7523} 7524 7525// AsEntertainmentBusiness is the BasicResponseBase implementation for LodgingBusiness. 7526func (lb LodgingBusiness) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 7527 return nil, false 7528} 7529 7530// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for LodgingBusiness. 7531func (lb LodgingBusiness) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 7532 return nil, false 7533} 7534 7535// AsFoodEstablishment is the BasicResponseBase implementation for LodgingBusiness. 7536func (lb LodgingBusiness) AsFoodEstablishment() (*FoodEstablishment, bool) { 7537 return nil, false 7538} 7539 7540// AsBasicFoodEstablishment is the BasicResponseBase implementation for LodgingBusiness. 7541func (lb LodgingBusiness) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 7542 return nil, false 7543} 7544 7545// AsLodgingBusiness is the BasicResponseBase implementation for LodgingBusiness. 7546func (lb LodgingBusiness) AsLodgingBusiness() (*LodgingBusiness, bool) { 7547 return &lb, true 7548} 7549 7550// AsBasicLodgingBusiness is the BasicResponseBase implementation for LodgingBusiness. 7551func (lb LodgingBusiness) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 7552 return &lb, true 7553} 7554 7555// AsRestaurant is the BasicResponseBase implementation for LodgingBusiness. 7556func (lb LodgingBusiness) AsRestaurant() (*Restaurant, bool) { 7557 return nil, false 7558} 7559 7560// AsHotel is the BasicResponseBase implementation for LodgingBusiness. 7561func (lb LodgingBusiness) AsHotel() (*Hotel, bool) { 7562 return nil, false 7563} 7564 7565// AsResponseBase is the BasicResponseBase implementation for LodgingBusiness. 7566func (lb LodgingBusiness) AsResponseBase() (*ResponseBase, bool) { 7567 return nil, false 7568} 7569 7570// AsBasicResponseBase is the BasicResponseBase implementation for LodgingBusiness. 7571func (lb LodgingBusiness) AsBasicResponseBase() (BasicResponseBase, bool) { 7572 return &lb, true 7573} 7574 7575// UnmarshalJSON is the custom unmarshaler for LodgingBusiness struct. 7576func (lb *LodgingBusiness) UnmarshalJSON(body []byte) error { 7577 var m map[string]*json.RawMessage 7578 err := json.Unmarshal(body, &m) 7579 if err != nil { 7580 return err 7581 } 7582 for k, v := range m { 7583 switch k { 7584 case "priceRange": 7585 if v != nil { 7586 var priceRange string 7587 err = json.Unmarshal(*v, &priceRange) 7588 if err != nil { 7589 return err 7590 } 7591 lb.PriceRange = &priceRange 7592 } 7593 case "panoramas": 7594 if v != nil { 7595 var panoramas []ImageObject 7596 err = json.Unmarshal(*v, &panoramas) 7597 if err != nil { 7598 return err 7599 } 7600 lb.Panoramas = &panoramas 7601 } 7602 case "isPermanentlyClosed": 7603 if v != nil { 7604 var isPermanentlyClosed bool 7605 err = json.Unmarshal(*v, &isPermanentlyClosed) 7606 if err != nil { 7607 return err 7608 } 7609 lb.IsPermanentlyClosed = &isPermanentlyClosed 7610 } 7611 case "tagLine": 7612 if v != nil { 7613 var tagLine string 7614 err = json.Unmarshal(*v, &tagLine) 7615 if err != nil { 7616 return err 7617 } 7618 lb.TagLine = &tagLine 7619 } 7620 case "address": 7621 if v != nil { 7622 var address PostalAddress 7623 err = json.Unmarshal(*v, &address) 7624 if err != nil { 7625 return err 7626 } 7627 lb.Address = &address 7628 } 7629 case "telephone": 7630 if v != nil { 7631 var telephone string 7632 err = json.Unmarshal(*v, &telephone) 7633 if err != nil { 7634 return err 7635 } 7636 lb.Telephone = &telephone 7637 } 7638 case "name": 7639 if v != nil { 7640 var name string 7641 err = json.Unmarshal(*v, &name) 7642 if err != nil { 7643 return err 7644 } 7645 lb.Name = &name 7646 } 7647 case "url": 7648 if v != nil { 7649 var URL string 7650 err = json.Unmarshal(*v, &URL) 7651 if err != nil { 7652 return err 7653 } 7654 lb.URL = &URL 7655 } 7656 case "image": 7657 if v != nil { 7658 var imageVar ImageObject 7659 err = json.Unmarshal(*v, &imageVar) 7660 if err != nil { 7661 return err 7662 } 7663 lb.Image = &imageVar 7664 } 7665 case "description": 7666 if v != nil { 7667 var description string 7668 err = json.Unmarshal(*v, &description) 7669 if err != nil { 7670 return err 7671 } 7672 lb.Description = &description 7673 } 7674 case "entityPresentationInfo": 7675 if v != nil { 7676 var entityPresentationInfo EntitiesEntityPresentationInfo 7677 err = json.Unmarshal(*v, &entityPresentationInfo) 7678 if err != nil { 7679 return err 7680 } 7681 lb.EntityPresentationInfo = &entityPresentationInfo 7682 } 7683 case "bingId": 7684 if v != nil { 7685 var bingID string 7686 err = json.Unmarshal(*v, &bingID) 7687 if err != nil { 7688 return err 7689 } 7690 lb.BingID = &bingID 7691 } 7692 case "contractualRules": 7693 if v != nil { 7694 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 7695 if err != nil { 7696 return err 7697 } 7698 lb.ContractualRules = &contractualRules 7699 } 7700 case "webSearchUrl": 7701 if v != nil { 7702 var webSearchURL string 7703 err = json.Unmarshal(*v, &webSearchURL) 7704 if err != nil { 7705 return err 7706 } 7707 lb.WebSearchURL = &webSearchURL 7708 } 7709 case "id": 7710 if v != nil { 7711 var ID string 7712 err = json.Unmarshal(*v, &ID) 7713 if err != nil { 7714 return err 7715 } 7716 lb.ID = &ID 7717 } 7718 case "_type": 7719 if v != nil { 7720 var typeVar TypeBasicResponseBase 7721 err = json.Unmarshal(*v, &typeVar) 7722 if err != nil { 7723 return err 7724 } 7725 lb.Type = typeVar 7726 } 7727 } 7728 } 7729 7730 return nil 7731} 7732 7733// BasicMediaObject ... 7734type BasicMediaObject interface { 7735 AsImageObject() (*ImageObject, bool) 7736 AsMediaObject() (*MediaObject, bool) 7737} 7738 7739// MediaObject ... 7740type MediaObject struct { 7741 // ContentURL - Original URL to retrieve the source (file) for the media object (e.g the source URL for the image). 7742 ContentURL *string `json:"contentUrl,omitempty"` 7743 // HostPageURL - URL of the page that hosts the media object. 7744 HostPageURL *string `json:"hostPageUrl,omitempty"` 7745 // Width - The width of the source media object, in pixels. 7746 Width *int32 `json:"width,omitempty"` 7747 // Height - The height of the source media object, in pixels. 7748 Height *int32 `json:"height,omitempty"` 7749 // ThumbnailURL - The URL to a thumbnail of the item. 7750 ThumbnailURL *string `json:"thumbnailUrl,omitempty"` 7751 // Provider - The source of the creative work. 7752 Provider *[]BasicThing `json:"provider,omitempty"` 7753 Text *string `json:"text,omitempty"` 7754 // Name - The name of the thing represented by this object. 7755 Name *string `json:"name,omitempty"` 7756 // URL - The URL to get more information about the thing represented by this object. 7757 URL *string `json:"url,omitempty"` 7758 Image *ImageObject `json:"image,omitempty"` 7759 // Description - A short description of the item. 7760 Description *string `json:"description,omitempty"` 7761 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 7762 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 7763 // BingID - An ID that uniquely identifies this item. 7764 BingID *string `json:"bingId,omitempty"` 7765 // ContractualRules - A list of rules that you must adhere to if you display the item. 7766 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 7767 // WebSearchURL - The URL To Bing's search result for this item. 7768 WebSearchURL *string `json:"webSearchUrl,omitempty"` 7769 // ID - A String identifier. 7770 ID *string `json:"id,omitempty"` 7771 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 7772 Type TypeBasicResponseBase `json:"_type,omitempty"` 7773} 7774 7775func unmarshalBasicMediaObject(body []byte) (BasicMediaObject, error) { 7776 var m map[string]interface{} 7777 err := json.Unmarshal(body, &m) 7778 if err != nil { 7779 return nil, err 7780 } 7781 7782 switch m["_type"] { 7783 case string(TypeImageObject): 7784 var ioVar ImageObject 7785 err := json.Unmarshal(body, &ioVar) 7786 return ioVar, err 7787 default: 7788 var mo MediaObject 7789 err := json.Unmarshal(body, &mo) 7790 return mo, err 7791 } 7792} 7793func unmarshalBasicMediaObjectArray(body []byte) ([]BasicMediaObject, error) { 7794 var rawMessages []*json.RawMessage 7795 err := json.Unmarshal(body, &rawMessages) 7796 if err != nil { 7797 return nil, err 7798 } 7799 7800 moArray := make([]BasicMediaObject, len(rawMessages)) 7801 7802 for index, rawMessage := range rawMessages { 7803 mo, err := unmarshalBasicMediaObject(*rawMessage) 7804 if err != nil { 7805 return nil, err 7806 } 7807 moArray[index] = mo 7808 } 7809 return moArray, nil 7810} 7811 7812// MarshalJSON is the custom marshaler for MediaObject. 7813func (mo MediaObject) MarshalJSON() ([]byte, error) { 7814 mo.Type = TypeMediaObject 7815 objectMap := make(map[string]interface{}) 7816 if mo.ContentURL != nil { 7817 objectMap["contentUrl"] = mo.ContentURL 7818 } 7819 if mo.HostPageURL != nil { 7820 objectMap["hostPageUrl"] = mo.HostPageURL 7821 } 7822 if mo.Width != nil { 7823 objectMap["width"] = mo.Width 7824 } 7825 if mo.Height != nil { 7826 objectMap["height"] = mo.Height 7827 } 7828 if mo.ThumbnailURL != nil { 7829 objectMap["thumbnailUrl"] = mo.ThumbnailURL 7830 } 7831 if mo.Provider != nil { 7832 objectMap["provider"] = mo.Provider 7833 } 7834 if mo.Text != nil { 7835 objectMap["text"] = mo.Text 7836 } 7837 if mo.Name != nil { 7838 objectMap["name"] = mo.Name 7839 } 7840 if mo.URL != nil { 7841 objectMap["url"] = mo.URL 7842 } 7843 if mo.Image != nil { 7844 objectMap["image"] = mo.Image 7845 } 7846 if mo.Description != nil { 7847 objectMap["description"] = mo.Description 7848 } 7849 if mo.EntityPresentationInfo != nil { 7850 objectMap["entityPresentationInfo"] = mo.EntityPresentationInfo 7851 } 7852 if mo.BingID != nil { 7853 objectMap["bingId"] = mo.BingID 7854 } 7855 if mo.ContractualRules != nil { 7856 objectMap["contractualRules"] = mo.ContractualRules 7857 } 7858 if mo.WebSearchURL != nil { 7859 objectMap["webSearchUrl"] = mo.WebSearchURL 7860 } 7861 if mo.ID != nil { 7862 objectMap["id"] = mo.ID 7863 } 7864 if mo.Type != "" { 7865 objectMap["_type"] = mo.Type 7866 } 7867 return json.Marshal(objectMap) 7868} 7869 7870// AsImageObject is the BasicResponseBase implementation for MediaObject. 7871func (mo MediaObject) AsImageObject() (*ImageObject, bool) { 7872 return nil, false 7873} 7874 7875// AsThing is the BasicResponseBase implementation for MediaObject. 7876func (mo MediaObject) AsThing() (*Thing, bool) { 7877 return nil, false 7878} 7879 7880// AsBasicThing is the BasicResponseBase implementation for MediaObject. 7881func (mo MediaObject) AsBasicThing() (BasicThing, bool) { 7882 return &mo, true 7883} 7884 7885// AsEntities is the BasicResponseBase implementation for MediaObject. 7886func (mo MediaObject) AsEntities() (*Entities, bool) { 7887 return nil, false 7888} 7889 7890// AsPlaces is the BasicResponseBase implementation for MediaObject. 7891func (mo MediaObject) AsPlaces() (*Places, bool) { 7892 return nil, false 7893} 7894 7895// AsSearchResponse is the BasicResponseBase implementation for MediaObject. 7896func (mo MediaObject) AsSearchResponse() (*SearchResponse, bool) { 7897 return nil, false 7898} 7899 7900// AsResponse is the BasicResponseBase implementation for MediaObject. 7901func (mo MediaObject) AsResponse() (*Response, bool) { 7902 return nil, false 7903} 7904 7905// AsBasicResponse is the BasicResponseBase implementation for MediaObject. 7906func (mo MediaObject) AsBasicResponse() (BasicResponse, bool) { 7907 return &mo, true 7908} 7909 7910// AsSearchResultsAnswer is the BasicResponseBase implementation for MediaObject. 7911func (mo MediaObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 7912 return nil, false 7913} 7914 7915// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for MediaObject. 7916func (mo MediaObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 7917 return nil, false 7918} 7919 7920// AsIdentifiable is the BasicResponseBase implementation for MediaObject. 7921func (mo MediaObject) AsIdentifiable() (*Identifiable, bool) { 7922 return nil, false 7923} 7924 7925// AsBasicIdentifiable is the BasicResponseBase implementation for MediaObject. 7926func (mo MediaObject) AsBasicIdentifiable() (BasicIdentifiable, bool) { 7927 return &mo, true 7928} 7929 7930// AsAnswer is the BasicResponseBase implementation for MediaObject. 7931func (mo MediaObject) AsAnswer() (*Answer, bool) { 7932 return nil, false 7933} 7934 7935// AsBasicAnswer is the BasicResponseBase implementation for MediaObject. 7936func (mo MediaObject) AsBasicAnswer() (BasicAnswer, bool) { 7937 return nil, false 7938} 7939 7940// AsErrorResponse is the BasicResponseBase implementation for MediaObject. 7941func (mo MediaObject) AsErrorResponse() (*ErrorResponse, bool) { 7942 return nil, false 7943} 7944 7945// AsPostalAddress is the BasicResponseBase implementation for MediaObject. 7946func (mo MediaObject) AsPostalAddress() (*PostalAddress, bool) { 7947 return nil, false 7948} 7949 7950// AsPlace is the BasicResponseBase implementation for MediaObject. 7951func (mo MediaObject) AsPlace() (*Place, bool) { 7952 return nil, false 7953} 7954 7955// AsBasicPlace is the BasicResponseBase implementation for MediaObject. 7956func (mo MediaObject) AsBasicPlace() (BasicPlace, bool) { 7957 return nil, false 7958} 7959 7960// AsOrganization is the BasicResponseBase implementation for MediaObject. 7961func (mo MediaObject) AsOrganization() (*Organization, bool) { 7962 return nil, false 7963} 7964 7965// AsCreativeWork is the BasicResponseBase implementation for MediaObject. 7966func (mo MediaObject) AsCreativeWork() (*CreativeWork, bool) { 7967 return nil, false 7968} 7969 7970// AsBasicCreativeWork is the BasicResponseBase implementation for MediaObject. 7971func (mo MediaObject) AsBasicCreativeWork() (BasicCreativeWork, bool) { 7972 return &mo, true 7973} 7974 7975// AsIntangible is the BasicResponseBase implementation for MediaObject. 7976func (mo MediaObject) AsIntangible() (*Intangible, bool) { 7977 return nil, false 7978} 7979 7980// AsBasicIntangible is the BasicResponseBase implementation for MediaObject. 7981func (mo MediaObject) AsBasicIntangible() (BasicIntangible, bool) { 7982 return nil, false 7983} 7984 7985// AsMovieTheater is the BasicResponseBase implementation for MediaObject. 7986func (mo MediaObject) AsMovieTheater() (*MovieTheater, bool) { 7987 return nil, false 7988} 7989 7990// AsMediaObject is the BasicResponseBase implementation for MediaObject. 7991func (mo MediaObject) AsMediaObject() (*MediaObject, bool) { 7992 return &mo, true 7993} 7994 7995// AsBasicMediaObject is the BasicResponseBase implementation for MediaObject. 7996func (mo MediaObject) AsBasicMediaObject() (BasicMediaObject, bool) { 7997 return &mo, true 7998} 7999 8000// AsCivicStructure is the BasicResponseBase implementation for MediaObject. 8001func (mo MediaObject) AsCivicStructure() (*CivicStructure, bool) { 8002 return nil, false 8003} 8004 8005// AsBasicCivicStructure is the BasicResponseBase implementation for MediaObject. 8006func (mo MediaObject) AsBasicCivicStructure() (BasicCivicStructure, bool) { 8007 return nil, false 8008} 8009 8010// AsLocalBusiness is the BasicResponseBase implementation for MediaObject. 8011func (mo MediaObject) AsLocalBusiness() (*LocalBusiness, bool) { 8012 return nil, false 8013} 8014 8015// AsBasicLocalBusiness is the BasicResponseBase implementation for MediaObject. 8016func (mo MediaObject) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 8017 return nil, false 8018} 8019 8020// AsTouristAttraction is the BasicResponseBase implementation for MediaObject. 8021func (mo MediaObject) AsTouristAttraction() (*TouristAttraction, bool) { 8022 return nil, false 8023} 8024 8025// AsAirport is the BasicResponseBase implementation for MediaObject. 8026func (mo MediaObject) AsAirport() (*Airport, bool) { 8027 return nil, false 8028} 8029 8030// AsLicense is the BasicResponseBase implementation for MediaObject. 8031func (mo MediaObject) AsLicense() (*License, bool) { 8032 return nil, false 8033} 8034 8035// AsStructuredValue is the BasicResponseBase implementation for MediaObject. 8036func (mo MediaObject) AsStructuredValue() (*StructuredValue, bool) { 8037 return nil, false 8038} 8039 8040// AsBasicStructuredValue is the BasicResponseBase implementation for MediaObject. 8041func (mo MediaObject) AsBasicStructuredValue() (BasicStructuredValue, bool) { 8042 return nil, false 8043} 8044 8045// AsEntertainmentBusiness is the BasicResponseBase implementation for MediaObject. 8046func (mo MediaObject) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 8047 return nil, false 8048} 8049 8050// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for MediaObject. 8051func (mo MediaObject) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 8052 return nil, false 8053} 8054 8055// AsFoodEstablishment is the BasicResponseBase implementation for MediaObject. 8056func (mo MediaObject) AsFoodEstablishment() (*FoodEstablishment, bool) { 8057 return nil, false 8058} 8059 8060// AsBasicFoodEstablishment is the BasicResponseBase implementation for MediaObject. 8061func (mo MediaObject) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 8062 return nil, false 8063} 8064 8065// AsLodgingBusiness is the BasicResponseBase implementation for MediaObject. 8066func (mo MediaObject) AsLodgingBusiness() (*LodgingBusiness, bool) { 8067 return nil, false 8068} 8069 8070// AsBasicLodgingBusiness is the BasicResponseBase implementation for MediaObject. 8071func (mo MediaObject) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 8072 return nil, false 8073} 8074 8075// AsRestaurant is the BasicResponseBase implementation for MediaObject. 8076func (mo MediaObject) AsRestaurant() (*Restaurant, bool) { 8077 return nil, false 8078} 8079 8080// AsHotel is the BasicResponseBase implementation for MediaObject. 8081func (mo MediaObject) AsHotel() (*Hotel, bool) { 8082 return nil, false 8083} 8084 8085// AsResponseBase is the BasicResponseBase implementation for MediaObject. 8086func (mo MediaObject) AsResponseBase() (*ResponseBase, bool) { 8087 return nil, false 8088} 8089 8090// AsBasicResponseBase is the BasicResponseBase implementation for MediaObject. 8091func (mo MediaObject) AsBasicResponseBase() (BasicResponseBase, bool) { 8092 return &mo, true 8093} 8094 8095// UnmarshalJSON is the custom unmarshaler for MediaObject struct. 8096func (mo *MediaObject) UnmarshalJSON(body []byte) error { 8097 var m map[string]*json.RawMessage 8098 err := json.Unmarshal(body, &m) 8099 if err != nil { 8100 return err 8101 } 8102 for k, v := range m { 8103 switch k { 8104 case "contentUrl": 8105 if v != nil { 8106 var contentURL string 8107 err = json.Unmarshal(*v, &contentURL) 8108 if err != nil { 8109 return err 8110 } 8111 mo.ContentURL = &contentURL 8112 } 8113 case "hostPageUrl": 8114 if v != nil { 8115 var hostPageURL string 8116 err = json.Unmarshal(*v, &hostPageURL) 8117 if err != nil { 8118 return err 8119 } 8120 mo.HostPageURL = &hostPageURL 8121 } 8122 case "width": 8123 if v != nil { 8124 var width int32 8125 err = json.Unmarshal(*v, &width) 8126 if err != nil { 8127 return err 8128 } 8129 mo.Width = &width 8130 } 8131 case "height": 8132 if v != nil { 8133 var height int32 8134 err = json.Unmarshal(*v, &height) 8135 if err != nil { 8136 return err 8137 } 8138 mo.Height = &height 8139 } 8140 case "thumbnailUrl": 8141 if v != nil { 8142 var thumbnailURL string 8143 err = json.Unmarshal(*v, &thumbnailURL) 8144 if err != nil { 8145 return err 8146 } 8147 mo.ThumbnailURL = &thumbnailURL 8148 } 8149 case "provider": 8150 if v != nil { 8151 provider, err := unmarshalBasicThingArray(*v) 8152 if err != nil { 8153 return err 8154 } 8155 mo.Provider = &provider 8156 } 8157 case "text": 8158 if v != nil { 8159 var textVar string 8160 err = json.Unmarshal(*v, &textVar) 8161 if err != nil { 8162 return err 8163 } 8164 mo.Text = &textVar 8165 } 8166 case "name": 8167 if v != nil { 8168 var name string 8169 err = json.Unmarshal(*v, &name) 8170 if err != nil { 8171 return err 8172 } 8173 mo.Name = &name 8174 } 8175 case "url": 8176 if v != nil { 8177 var URL string 8178 err = json.Unmarshal(*v, &URL) 8179 if err != nil { 8180 return err 8181 } 8182 mo.URL = &URL 8183 } 8184 case "image": 8185 if v != nil { 8186 var imageVar ImageObject 8187 err = json.Unmarshal(*v, &imageVar) 8188 if err != nil { 8189 return err 8190 } 8191 mo.Image = &imageVar 8192 } 8193 case "description": 8194 if v != nil { 8195 var description string 8196 err = json.Unmarshal(*v, &description) 8197 if err != nil { 8198 return err 8199 } 8200 mo.Description = &description 8201 } 8202 case "entityPresentationInfo": 8203 if v != nil { 8204 var entityPresentationInfo EntitiesEntityPresentationInfo 8205 err = json.Unmarshal(*v, &entityPresentationInfo) 8206 if err != nil { 8207 return err 8208 } 8209 mo.EntityPresentationInfo = &entityPresentationInfo 8210 } 8211 case "bingId": 8212 if v != nil { 8213 var bingID string 8214 err = json.Unmarshal(*v, &bingID) 8215 if err != nil { 8216 return err 8217 } 8218 mo.BingID = &bingID 8219 } 8220 case "contractualRules": 8221 if v != nil { 8222 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 8223 if err != nil { 8224 return err 8225 } 8226 mo.ContractualRules = &contractualRules 8227 } 8228 case "webSearchUrl": 8229 if v != nil { 8230 var webSearchURL string 8231 err = json.Unmarshal(*v, &webSearchURL) 8232 if err != nil { 8233 return err 8234 } 8235 mo.WebSearchURL = &webSearchURL 8236 } 8237 case "id": 8238 if v != nil { 8239 var ID string 8240 err = json.Unmarshal(*v, &ID) 8241 if err != nil { 8242 return err 8243 } 8244 mo.ID = &ID 8245 } 8246 case "_type": 8247 if v != nil { 8248 var typeVar TypeBasicResponseBase 8249 err = json.Unmarshal(*v, &typeVar) 8250 if err != nil { 8251 return err 8252 } 8253 mo.Type = typeVar 8254 } 8255 } 8256 } 8257 8258 return nil 8259} 8260 8261// MovieTheater ... 8262type MovieTheater struct { 8263 ScreenCount *int32 `json:"screenCount,omitempty"` 8264 // PriceRange - $$. 8265 PriceRange *string `json:"priceRange,omitempty"` 8266 Panoramas *[]ImageObject `json:"panoramas,omitempty"` 8267 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"` 8268 TagLine *string `json:"tagLine,omitempty"` 8269 // Address - The postal address of where the entity is located 8270 Address *PostalAddress `json:"address,omitempty"` 8271 // Telephone - The entity's telephone number 8272 Telephone *string `json:"telephone,omitempty"` 8273 // Name - The name of the thing represented by this object. 8274 Name *string `json:"name,omitempty"` 8275 // URL - The URL to get more information about the thing represented by this object. 8276 URL *string `json:"url,omitempty"` 8277 Image *ImageObject `json:"image,omitempty"` 8278 // Description - A short description of the item. 8279 Description *string `json:"description,omitempty"` 8280 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 8281 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 8282 // BingID - An ID that uniquely identifies this item. 8283 BingID *string `json:"bingId,omitempty"` 8284 // ContractualRules - A list of rules that you must adhere to if you display the item. 8285 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 8286 // WebSearchURL - The URL To Bing's search result for this item. 8287 WebSearchURL *string `json:"webSearchUrl,omitempty"` 8288 // ID - A String identifier. 8289 ID *string `json:"id,omitempty"` 8290 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 8291 Type TypeBasicResponseBase `json:"_type,omitempty"` 8292} 8293 8294// MarshalJSON is the custom marshaler for MovieTheater. 8295func (mt MovieTheater) MarshalJSON() ([]byte, error) { 8296 mt.Type = TypeMovieTheater 8297 objectMap := make(map[string]interface{}) 8298 if mt.ScreenCount != nil { 8299 objectMap["screenCount"] = mt.ScreenCount 8300 } 8301 if mt.PriceRange != nil { 8302 objectMap["priceRange"] = mt.PriceRange 8303 } 8304 if mt.Panoramas != nil { 8305 objectMap["panoramas"] = mt.Panoramas 8306 } 8307 if mt.IsPermanentlyClosed != nil { 8308 objectMap["isPermanentlyClosed"] = mt.IsPermanentlyClosed 8309 } 8310 if mt.TagLine != nil { 8311 objectMap["tagLine"] = mt.TagLine 8312 } 8313 if mt.Address != nil { 8314 objectMap["address"] = mt.Address 8315 } 8316 if mt.Telephone != nil { 8317 objectMap["telephone"] = mt.Telephone 8318 } 8319 if mt.Name != nil { 8320 objectMap["name"] = mt.Name 8321 } 8322 if mt.URL != nil { 8323 objectMap["url"] = mt.URL 8324 } 8325 if mt.Image != nil { 8326 objectMap["image"] = mt.Image 8327 } 8328 if mt.Description != nil { 8329 objectMap["description"] = mt.Description 8330 } 8331 if mt.EntityPresentationInfo != nil { 8332 objectMap["entityPresentationInfo"] = mt.EntityPresentationInfo 8333 } 8334 if mt.BingID != nil { 8335 objectMap["bingId"] = mt.BingID 8336 } 8337 if mt.ContractualRules != nil { 8338 objectMap["contractualRules"] = mt.ContractualRules 8339 } 8340 if mt.WebSearchURL != nil { 8341 objectMap["webSearchUrl"] = mt.WebSearchURL 8342 } 8343 if mt.ID != nil { 8344 objectMap["id"] = mt.ID 8345 } 8346 if mt.Type != "" { 8347 objectMap["_type"] = mt.Type 8348 } 8349 return json.Marshal(objectMap) 8350} 8351 8352// AsImageObject is the BasicResponseBase implementation for MovieTheater. 8353func (mt MovieTheater) AsImageObject() (*ImageObject, bool) { 8354 return nil, false 8355} 8356 8357// AsThing is the BasicResponseBase implementation for MovieTheater. 8358func (mt MovieTheater) AsThing() (*Thing, bool) { 8359 return nil, false 8360} 8361 8362// AsBasicThing is the BasicResponseBase implementation for MovieTheater. 8363func (mt MovieTheater) AsBasicThing() (BasicThing, bool) { 8364 return &mt, true 8365} 8366 8367// AsEntities is the BasicResponseBase implementation for MovieTheater. 8368func (mt MovieTheater) AsEntities() (*Entities, bool) { 8369 return nil, false 8370} 8371 8372// AsPlaces is the BasicResponseBase implementation for MovieTheater. 8373func (mt MovieTheater) AsPlaces() (*Places, bool) { 8374 return nil, false 8375} 8376 8377// AsSearchResponse is the BasicResponseBase implementation for MovieTheater. 8378func (mt MovieTheater) AsSearchResponse() (*SearchResponse, bool) { 8379 return nil, false 8380} 8381 8382// AsResponse is the BasicResponseBase implementation for MovieTheater. 8383func (mt MovieTheater) AsResponse() (*Response, bool) { 8384 return nil, false 8385} 8386 8387// AsBasicResponse is the BasicResponseBase implementation for MovieTheater. 8388func (mt MovieTheater) AsBasicResponse() (BasicResponse, bool) { 8389 return &mt, true 8390} 8391 8392// AsSearchResultsAnswer is the BasicResponseBase implementation for MovieTheater. 8393func (mt MovieTheater) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 8394 return nil, false 8395} 8396 8397// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for MovieTheater. 8398func (mt MovieTheater) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 8399 return nil, false 8400} 8401 8402// AsIdentifiable is the BasicResponseBase implementation for MovieTheater. 8403func (mt MovieTheater) AsIdentifiable() (*Identifiable, bool) { 8404 return nil, false 8405} 8406 8407// AsBasicIdentifiable is the BasicResponseBase implementation for MovieTheater. 8408func (mt MovieTheater) AsBasicIdentifiable() (BasicIdentifiable, bool) { 8409 return &mt, true 8410} 8411 8412// AsAnswer is the BasicResponseBase implementation for MovieTheater. 8413func (mt MovieTheater) AsAnswer() (*Answer, bool) { 8414 return nil, false 8415} 8416 8417// AsBasicAnswer is the BasicResponseBase implementation for MovieTheater. 8418func (mt MovieTheater) AsBasicAnswer() (BasicAnswer, bool) { 8419 return nil, false 8420} 8421 8422// AsErrorResponse is the BasicResponseBase implementation for MovieTheater. 8423func (mt MovieTheater) AsErrorResponse() (*ErrorResponse, bool) { 8424 return nil, false 8425} 8426 8427// AsPostalAddress is the BasicResponseBase implementation for MovieTheater. 8428func (mt MovieTheater) AsPostalAddress() (*PostalAddress, bool) { 8429 return nil, false 8430} 8431 8432// AsPlace is the BasicResponseBase implementation for MovieTheater. 8433func (mt MovieTheater) AsPlace() (*Place, bool) { 8434 return nil, false 8435} 8436 8437// AsBasicPlace is the BasicResponseBase implementation for MovieTheater. 8438func (mt MovieTheater) AsBasicPlace() (BasicPlace, bool) { 8439 return &mt, true 8440} 8441 8442// AsOrganization is the BasicResponseBase implementation for MovieTheater. 8443func (mt MovieTheater) AsOrganization() (*Organization, bool) { 8444 return nil, false 8445} 8446 8447// AsCreativeWork is the BasicResponseBase implementation for MovieTheater. 8448func (mt MovieTheater) AsCreativeWork() (*CreativeWork, bool) { 8449 return nil, false 8450} 8451 8452// AsBasicCreativeWork is the BasicResponseBase implementation for MovieTheater. 8453func (mt MovieTheater) AsBasicCreativeWork() (BasicCreativeWork, bool) { 8454 return nil, false 8455} 8456 8457// AsIntangible is the BasicResponseBase implementation for MovieTheater. 8458func (mt MovieTheater) AsIntangible() (*Intangible, bool) { 8459 return nil, false 8460} 8461 8462// AsBasicIntangible is the BasicResponseBase implementation for MovieTheater. 8463func (mt MovieTheater) AsBasicIntangible() (BasicIntangible, bool) { 8464 return nil, false 8465} 8466 8467// AsMovieTheater is the BasicResponseBase implementation for MovieTheater. 8468func (mt MovieTheater) AsMovieTheater() (*MovieTheater, bool) { 8469 return &mt, true 8470} 8471 8472// AsMediaObject is the BasicResponseBase implementation for MovieTheater. 8473func (mt MovieTheater) AsMediaObject() (*MediaObject, bool) { 8474 return nil, false 8475} 8476 8477// AsBasicMediaObject is the BasicResponseBase implementation for MovieTheater. 8478func (mt MovieTheater) AsBasicMediaObject() (BasicMediaObject, bool) { 8479 return nil, false 8480} 8481 8482// AsCivicStructure is the BasicResponseBase implementation for MovieTheater. 8483func (mt MovieTheater) AsCivicStructure() (*CivicStructure, bool) { 8484 return nil, false 8485} 8486 8487// AsBasicCivicStructure is the BasicResponseBase implementation for MovieTheater. 8488func (mt MovieTheater) AsBasicCivicStructure() (BasicCivicStructure, bool) { 8489 return nil, false 8490} 8491 8492// AsLocalBusiness is the BasicResponseBase implementation for MovieTheater. 8493func (mt MovieTheater) AsLocalBusiness() (*LocalBusiness, bool) { 8494 return nil, false 8495} 8496 8497// AsBasicLocalBusiness is the BasicResponseBase implementation for MovieTheater. 8498func (mt MovieTheater) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 8499 return &mt, true 8500} 8501 8502// AsTouristAttraction is the BasicResponseBase implementation for MovieTheater. 8503func (mt MovieTheater) AsTouristAttraction() (*TouristAttraction, bool) { 8504 return nil, false 8505} 8506 8507// AsAirport is the BasicResponseBase implementation for MovieTheater. 8508func (mt MovieTheater) AsAirport() (*Airport, bool) { 8509 return nil, false 8510} 8511 8512// AsLicense is the BasicResponseBase implementation for MovieTheater. 8513func (mt MovieTheater) AsLicense() (*License, bool) { 8514 return nil, false 8515} 8516 8517// AsStructuredValue is the BasicResponseBase implementation for MovieTheater. 8518func (mt MovieTheater) AsStructuredValue() (*StructuredValue, bool) { 8519 return nil, false 8520} 8521 8522// AsBasicStructuredValue is the BasicResponseBase implementation for MovieTheater. 8523func (mt MovieTheater) AsBasicStructuredValue() (BasicStructuredValue, bool) { 8524 return nil, false 8525} 8526 8527// AsEntertainmentBusiness is the BasicResponseBase implementation for MovieTheater. 8528func (mt MovieTheater) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 8529 return nil, false 8530} 8531 8532// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for MovieTheater. 8533func (mt MovieTheater) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 8534 return &mt, true 8535} 8536 8537// AsFoodEstablishment is the BasicResponseBase implementation for MovieTheater. 8538func (mt MovieTheater) AsFoodEstablishment() (*FoodEstablishment, bool) { 8539 return nil, false 8540} 8541 8542// AsBasicFoodEstablishment is the BasicResponseBase implementation for MovieTheater. 8543func (mt MovieTheater) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 8544 return nil, false 8545} 8546 8547// AsLodgingBusiness is the BasicResponseBase implementation for MovieTheater. 8548func (mt MovieTheater) AsLodgingBusiness() (*LodgingBusiness, bool) { 8549 return nil, false 8550} 8551 8552// AsBasicLodgingBusiness is the BasicResponseBase implementation for MovieTheater. 8553func (mt MovieTheater) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 8554 return nil, false 8555} 8556 8557// AsRestaurant is the BasicResponseBase implementation for MovieTheater. 8558func (mt MovieTheater) AsRestaurant() (*Restaurant, bool) { 8559 return nil, false 8560} 8561 8562// AsHotel is the BasicResponseBase implementation for MovieTheater. 8563func (mt MovieTheater) AsHotel() (*Hotel, bool) { 8564 return nil, false 8565} 8566 8567// AsResponseBase is the BasicResponseBase implementation for MovieTheater. 8568func (mt MovieTheater) AsResponseBase() (*ResponseBase, bool) { 8569 return nil, false 8570} 8571 8572// AsBasicResponseBase is the BasicResponseBase implementation for MovieTheater. 8573func (mt MovieTheater) AsBasicResponseBase() (BasicResponseBase, bool) { 8574 return &mt, true 8575} 8576 8577// UnmarshalJSON is the custom unmarshaler for MovieTheater struct. 8578func (mt *MovieTheater) UnmarshalJSON(body []byte) error { 8579 var m map[string]*json.RawMessage 8580 err := json.Unmarshal(body, &m) 8581 if err != nil { 8582 return err 8583 } 8584 for k, v := range m { 8585 switch k { 8586 case "screenCount": 8587 if v != nil { 8588 var screenCount int32 8589 err = json.Unmarshal(*v, &screenCount) 8590 if err != nil { 8591 return err 8592 } 8593 mt.ScreenCount = &screenCount 8594 } 8595 case "priceRange": 8596 if v != nil { 8597 var priceRange string 8598 err = json.Unmarshal(*v, &priceRange) 8599 if err != nil { 8600 return err 8601 } 8602 mt.PriceRange = &priceRange 8603 } 8604 case "panoramas": 8605 if v != nil { 8606 var panoramas []ImageObject 8607 err = json.Unmarshal(*v, &panoramas) 8608 if err != nil { 8609 return err 8610 } 8611 mt.Panoramas = &panoramas 8612 } 8613 case "isPermanentlyClosed": 8614 if v != nil { 8615 var isPermanentlyClosed bool 8616 err = json.Unmarshal(*v, &isPermanentlyClosed) 8617 if err != nil { 8618 return err 8619 } 8620 mt.IsPermanentlyClosed = &isPermanentlyClosed 8621 } 8622 case "tagLine": 8623 if v != nil { 8624 var tagLine string 8625 err = json.Unmarshal(*v, &tagLine) 8626 if err != nil { 8627 return err 8628 } 8629 mt.TagLine = &tagLine 8630 } 8631 case "address": 8632 if v != nil { 8633 var address PostalAddress 8634 err = json.Unmarshal(*v, &address) 8635 if err != nil { 8636 return err 8637 } 8638 mt.Address = &address 8639 } 8640 case "telephone": 8641 if v != nil { 8642 var telephone string 8643 err = json.Unmarshal(*v, &telephone) 8644 if err != nil { 8645 return err 8646 } 8647 mt.Telephone = &telephone 8648 } 8649 case "name": 8650 if v != nil { 8651 var name string 8652 err = json.Unmarshal(*v, &name) 8653 if err != nil { 8654 return err 8655 } 8656 mt.Name = &name 8657 } 8658 case "url": 8659 if v != nil { 8660 var URL string 8661 err = json.Unmarshal(*v, &URL) 8662 if err != nil { 8663 return err 8664 } 8665 mt.URL = &URL 8666 } 8667 case "image": 8668 if v != nil { 8669 var imageVar ImageObject 8670 err = json.Unmarshal(*v, &imageVar) 8671 if err != nil { 8672 return err 8673 } 8674 mt.Image = &imageVar 8675 } 8676 case "description": 8677 if v != nil { 8678 var description string 8679 err = json.Unmarshal(*v, &description) 8680 if err != nil { 8681 return err 8682 } 8683 mt.Description = &description 8684 } 8685 case "entityPresentationInfo": 8686 if v != nil { 8687 var entityPresentationInfo EntitiesEntityPresentationInfo 8688 err = json.Unmarshal(*v, &entityPresentationInfo) 8689 if err != nil { 8690 return err 8691 } 8692 mt.EntityPresentationInfo = &entityPresentationInfo 8693 } 8694 case "bingId": 8695 if v != nil { 8696 var bingID string 8697 err = json.Unmarshal(*v, &bingID) 8698 if err != nil { 8699 return err 8700 } 8701 mt.BingID = &bingID 8702 } 8703 case "contractualRules": 8704 if v != nil { 8705 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 8706 if err != nil { 8707 return err 8708 } 8709 mt.ContractualRules = &contractualRules 8710 } 8711 case "webSearchUrl": 8712 if v != nil { 8713 var webSearchURL string 8714 err = json.Unmarshal(*v, &webSearchURL) 8715 if err != nil { 8716 return err 8717 } 8718 mt.WebSearchURL = &webSearchURL 8719 } 8720 case "id": 8721 if v != nil { 8722 var ID string 8723 err = json.Unmarshal(*v, &ID) 8724 if err != nil { 8725 return err 8726 } 8727 mt.ID = &ID 8728 } 8729 case "_type": 8730 if v != nil { 8731 var typeVar TypeBasicResponseBase 8732 err = json.Unmarshal(*v, &typeVar) 8733 if err != nil { 8734 return err 8735 } 8736 mt.Type = typeVar 8737 } 8738 } 8739 } 8740 8741 return nil 8742} 8743 8744// Organization defines an organization. 8745type Organization struct { 8746 // Name - The name of the thing represented by this object. 8747 Name *string `json:"name,omitempty"` 8748 // URL - The URL to get more information about the thing represented by this object. 8749 URL *string `json:"url,omitempty"` 8750 Image *ImageObject `json:"image,omitempty"` 8751 // Description - A short description of the item. 8752 Description *string `json:"description,omitempty"` 8753 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 8754 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 8755 // BingID - An ID that uniquely identifies this item. 8756 BingID *string `json:"bingId,omitempty"` 8757 // ContractualRules - A list of rules that you must adhere to if you display the item. 8758 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 8759 // WebSearchURL - The URL To Bing's search result for this item. 8760 WebSearchURL *string `json:"webSearchUrl,omitempty"` 8761 // ID - A String identifier. 8762 ID *string `json:"id,omitempty"` 8763 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 8764 Type TypeBasicResponseBase `json:"_type,omitempty"` 8765} 8766 8767// MarshalJSON is the custom marshaler for Organization. 8768func (o Organization) MarshalJSON() ([]byte, error) { 8769 o.Type = TypeOrganization 8770 objectMap := make(map[string]interface{}) 8771 if o.Name != nil { 8772 objectMap["name"] = o.Name 8773 } 8774 if o.URL != nil { 8775 objectMap["url"] = o.URL 8776 } 8777 if o.Image != nil { 8778 objectMap["image"] = o.Image 8779 } 8780 if o.Description != nil { 8781 objectMap["description"] = o.Description 8782 } 8783 if o.EntityPresentationInfo != nil { 8784 objectMap["entityPresentationInfo"] = o.EntityPresentationInfo 8785 } 8786 if o.BingID != nil { 8787 objectMap["bingId"] = o.BingID 8788 } 8789 if o.ContractualRules != nil { 8790 objectMap["contractualRules"] = o.ContractualRules 8791 } 8792 if o.WebSearchURL != nil { 8793 objectMap["webSearchUrl"] = o.WebSearchURL 8794 } 8795 if o.ID != nil { 8796 objectMap["id"] = o.ID 8797 } 8798 if o.Type != "" { 8799 objectMap["_type"] = o.Type 8800 } 8801 return json.Marshal(objectMap) 8802} 8803 8804// AsImageObject is the BasicResponseBase implementation for Organization. 8805func (o Organization) AsImageObject() (*ImageObject, bool) { 8806 return nil, false 8807} 8808 8809// AsThing is the BasicResponseBase implementation for Organization. 8810func (o Organization) AsThing() (*Thing, bool) { 8811 return nil, false 8812} 8813 8814// AsBasicThing is the BasicResponseBase implementation for Organization. 8815func (o Organization) AsBasicThing() (BasicThing, bool) { 8816 return &o, true 8817} 8818 8819// AsEntities is the BasicResponseBase implementation for Organization. 8820func (o Organization) AsEntities() (*Entities, bool) { 8821 return nil, false 8822} 8823 8824// AsPlaces is the BasicResponseBase implementation for Organization. 8825func (o Organization) AsPlaces() (*Places, bool) { 8826 return nil, false 8827} 8828 8829// AsSearchResponse is the BasicResponseBase implementation for Organization. 8830func (o Organization) AsSearchResponse() (*SearchResponse, bool) { 8831 return nil, false 8832} 8833 8834// AsResponse is the BasicResponseBase implementation for Organization. 8835func (o Organization) AsResponse() (*Response, bool) { 8836 return nil, false 8837} 8838 8839// AsBasicResponse is the BasicResponseBase implementation for Organization. 8840func (o Organization) AsBasicResponse() (BasicResponse, bool) { 8841 return &o, true 8842} 8843 8844// AsSearchResultsAnswer is the BasicResponseBase implementation for Organization. 8845func (o Organization) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 8846 return nil, false 8847} 8848 8849// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Organization. 8850func (o Organization) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 8851 return nil, false 8852} 8853 8854// AsIdentifiable is the BasicResponseBase implementation for Organization. 8855func (o Organization) AsIdentifiable() (*Identifiable, bool) { 8856 return nil, false 8857} 8858 8859// AsBasicIdentifiable is the BasicResponseBase implementation for Organization. 8860func (o Organization) AsBasicIdentifiable() (BasicIdentifiable, bool) { 8861 return &o, true 8862} 8863 8864// AsAnswer is the BasicResponseBase implementation for Organization. 8865func (o Organization) AsAnswer() (*Answer, bool) { 8866 return nil, false 8867} 8868 8869// AsBasicAnswer is the BasicResponseBase implementation for Organization. 8870func (o Organization) AsBasicAnswer() (BasicAnswer, bool) { 8871 return nil, false 8872} 8873 8874// AsErrorResponse is the BasicResponseBase implementation for Organization. 8875func (o Organization) AsErrorResponse() (*ErrorResponse, bool) { 8876 return nil, false 8877} 8878 8879// AsPostalAddress is the BasicResponseBase implementation for Organization. 8880func (o Organization) AsPostalAddress() (*PostalAddress, bool) { 8881 return nil, false 8882} 8883 8884// AsPlace is the BasicResponseBase implementation for Organization. 8885func (o Organization) AsPlace() (*Place, bool) { 8886 return nil, false 8887} 8888 8889// AsBasicPlace is the BasicResponseBase implementation for Organization. 8890func (o Organization) AsBasicPlace() (BasicPlace, bool) { 8891 return nil, false 8892} 8893 8894// AsOrganization is the BasicResponseBase implementation for Organization. 8895func (o Organization) AsOrganization() (*Organization, bool) { 8896 return &o, true 8897} 8898 8899// AsCreativeWork is the BasicResponseBase implementation for Organization. 8900func (o Organization) AsCreativeWork() (*CreativeWork, bool) { 8901 return nil, false 8902} 8903 8904// AsBasicCreativeWork is the BasicResponseBase implementation for Organization. 8905func (o Organization) AsBasicCreativeWork() (BasicCreativeWork, bool) { 8906 return nil, false 8907} 8908 8909// AsIntangible is the BasicResponseBase implementation for Organization. 8910func (o Organization) AsIntangible() (*Intangible, bool) { 8911 return nil, false 8912} 8913 8914// AsBasicIntangible is the BasicResponseBase implementation for Organization. 8915func (o Organization) AsBasicIntangible() (BasicIntangible, bool) { 8916 return nil, false 8917} 8918 8919// AsMovieTheater is the BasicResponseBase implementation for Organization. 8920func (o Organization) AsMovieTheater() (*MovieTheater, bool) { 8921 return nil, false 8922} 8923 8924// AsMediaObject is the BasicResponseBase implementation for Organization. 8925func (o Organization) AsMediaObject() (*MediaObject, bool) { 8926 return nil, false 8927} 8928 8929// AsBasicMediaObject is the BasicResponseBase implementation for Organization. 8930func (o Organization) AsBasicMediaObject() (BasicMediaObject, bool) { 8931 return nil, false 8932} 8933 8934// AsCivicStructure is the BasicResponseBase implementation for Organization. 8935func (o Organization) AsCivicStructure() (*CivicStructure, bool) { 8936 return nil, false 8937} 8938 8939// AsBasicCivicStructure is the BasicResponseBase implementation for Organization. 8940func (o Organization) AsBasicCivicStructure() (BasicCivicStructure, bool) { 8941 return nil, false 8942} 8943 8944// AsLocalBusiness is the BasicResponseBase implementation for Organization. 8945func (o Organization) AsLocalBusiness() (*LocalBusiness, bool) { 8946 return nil, false 8947} 8948 8949// AsBasicLocalBusiness is the BasicResponseBase implementation for Organization. 8950func (o Organization) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 8951 return nil, false 8952} 8953 8954// AsTouristAttraction is the BasicResponseBase implementation for Organization. 8955func (o Organization) AsTouristAttraction() (*TouristAttraction, bool) { 8956 return nil, false 8957} 8958 8959// AsAirport is the BasicResponseBase implementation for Organization. 8960func (o Organization) AsAirport() (*Airport, bool) { 8961 return nil, false 8962} 8963 8964// AsLicense is the BasicResponseBase implementation for Organization. 8965func (o Organization) AsLicense() (*License, bool) { 8966 return nil, false 8967} 8968 8969// AsStructuredValue is the BasicResponseBase implementation for Organization. 8970func (o Organization) AsStructuredValue() (*StructuredValue, bool) { 8971 return nil, false 8972} 8973 8974// AsBasicStructuredValue is the BasicResponseBase implementation for Organization. 8975func (o Organization) AsBasicStructuredValue() (BasicStructuredValue, bool) { 8976 return nil, false 8977} 8978 8979// AsEntertainmentBusiness is the BasicResponseBase implementation for Organization. 8980func (o Organization) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 8981 return nil, false 8982} 8983 8984// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Organization. 8985func (o Organization) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 8986 return nil, false 8987} 8988 8989// AsFoodEstablishment is the BasicResponseBase implementation for Organization. 8990func (o Organization) AsFoodEstablishment() (*FoodEstablishment, bool) { 8991 return nil, false 8992} 8993 8994// AsBasicFoodEstablishment is the BasicResponseBase implementation for Organization. 8995func (o Organization) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 8996 return nil, false 8997} 8998 8999// AsLodgingBusiness is the BasicResponseBase implementation for Organization. 9000func (o Organization) AsLodgingBusiness() (*LodgingBusiness, bool) { 9001 return nil, false 9002} 9003 9004// AsBasicLodgingBusiness is the BasicResponseBase implementation for Organization. 9005func (o Organization) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 9006 return nil, false 9007} 9008 9009// AsRestaurant is the BasicResponseBase implementation for Organization. 9010func (o Organization) AsRestaurant() (*Restaurant, bool) { 9011 return nil, false 9012} 9013 9014// AsHotel is the BasicResponseBase implementation for Organization. 9015func (o Organization) AsHotel() (*Hotel, bool) { 9016 return nil, false 9017} 9018 9019// AsResponseBase is the BasicResponseBase implementation for Organization. 9020func (o Organization) AsResponseBase() (*ResponseBase, bool) { 9021 return nil, false 9022} 9023 9024// AsBasicResponseBase is the BasicResponseBase implementation for Organization. 9025func (o Organization) AsBasicResponseBase() (BasicResponseBase, bool) { 9026 return &o, true 9027} 9028 9029// UnmarshalJSON is the custom unmarshaler for Organization struct. 9030func (o *Organization) UnmarshalJSON(body []byte) error { 9031 var m map[string]*json.RawMessage 9032 err := json.Unmarshal(body, &m) 9033 if err != nil { 9034 return err 9035 } 9036 for k, v := range m { 9037 switch k { 9038 case "name": 9039 if v != nil { 9040 var name string 9041 err = json.Unmarshal(*v, &name) 9042 if err != nil { 9043 return err 9044 } 9045 o.Name = &name 9046 } 9047 case "url": 9048 if v != nil { 9049 var URL string 9050 err = json.Unmarshal(*v, &URL) 9051 if err != nil { 9052 return err 9053 } 9054 o.URL = &URL 9055 } 9056 case "image": 9057 if v != nil { 9058 var imageVar ImageObject 9059 err = json.Unmarshal(*v, &imageVar) 9060 if err != nil { 9061 return err 9062 } 9063 o.Image = &imageVar 9064 } 9065 case "description": 9066 if v != nil { 9067 var description string 9068 err = json.Unmarshal(*v, &description) 9069 if err != nil { 9070 return err 9071 } 9072 o.Description = &description 9073 } 9074 case "entityPresentationInfo": 9075 if v != nil { 9076 var entityPresentationInfo EntitiesEntityPresentationInfo 9077 err = json.Unmarshal(*v, &entityPresentationInfo) 9078 if err != nil { 9079 return err 9080 } 9081 o.EntityPresentationInfo = &entityPresentationInfo 9082 } 9083 case "bingId": 9084 if v != nil { 9085 var bingID string 9086 err = json.Unmarshal(*v, &bingID) 9087 if err != nil { 9088 return err 9089 } 9090 o.BingID = &bingID 9091 } 9092 case "contractualRules": 9093 if v != nil { 9094 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 9095 if err != nil { 9096 return err 9097 } 9098 o.ContractualRules = &contractualRules 9099 } 9100 case "webSearchUrl": 9101 if v != nil { 9102 var webSearchURL string 9103 err = json.Unmarshal(*v, &webSearchURL) 9104 if err != nil { 9105 return err 9106 } 9107 o.WebSearchURL = &webSearchURL 9108 } 9109 case "id": 9110 if v != nil { 9111 var ID string 9112 err = json.Unmarshal(*v, &ID) 9113 if err != nil { 9114 return err 9115 } 9116 o.ID = &ID 9117 } 9118 case "_type": 9119 if v != nil { 9120 var typeVar TypeBasicResponseBase 9121 err = json.Unmarshal(*v, &typeVar) 9122 if err != nil { 9123 return err 9124 } 9125 o.Type = typeVar 9126 } 9127 } 9128 } 9129 9130 return nil 9131} 9132 9133// BasicPlace defines information about a local entity, such as a restaurant or hotel. 9134type BasicPlace interface { 9135 AsMovieTheater() (*MovieTheater, bool) 9136 AsCivicStructure() (*CivicStructure, bool) 9137 AsBasicCivicStructure() (BasicCivicStructure, bool) 9138 AsLocalBusiness() (*LocalBusiness, bool) 9139 AsBasicLocalBusiness() (BasicLocalBusiness, bool) 9140 AsTouristAttraction() (*TouristAttraction, bool) 9141 AsAirport() (*Airport, bool) 9142 AsEntertainmentBusiness() (*EntertainmentBusiness, bool) 9143 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) 9144 AsFoodEstablishment() (*FoodEstablishment, bool) 9145 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) 9146 AsLodgingBusiness() (*LodgingBusiness, bool) 9147 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) 9148 AsRestaurant() (*Restaurant, bool) 9149 AsHotel() (*Hotel, bool) 9150 AsPlace() (*Place, bool) 9151} 9152 9153// Place defines information about a local entity, such as a restaurant or hotel. 9154type Place struct { 9155 // Address - The postal address of where the entity is located 9156 Address *PostalAddress `json:"address,omitempty"` 9157 // Telephone - The entity's telephone number 9158 Telephone *string `json:"telephone,omitempty"` 9159 // Name - The name of the thing represented by this object. 9160 Name *string `json:"name,omitempty"` 9161 // URL - The URL to get more information about the thing represented by this object. 9162 URL *string `json:"url,omitempty"` 9163 Image *ImageObject `json:"image,omitempty"` 9164 // Description - A short description of the item. 9165 Description *string `json:"description,omitempty"` 9166 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 9167 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 9168 // BingID - An ID that uniquely identifies this item. 9169 BingID *string `json:"bingId,omitempty"` 9170 // ContractualRules - A list of rules that you must adhere to if you display the item. 9171 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 9172 // WebSearchURL - The URL To Bing's search result for this item. 9173 WebSearchURL *string `json:"webSearchUrl,omitempty"` 9174 // ID - A String identifier. 9175 ID *string `json:"id,omitempty"` 9176 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 9177 Type TypeBasicResponseBase `json:"_type,omitempty"` 9178} 9179 9180func unmarshalBasicPlace(body []byte) (BasicPlace, error) { 9181 var m map[string]interface{} 9182 err := json.Unmarshal(body, &m) 9183 if err != nil { 9184 return nil, err 9185 } 9186 9187 switch m["_type"] { 9188 case string(TypeMovieTheater): 9189 var mt MovieTheater 9190 err := json.Unmarshal(body, &mt) 9191 return mt, err 9192 case string(TypeCivicStructure): 9193 var cs CivicStructure 9194 err := json.Unmarshal(body, &cs) 9195 return cs, err 9196 case string(TypeLocalBusiness): 9197 var lb LocalBusiness 9198 err := json.Unmarshal(body, &lb) 9199 return lb, err 9200 case string(TypeTouristAttraction): 9201 var ta TouristAttraction 9202 err := json.Unmarshal(body, &ta) 9203 return ta, err 9204 case string(TypeAirport): 9205 var a Airport 9206 err := json.Unmarshal(body, &a) 9207 return a, err 9208 case string(TypeEntertainmentBusiness): 9209 var eb EntertainmentBusiness 9210 err := json.Unmarshal(body, &eb) 9211 return eb, err 9212 case string(TypeFoodEstablishment): 9213 var fe FoodEstablishment 9214 err := json.Unmarshal(body, &fe) 9215 return fe, err 9216 case string(TypeLodgingBusiness): 9217 var lb LodgingBusiness 9218 err := json.Unmarshal(body, &lb) 9219 return lb, err 9220 case string(TypeRestaurant): 9221 var r Restaurant 9222 err := json.Unmarshal(body, &r) 9223 return r, err 9224 case string(TypeHotel): 9225 var h Hotel 9226 err := json.Unmarshal(body, &h) 9227 return h, err 9228 default: 9229 var p Place 9230 err := json.Unmarshal(body, &p) 9231 return p, err 9232 } 9233} 9234func unmarshalBasicPlaceArray(body []byte) ([]BasicPlace, error) { 9235 var rawMessages []*json.RawMessage 9236 err := json.Unmarshal(body, &rawMessages) 9237 if err != nil { 9238 return nil, err 9239 } 9240 9241 pArray := make([]BasicPlace, len(rawMessages)) 9242 9243 for index, rawMessage := range rawMessages { 9244 p, err := unmarshalBasicPlace(*rawMessage) 9245 if err != nil { 9246 return nil, err 9247 } 9248 pArray[index] = p 9249 } 9250 return pArray, nil 9251} 9252 9253// MarshalJSON is the custom marshaler for Place. 9254func (p Place) MarshalJSON() ([]byte, error) { 9255 p.Type = TypePlace 9256 objectMap := make(map[string]interface{}) 9257 if p.Address != nil { 9258 objectMap["address"] = p.Address 9259 } 9260 if p.Telephone != nil { 9261 objectMap["telephone"] = p.Telephone 9262 } 9263 if p.Name != nil { 9264 objectMap["name"] = p.Name 9265 } 9266 if p.URL != nil { 9267 objectMap["url"] = p.URL 9268 } 9269 if p.Image != nil { 9270 objectMap["image"] = p.Image 9271 } 9272 if p.Description != nil { 9273 objectMap["description"] = p.Description 9274 } 9275 if p.EntityPresentationInfo != nil { 9276 objectMap["entityPresentationInfo"] = p.EntityPresentationInfo 9277 } 9278 if p.BingID != nil { 9279 objectMap["bingId"] = p.BingID 9280 } 9281 if p.ContractualRules != nil { 9282 objectMap["contractualRules"] = p.ContractualRules 9283 } 9284 if p.WebSearchURL != nil { 9285 objectMap["webSearchUrl"] = p.WebSearchURL 9286 } 9287 if p.ID != nil { 9288 objectMap["id"] = p.ID 9289 } 9290 if p.Type != "" { 9291 objectMap["_type"] = p.Type 9292 } 9293 return json.Marshal(objectMap) 9294} 9295 9296// AsImageObject is the BasicResponseBase implementation for Place. 9297func (p Place) AsImageObject() (*ImageObject, bool) { 9298 return nil, false 9299} 9300 9301// AsThing is the BasicResponseBase implementation for Place. 9302func (p Place) AsThing() (*Thing, bool) { 9303 return nil, false 9304} 9305 9306// AsBasicThing is the BasicResponseBase implementation for Place. 9307func (p Place) AsBasicThing() (BasicThing, bool) { 9308 return &p, true 9309} 9310 9311// AsEntities is the BasicResponseBase implementation for Place. 9312func (p Place) AsEntities() (*Entities, bool) { 9313 return nil, false 9314} 9315 9316// AsPlaces is the BasicResponseBase implementation for Place. 9317func (p Place) AsPlaces() (*Places, bool) { 9318 return nil, false 9319} 9320 9321// AsSearchResponse is the BasicResponseBase implementation for Place. 9322func (p Place) AsSearchResponse() (*SearchResponse, bool) { 9323 return nil, false 9324} 9325 9326// AsResponse is the BasicResponseBase implementation for Place. 9327func (p Place) AsResponse() (*Response, bool) { 9328 return nil, false 9329} 9330 9331// AsBasicResponse is the BasicResponseBase implementation for Place. 9332func (p Place) AsBasicResponse() (BasicResponse, bool) { 9333 return &p, true 9334} 9335 9336// AsSearchResultsAnswer is the BasicResponseBase implementation for Place. 9337func (p Place) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 9338 return nil, false 9339} 9340 9341// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Place. 9342func (p Place) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 9343 return nil, false 9344} 9345 9346// AsIdentifiable is the BasicResponseBase implementation for Place. 9347func (p Place) AsIdentifiable() (*Identifiable, bool) { 9348 return nil, false 9349} 9350 9351// AsBasicIdentifiable is the BasicResponseBase implementation for Place. 9352func (p Place) AsBasicIdentifiable() (BasicIdentifiable, bool) { 9353 return &p, true 9354} 9355 9356// AsAnswer is the BasicResponseBase implementation for Place. 9357func (p Place) AsAnswer() (*Answer, bool) { 9358 return nil, false 9359} 9360 9361// AsBasicAnswer is the BasicResponseBase implementation for Place. 9362func (p Place) AsBasicAnswer() (BasicAnswer, bool) { 9363 return nil, false 9364} 9365 9366// AsErrorResponse is the BasicResponseBase implementation for Place. 9367func (p Place) AsErrorResponse() (*ErrorResponse, bool) { 9368 return nil, false 9369} 9370 9371// AsPostalAddress is the BasicResponseBase implementation for Place. 9372func (p Place) AsPostalAddress() (*PostalAddress, bool) { 9373 return nil, false 9374} 9375 9376// AsPlace is the BasicResponseBase implementation for Place. 9377func (p Place) AsPlace() (*Place, bool) { 9378 return &p, true 9379} 9380 9381// AsBasicPlace is the BasicResponseBase implementation for Place. 9382func (p Place) AsBasicPlace() (BasicPlace, bool) { 9383 return &p, true 9384} 9385 9386// AsOrganization is the BasicResponseBase implementation for Place. 9387func (p Place) AsOrganization() (*Organization, bool) { 9388 return nil, false 9389} 9390 9391// AsCreativeWork is the BasicResponseBase implementation for Place. 9392func (p Place) AsCreativeWork() (*CreativeWork, bool) { 9393 return nil, false 9394} 9395 9396// AsBasicCreativeWork is the BasicResponseBase implementation for Place. 9397func (p Place) AsBasicCreativeWork() (BasicCreativeWork, bool) { 9398 return nil, false 9399} 9400 9401// AsIntangible is the BasicResponseBase implementation for Place. 9402func (p Place) AsIntangible() (*Intangible, bool) { 9403 return nil, false 9404} 9405 9406// AsBasicIntangible is the BasicResponseBase implementation for Place. 9407func (p Place) AsBasicIntangible() (BasicIntangible, bool) { 9408 return nil, false 9409} 9410 9411// AsMovieTheater is the BasicResponseBase implementation for Place. 9412func (p Place) AsMovieTheater() (*MovieTheater, bool) { 9413 return nil, false 9414} 9415 9416// AsMediaObject is the BasicResponseBase implementation for Place. 9417func (p Place) AsMediaObject() (*MediaObject, bool) { 9418 return nil, false 9419} 9420 9421// AsBasicMediaObject is the BasicResponseBase implementation for Place. 9422func (p Place) AsBasicMediaObject() (BasicMediaObject, bool) { 9423 return nil, false 9424} 9425 9426// AsCivicStructure is the BasicResponseBase implementation for Place. 9427func (p Place) AsCivicStructure() (*CivicStructure, bool) { 9428 return nil, false 9429} 9430 9431// AsBasicCivicStructure is the BasicResponseBase implementation for Place. 9432func (p Place) AsBasicCivicStructure() (BasicCivicStructure, bool) { 9433 return nil, false 9434} 9435 9436// AsLocalBusiness is the BasicResponseBase implementation for Place. 9437func (p Place) AsLocalBusiness() (*LocalBusiness, bool) { 9438 return nil, false 9439} 9440 9441// AsBasicLocalBusiness is the BasicResponseBase implementation for Place. 9442func (p Place) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 9443 return nil, false 9444} 9445 9446// AsTouristAttraction is the BasicResponseBase implementation for Place. 9447func (p Place) AsTouristAttraction() (*TouristAttraction, bool) { 9448 return nil, false 9449} 9450 9451// AsAirport is the BasicResponseBase implementation for Place. 9452func (p Place) AsAirport() (*Airport, bool) { 9453 return nil, false 9454} 9455 9456// AsLicense is the BasicResponseBase implementation for Place. 9457func (p Place) AsLicense() (*License, bool) { 9458 return nil, false 9459} 9460 9461// AsStructuredValue is the BasicResponseBase implementation for Place. 9462func (p Place) AsStructuredValue() (*StructuredValue, bool) { 9463 return nil, false 9464} 9465 9466// AsBasicStructuredValue is the BasicResponseBase implementation for Place. 9467func (p Place) AsBasicStructuredValue() (BasicStructuredValue, bool) { 9468 return nil, false 9469} 9470 9471// AsEntertainmentBusiness is the BasicResponseBase implementation for Place. 9472func (p Place) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 9473 return nil, false 9474} 9475 9476// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Place. 9477func (p Place) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 9478 return nil, false 9479} 9480 9481// AsFoodEstablishment is the BasicResponseBase implementation for Place. 9482func (p Place) AsFoodEstablishment() (*FoodEstablishment, bool) { 9483 return nil, false 9484} 9485 9486// AsBasicFoodEstablishment is the BasicResponseBase implementation for Place. 9487func (p Place) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 9488 return nil, false 9489} 9490 9491// AsLodgingBusiness is the BasicResponseBase implementation for Place. 9492func (p Place) AsLodgingBusiness() (*LodgingBusiness, bool) { 9493 return nil, false 9494} 9495 9496// AsBasicLodgingBusiness is the BasicResponseBase implementation for Place. 9497func (p Place) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 9498 return nil, false 9499} 9500 9501// AsRestaurant is the BasicResponseBase implementation for Place. 9502func (p Place) AsRestaurant() (*Restaurant, bool) { 9503 return nil, false 9504} 9505 9506// AsHotel is the BasicResponseBase implementation for Place. 9507func (p Place) AsHotel() (*Hotel, bool) { 9508 return nil, false 9509} 9510 9511// AsResponseBase is the BasicResponseBase implementation for Place. 9512func (p Place) AsResponseBase() (*ResponseBase, bool) { 9513 return nil, false 9514} 9515 9516// AsBasicResponseBase is the BasicResponseBase implementation for Place. 9517func (p Place) AsBasicResponseBase() (BasicResponseBase, bool) { 9518 return &p, true 9519} 9520 9521// UnmarshalJSON is the custom unmarshaler for Place struct. 9522func (p *Place) UnmarshalJSON(body []byte) error { 9523 var m map[string]*json.RawMessage 9524 err := json.Unmarshal(body, &m) 9525 if err != nil { 9526 return err 9527 } 9528 for k, v := range m { 9529 switch k { 9530 case "address": 9531 if v != nil { 9532 var address PostalAddress 9533 err = json.Unmarshal(*v, &address) 9534 if err != nil { 9535 return err 9536 } 9537 p.Address = &address 9538 } 9539 case "telephone": 9540 if v != nil { 9541 var telephone string 9542 err = json.Unmarshal(*v, &telephone) 9543 if err != nil { 9544 return err 9545 } 9546 p.Telephone = &telephone 9547 } 9548 case "name": 9549 if v != nil { 9550 var name string 9551 err = json.Unmarshal(*v, &name) 9552 if err != nil { 9553 return err 9554 } 9555 p.Name = &name 9556 } 9557 case "url": 9558 if v != nil { 9559 var URL string 9560 err = json.Unmarshal(*v, &URL) 9561 if err != nil { 9562 return err 9563 } 9564 p.URL = &URL 9565 } 9566 case "image": 9567 if v != nil { 9568 var imageVar ImageObject 9569 err = json.Unmarshal(*v, &imageVar) 9570 if err != nil { 9571 return err 9572 } 9573 p.Image = &imageVar 9574 } 9575 case "description": 9576 if v != nil { 9577 var description string 9578 err = json.Unmarshal(*v, &description) 9579 if err != nil { 9580 return err 9581 } 9582 p.Description = &description 9583 } 9584 case "entityPresentationInfo": 9585 if v != nil { 9586 var entityPresentationInfo EntitiesEntityPresentationInfo 9587 err = json.Unmarshal(*v, &entityPresentationInfo) 9588 if err != nil { 9589 return err 9590 } 9591 p.EntityPresentationInfo = &entityPresentationInfo 9592 } 9593 case "bingId": 9594 if v != nil { 9595 var bingID string 9596 err = json.Unmarshal(*v, &bingID) 9597 if err != nil { 9598 return err 9599 } 9600 p.BingID = &bingID 9601 } 9602 case "contractualRules": 9603 if v != nil { 9604 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 9605 if err != nil { 9606 return err 9607 } 9608 p.ContractualRules = &contractualRules 9609 } 9610 case "webSearchUrl": 9611 if v != nil { 9612 var webSearchURL string 9613 err = json.Unmarshal(*v, &webSearchURL) 9614 if err != nil { 9615 return err 9616 } 9617 p.WebSearchURL = &webSearchURL 9618 } 9619 case "id": 9620 if v != nil { 9621 var ID string 9622 err = json.Unmarshal(*v, &ID) 9623 if err != nil { 9624 return err 9625 } 9626 p.ID = &ID 9627 } 9628 case "_type": 9629 if v != nil { 9630 var typeVar TypeBasicResponseBase 9631 err = json.Unmarshal(*v, &typeVar) 9632 if err != nil { 9633 return err 9634 } 9635 p.Type = typeVar 9636 } 9637 } 9638 } 9639 9640 return nil 9641} 9642 9643// Places defines a local entity answer. 9644type Places struct { 9645 // Value - A list of local entities, such as restaurants or hotels. 9646 Value *[]BasicThing `json:"value,omitempty"` 9647 QueryContext *QueryContext `json:"queryContext,omitempty"` 9648 // ContractualRules - A list of rules that you must adhere to if you display the item. 9649 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 9650 // WebSearchURL - The URL To Bing's search result for this item. 9651 WebSearchURL *string `json:"webSearchUrl,omitempty"` 9652 // ID - A String identifier. 9653 ID *string `json:"id,omitempty"` 9654 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 9655 Type TypeBasicResponseBase `json:"_type,omitempty"` 9656} 9657 9658// MarshalJSON is the custom marshaler for Places. 9659func (p Places) MarshalJSON() ([]byte, error) { 9660 p.Type = TypePlaces 9661 objectMap := make(map[string]interface{}) 9662 if p.Value != nil { 9663 objectMap["value"] = p.Value 9664 } 9665 if p.QueryContext != nil { 9666 objectMap["queryContext"] = p.QueryContext 9667 } 9668 if p.ContractualRules != nil { 9669 objectMap["contractualRules"] = p.ContractualRules 9670 } 9671 if p.WebSearchURL != nil { 9672 objectMap["webSearchUrl"] = p.WebSearchURL 9673 } 9674 if p.ID != nil { 9675 objectMap["id"] = p.ID 9676 } 9677 if p.Type != "" { 9678 objectMap["_type"] = p.Type 9679 } 9680 return json.Marshal(objectMap) 9681} 9682 9683// AsImageObject is the BasicResponseBase implementation for Places. 9684func (p Places) AsImageObject() (*ImageObject, bool) { 9685 return nil, false 9686} 9687 9688// AsThing is the BasicResponseBase implementation for Places. 9689func (p Places) AsThing() (*Thing, bool) { 9690 return nil, false 9691} 9692 9693// AsBasicThing is the BasicResponseBase implementation for Places. 9694func (p Places) AsBasicThing() (BasicThing, bool) { 9695 return nil, false 9696} 9697 9698// AsEntities is the BasicResponseBase implementation for Places. 9699func (p Places) AsEntities() (*Entities, bool) { 9700 return nil, false 9701} 9702 9703// AsPlaces is the BasicResponseBase implementation for Places. 9704func (p Places) AsPlaces() (*Places, bool) { 9705 return &p, true 9706} 9707 9708// AsSearchResponse is the BasicResponseBase implementation for Places. 9709func (p Places) AsSearchResponse() (*SearchResponse, bool) { 9710 return nil, false 9711} 9712 9713// AsResponse is the BasicResponseBase implementation for Places. 9714func (p Places) AsResponse() (*Response, bool) { 9715 return nil, false 9716} 9717 9718// AsBasicResponse is the BasicResponseBase implementation for Places. 9719func (p Places) AsBasicResponse() (BasicResponse, bool) { 9720 return &p, true 9721} 9722 9723// AsSearchResultsAnswer is the BasicResponseBase implementation for Places. 9724func (p Places) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 9725 return nil, false 9726} 9727 9728// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Places. 9729func (p Places) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 9730 return &p, true 9731} 9732 9733// AsIdentifiable is the BasicResponseBase implementation for Places. 9734func (p Places) AsIdentifiable() (*Identifiable, bool) { 9735 return nil, false 9736} 9737 9738// AsBasicIdentifiable is the BasicResponseBase implementation for Places. 9739func (p Places) AsBasicIdentifiable() (BasicIdentifiable, bool) { 9740 return &p, true 9741} 9742 9743// AsAnswer is the BasicResponseBase implementation for Places. 9744func (p Places) AsAnswer() (*Answer, bool) { 9745 return nil, false 9746} 9747 9748// AsBasicAnswer is the BasicResponseBase implementation for Places. 9749func (p Places) AsBasicAnswer() (BasicAnswer, bool) { 9750 return &p, true 9751} 9752 9753// AsErrorResponse is the BasicResponseBase implementation for Places. 9754func (p Places) AsErrorResponse() (*ErrorResponse, bool) { 9755 return nil, false 9756} 9757 9758// AsPostalAddress is the BasicResponseBase implementation for Places. 9759func (p Places) AsPostalAddress() (*PostalAddress, bool) { 9760 return nil, false 9761} 9762 9763// AsPlace is the BasicResponseBase implementation for Places. 9764func (p Places) AsPlace() (*Place, bool) { 9765 return nil, false 9766} 9767 9768// AsBasicPlace is the BasicResponseBase implementation for Places. 9769func (p Places) AsBasicPlace() (BasicPlace, bool) { 9770 return nil, false 9771} 9772 9773// AsOrganization is the BasicResponseBase implementation for Places. 9774func (p Places) AsOrganization() (*Organization, bool) { 9775 return nil, false 9776} 9777 9778// AsCreativeWork is the BasicResponseBase implementation for Places. 9779func (p Places) AsCreativeWork() (*CreativeWork, bool) { 9780 return nil, false 9781} 9782 9783// AsBasicCreativeWork is the BasicResponseBase implementation for Places. 9784func (p Places) AsBasicCreativeWork() (BasicCreativeWork, bool) { 9785 return nil, false 9786} 9787 9788// AsIntangible is the BasicResponseBase implementation for Places. 9789func (p Places) AsIntangible() (*Intangible, bool) { 9790 return nil, false 9791} 9792 9793// AsBasicIntangible is the BasicResponseBase implementation for Places. 9794func (p Places) AsBasicIntangible() (BasicIntangible, bool) { 9795 return nil, false 9796} 9797 9798// AsMovieTheater is the BasicResponseBase implementation for Places. 9799func (p Places) AsMovieTheater() (*MovieTheater, bool) { 9800 return nil, false 9801} 9802 9803// AsMediaObject is the BasicResponseBase implementation for Places. 9804func (p Places) AsMediaObject() (*MediaObject, bool) { 9805 return nil, false 9806} 9807 9808// AsBasicMediaObject is the BasicResponseBase implementation for Places. 9809func (p Places) AsBasicMediaObject() (BasicMediaObject, bool) { 9810 return nil, false 9811} 9812 9813// AsCivicStructure is the BasicResponseBase implementation for Places. 9814func (p Places) AsCivicStructure() (*CivicStructure, bool) { 9815 return nil, false 9816} 9817 9818// AsBasicCivicStructure is the BasicResponseBase implementation for Places. 9819func (p Places) AsBasicCivicStructure() (BasicCivicStructure, bool) { 9820 return nil, false 9821} 9822 9823// AsLocalBusiness is the BasicResponseBase implementation for Places. 9824func (p Places) AsLocalBusiness() (*LocalBusiness, bool) { 9825 return nil, false 9826} 9827 9828// AsBasicLocalBusiness is the BasicResponseBase implementation for Places. 9829func (p Places) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 9830 return nil, false 9831} 9832 9833// AsTouristAttraction is the BasicResponseBase implementation for Places. 9834func (p Places) AsTouristAttraction() (*TouristAttraction, bool) { 9835 return nil, false 9836} 9837 9838// AsAirport is the BasicResponseBase implementation for Places. 9839func (p Places) AsAirport() (*Airport, bool) { 9840 return nil, false 9841} 9842 9843// AsLicense is the BasicResponseBase implementation for Places. 9844func (p Places) AsLicense() (*License, bool) { 9845 return nil, false 9846} 9847 9848// AsStructuredValue is the BasicResponseBase implementation for Places. 9849func (p Places) AsStructuredValue() (*StructuredValue, bool) { 9850 return nil, false 9851} 9852 9853// AsBasicStructuredValue is the BasicResponseBase implementation for Places. 9854func (p Places) AsBasicStructuredValue() (BasicStructuredValue, bool) { 9855 return nil, false 9856} 9857 9858// AsEntertainmentBusiness is the BasicResponseBase implementation for Places. 9859func (p Places) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 9860 return nil, false 9861} 9862 9863// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Places. 9864func (p Places) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 9865 return nil, false 9866} 9867 9868// AsFoodEstablishment is the BasicResponseBase implementation for Places. 9869func (p Places) AsFoodEstablishment() (*FoodEstablishment, bool) { 9870 return nil, false 9871} 9872 9873// AsBasicFoodEstablishment is the BasicResponseBase implementation for Places. 9874func (p Places) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 9875 return nil, false 9876} 9877 9878// AsLodgingBusiness is the BasicResponseBase implementation for Places. 9879func (p Places) AsLodgingBusiness() (*LodgingBusiness, bool) { 9880 return nil, false 9881} 9882 9883// AsBasicLodgingBusiness is the BasicResponseBase implementation for Places. 9884func (p Places) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 9885 return nil, false 9886} 9887 9888// AsRestaurant is the BasicResponseBase implementation for Places. 9889func (p Places) AsRestaurant() (*Restaurant, bool) { 9890 return nil, false 9891} 9892 9893// AsHotel is the BasicResponseBase implementation for Places. 9894func (p Places) AsHotel() (*Hotel, bool) { 9895 return nil, false 9896} 9897 9898// AsResponseBase is the BasicResponseBase implementation for Places. 9899func (p Places) AsResponseBase() (*ResponseBase, bool) { 9900 return nil, false 9901} 9902 9903// AsBasicResponseBase is the BasicResponseBase implementation for Places. 9904func (p Places) AsBasicResponseBase() (BasicResponseBase, bool) { 9905 return &p, true 9906} 9907 9908// UnmarshalJSON is the custom unmarshaler for Places struct. 9909func (p *Places) UnmarshalJSON(body []byte) error { 9910 var m map[string]*json.RawMessage 9911 err := json.Unmarshal(body, &m) 9912 if err != nil { 9913 return err 9914 } 9915 for k, v := range m { 9916 switch k { 9917 case "value": 9918 if v != nil { 9919 value, err := unmarshalBasicThingArray(*v) 9920 if err != nil { 9921 return err 9922 } 9923 p.Value = &value 9924 } 9925 case "queryContext": 9926 if v != nil { 9927 var queryContext QueryContext 9928 err = json.Unmarshal(*v, &queryContext) 9929 if err != nil { 9930 return err 9931 } 9932 p.QueryContext = &queryContext 9933 } 9934 case "contractualRules": 9935 if v != nil { 9936 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 9937 if err != nil { 9938 return err 9939 } 9940 p.ContractualRules = &contractualRules 9941 } 9942 case "webSearchUrl": 9943 if v != nil { 9944 var webSearchURL string 9945 err = json.Unmarshal(*v, &webSearchURL) 9946 if err != nil { 9947 return err 9948 } 9949 p.WebSearchURL = &webSearchURL 9950 } 9951 case "id": 9952 if v != nil { 9953 var ID string 9954 err = json.Unmarshal(*v, &ID) 9955 if err != nil { 9956 return err 9957 } 9958 p.ID = &ID 9959 } 9960 case "_type": 9961 if v != nil { 9962 var typeVar TypeBasicResponseBase 9963 err = json.Unmarshal(*v, &typeVar) 9964 if err != nil { 9965 return err 9966 } 9967 p.Type = typeVar 9968 } 9969 } 9970 } 9971 9972 return nil 9973} 9974 9975// PostalAddress defines a postal address. 9976type PostalAddress struct { 9977 StreetAddress *string `json:"streetAddress,omitempty"` 9978 // AddressLocality - The city where the street address is located. For example, Seattle. 9979 AddressLocality *string `json:"addressLocality,omitempty"` 9980 AddressSubregion *string `json:"addressSubregion,omitempty"` 9981 // AddressRegion - The state or province code where the street address is located. This could be the two-letter code. For example, WA, or the full name , Washington. 9982 AddressRegion *string `json:"addressRegion,omitempty"` 9983 // PostalCode - The zip code or postal code where the street address is located. For example, 98052. 9984 PostalCode *string `json:"postalCode,omitempty"` 9985 PostOfficeBoxNumber *string `json:"postOfficeBoxNumber,omitempty"` 9986 // AddressCountry - The country/region where the street address is located. This could be the two-letter ISO code. For example, US, or the full name, United States. 9987 AddressCountry *string `json:"addressCountry,omitempty"` 9988 // CountryIso - The two letter ISO code of this countr. For example, US. 9989 CountryIso *string `json:"countryIso,omitempty"` 9990 // Neighborhood - The neighborhood where the street address is located. For example, Westlake. 9991 Neighborhood *string `json:"neighborhood,omitempty"` 9992 // AddressRegionAbbreviation - Region Abbreviation. For example, WA. 9993 AddressRegionAbbreviation *string `json:"addressRegionAbbreviation,omitempty"` 9994 // Text - The complete address. For example, 2100 Westlake Ave N, Bellevue, WA 98052. 9995 Text *string `json:"text,omitempty"` 9996 // Name - The name of the thing represented by this object. 9997 Name *string `json:"name,omitempty"` 9998 // URL - The URL to get more information about the thing represented by this object. 9999 URL *string `json:"url,omitempty"` 10000 Image *ImageObject `json:"image,omitempty"` 10001 // Description - A short description of the item. 10002 Description *string `json:"description,omitempty"` 10003 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 10004 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 10005 // BingID - An ID that uniquely identifies this item. 10006 BingID *string `json:"bingId,omitempty"` 10007 // ContractualRules - A list of rules that you must adhere to if you display the item. 10008 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 10009 // WebSearchURL - The URL To Bing's search result for this item. 10010 WebSearchURL *string `json:"webSearchUrl,omitempty"` 10011 // ID - A String identifier. 10012 ID *string `json:"id,omitempty"` 10013 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 10014 Type TypeBasicResponseBase `json:"_type,omitempty"` 10015} 10016 10017// MarshalJSON is the custom marshaler for PostalAddress. 10018func (pa PostalAddress) MarshalJSON() ([]byte, error) { 10019 pa.Type = TypePostalAddress 10020 objectMap := make(map[string]interface{}) 10021 if pa.StreetAddress != nil { 10022 objectMap["streetAddress"] = pa.StreetAddress 10023 } 10024 if pa.AddressLocality != nil { 10025 objectMap["addressLocality"] = pa.AddressLocality 10026 } 10027 if pa.AddressSubregion != nil { 10028 objectMap["addressSubregion"] = pa.AddressSubregion 10029 } 10030 if pa.AddressRegion != nil { 10031 objectMap["addressRegion"] = pa.AddressRegion 10032 } 10033 if pa.PostalCode != nil { 10034 objectMap["postalCode"] = pa.PostalCode 10035 } 10036 if pa.PostOfficeBoxNumber != nil { 10037 objectMap["postOfficeBoxNumber"] = pa.PostOfficeBoxNumber 10038 } 10039 if pa.AddressCountry != nil { 10040 objectMap["addressCountry"] = pa.AddressCountry 10041 } 10042 if pa.CountryIso != nil { 10043 objectMap["countryIso"] = pa.CountryIso 10044 } 10045 if pa.Neighborhood != nil { 10046 objectMap["neighborhood"] = pa.Neighborhood 10047 } 10048 if pa.AddressRegionAbbreviation != nil { 10049 objectMap["addressRegionAbbreviation"] = pa.AddressRegionAbbreviation 10050 } 10051 if pa.Text != nil { 10052 objectMap["text"] = pa.Text 10053 } 10054 if pa.Name != nil { 10055 objectMap["name"] = pa.Name 10056 } 10057 if pa.URL != nil { 10058 objectMap["url"] = pa.URL 10059 } 10060 if pa.Image != nil { 10061 objectMap["image"] = pa.Image 10062 } 10063 if pa.Description != nil { 10064 objectMap["description"] = pa.Description 10065 } 10066 if pa.EntityPresentationInfo != nil { 10067 objectMap["entityPresentationInfo"] = pa.EntityPresentationInfo 10068 } 10069 if pa.BingID != nil { 10070 objectMap["bingId"] = pa.BingID 10071 } 10072 if pa.ContractualRules != nil { 10073 objectMap["contractualRules"] = pa.ContractualRules 10074 } 10075 if pa.WebSearchURL != nil { 10076 objectMap["webSearchUrl"] = pa.WebSearchURL 10077 } 10078 if pa.ID != nil { 10079 objectMap["id"] = pa.ID 10080 } 10081 if pa.Type != "" { 10082 objectMap["_type"] = pa.Type 10083 } 10084 return json.Marshal(objectMap) 10085} 10086 10087// AsImageObject is the BasicResponseBase implementation for PostalAddress. 10088func (pa PostalAddress) AsImageObject() (*ImageObject, bool) { 10089 return nil, false 10090} 10091 10092// AsThing is the BasicResponseBase implementation for PostalAddress. 10093func (pa PostalAddress) AsThing() (*Thing, bool) { 10094 return nil, false 10095} 10096 10097// AsBasicThing is the BasicResponseBase implementation for PostalAddress. 10098func (pa PostalAddress) AsBasicThing() (BasicThing, bool) { 10099 return &pa, true 10100} 10101 10102// AsEntities is the BasicResponseBase implementation for PostalAddress. 10103func (pa PostalAddress) AsEntities() (*Entities, bool) { 10104 return nil, false 10105} 10106 10107// AsPlaces is the BasicResponseBase implementation for PostalAddress. 10108func (pa PostalAddress) AsPlaces() (*Places, bool) { 10109 return nil, false 10110} 10111 10112// AsSearchResponse is the BasicResponseBase implementation for PostalAddress. 10113func (pa PostalAddress) AsSearchResponse() (*SearchResponse, bool) { 10114 return nil, false 10115} 10116 10117// AsResponse is the BasicResponseBase implementation for PostalAddress. 10118func (pa PostalAddress) AsResponse() (*Response, bool) { 10119 return nil, false 10120} 10121 10122// AsBasicResponse is the BasicResponseBase implementation for PostalAddress. 10123func (pa PostalAddress) AsBasicResponse() (BasicResponse, bool) { 10124 return &pa, true 10125} 10126 10127// AsSearchResultsAnswer is the BasicResponseBase implementation for PostalAddress. 10128func (pa PostalAddress) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 10129 return nil, false 10130} 10131 10132// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for PostalAddress. 10133func (pa PostalAddress) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 10134 return nil, false 10135} 10136 10137// AsIdentifiable is the BasicResponseBase implementation for PostalAddress. 10138func (pa PostalAddress) AsIdentifiable() (*Identifiable, bool) { 10139 return nil, false 10140} 10141 10142// AsBasicIdentifiable is the BasicResponseBase implementation for PostalAddress. 10143func (pa PostalAddress) AsBasicIdentifiable() (BasicIdentifiable, bool) { 10144 return &pa, true 10145} 10146 10147// AsAnswer is the BasicResponseBase implementation for PostalAddress. 10148func (pa PostalAddress) AsAnswer() (*Answer, bool) { 10149 return nil, false 10150} 10151 10152// AsBasicAnswer is the BasicResponseBase implementation for PostalAddress. 10153func (pa PostalAddress) AsBasicAnswer() (BasicAnswer, bool) { 10154 return nil, false 10155} 10156 10157// AsErrorResponse is the BasicResponseBase implementation for PostalAddress. 10158func (pa PostalAddress) AsErrorResponse() (*ErrorResponse, bool) { 10159 return nil, false 10160} 10161 10162// AsPostalAddress is the BasicResponseBase implementation for PostalAddress. 10163func (pa PostalAddress) AsPostalAddress() (*PostalAddress, bool) { 10164 return &pa, true 10165} 10166 10167// AsPlace is the BasicResponseBase implementation for PostalAddress. 10168func (pa PostalAddress) AsPlace() (*Place, bool) { 10169 return nil, false 10170} 10171 10172// AsBasicPlace is the BasicResponseBase implementation for PostalAddress. 10173func (pa PostalAddress) AsBasicPlace() (BasicPlace, bool) { 10174 return nil, false 10175} 10176 10177// AsOrganization is the BasicResponseBase implementation for PostalAddress. 10178func (pa PostalAddress) AsOrganization() (*Organization, bool) { 10179 return nil, false 10180} 10181 10182// AsCreativeWork is the BasicResponseBase implementation for PostalAddress. 10183func (pa PostalAddress) AsCreativeWork() (*CreativeWork, bool) { 10184 return nil, false 10185} 10186 10187// AsBasicCreativeWork is the BasicResponseBase implementation for PostalAddress. 10188func (pa PostalAddress) AsBasicCreativeWork() (BasicCreativeWork, bool) { 10189 return nil, false 10190} 10191 10192// AsIntangible is the BasicResponseBase implementation for PostalAddress. 10193func (pa PostalAddress) AsIntangible() (*Intangible, bool) { 10194 return nil, false 10195} 10196 10197// AsBasicIntangible is the BasicResponseBase implementation for PostalAddress. 10198func (pa PostalAddress) AsBasicIntangible() (BasicIntangible, bool) { 10199 return &pa, true 10200} 10201 10202// AsMovieTheater is the BasicResponseBase implementation for PostalAddress. 10203func (pa PostalAddress) AsMovieTheater() (*MovieTheater, bool) { 10204 return nil, false 10205} 10206 10207// AsMediaObject is the BasicResponseBase implementation for PostalAddress. 10208func (pa PostalAddress) AsMediaObject() (*MediaObject, bool) { 10209 return nil, false 10210} 10211 10212// AsBasicMediaObject is the BasicResponseBase implementation for PostalAddress. 10213func (pa PostalAddress) AsBasicMediaObject() (BasicMediaObject, bool) { 10214 return nil, false 10215} 10216 10217// AsCivicStructure is the BasicResponseBase implementation for PostalAddress. 10218func (pa PostalAddress) AsCivicStructure() (*CivicStructure, bool) { 10219 return nil, false 10220} 10221 10222// AsBasicCivicStructure is the BasicResponseBase implementation for PostalAddress. 10223func (pa PostalAddress) AsBasicCivicStructure() (BasicCivicStructure, bool) { 10224 return nil, false 10225} 10226 10227// AsLocalBusiness is the BasicResponseBase implementation for PostalAddress. 10228func (pa PostalAddress) AsLocalBusiness() (*LocalBusiness, bool) { 10229 return nil, false 10230} 10231 10232// AsBasicLocalBusiness is the BasicResponseBase implementation for PostalAddress. 10233func (pa PostalAddress) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 10234 return nil, false 10235} 10236 10237// AsTouristAttraction is the BasicResponseBase implementation for PostalAddress. 10238func (pa PostalAddress) AsTouristAttraction() (*TouristAttraction, bool) { 10239 return nil, false 10240} 10241 10242// AsAirport is the BasicResponseBase implementation for PostalAddress. 10243func (pa PostalAddress) AsAirport() (*Airport, bool) { 10244 return nil, false 10245} 10246 10247// AsLicense is the BasicResponseBase implementation for PostalAddress. 10248func (pa PostalAddress) AsLicense() (*License, bool) { 10249 return nil, false 10250} 10251 10252// AsStructuredValue is the BasicResponseBase implementation for PostalAddress. 10253func (pa PostalAddress) AsStructuredValue() (*StructuredValue, bool) { 10254 return nil, false 10255} 10256 10257// AsBasicStructuredValue is the BasicResponseBase implementation for PostalAddress. 10258func (pa PostalAddress) AsBasicStructuredValue() (BasicStructuredValue, bool) { 10259 return &pa, true 10260} 10261 10262// AsEntertainmentBusiness is the BasicResponseBase implementation for PostalAddress. 10263func (pa PostalAddress) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 10264 return nil, false 10265} 10266 10267// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for PostalAddress. 10268func (pa PostalAddress) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 10269 return nil, false 10270} 10271 10272// AsFoodEstablishment is the BasicResponseBase implementation for PostalAddress. 10273func (pa PostalAddress) AsFoodEstablishment() (*FoodEstablishment, bool) { 10274 return nil, false 10275} 10276 10277// AsBasicFoodEstablishment is the BasicResponseBase implementation for PostalAddress. 10278func (pa PostalAddress) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 10279 return nil, false 10280} 10281 10282// AsLodgingBusiness is the BasicResponseBase implementation for PostalAddress. 10283func (pa PostalAddress) AsLodgingBusiness() (*LodgingBusiness, bool) { 10284 return nil, false 10285} 10286 10287// AsBasicLodgingBusiness is the BasicResponseBase implementation for PostalAddress. 10288func (pa PostalAddress) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 10289 return nil, false 10290} 10291 10292// AsRestaurant is the BasicResponseBase implementation for PostalAddress. 10293func (pa PostalAddress) AsRestaurant() (*Restaurant, bool) { 10294 return nil, false 10295} 10296 10297// AsHotel is the BasicResponseBase implementation for PostalAddress. 10298func (pa PostalAddress) AsHotel() (*Hotel, bool) { 10299 return nil, false 10300} 10301 10302// AsResponseBase is the BasicResponseBase implementation for PostalAddress. 10303func (pa PostalAddress) AsResponseBase() (*ResponseBase, bool) { 10304 return nil, false 10305} 10306 10307// AsBasicResponseBase is the BasicResponseBase implementation for PostalAddress. 10308func (pa PostalAddress) AsBasicResponseBase() (BasicResponseBase, bool) { 10309 return &pa, true 10310} 10311 10312// UnmarshalJSON is the custom unmarshaler for PostalAddress struct. 10313func (pa *PostalAddress) UnmarshalJSON(body []byte) error { 10314 var m map[string]*json.RawMessage 10315 err := json.Unmarshal(body, &m) 10316 if err != nil { 10317 return err 10318 } 10319 for k, v := range m { 10320 switch k { 10321 case "streetAddress": 10322 if v != nil { 10323 var streetAddress string 10324 err = json.Unmarshal(*v, &streetAddress) 10325 if err != nil { 10326 return err 10327 } 10328 pa.StreetAddress = &streetAddress 10329 } 10330 case "addressLocality": 10331 if v != nil { 10332 var addressLocality string 10333 err = json.Unmarshal(*v, &addressLocality) 10334 if err != nil { 10335 return err 10336 } 10337 pa.AddressLocality = &addressLocality 10338 } 10339 case "addressSubregion": 10340 if v != nil { 10341 var addressSubregion string 10342 err = json.Unmarshal(*v, &addressSubregion) 10343 if err != nil { 10344 return err 10345 } 10346 pa.AddressSubregion = &addressSubregion 10347 } 10348 case "addressRegion": 10349 if v != nil { 10350 var addressRegion string 10351 err = json.Unmarshal(*v, &addressRegion) 10352 if err != nil { 10353 return err 10354 } 10355 pa.AddressRegion = &addressRegion 10356 } 10357 case "postalCode": 10358 if v != nil { 10359 var postalCode string 10360 err = json.Unmarshal(*v, &postalCode) 10361 if err != nil { 10362 return err 10363 } 10364 pa.PostalCode = &postalCode 10365 } 10366 case "postOfficeBoxNumber": 10367 if v != nil { 10368 var postOfficeBoxNumber string 10369 err = json.Unmarshal(*v, &postOfficeBoxNumber) 10370 if err != nil { 10371 return err 10372 } 10373 pa.PostOfficeBoxNumber = &postOfficeBoxNumber 10374 } 10375 case "addressCountry": 10376 if v != nil { 10377 var addressCountry string 10378 err = json.Unmarshal(*v, &addressCountry) 10379 if err != nil { 10380 return err 10381 } 10382 pa.AddressCountry = &addressCountry 10383 } 10384 case "countryIso": 10385 if v != nil { 10386 var countryIso string 10387 err = json.Unmarshal(*v, &countryIso) 10388 if err != nil { 10389 return err 10390 } 10391 pa.CountryIso = &countryIso 10392 } 10393 case "neighborhood": 10394 if v != nil { 10395 var neighborhood string 10396 err = json.Unmarshal(*v, &neighborhood) 10397 if err != nil { 10398 return err 10399 } 10400 pa.Neighborhood = &neighborhood 10401 } 10402 case "addressRegionAbbreviation": 10403 if v != nil { 10404 var addressRegionAbbreviation string 10405 err = json.Unmarshal(*v, &addressRegionAbbreviation) 10406 if err != nil { 10407 return err 10408 } 10409 pa.AddressRegionAbbreviation = &addressRegionAbbreviation 10410 } 10411 case "text": 10412 if v != nil { 10413 var textVar string 10414 err = json.Unmarshal(*v, &textVar) 10415 if err != nil { 10416 return err 10417 } 10418 pa.Text = &textVar 10419 } 10420 case "name": 10421 if v != nil { 10422 var name string 10423 err = json.Unmarshal(*v, &name) 10424 if err != nil { 10425 return err 10426 } 10427 pa.Name = &name 10428 } 10429 case "url": 10430 if v != nil { 10431 var URL string 10432 err = json.Unmarshal(*v, &URL) 10433 if err != nil { 10434 return err 10435 } 10436 pa.URL = &URL 10437 } 10438 case "image": 10439 if v != nil { 10440 var imageVar ImageObject 10441 err = json.Unmarshal(*v, &imageVar) 10442 if err != nil { 10443 return err 10444 } 10445 pa.Image = &imageVar 10446 } 10447 case "description": 10448 if v != nil { 10449 var description string 10450 err = json.Unmarshal(*v, &description) 10451 if err != nil { 10452 return err 10453 } 10454 pa.Description = &description 10455 } 10456 case "entityPresentationInfo": 10457 if v != nil { 10458 var entityPresentationInfo EntitiesEntityPresentationInfo 10459 err = json.Unmarshal(*v, &entityPresentationInfo) 10460 if err != nil { 10461 return err 10462 } 10463 pa.EntityPresentationInfo = &entityPresentationInfo 10464 } 10465 case "bingId": 10466 if v != nil { 10467 var bingID string 10468 err = json.Unmarshal(*v, &bingID) 10469 if err != nil { 10470 return err 10471 } 10472 pa.BingID = &bingID 10473 } 10474 case "contractualRules": 10475 if v != nil { 10476 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 10477 if err != nil { 10478 return err 10479 } 10480 pa.ContractualRules = &contractualRules 10481 } 10482 case "webSearchUrl": 10483 if v != nil { 10484 var webSearchURL string 10485 err = json.Unmarshal(*v, &webSearchURL) 10486 if err != nil { 10487 return err 10488 } 10489 pa.WebSearchURL = &webSearchURL 10490 } 10491 case "id": 10492 if v != nil { 10493 var ID string 10494 err = json.Unmarshal(*v, &ID) 10495 if err != nil { 10496 return err 10497 } 10498 pa.ID = &ID 10499 } 10500 case "_type": 10501 if v != nil { 10502 var typeVar TypeBasicResponseBase 10503 err = json.Unmarshal(*v, &typeVar) 10504 if err != nil { 10505 return err 10506 } 10507 pa.Type = typeVar 10508 } 10509 } 10510 } 10511 10512 return nil 10513} 10514 10515// QueryContext defines the query context that Bing used for the request. 10516type QueryContext struct { 10517 // OriginalQuery - The query string as specified in the request. 10518 OriginalQuery *string `json:"originalQuery,omitempty"` 10519 // AlteredQuery - The query string used by Bing to perform the query. Bing uses the altered query string if the original query string contained spelling mistakes. For example, if the query string is "saling downwind", the altered query string will be "sailing downwind". This field is included only if the original query string contains a spelling mistake. 10520 AlteredQuery *string `json:"alteredQuery,omitempty"` 10521 // AlterationOverrideQuery - The query string to use to force Bing to use the original string. For example, if the query string is "saling downwind", the override query string will be "+saling downwind". Remember to encode the query string which results in "%2Bsaling+downwind". This field is included only if the original query string contains a spelling mistake. 10522 AlterationOverrideQuery *string `json:"alterationOverrideQuery,omitempty"` 10523 // AdultIntent - A Boolean value that indicates whether the specified query has adult intent. The value is true if the query has adult intent; otherwise, false. 10524 AdultIntent *bool `json:"adultIntent,omitempty"` 10525 // AskUserForLocation - A Boolean value that indicates whether Bing requires the user's location to provide accurate results. If you specified the user's location by using the X-MSEdge-ClientIP and X-Search-Location headers, you can ignore this field. For location aware queries, such as "today's weather" or "restaurants near me" that need the user's location to provide accurate results, this field is set to true. For location aware queries that include the location (for example, "Seattle weather"), this field is set to false. This field is also set to false for queries that are not location aware, such as "best sellers". 10526 AskUserForLocation *bool `json:"askUserForLocation,omitempty"` 10527} 10528 10529// BasicResponse defines a response. All schemas that could be returned at the root of a response should inherit from 10530// this 10531type BasicResponse interface { 10532 AsImageObject() (*ImageObject, bool) 10533 AsThing() (*Thing, bool) 10534 AsBasicThing() (BasicThing, bool) 10535 AsEntities() (*Entities, bool) 10536 AsPlaces() (*Places, bool) 10537 AsSearchResponse() (*SearchResponse, bool) 10538 AsSearchResultsAnswer() (*SearchResultsAnswer, bool) 10539 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) 10540 AsAnswer() (*Answer, bool) 10541 AsBasicAnswer() (BasicAnswer, bool) 10542 AsErrorResponse() (*ErrorResponse, bool) 10543 AsPostalAddress() (*PostalAddress, bool) 10544 AsPlace() (*Place, bool) 10545 AsBasicPlace() (BasicPlace, bool) 10546 AsOrganization() (*Organization, bool) 10547 AsCreativeWork() (*CreativeWork, bool) 10548 AsBasicCreativeWork() (BasicCreativeWork, bool) 10549 AsIntangible() (*Intangible, bool) 10550 AsBasicIntangible() (BasicIntangible, bool) 10551 AsMovieTheater() (*MovieTheater, bool) 10552 AsMediaObject() (*MediaObject, bool) 10553 AsBasicMediaObject() (BasicMediaObject, bool) 10554 AsCivicStructure() (*CivicStructure, bool) 10555 AsBasicCivicStructure() (BasicCivicStructure, bool) 10556 AsLocalBusiness() (*LocalBusiness, bool) 10557 AsBasicLocalBusiness() (BasicLocalBusiness, bool) 10558 AsTouristAttraction() (*TouristAttraction, bool) 10559 AsAirport() (*Airport, bool) 10560 AsLicense() (*License, bool) 10561 AsStructuredValue() (*StructuredValue, bool) 10562 AsBasicStructuredValue() (BasicStructuredValue, bool) 10563 AsEntertainmentBusiness() (*EntertainmentBusiness, bool) 10564 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) 10565 AsFoodEstablishment() (*FoodEstablishment, bool) 10566 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) 10567 AsLodgingBusiness() (*LodgingBusiness, bool) 10568 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) 10569 AsRestaurant() (*Restaurant, bool) 10570 AsHotel() (*Hotel, bool) 10571 AsResponse() (*Response, bool) 10572} 10573 10574// Response defines a response. All schemas that could be returned at the root of a response should inherit from 10575// this 10576type Response struct { 10577 // ContractualRules - A list of rules that you must adhere to if you display the item. 10578 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 10579 // WebSearchURL - The URL To Bing's search result for this item. 10580 WebSearchURL *string `json:"webSearchUrl,omitempty"` 10581 // ID - A String identifier. 10582 ID *string `json:"id,omitempty"` 10583 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 10584 Type TypeBasicResponseBase `json:"_type,omitempty"` 10585} 10586 10587func unmarshalBasicResponse(body []byte) (BasicResponse, error) { 10588 var m map[string]interface{} 10589 err := json.Unmarshal(body, &m) 10590 if err != nil { 10591 return nil, err 10592 } 10593 10594 switch m["_type"] { 10595 case string(TypeImageObject): 10596 var ioVar ImageObject 10597 err := json.Unmarshal(body, &ioVar) 10598 return ioVar, err 10599 case string(TypeThing): 10600 var t Thing 10601 err := json.Unmarshal(body, &t) 10602 return t, err 10603 case string(TypeEntities): 10604 var e Entities 10605 err := json.Unmarshal(body, &e) 10606 return e, err 10607 case string(TypePlaces): 10608 var p Places 10609 err := json.Unmarshal(body, &p) 10610 return p, err 10611 case string(TypeSearchResponse): 10612 var sr SearchResponse 10613 err := json.Unmarshal(body, &sr) 10614 return sr, err 10615 case string(TypeSearchResultsAnswer): 10616 var sra SearchResultsAnswer 10617 err := json.Unmarshal(body, &sra) 10618 return sra, err 10619 case string(TypeAnswer): 10620 var a Answer 10621 err := json.Unmarshal(body, &a) 10622 return a, err 10623 case string(TypeErrorResponse): 10624 var er ErrorResponse 10625 err := json.Unmarshal(body, &er) 10626 return er, err 10627 case string(TypePostalAddress): 10628 var pa PostalAddress 10629 err := json.Unmarshal(body, &pa) 10630 return pa, err 10631 case string(TypePlace): 10632 var p Place 10633 err := json.Unmarshal(body, &p) 10634 return p, err 10635 case string(TypeOrganization): 10636 var o Organization 10637 err := json.Unmarshal(body, &o) 10638 return o, err 10639 case string(TypeCreativeWork): 10640 var cw CreativeWork 10641 err := json.Unmarshal(body, &cw) 10642 return cw, err 10643 case string(TypeIntangible): 10644 var i Intangible 10645 err := json.Unmarshal(body, &i) 10646 return i, err 10647 case string(TypeMovieTheater): 10648 var mt MovieTheater 10649 err := json.Unmarshal(body, &mt) 10650 return mt, err 10651 case string(TypeMediaObject): 10652 var mo MediaObject 10653 err := json.Unmarshal(body, &mo) 10654 return mo, err 10655 case string(TypeCivicStructure): 10656 var cs CivicStructure 10657 err := json.Unmarshal(body, &cs) 10658 return cs, err 10659 case string(TypeLocalBusiness): 10660 var lb LocalBusiness 10661 err := json.Unmarshal(body, &lb) 10662 return lb, err 10663 case string(TypeTouristAttraction): 10664 var ta TouristAttraction 10665 err := json.Unmarshal(body, &ta) 10666 return ta, err 10667 case string(TypeAirport): 10668 var a Airport 10669 err := json.Unmarshal(body, &a) 10670 return a, err 10671 case string(TypeLicense): 10672 var l License 10673 err := json.Unmarshal(body, &l) 10674 return l, err 10675 case string(TypeStructuredValue): 10676 var sv StructuredValue 10677 err := json.Unmarshal(body, &sv) 10678 return sv, err 10679 case string(TypeEntertainmentBusiness): 10680 var eb EntertainmentBusiness 10681 err := json.Unmarshal(body, &eb) 10682 return eb, err 10683 case string(TypeFoodEstablishment): 10684 var fe FoodEstablishment 10685 err := json.Unmarshal(body, &fe) 10686 return fe, err 10687 case string(TypeLodgingBusiness): 10688 var lb LodgingBusiness 10689 err := json.Unmarshal(body, &lb) 10690 return lb, err 10691 case string(TypeRestaurant): 10692 var r Restaurant 10693 err := json.Unmarshal(body, &r) 10694 return r, err 10695 case string(TypeHotel): 10696 var h Hotel 10697 err := json.Unmarshal(body, &h) 10698 return h, err 10699 default: 10700 var r Response 10701 err := json.Unmarshal(body, &r) 10702 return r, err 10703 } 10704} 10705func unmarshalBasicResponseArray(body []byte) ([]BasicResponse, error) { 10706 var rawMessages []*json.RawMessage 10707 err := json.Unmarshal(body, &rawMessages) 10708 if err != nil { 10709 return nil, err 10710 } 10711 10712 rArray := make([]BasicResponse, len(rawMessages)) 10713 10714 for index, rawMessage := range rawMessages { 10715 r, err := unmarshalBasicResponse(*rawMessage) 10716 if err != nil { 10717 return nil, err 10718 } 10719 rArray[index] = r 10720 } 10721 return rArray, nil 10722} 10723 10724// MarshalJSON is the custom marshaler for Response. 10725func (r Response) MarshalJSON() ([]byte, error) { 10726 r.Type = TypeResponse 10727 objectMap := make(map[string]interface{}) 10728 if r.ContractualRules != nil { 10729 objectMap["contractualRules"] = r.ContractualRules 10730 } 10731 if r.WebSearchURL != nil { 10732 objectMap["webSearchUrl"] = r.WebSearchURL 10733 } 10734 if r.ID != nil { 10735 objectMap["id"] = r.ID 10736 } 10737 if r.Type != "" { 10738 objectMap["_type"] = r.Type 10739 } 10740 return json.Marshal(objectMap) 10741} 10742 10743// AsImageObject is the BasicResponseBase implementation for Response. 10744func (r Response) AsImageObject() (*ImageObject, bool) { 10745 return nil, false 10746} 10747 10748// AsThing is the BasicResponseBase implementation for Response. 10749func (r Response) AsThing() (*Thing, bool) { 10750 return nil, false 10751} 10752 10753// AsBasicThing is the BasicResponseBase implementation for Response. 10754func (r Response) AsBasicThing() (BasicThing, bool) { 10755 return nil, false 10756} 10757 10758// AsEntities is the BasicResponseBase implementation for Response. 10759func (r Response) AsEntities() (*Entities, bool) { 10760 return nil, false 10761} 10762 10763// AsPlaces is the BasicResponseBase implementation for Response. 10764func (r Response) AsPlaces() (*Places, bool) { 10765 return nil, false 10766} 10767 10768// AsSearchResponse is the BasicResponseBase implementation for Response. 10769func (r Response) AsSearchResponse() (*SearchResponse, bool) { 10770 return nil, false 10771} 10772 10773// AsResponse is the BasicResponseBase implementation for Response. 10774func (r Response) AsResponse() (*Response, bool) { 10775 return &r, true 10776} 10777 10778// AsBasicResponse is the BasicResponseBase implementation for Response. 10779func (r Response) AsBasicResponse() (BasicResponse, bool) { 10780 return &r, true 10781} 10782 10783// AsSearchResultsAnswer is the BasicResponseBase implementation for Response. 10784func (r Response) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 10785 return nil, false 10786} 10787 10788// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Response. 10789func (r Response) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 10790 return nil, false 10791} 10792 10793// AsIdentifiable is the BasicResponseBase implementation for Response. 10794func (r Response) AsIdentifiable() (*Identifiable, bool) { 10795 return nil, false 10796} 10797 10798// AsBasicIdentifiable is the BasicResponseBase implementation for Response. 10799func (r Response) AsBasicIdentifiable() (BasicIdentifiable, bool) { 10800 return &r, true 10801} 10802 10803// AsAnswer is the BasicResponseBase implementation for Response. 10804func (r Response) AsAnswer() (*Answer, bool) { 10805 return nil, false 10806} 10807 10808// AsBasicAnswer is the BasicResponseBase implementation for Response. 10809func (r Response) AsBasicAnswer() (BasicAnswer, bool) { 10810 return nil, false 10811} 10812 10813// AsErrorResponse is the BasicResponseBase implementation for Response. 10814func (r Response) AsErrorResponse() (*ErrorResponse, bool) { 10815 return nil, false 10816} 10817 10818// AsPostalAddress is the BasicResponseBase implementation for Response. 10819func (r Response) AsPostalAddress() (*PostalAddress, bool) { 10820 return nil, false 10821} 10822 10823// AsPlace is the BasicResponseBase implementation for Response. 10824func (r Response) AsPlace() (*Place, bool) { 10825 return nil, false 10826} 10827 10828// AsBasicPlace is the BasicResponseBase implementation for Response. 10829func (r Response) AsBasicPlace() (BasicPlace, bool) { 10830 return nil, false 10831} 10832 10833// AsOrganization is the BasicResponseBase implementation for Response. 10834func (r Response) AsOrganization() (*Organization, bool) { 10835 return nil, false 10836} 10837 10838// AsCreativeWork is the BasicResponseBase implementation for Response. 10839func (r Response) AsCreativeWork() (*CreativeWork, bool) { 10840 return nil, false 10841} 10842 10843// AsBasicCreativeWork is the BasicResponseBase implementation for Response. 10844func (r Response) AsBasicCreativeWork() (BasicCreativeWork, bool) { 10845 return nil, false 10846} 10847 10848// AsIntangible is the BasicResponseBase implementation for Response. 10849func (r Response) AsIntangible() (*Intangible, bool) { 10850 return nil, false 10851} 10852 10853// AsBasicIntangible is the BasicResponseBase implementation for Response. 10854func (r Response) AsBasicIntangible() (BasicIntangible, bool) { 10855 return nil, false 10856} 10857 10858// AsMovieTheater is the BasicResponseBase implementation for Response. 10859func (r Response) AsMovieTheater() (*MovieTheater, bool) { 10860 return nil, false 10861} 10862 10863// AsMediaObject is the BasicResponseBase implementation for Response. 10864func (r Response) AsMediaObject() (*MediaObject, bool) { 10865 return nil, false 10866} 10867 10868// AsBasicMediaObject is the BasicResponseBase implementation for Response. 10869func (r Response) AsBasicMediaObject() (BasicMediaObject, bool) { 10870 return nil, false 10871} 10872 10873// AsCivicStructure is the BasicResponseBase implementation for Response. 10874func (r Response) AsCivicStructure() (*CivicStructure, bool) { 10875 return nil, false 10876} 10877 10878// AsBasicCivicStructure is the BasicResponseBase implementation for Response. 10879func (r Response) AsBasicCivicStructure() (BasicCivicStructure, bool) { 10880 return nil, false 10881} 10882 10883// AsLocalBusiness is the BasicResponseBase implementation for Response. 10884func (r Response) AsLocalBusiness() (*LocalBusiness, bool) { 10885 return nil, false 10886} 10887 10888// AsBasicLocalBusiness is the BasicResponseBase implementation for Response. 10889func (r Response) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 10890 return nil, false 10891} 10892 10893// AsTouristAttraction is the BasicResponseBase implementation for Response. 10894func (r Response) AsTouristAttraction() (*TouristAttraction, bool) { 10895 return nil, false 10896} 10897 10898// AsAirport is the BasicResponseBase implementation for Response. 10899func (r Response) AsAirport() (*Airport, bool) { 10900 return nil, false 10901} 10902 10903// AsLicense is the BasicResponseBase implementation for Response. 10904func (r Response) AsLicense() (*License, bool) { 10905 return nil, false 10906} 10907 10908// AsStructuredValue is the BasicResponseBase implementation for Response. 10909func (r Response) AsStructuredValue() (*StructuredValue, bool) { 10910 return nil, false 10911} 10912 10913// AsBasicStructuredValue is the BasicResponseBase implementation for Response. 10914func (r Response) AsBasicStructuredValue() (BasicStructuredValue, bool) { 10915 return nil, false 10916} 10917 10918// AsEntertainmentBusiness is the BasicResponseBase implementation for Response. 10919func (r Response) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 10920 return nil, false 10921} 10922 10923// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Response. 10924func (r Response) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 10925 return nil, false 10926} 10927 10928// AsFoodEstablishment is the BasicResponseBase implementation for Response. 10929func (r Response) AsFoodEstablishment() (*FoodEstablishment, bool) { 10930 return nil, false 10931} 10932 10933// AsBasicFoodEstablishment is the BasicResponseBase implementation for Response. 10934func (r Response) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 10935 return nil, false 10936} 10937 10938// AsLodgingBusiness is the BasicResponseBase implementation for Response. 10939func (r Response) AsLodgingBusiness() (*LodgingBusiness, bool) { 10940 return nil, false 10941} 10942 10943// AsBasicLodgingBusiness is the BasicResponseBase implementation for Response. 10944func (r Response) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 10945 return nil, false 10946} 10947 10948// AsRestaurant is the BasicResponseBase implementation for Response. 10949func (r Response) AsRestaurant() (*Restaurant, bool) { 10950 return nil, false 10951} 10952 10953// AsHotel is the BasicResponseBase implementation for Response. 10954func (r Response) AsHotel() (*Hotel, bool) { 10955 return nil, false 10956} 10957 10958// AsResponseBase is the BasicResponseBase implementation for Response. 10959func (r Response) AsResponseBase() (*ResponseBase, bool) { 10960 return nil, false 10961} 10962 10963// AsBasicResponseBase is the BasicResponseBase implementation for Response. 10964func (r Response) AsBasicResponseBase() (BasicResponseBase, bool) { 10965 return &r, true 10966} 10967 10968// UnmarshalJSON is the custom unmarshaler for Response struct. 10969func (r *Response) UnmarshalJSON(body []byte) error { 10970 var m map[string]*json.RawMessage 10971 err := json.Unmarshal(body, &m) 10972 if err != nil { 10973 return err 10974 } 10975 for k, v := range m { 10976 switch k { 10977 case "contractualRules": 10978 if v != nil { 10979 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 10980 if err != nil { 10981 return err 10982 } 10983 r.ContractualRules = &contractualRules 10984 } 10985 case "webSearchUrl": 10986 if v != nil { 10987 var webSearchURL string 10988 err = json.Unmarshal(*v, &webSearchURL) 10989 if err != nil { 10990 return err 10991 } 10992 r.WebSearchURL = &webSearchURL 10993 } 10994 case "id": 10995 if v != nil { 10996 var ID string 10997 err = json.Unmarshal(*v, &ID) 10998 if err != nil { 10999 return err 11000 } 11001 r.ID = &ID 11002 } 11003 case "_type": 11004 if v != nil { 11005 var typeVar TypeBasicResponseBase 11006 err = json.Unmarshal(*v, &typeVar) 11007 if err != nil { 11008 return err 11009 } 11010 r.Type = typeVar 11011 } 11012 } 11013 } 11014 11015 return nil 11016} 11017 11018// BasicResponseBase ... 11019type BasicResponseBase interface { 11020 AsImageObject() (*ImageObject, bool) 11021 AsThing() (*Thing, bool) 11022 AsBasicThing() (BasicThing, bool) 11023 AsEntities() (*Entities, bool) 11024 AsPlaces() (*Places, bool) 11025 AsSearchResponse() (*SearchResponse, bool) 11026 AsResponse() (*Response, bool) 11027 AsBasicResponse() (BasicResponse, bool) 11028 AsSearchResultsAnswer() (*SearchResultsAnswer, bool) 11029 AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) 11030 AsIdentifiable() (*Identifiable, bool) 11031 AsBasicIdentifiable() (BasicIdentifiable, bool) 11032 AsAnswer() (*Answer, bool) 11033 AsBasicAnswer() (BasicAnswer, bool) 11034 AsErrorResponse() (*ErrorResponse, bool) 11035 AsPostalAddress() (*PostalAddress, bool) 11036 AsPlace() (*Place, bool) 11037 AsBasicPlace() (BasicPlace, bool) 11038 AsOrganization() (*Organization, bool) 11039 AsCreativeWork() (*CreativeWork, bool) 11040 AsBasicCreativeWork() (BasicCreativeWork, bool) 11041 AsIntangible() (*Intangible, bool) 11042 AsBasicIntangible() (BasicIntangible, bool) 11043 AsMovieTheater() (*MovieTheater, bool) 11044 AsMediaObject() (*MediaObject, bool) 11045 AsBasicMediaObject() (BasicMediaObject, bool) 11046 AsCivicStructure() (*CivicStructure, bool) 11047 AsBasicCivicStructure() (BasicCivicStructure, bool) 11048 AsLocalBusiness() (*LocalBusiness, bool) 11049 AsBasicLocalBusiness() (BasicLocalBusiness, bool) 11050 AsTouristAttraction() (*TouristAttraction, bool) 11051 AsAirport() (*Airport, bool) 11052 AsLicense() (*License, bool) 11053 AsStructuredValue() (*StructuredValue, bool) 11054 AsBasicStructuredValue() (BasicStructuredValue, bool) 11055 AsEntertainmentBusiness() (*EntertainmentBusiness, bool) 11056 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) 11057 AsFoodEstablishment() (*FoodEstablishment, bool) 11058 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) 11059 AsLodgingBusiness() (*LodgingBusiness, bool) 11060 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) 11061 AsRestaurant() (*Restaurant, bool) 11062 AsHotel() (*Hotel, bool) 11063 AsResponseBase() (*ResponseBase, bool) 11064} 11065 11066// ResponseBase ... 11067type ResponseBase struct { 11068 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 11069 Type TypeBasicResponseBase `json:"_type,omitempty"` 11070} 11071 11072func unmarshalBasicResponseBase(body []byte) (BasicResponseBase, error) { 11073 var m map[string]interface{} 11074 err := json.Unmarshal(body, &m) 11075 if err != nil { 11076 return nil, err 11077 } 11078 11079 switch m["_type"] { 11080 case string(TypeImageObject): 11081 var ioVar ImageObject 11082 err := json.Unmarshal(body, &ioVar) 11083 return ioVar, err 11084 case string(TypeThing): 11085 var t Thing 11086 err := json.Unmarshal(body, &t) 11087 return t, err 11088 case string(TypeEntities): 11089 var e Entities 11090 err := json.Unmarshal(body, &e) 11091 return e, err 11092 case string(TypePlaces): 11093 var p Places 11094 err := json.Unmarshal(body, &p) 11095 return p, err 11096 case string(TypeSearchResponse): 11097 var sr SearchResponse 11098 err := json.Unmarshal(body, &sr) 11099 return sr, err 11100 case string(TypeResponse): 11101 var r Response 11102 err := json.Unmarshal(body, &r) 11103 return r, err 11104 case string(TypeSearchResultsAnswer): 11105 var sra SearchResultsAnswer 11106 err := json.Unmarshal(body, &sra) 11107 return sra, err 11108 case string(TypeIdentifiable): 11109 var i Identifiable 11110 err := json.Unmarshal(body, &i) 11111 return i, err 11112 case string(TypeAnswer): 11113 var a Answer 11114 err := json.Unmarshal(body, &a) 11115 return a, err 11116 case string(TypeErrorResponse): 11117 var er ErrorResponse 11118 err := json.Unmarshal(body, &er) 11119 return er, err 11120 case string(TypePostalAddress): 11121 var pa PostalAddress 11122 err := json.Unmarshal(body, &pa) 11123 return pa, err 11124 case string(TypePlace): 11125 var p Place 11126 err := json.Unmarshal(body, &p) 11127 return p, err 11128 case string(TypeOrganization): 11129 var o Organization 11130 err := json.Unmarshal(body, &o) 11131 return o, err 11132 case string(TypeCreativeWork): 11133 var cw CreativeWork 11134 err := json.Unmarshal(body, &cw) 11135 return cw, err 11136 case string(TypeIntangible): 11137 var i Intangible 11138 err := json.Unmarshal(body, &i) 11139 return i, err 11140 case string(TypeMovieTheater): 11141 var mt MovieTheater 11142 err := json.Unmarshal(body, &mt) 11143 return mt, err 11144 case string(TypeMediaObject): 11145 var mo MediaObject 11146 err := json.Unmarshal(body, &mo) 11147 return mo, err 11148 case string(TypeCivicStructure): 11149 var cs CivicStructure 11150 err := json.Unmarshal(body, &cs) 11151 return cs, err 11152 case string(TypeLocalBusiness): 11153 var lb LocalBusiness 11154 err := json.Unmarshal(body, &lb) 11155 return lb, err 11156 case string(TypeTouristAttraction): 11157 var ta TouristAttraction 11158 err := json.Unmarshal(body, &ta) 11159 return ta, err 11160 case string(TypeAirport): 11161 var a Airport 11162 err := json.Unmarshal(body, &a) 11163 return a, err 11164 case string(TypeLicense): 11165 var l License 11166 err := json.Unmarshal(body, &l) 11167 return l, err 11168 case string(TypeStructuredValue): 11169 var sv StructuredValue 11170 err := json.Unmarshal(body, &sv) 11171 return sv, err 11172 case string(TypeEntertainmentBusiness): 11173 var eb EntertainmentBusiness 11174 err := json.Unmarshal(body, &eb) 11175 return eb, err 11176 case string(TypeFoodEstablishment): 11177 var fe FoodEstablishment 11178 err := json.Unmarshal(body, &fe) 11179 return fe, err 11180 case string(TypeLodgingBusiness): 11181 var lb LodgingBusiness 11182 err := json.Unmarshal(body, &lb) 11183 return lb, err 11184 case string(TypeRestaurant): 11185 var r Restaurant 11186 err := json.Unmarshal(body, &r) 11187 return r, err 11188 case string(TypeHotel): 11189 var h Hotel 11190 err := json.Unmarshal(body, &h) 11191 return h, err 11192 default: 11193 var rb ResponseBase 11194 err := json.Unmarshal(body, &rb) 11195 return rb, err 11196 } 11197} 11198func unmarshalBasicResponseBaseArray(body []byte) ([]BasicResponseBase, error) { 11199 var rawMessages []*json.RawMessage 11200 err := json.Unmarshal(body, &rawMessages) 11201 if err != nil { 11202 return nil, err 11203 } 11204 11205 rbArray := make([]BasicResponseBase, len(rawMessages)) 11206 11207 for index, rawMessage := range rawMessages { 11208 rb, err := unmarshalBasicResponseBase(*rawMessage) 11209 if err != nil { 11210 return nil, err 11211 } 11212 rbArray[index] = rb 11213 } 11214 return rbArray, nil 11215} 11216 11217// MarshalJSON is the custom marshaler for ResponseBase. 11218func (rb ResponseBase) MarshalJSON() ([]byte, error) { 11219 rb.Type = TypeResponseBase 11220 objectMap := make(map[string]interface{}) 11221 if rb.Type != "" { 11222 objectMap["_type"] = rb.Type 11223 } 11224 return json.Marshal(objectMap) 11225} 11226 11227// AsImageObject is the BasicResponseBase implementation for ResponseBase. 11228func (rb ResponseBase) AsImageObject() (*ImageObject, bool) { 11229 return nil, false 11230} 11231 11232// AsThing is the BasicResponseBase implementation for ResponseBase. 11233func (rb ResponseBase) AsThing() (*Thing, bool) { 11234 return nil, false 11235} 11236 11237// AsBasicThing is the BasicResponseBase implementation for ResponseBase. 11238func (rb ResponseBase) AsBasicThing() (BasicThing, bool) { 11239 return nil, false 11240} 11241 11242// AsEntities is the BasicResponseBase implementation for ResponseBase. 11243func (rb ResponseBase) AsEntities() (*Entities, bool) { 11244 return nil, false 11245} 11246 11247// AsPlaces is the BasicResponseBase implementation for ResponseBase. 11248func (rb ResponseBase) AsPlaces() (*Places, bool) { 11249 return nil, false 11250} 11251 11252// AsSearchResponse is the BasicResponseBase implementation for ResponseBase. 11253func (rb ResponseBase) AsSearchResponse() (*SearchResponse, bool) { 11254 return nil, false 11255} 11256 11257// AsResponse is the BasicResponseBase implementation for ResponseBase. 11258func (rb ResponseBase) AsResponse() (*Response, bool) { 11259 return nil, false 11260} 11261 11262// AsBasicResponse is the BasicResponseBase implementation for ResponseBase. 11263func (rb ResponseBase) AsBasicResponse() (BasicResponse, bool) { 11264 return nil, false 11265} 11266 11267// AsSearchResultsAnswer is the BasicResponseBase implementation for ResponseBase. 11268func (rb ResponseBase) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 11269 return nil, false 11270} 11271 11272// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ResponseBase. 11273func (rb ResponseBase) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 11274 return nil, false 11275} 11276 11277// AsIdentifiable is the BasicResponseBase implementation for ResponseBase. 11278func (rb ResponseBase) AsIdentifiable() (*Identifiable, bool) { 11279 return nil, false 11280} 11281 11282// AsBasicIdentifiable is the BasicResponseBase implementation for ResponseBase. 11283func (rb ResponseBase) AsBasicIdentifiable() (BasicIdentifiable, bool) { 11284 return nil, false 11285} 11286 11287// AsAnswer is the BasicResponseBase implementation for ResponseBase. 11288func (rb ResponseBase) AsAnswer() (*Answer, bool) { 11289 return nil, false 11290} 11291 11292// AsBasicAnswer is the BasicResponseBase implementation for ResponseBase. 11293func (rb ResponseBase) AsBasicAnswer() (BasicAnswer, bool) { 11294 return nil, false 11295} 11296 11297// AsErrorResponse is the BasicResponseBase implementation for ResponseBase. 11298func (rb ResponseBase) AsErrorResponse() (*ErrorResponse, bool) { 11299 return nil, false 11300} 11301 11302// AsPostalAddress is the BasicResponseBase implementation for ResponseBase. 11303func (rb ResponseBase) AsPostalAddress() (*PostalAddress, bool) { 11304 return nil, false 11305} 11306 11307// AsPlace is the BasicResponseBase implementation for ResponseBase. 11308func (rb ResponseBase) AsPlace() (*Place, bool) { 11309 return nil, false 11310} 11311 11312// AsBasicPlace is the BasicResponseBase implementation for ResponseBase. 11313func (rb ResponseBase) AsBasicPlace() (BasicPlace, bool) { 11314 return nil, false 11315} 11316 11317// AsOrganization is the BasicResponseBase implementation for ResponseBase. 11318func (rb ResponseBase) AsOrganization() (*Organization, bool) { 11319 return nil, false 11320} 11321 11322// AsCreativeWork is the BasicResponseBase implementation for ResponseBase. 11323func (rb ResponseBase) AsCreativeWork() (*CreativeWork, bool) { 11324 return nil, false 11325} 11326 11327// AsBasicCreativeWork is the BasicResponseBase implementation for ResponseBase. 11328func (rb ResponseBase) AsBasicCreativeWork() (BasicCreativeWork, bool) { 11329 return nil, false 11330} 11331 11332// AsIntangible is the BasicResponseBase implementation for ResponseBase. 11333func (rb ResponseBase) AsIntangible() (*Intangible, bool) { 11334 return nil, false 11335} 11336 11337// AsBasicIntangible is the BasicResponseBase implementation for ResponseBase. 11338func (rb ResponseBase) AsBasicIntangible() (BasicIntangible, bool) { 11339 return nil, false 11340} 11341 11342// AsMovieTheater is the BasicResponseBase implementation for ResponseBase. 11343func (rb ResponseBase) AsMovieTheater() (*MovieTheater, bool) { 11344 return nil, false 11345} 11346 11347// AsMediaObject is the BasicResponseBase implementation for ResponseBase. 11348func (rb ResponseBase) AsMediaObject() (*MediaObject, bool) { 11349 return nil, false 11350} 11351 11352// AsBasicMediaObject is the BasicResponseBase implementation for ResponseBase. 11353func (rb ResponseBase) AsBasicMediaObject() (BasicMediaObject, bool) { 11354 return nil, false 11355} 11356 11357// AsCivicStructure is the BasicResponseBase implementation for ResponseBase. 11358func (rb ResponseBase) AsCivicStructure() (*CivicStructure, bool) { 11359 return nil, false 11360} 11361 11362// AsBasicCivicStructure is the BasicResponseBase implementation for ResponseBase. 11363func (rb ResponseBase) AsBasicCivicStructure() (BasicCivicStructure, bool) { 11364 return nil, false 11365} 11366 11367// AsLocalBusiness is the BasicResponseBase implementation for ResponseBase. 11368func (rb ResponseBase) AsLocalBusiness() (*LocalBusiness, bool) { 11369 return nil, false 11370} 11371 11372// AsBasicLocalBusiness is the BasicResponseBase implementation for ResponseBase. 11373func (rb ResponseBase) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 11374 return nil, false 11375} 11376 11377// AsTouristAttraction is the BasicResponseBase implementation for ResponseBase. 11378func (rb ResponseBase) AsTouristAttraction() (*TouristAttraction, bool) { 11379 return nil, false 11380} 11381 11382// AsAirport is the BasicResponseBase implementation for ResponseBase. 11383func (rb ResponseBase) AsAirport() (*Airport, bool) { 11384 return nil, false 11385} 11386 11387// AsLicense is the BasicResponseBase implementation for ResponseBase. 11388func (rb ResponseBase) AsLicense() (*License, bool) { 11389 return nil, false 11390} 11391 11392// AsStructuredValue is the BasicResponseBase implementation for ResponseBase. 11393func (rb ResponseBase) AsStructuredValue() (*StructuredValue, bool) { 11394 return nil, false 11395} 11396 11397// AsBasicStructuredValue is the BasicResponseBase implementation for ResponseBase. 11398func (rb ResponseBase) AsBasicStructuredValue() (BasicStructuredValue, bool) { 11399 return nil, false 11400} 11401 11402// AsEntertainmentBusiness is the BasicResponseBase implementation for ResponseBase. 11403func (rb ResponseBase) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 11404 return nil, false 11405} 11406 11407// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for ResponseBase. 11408func (rb ResponseBase) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 11409 return nil, false 11410} 11411 11412// AsFoodEstablishment is the BasicResponseBase implementation for ResponseBase. 11413func (rb ResponseBase) AsFoodEstablishment() (*FoodEstablishment, bool) { 11414 return nil, false 11415} 11416 11417// AsBasicFoodEstablishment is the BasicResponseBase implementation for ResponseBase. 11418func (rb ResponseBase) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 11419 return nil, false 11420} 11421 11422// AsLodgingBusiness is the BasicResponseBase implementation for ResponseBase. 11423func (rb ResponseBase) AsLodgingBusiness() (*LodgingBusiness, bool) { 11424 return nil, false 11425} 11426 11427// AsBasicLodgingBusiness is the BasicResponseBase implementation for ResponseBase. 11428func (rb ResponseBase) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 11429 return nil, false 11430} 11431 11432// AsRestaurant is the BasicResponseBase implementation for ResponseBase. 11433func (rb ResponseBase) AsRestaurant() (*Restaurant, bool) { 11434 return nil, false 11435} 11436 11437// AsHotel is the BasicResponseBase implementation for ResponseBase. 11438func (rb ResponseBase) AsHotel() (*Hotel, bool) { 11439 return nil, false 11440} 11441 11442// AsResponseBase is the BasicResponseBase implementation for ResponseBase. 11443func (rb ResponseBase) AsResponseBase() (*ResponseBase, bool) { 11444 return &rb, true 11445} 11446 11447// AsBasicResponseBase is the BasicResponseBase implementation for ResponseBase. 11448func (rb ResponseBase) AsBasicResponseBase() (BasicResponseBase, bool) { 11449 return &rb, true 11450} 11451 11452// Restaurant ... 11453type Restaurant struct { 11454 AcceptsReservations *bool `json:"acceptsReservations,omitempty"` 11455 ReservationURL *string `json:"reservationUrl,omitempty"` 11456 ServesCuisine *[]string `json:"servesCuisine,omitempty"` 11457 MenuURL *string `json:"menuUrl,omitempty"` 11458 // PriceRange - $$. 11459 PriceRange *string `json:"priceRange,omitempty"` 11460 Panoramas *[]ImageObject `json:"panoramas,omitempty"` 11461 IsPermanentlyClosed *bool `json:"isPermanentlyClosed,omitempty"` 11462 TagLine *string `json:"tagLine,omitempty"` 11463 // Address - The postal address of where the entity is located 11464 Address *PostalAddress `json:"address,omitempty"` 11465 // Telephone - The entity's telephone number 11466 Telephone *string `json:"telephone,omitempty"` 11467 // Name - The name of the thing represented by this object. 11468 Name *string `json:"name,omitempty"` 11469 // URL - The URL to get more information about the thing represented by this object. 11470 URL *string `json:"url,omitempty"` 11471 Image *ImageObject `json:"image,omitempty"` 11472 // Description - A short description of the item. 11473 Description *string `json:"description,omitempty"` 11474 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 11475 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 11476 // BingID - An ID that uniquely identifies this item. 11477 BingID *string `json:"bingId,omitempty"` 11478 // ContractualRules - A list of rules that you must adhere to if you display the item. 11479 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 11480 // WebSearchURL - The URL To Bing's search result for this item. 11481 WebSearchURL *string `json:"webSearchUrl,omitempty"` 11482 // ID - A String identifier. 11483 ID *string `json:"id,omitempty"` 11484 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 11485 Type TypeBasicResponseBase `json:"_type,omitempty"` 11486} 11487 11488// MarshalJSON is the custom marshaler for Restaurant. 11489func (r Restaurant) MarshalJSON() ([]byte, error) { 11490 r.Type = TypeRestaurant 11491 objectMap := make(map[string]interface{}) 11492 if r.AcceptsReservations != nil { 11493 objectMap["acceptsReservations"] = r.AcceptsReservations 11494 } 11495 if r.ReservationURL != nil { 11496 objectMap["reservationUrl"] = r.ReservationURL 11497 } 11498 if r.ServesCuisine != nil { 11499 objectMap["servesCuisine"] = r.ServesCuisine 11500 } 11501 if r.MenuURL != nil { 11502 objectMap["menuUrl"] = r.MenuURL 11503 } 11504 if r.PriceRange != nil { 11505 objectMap["priceRange"] = r.PriceRange 11506 } 11507 if r.Panoramas != nil { 11508 objectMap["panoramas"] = r.Panoramas 11509 } 11510 if r.IsPermanentlyClosed != nil { 11511 objectMap["isPermanentlyClosed"] = r.IsPermanentlyClosed 11512 } 11513 if r.TagLine != nil { 11514 objectMap["tagLine"] = r.TagLine 11515 } 11516 if r.Address != nil { 11517 objectMap["address"] = r.Address 11518 } 11519 if r.Telephone != nil { 11520 objectMap["telephone"] = r.Telephone 11521 } 11522 if r.Name != nil { 11523 objectMap["name"] = r.Name 11524 } 11525 if r.URL != nil { 11526 objectMap["url"] = r.URL 11527 } 11528 if r.Image != nil { 11529 objectMap["image"] = r.Image 11530 } 11531 if r.Description != nil { 11532 objectMap["description"] = r.Description 11533 } 11534 if r.EntityPresentationInfo != nil { 11535 objectMap["entityPresentationInfo"] = r.EntityPresentationInfo 11536 } 11537 if r.BingID != nil { 11538 objectMap["bingId"] = r.BingID 11539 } 11540 if r.ContractualRules != nil { 11541 objectMap["contractualRules"] = r.ContractualRules 11542 } 11543 if r.WebSearchURL != nil { 11544 objectMap["webSearchUrl"] = r.WebSearchURL 11545 } 11546 if r.ID != nil { 11547 objectMap["id"] = r.ID 11548 } 11549 if r.Type != "" { 11550 objectMap["_type"] = r.Type 11551 } 11552 return json.Marshal(objectMap) 11553} 11554 11555// AsImageObject is the BasicResponseBase implementation for Restaurant. 11556func (r Restaurant) AsImageObject() (*ImageObject, bool) { 11557 return nil, false 11558} 11559 11560// AsThing is the BasicResponseBase implementation for Restaurant. 11561func (r Restaurant) AsThing() (*Thing, bool) { 11562 return nil, false 11563} 11564 11565// AsBasicThing is the BasicResponseBase implementation for Restaurant. 11566func (r Restaurant) AsBasicThing() (BasicThing, bool) { 11567 return &r, true 11568} 11569 11570// AsEntities is the BasicResponseBase implementation for Restaurant. 11571func (r Restaurant) AsEntities() (*Entities, bool) { 11572 return nil, false 11573} 11574 11575// AsPlaces is the BasicResponseBase implementation for Restaurant. 11576func (r Restaurant) AsPlaces() (*Places, bool) { 11577 return nil, false 11578} 11579 11580// AsSearchResponse is the BasicResponseBase implementation for Restaurant. 11581func (r Restaurant) AsSearchResponse() (*SearchResponse, bool) { 11582 return nil, false 11583} 11584 11585// AsResponse is the BasicResponseBase implementation for Restaurant. 11586func (r Restaurant) AsResponse() (*Response, bool) { 11587 return nil, false 11588} 11589 11590// AsBasicResponse is the BasicResponseBase implementation for Restaurant. 11591func (r Restaurant) AsBasicResponse() (BasicResponse, bool) { 11592 return &r, true 11593} 11594 11595// AsSearchResultsAnswer is the BasicResponseBase implementation for Restaurant. 11596func (r Restaurant) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 11597 return nil, false 11598} 11599 11600// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Restaurant. 11601func (r Restaurant) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 11602 return nil, false 11603} 11604 11605// AsIdentifiable is the BasicResponseBase implementation for Restaurant. 11606func (r Restaurant) AsIdentifiable() (*Identifiable, bool) { 11607 return nil, false 11608} 11609 11610// AsBasicIdentifiable is the BasicResponseBase implementation for Restaurant. 11611func (r Restaurant) AsBasicIdentifiable() (BasicIdentifiable, bool) { 11612 return &r, true 11613} 11614 11615// AsAnswer is the BasicResponseBase implementation for Restaurant. 11616func (r Restaurant) AsAnswer() (*Answer, bool) { 11617 return nil, false 11618} 11619 11620// AsBasicAnswer is the BasicResponseBase implementation for Restaurant. 11621func (r Restaurant) AsBasicAnswer() (BasicAnswer, bool) { 11622 return nil, false 11623} 11624 11625// AsErrorResponse is the BasicResponseBase implementation for Restaurant. 11626func (r Restaurant) AsErrorResponse() (*ErrorResponse, bool) { 11627 return nil, false 11628} 11629 11630// AsPostalAddress is the BasicResponseBase implementation for Restaurant. 11631func (r Restaurant) AsPostalAddress() (*PostalAddress, bool) { 11632 return nil, false 11633} 11634 11635// AsPlace is the BasicResponseBase implementation for Restaurant. 11636func (r Restaurant) AsPlace() (*Place, bool) { 11637 return nil, false 11638} 11639 11640// AsBasicPlace is the BasicResponseBase implementation for Restaurant. 11641func (r Restaurant) AsBasicPlace() (BasicPlace, bool) { 11642 return &r, true 11643} 11644 11645// AsOrganization is the BasicResponseBase implementation for Restaurant. 11646func (r Restaurant) AsOrganization() (*Organization, bool) { 11647 return nil, false 11648} 11649 11650// AsCreativeWork is the BasicResponseBase implementation for Restaurant. 11651func (r Restaurant) AsCreativeWork() (*CreativeWork, bool) { 11652 return nil, false 11653} 11654 11655// AsBasicCreativeWork is the BasicResponseBase implementation for Restaurant. 11656func (r Restaurant) AsBasicCreativeWork() (BasicCreativeWork, bool) { 11657 return nil, false 11658} 11659 11660// AsIntangible is the BasicResponseBase implementation for Restaurant. 11661func (r Restaurant) AsIntangible() (*Intangible, bool) { 11662 return nil, false 11663} 11664 11665// AsBasicIntangible is the BasicResponseBase implementation for Restaurant. 11666func (r Restaurant) AsBasicIntangible() (BasicIntangible, bool) { 11667 return nil, false 11668} 11669 11670// AsMovieTheater is the BasicResponseBase implementation for Restaurant. 11671func (r Restaurant) AsMovieTheater() (*MovieTheater, bool) { 11672 return nil, false 11673} 11674 11675// AsMediaObject is the BasicResponseBase implementation for Restaurant. 11676func (r Restaurant) AsMediaObject() (*MediaObject, bool) { 11677 return nil, false 11678} 11679 11680// AsBasicMediaObject is the BasicResponseBase implementation for Restaurant. 11681func (r Restaurant) AsBasicMediaObject() (BasicMediaObject, bool) { 11682 return nil, false 11683} 11684 11685// AsCivicStructure is the BasicResponseBase implementation for Restaurant. 11686func (r Restaurant) AsCivicStructure() (*CivicStructure, bool) { 11687 return nil, false 11688} 11689 11690// AsBasicCivicStructure is the BasicResponseBase implementation for Restaurant. 11691func (r Restaurant) AsBasicCivicStructure() (BasicCivicStructure, bool) { 11692 return nil, false 11693} 11694 11695// AsLocalBusiness is the BasicResponseBase implementation for Restaurant. 11696func (r Restaurant) AsLocalBusiness() (*LocalBusiness, bool) { 11697 return nil, false 11698} 11699 11700// AsBasicLocalBusiness is the BasicResponseBase implementation for Restaurant. 11701func (r Restaurant) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 11702 return &r, true 11703} 11704 11705// AsTouristAttraction is the BasicResponseBase implementation for Restaurant. 11706func (r Restaurant) AsTouristAttraction() (*TouristAttraction, bool) { 11707 return nil, false 11708} 11709 11710// AsAirport is the BasicResponseBase implementation for Restaurant. 11711func (r Restaurant) AsAirport() (*Airport, bool) { 11712 return nil, false 11713} 11714 11715// AsLicense is the BasicResponseBase implementation for Restaurant. 11716func (r Restaurant) AsLicense() (*License, bool) { 11717 return nil, false 11718} 11719 11720// AsStructuredValue is the BasicResponseBase implementation for Restaurant. 11721func (r Restaurant) AsStructuredValue() (*StructuredValue, bool) { 11722 return nil, false 11723} 11724 11725// AsBasicStructuredValue is the BasicResponseBase implementation for Restaurant. 11726func (r Restaurant) AsBasicStructuredValue() (BasicStructuredValue, bool) { 11727 return nil, false 11728} 11729 11730// AsEntertainmentBusiness is the BasicResponseBase implementation for Restaurant. 11731func (r Restaurant) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 11732 return nil, false 11733} 11734 11735// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Restaurant. 11736func (r Restaurant) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 11737 return nil, false 11738} 11739 11740// AsFoodEstablishment is the BasicResponseBase implementation for Restaurant. 11741func (r Restaurant) AsFoodEstablishment() (*FoodEstablishment, bool) { 11742 return nil, false 11743} 11744 11745// AsBasicFoodEstablishment is the BasicResponseBase implementation for Restaurant. 11746func (r Restaurant) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 11747 return &r, true 11748} 11749 11750// AsLodgingBusiness is the BasicResponseBase implementation for Restaurant. 11751func (r Restaurant) AsLodgingBusiness() (*LodgingBusiness, bool) { 11752 return nil, false 11753} 11754 11755// AsBasicLodgingBusiness is the BasicResponseBase implementation for Restaurant. 11756func (r Restaurant) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 11757 return nil, false 11758} 11759 11760// AsRestaurant is the BasicResponseBase implementation for Restaurant. 11761func (r Restaurant) AsRestaurant() (*Restaurant, bool) { 11762 return &r, true 11763} 11764 11765// AsHotel is the BasicResponseBase implementation for Restaurant. 11766func (r Restaurant) AsHotel() (*Hotel, bool) { 11767 return nil, false 11768} 11769 11770// AsResponseBase is the BasicResponseBase implementation for Restaurant. 11771func (r Restaurant) AsResponseBase() (*ResponseBase, bool) { 11772 return nil, false 11773} 11774 11775// AsBasicResponseBase is the BasicResponseBase implementation for Restaurant. 11776func (r Restaurant) AsBasicResponseBase() (BasicResponseBase, bool) { 11777 return &r, true 11778} 11779 11780// UnmarshalJSON is the custom unmarshaler for Restaurant struct. 11781func (r *Restaurant) UnmarshalJSON(body []byte) error { 11782 var m map[string]*json.RawMessage 11783 err := json.Unmarshal(body, &m) 11784 if err != nil { 11785 return err 11786 } 11787 for k, v := range m { 11788 switch k { 11789 case "acceptsReservations": 11790 if v != nil { 11791 var acceptsReservations bool 11792 err = json.Unmarshal(*v, &acceptsReservations) 11793 if err != nil { 11794 return err 11795 } 11796 r.AcceptsReservations = &acceptsReservations 11797 } 11798 case "reservationUrl": 11799 if v != nil { 11800 var reservationURL string 11801 err = json.Unmarshal(*v, &reservationURL) 11802 if err != nil { 11803 return err 11804 } 11805 r.ReservationURL = &reservationURL 11806 } 11807 case "servesCuisine": 11808 if v != nil { 11809 var servesCuisine []string 11810 err = json.Unmarshal(*v, &servesCuisine) 11811 if err != nil { 11812 return err 11813 } 11814 r.ServesCuisine = &servesCuisine 11815 } 11816 case "menuUrl": 11817 if v != nil { 11818 var menuURL string 11819 err = json.Unmarshal(*v, &menuURL) 11820 if err != nil { 11821 return err 11822 } 11823 r.MenuURL = &menuURL 11824 } 11825 case "priceRange": 11826 if v != nil { 11827 var priceRange string 11828 err = json.Unmarshal(*v, &priceRange) 11829 if err != nil { 11830 return err 11831 } 11832 r.PriceRange = &priceRange 11833 } 11834 case "panoramas": 11835 if v != nil { 11836 var panoramas []ImageObject 11837 err = json.Unmarshal(*v, &panoramas) 11838 if err != nil { 11839 return err 11840 } 11841 r.Panoramas = &panoramas 11842 } 11843 case "isPermanentlyClosed": 11844 if v != nil { 11845 var isPermanentlyClosed bool 11846 err = json.Unmarshal(*v, &isPermanentlyClosed) 11847 if err != nil { 11848 return err 11849 } 11850 r.IsPermanentlyClosed = &isPermanentlyClosed 11851 } 11852 case "tagLine": 11853 if v != nil { 11854 var tagLine string 11855 err = json.Unmarshal(*v, &tagLine) 11856 if err != nil { 11857 return err 11858 } 11859 r.TagLine = &tagLine 11860 } 11861 case "address": 11862 if v != nil { 11863 var address PostalAddress 11864 err = json.Unmarshal(*v, &address) 11865 if err != nil { 11866 return err 11867 } 11868 r.Address = &address 11869 } 11870 case "telephone": 11871 if v != nil { 11872 var telephone string 11873 err = json.Unmarshal(*v, &telephone) 11874 if err != nil { 11875 return err 11876 } 11877 r.Telephone = &telephone 11878 } 11879 case "name": 11880 if v != nil { 11881 var name string 11882 err = json.Unmarshal(*v, &name) 11883 if err != nil { 11884 return err 11885 } 11886 r.Name = &name 11887 } 11888 case "url": 11889 if v != nil { 11890 var URL string 11891 err = json.Unmarshal(*v, &URL) 11892 if err != nil { 11893 return err 11894 } 11895 r.URL = &URL 11896 } 11897 case "image": 11898 if v != nil { 11899 var imageVar ImageObject 11900 err = json.Unmarshal(*v, &imageVar) 11901 if err != nil { 11902 return err 11903 } 11904 r.Image = &imageVar 11905 } 11906 case "description": 11907 if v != nil { 11908 var description string 11909 err = json.Unmarshal(*v, &description) 11910 if err != nil { 11911 return err 11912 } 11913 r.Description = &description 11914 } 11915 case "entityPresentationInfo": 11916 if v != nil { 11917 var entityPresentationInfo EntitiesEntityPresentationInfo 11918 err = json.Unmarshal(*v, &entityPresentationInfo) 11919 if err != nil { 11920 return err 11921 } 11922 r.EntityPresentationInfo = &entityPresentationInfo 11923 } 11924 case "bingId": 11925 if v != nil { 11926 var bingID string 11927 err = json.Unmarshal(*v, &bingID) 11928 if err != nil { 11929 return err 11930 } 11931 r.BingID = &bingID 11932 } 11933 case "contractualRules": 11934 if v != nil { 11935 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 11936 if err != nil { 11937 return err 11938 } 11939 r.ContractualRules = &contractualRules 11940 } 11941 case "webSearchUrl": 11942 if v != nil { 11943 var webSearchURL string 11944 err = json.Unmarshal(*v, &webSearchURL) 11945 if err != nil { 11946 return err 11947 } 11948 r.WebSearchURL = &webSearchURL 11949 } 11950 case "id": 11951 if v != nil { 11952 var ID string 11953 err = json.Unmarshal(*v, &ID) 11954 if err != nil { 11955 return err 11956 } 11957 r.ID = &ID 11958 } 11959 case "_type": 11960 if v != nil { 11961 var typeVar TypeBasicResponseBase 11962 err = json.Unmarshal(*v, &typeVar) 11963 if err != nil { 11964 return err 11965 } 11966 r.Type = typeVar 11967 } 11968 } 11969 } 11970 11971 return nil 11972} 11973 11974// SearchResponse defines the top-level object that the response includes when the request succeeds. 11975type SearchResponse struct { 11976 autorest.Response `json:"-"` 11977 // QueryContext - An object that contains the query string that Bing used for the request. This object contains the query string as entered by the user. It may also contain an altered query string that Bing used for the query if the query string contained a spelling mistake. 11978 QueryContext *QueryContext `json:"queryContext,omitempty"` 11979 // Entities - A list of entities that are relevant to the search query. 11980 Entities *Entities `json:"entities,omitempty"` 11981 // Places - A list of local entities such as restaurants or hotels that are relevant to the query. 11982 Places *Places `json:"places,omitempty"` 11983 // ContractualRules - A list of rules that you must adhere to if you display the item. 11984 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 11985 // WebSearchURL - The URL To Bing's search result for this item. 11986 WebSearchURL *string `json:"webSearchUrl,omitempty"` 11987 // ID - A String identifier. 11988 ID *string `json:"id,omitempty"` 11989 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 11990 Type TypeBasicResponseBase `json:"_type,omitempty"` 11991} 11992 11993// MarshalJSON is the custom marshaler for SearchResponse. 11994func (sr SearchResponse) MarshalJSON() ([]byte, error) { 11995 sr.Type = TypeSearchResponse 11996 objectMap := make(map[string]interface{}) 11997 if sr.QueryContext != nil { 11998 objectMap["queryContext"] = sr.QueryContext 11999 } 12000 if sr.Entities != nil { 12001 objectMap["entities"] = sr.Entities 12002 } 12003 if sr.Places != nil { 12004 objectMap["places"] = sr.Places 12005 } 12006 if sr.ContractualRules != nil { 12007 objectMap["contractualRules"] = sr.ContractualRules 12008 } 12009 if sr.WebSearchURL != nil { 12010 objectMap["webSearchUrl"] = sr.WebSearchURL 12011 } 12012 if sr.ID != nil { 12013 objectMap["id"] = sr.ID 12014 } 12015 if sr.Type != "" { 12016 objectMap["_type"] = sr.Type 12017 } 12018 return json.Marshal(objectMap) 12019} 12020 12021// AsImageObject is the BasicResponseBase implementation for SearchResponse. 12022func (sr SearchResponse) AsImageObject() (*ImageObject, bool) { 12023 return nil, false 12024} 12025 12026// AsThing is the BasicResponseBase implementation for SearchResponse. 12027func (sr SearchResponse) AsThing() (*Thing, bool) { 12028 return nil, false 12029} 12030 12031// AsBasicThing is the BasicResponseBase implementation for SearchResponse. 12032func (sr SearchResponse) AsBasicThing() (BasicThing, bool) { 12033 return nil, false 12034} 12035 12036// AsEntities is the BasicResponseBase implementation for SearchResponse. 12037func (sr SearchResponse) AsEntities() (*Entities, bool) { 12038 return nil, false 12039} 12040 12041// AsPlaces is the BasicResponseBase implementation for SearchResponse. 12042func (sr SearchResponse) AsPlaces() (*Places, bool) { 12043 return nil, false 12044} 12045 12046// AsSearchResponse is the BasicResponseBase implementation for SearchResponse. 12047func (sr SearchResponse) AsSearchResponse() (*SearchResponse, bool) { 12048 return &sr, true 12049} 12050 12051// AsResponse is the BasicResponseBase implementation for SearchResponse. 12052func (sr SearchResponse) AsResponse() (*Response, bool) { 12053 return nil, false 12054} 12055 12056// AsBasicResponse is the BasicResponseBase implementation for SearchResponse. 12057func (sr SearchResponse) AsBasicResponse() (BasicResponse, bool) { 12058 return &sr, true 12059} 12060 12061// AsSearchResultsAnswer is the BasicResponseBase implementation for SearchResponse. 12062func (sr SearchResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 12063 return nil, false 12064} 12065 12066// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for SearchResponse. 12067func (sr SearchResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 12068 return nil, false 12069} 12070 12071// AsIdentifiable is the BasicResponseBase implementation for SearchResponse. 12072func (sr SearchResponse) AsIdentifiable() (*Identifiable, bool) { 12073 return nil, false 12074} 12075 12076// AsBasicIdentifiable is the BasicResponseBase implementation for SearchResponse. 12077func (sr SearchResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) { 12078 return &sr, true 12079} 12080 12081// AsAnswer is the BasicResponseBase implementation for SearchResponse. 12082func (sr SearchResponse) AsAnswer() (*Answer, bool) { 12083 return nil, false 12084} 12085 12086// AsBasicAnswer is the BasicResponseBase implementation for SearchResponse. 12087func (sr SearchResponse) AsBasicAnswer() (BasicAnswer, bool) { 12088 return nil, false 12089} 12090 12091// AsErrorResponse is the BasicResponseBase implementation for SearchResponse. 12092func (sr SearchResponse) AsErrorResponse() (*ErrorResponse, bool) { 12093 return nil, false 12094} 12095 12096// AsPostalAddress is the BasicResponseBase implementation for SearchResponse. 12097func (sr SearchResponse) AsPostalAddress() (*PostalAddress, bool) { 12098 return nil, false 12099} 12100 12101// AsPlace is the BasicResponseBase implementation for SearchResponse. 12102func (sr SearchResponse) AsPlace() (*Place, bool) { 12103 return nil, false 12104} 12105 12106// AsBasicPlace is the BasicResponseBase implementation for SearchResponse. 12107func (sr SearchResponse) AsBasicPlace() (BasicPlace, bool) { 12108 return nil, false 12109} 12110 12111// AsOrganization is the BasicResponseBase implementation for SearchResponse. 12112func (sr SearchResponse) AsOrganization() (*Organization, bool) { 12113 return nil, false 12114} 12115 12116// AsCreativeWork is the BasicResponseBase implementation for SearchResponse. 12117func (sr SearchResponse) AsCreativeWork() (*CreativeWork, bool) { 12118 return nil, false 12119} 12120 12121// AsBasicCreativeWork is the BasicResponseBase implementation for SearchResponse. 12122func (sr SearchResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) { 12123 return nil, false 12124} 12125 12126// AsIntangible is the BasicResponseBase implementation for SearchResponse. 12127func (sr SearchResponse) AsIntangible() (*Intangible, bool) { 12128 return nil, false 12129} 12130 12131// AsBasicIntangible is the BasicResponseBase implementation for SearchResponse. 12132func (sr SearchResponse) AsBasicIntangible() (BasicIntangible, bool) { 12133 return nil, false 12134} 12135 12136// AsMovieTheater is the BasicResponseBase implementation for SearchResponse. 12137func (sr SearchResponse) AsMovieTheater() (*MovieTheater, bool) { 12138 return nil, false 12139} 12140 12141// AsMediaObject is the BasicResponseBase implementation for SearchResponse. 12142func (sr SearchResponse) AsMediaObject() (*MediaObject, bool) { 12143 return nil, false 12144} 12145 12146// AsBasicMediaObject is the BasicResponseBase implementation for SearchResponse. 12147func (sr SearchResponse) AsBasicMediaObject() (BasicMediaObject, bool) { 12148 return nil, false 12149} 12150 12151// AsCivicStructure is the BasicResponseBase implementation for SearchResponse. 12152func (sr SearchResponse) AsCivicStructure() (*CivicStructure, bool) { 12153 return nil, false 12154} 12155 12156// AsBasicCivicStructure is the BasicResponseBase implementation for SearchResponse. 12157func (sr SearchResponse) AsBasicCivicStructure() (BasicCivicStructure, bool) { 12158 return nil, false 12159} 12160 12161// AsLocalBusiness is the BasicResponseBase implementation for SearchResponse. 12162func (sr SearchResponse) AsLocalBusiness() (*LocalBusiness, bool) { 12163 return nil, false 12164} 12165 12166// AsBasicLocalBusiness is the BasicResponseBase implementation for SearchResponse. 12167func (sr SearchResponse) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 12168 return nil, false 12169} 12170 12171// AsTouristAttraction is the BasicResponseBase implementation for SearchResponse. 12172func (sr SearchResponse) AsTouristAttraction() (*TouristAttraction, bool) { 12173 return nil, false 12174} 12175 12176// AsAirport is the BasicResponseBase implementation for SearchResponse. 12177func (sr SearchResponse) AsAirport() (*Airport, bool) { 12178 return nil, false 12179} 12180 12181// AsLicense is the BasicResponseBase implementation for SearchResponse. 12182func (sr SearchResponse) AsLicense() (*License, bool) { 12183 return nil, false 12184} 12185 12186// AsStructuredValue is the BasicResponseBase implementation for SearchResponse. 12187func (sr SearchResponse) AsStructuredValue() (*StructuredValue, bool) { 12188 return nil, false 12189} 12190 12191// AsBasicStructuredValue is the BasicResponseBase implementation for SearchResponse. 12192func (sr SearchResponse) AsBasicStructuredValue() (BasicStructuredValue, bool) { 12193 return nil, false 12194} 12195 12196// AsEntertainmentBusiness is the BasicResponseBase implementation for SearchResponse. 12197func (sr SearchResponse) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 12198 return nil, false 12199} 12200 12201// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for SearchResponse. 12202func (sr SearchResponse) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 12203 return nil, false 12204} 12205 12206// AsFoodEstablishment is the BasicResponseBase implementation for SearchResponse. 12207func (sr SearchResponse) AsFoodEstablishment() (*FoodEstablishment, bool) { 12208 return nil, false 12209} 12210 12211// AsBasicFoodEstablishment is the BasicResponseBase implementation for SearchResponse. 12212func (sr SearchResponse) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 12213 return nil, false 12214} 12215 12216// AsLodgingBusiness is the BasicResponseBase implementation for SearchResponse. 12217func (sr SearchResponse) AsLodgingBusiness() (*LodgingBusiness, bool) { 12218 return nil, false 12219} 12220 12221// AsBasicLodgingBusiness is the BasicResponseBase implementation for SearchResponse. 12222func (sr SearchResponse) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 12223 return nil, false 12224} 12225 12226// AsRestaurant is the BasicResponseBase implementation for SearchResponse. 12227func (sr SearchResponse) AsRestaurant() (*Restaurant, bool) { 12228 return nil, false 12229} 12230 12231// AsHotel is the BasicResponseBase implementation for SearchResponse. 12232func (sr SearchResponse) AsHotel() (*Hotel, bool) { 12233 return nil, false 12234} 12235 12236// AsResponseBase is the BasicResponseBase implementation for SearchResponse. 12237func (sr SearchResponse) AsResponseBase() (*ResponseBase, bool) { 12238 return nil, false 12239} 12240 12241// AsBasicResponseBase is the BasicResponseBase implementation for SearchResponse. 12242func (sr SearchResponse) AsBasicResponseBase() (BasicResponseBase, bool) { 12243 return &sr, true 12244} 12245 12246// UnmarshalJSON is the custom unmarshaler for SearchResponse struct. 12247func (sr *SearchResponse) UnmarshalJSON(body []byte) error { 12248 var m map[string]*json.RawMessage 12249 err := json.Unmarshal(body, &m) 12250 if err != nil { 12251 return err 12252 } 12253 for k, v := range m { 12254 switch k { 12255 case "queryContext": 12256 if v != nil { 12257 var queryContext QueryContext 12258 err = json.Unmarshal(*v, &queryContext) 12259 if err != nil { 12260 return err 12261 } 12262 sr.QueryContext = &queryContext 12263 } 12264 case "entities": 12265 if v != nil { 12266 var entities Entities 12267 err = json.Unmarshal(*v, &entities) 12268 if err != nil { 12269 return err 12270 } 12271 sr.Entities = &entities 12272 } 12273 case "places": 12274 if v != nil { 12275 var places Places 12276 err = json.Unmarshal(*v, &places) 12277 if err != nil { 12278 return err 12279 } 12280 sr.Places = &places 12281 } 12282 case "contractualRules": 12283 if v != nil { 12284 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 12285 if err != nil { 12286 return err 12287 } 12288 sr.ContractualRules = &contractualRules 12289 } 12290 case "webSearchUrl": 12291 if v != nil { 12292 var webSearchURL string 12293 err = json.Unmarshal(*v, &webSearchURL) 12294 if err != nil { 12295 return err 12296 } 12297 sr.WebSearchURL = &webSearchURL 12298 } 12299 case "id": 12300 if v != nil { 12301 var ID string 12302 err = json.Unmarshal(*v, &ID) 12303 if err != nil { 12304 return err 12305 } 12306 sr.ID = &ID 12307 } 12308 case "_type": 12309 if v != nil { 12310 var typeVar TypeBasicResponseBase 12311 err = json.Unmarshal(*v, &typeVar) 12312 if err != nil { 12313 return err 12314 } 12315 sr.Type = typeVar 12316 } 12317 } 12318 } 12319 12320 return nil 12321} 12322 12323// BasicSearchResultsAnswer ... 12324type BasicSearchResultsAnswer interface { 12325 AsEntities() (*Entities, bool) 12326 AsPlaces() (*Places, bool) 12327 AsSearchResultsAnswer() (*SearchResultsAnswer, bool) 12328} 12329 12330// SearchResultsAnswer ... 12331type SearchResultsAnswer struct { 12332 QueryContext *QueryContext `json:"queryContext,omitempty"` 12333 // ContractualRules - A list of rules that you must adhere to if you display the item. 12334 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 12335 // WebSearchURL - The URL To Bing's search result for this item. 12336 WebSearchURL *string `json:"webSearchUrl,omitempty"` 12337 // ID - A String identifier. 12338 ID *string `json:"id,omitempty"` 12339 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 12340 Type TypeBasicResponseBase `json:"_type,omitempty"` 12341} 12342 12343func unmarshalBasicSearchResultsAnswer(body []byte) (BasicSearchResultsAnswer, error) { 12344 var m map[string]interface{} 12345 err := json.Unmarshal(body, &m) 12346 if err != nil { 12347 return nil, err 12348 } 12349 12350 switch m["_type"] { 12351 case string(TypeEntities): 12352 var e Entities 12353 err := json.Unmarshal(body, &e) 12354 return e, err 12355 case string(TypePlaces): 12356 var p Places 12357 err := json.Unmarshal(body, &p) 12358 return p, err 12359 default: 12360 var sra SearchResultsAnswer 12361 err := json.Unmarshal(body, &sra) 12362 return sra, err 12363 } 12364} 12365func unmarshalBasicSearchResultsAnswerArray(body []byte) ([]BasicSearchResultsAnswer, error) { 12366 var rawMessages []*json.RawMessage 12367 err := json.Unmarshal(body, &rawMessages) 12368 if err != nil { 12369 return nil, err 12370 } 12371 12372 sraArray := make([]BasicSearchResultsAnswer, len(rawMessages)) 12373 12374 for index, rawMessage := range rawMessages { 12375 sra, err := unmarshalBasicSearchResultsAnswer(*rawMessage) 12376 if err != nil { 12377 return nil, err 12378 } 12379 sraArray[index] = sra 12380 } 12381 return sraArray, nil 12382} 12383 12384// MarshalJSON is the custom marshaler for SearchResultsAnswer. 12385func (sra SearchResultsAnswer) MarshalJSON() ([]byte, error) { 12386 sra.Type = TypeSearchResultsAnswer 12387 objectMap := make(map[string]interface{}) 12388 if sra.QueryContext != nil { 12389 objectMap["queryContext"] = sra.QueryContext 12390 } 12391 if sra.ContractualRules != nil { 12392 objectMap["contractualRules"] = sra.ContractualRules 12393 } 12394 if sra.WebSearchURL != nil { 12395 objectMap["webSearchUrl"] = sra.WebSearchURL 12396 } 12397 if sra.ID != nil { 12398 objectMap["id"] = sra.ID 12399 } 12400 if sra.Type != "" { 12401 objectMap["_type"] = sra.Type 12402 } 12403 return json.Marshal(objectMap) 12404} 12405 12406// AsImageObject is the BasicResponseBase implementation for SearchResultsAnswer. 12407func (sra SearchResultsAnswer) AsImageObject() (*ImageObject, bool) { 12408 return nil, false 12409} 12410 12411// AsThing is the BasicResponseBase implementation for SearchResultsAnswer. 12412func (sra SearchResultsAnswer) AsThing() (*Thing, bool) { 12413 return nil, false 12414} 12415 12416// AsBasicThing is the BasicResponseBase implementation for SearchResultsAnswer. 12417func (sra SearchResultsAnswer) AsBasicThing() (BasicThing, bool) { 12418 return nil, false 12419} 12420 12421// AsEntities is the BasicResponseBase implementation for SearchResultsAnswer. 12422func (sra SearchResultsAnswer) AsEntities() (*Entities, bool) { 12423 return nil, false 12424} 12425 12426// AsPlaces is the BasicResponseBase implementation for SearchResultsAnswer. 12427func (sra SearchResultsAnswer) AsPlaces() (*Places, bool) { 12428 return nil, false 12429} 12430 12431// AsSearchResponse is the BasicResponseBase implementation for SearchResultsAnswer. 12432func (sra SearchResultsAnswer) AsSearchResponse() (*SearchResponse, bool) { 12433 return nil, false 12434} 12435 12436// AsResponse is the BasicResponseBase implementation for SearchResultsAnswer. 12437func (sra SearchResultsAnswer) AsResponse() (*Response, bool) { 12438 return nil, false 12439} 12440 12441// AsBasicResponse is the BasicResponseBase implementation for SearchResultsAnswer. 12442func (sra SearchResultsAnswer) AsBasicResponse() (BasicResponse, bool) { 12443 return &sra, true 12444} 12445 12446// AsSearchResultsAnswer is the BasicResponseBase implementation for SearchResultsAnswer. 12447func (sra SearchResultsAnswer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 12448 return &sra, true 12449} 12450 12451// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for SearchResultsAnswer. 12452func (sra SearchResultsAnswer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 12453 return &sra, true 12454} 12455 12456// AsIdentifiable is the BasicResponseBase implementation for SearchResultsAnswer. 12457func (sra SearchResultsAnswer) AsIdentifiable() (*Identifiable, bool) { 12458 return nil, false 12459} 12460 12461// AsBasicIdentifiable is the BasicResponseBase implementation for SearchResultsAnswer. 12462func (sra SearchResultsAnswer) AsBasicIdentifiable() (BasicIdentifiable, bool) { 12463 return &sra, true 12464} 12465 12466// AsAnswer is the BasicResponseBase implementation for SearchResultsAnswer. 12467func (sra SearchResultsAnswer) AsAnswer() (*Answer, bool) { 12468 return nil, false 12469} 12470 12471// AsBasicAnswer is the BasicResponseBase implementation for SearchResultsAnswer. 12472func (sra SearchResultsAnswer) AsBasicAnswer() (BasicAnswer, bool) { 12473 return &sra, true 12474} 12475 12476// AsErrorResponse is the BasicResponseBase implementation for SearchResultsAnswer. 12477func (sra SearchResultsAnswer) AsErrorResponse() (*ErrorResponse, bool) { 12478 return nil, false 12479} 12480 12481// AsPostalAddress is the BasicResponseBase implementation for SearchResultsAnswer. 12482func (sra SearchResultsAnswer) AsPostalAddress() (*PostalAddress, bool) { 12483 return nil, false 12484} 12485 12486// AsPlace is the BasicResponseBase implementation for SearchResultsAnswer. 12487func (sra SearchResultsAnswer) AsPlace() (*Place, bool) { 12488 return nil, false 12489} 12490 12491// AsBasicPlace is the BasicResponseBase implementation for SearchResultsAnswer. 12492func (sra SearchResultsAnswer) AsBasicPlace() (BasicPlace, bool) { 12493 return nil, false 12494} 12495 12496// AsOrganization is the BasicResponseBase implementation for SearchResultsAnswer. 12497func (sra SearchResultsAnswer) AsOrganization() (*Organization, bool) { 12498 return nil, false 12499} 12500 12501// AsCreativeWork is the BasicResponseBase implementation for SearchResultsAnswer. 12502func (sra SearchResultsAnswer) AsCreativeWork() (*CreativeWork, bool) { 12503 return nil, false 12504} 12505 12506// AsBasicCreativeWork is the BasicResponseBase implementation for SearchResultsAnswer. 12507func (sra SearchResultsAnswer) AsBasicCreativeWork() (BasicCreativeWork, bool) { 12508 return nil, false 12509} 12510 12511// AsIntangible is the BasicResponseBase implementation for SearchResultsAnswer. 12512func (sra SearchResultsAnswer) AsIntangible() (*Intangible, bool) { 12513 return nil, false 12514} 12515 12516// AsBasicIntangible is the BasicResponseBase implementation for SearchResultsAnswer. 12517func (sra SearchResultsAnswer) AsBasicIntangible() (BasicIntangible, bool) { 12518 return nil, false 12519} 12520 12521// AsMovieTheater is the BasicResponseBase implementation for SearchResultsAnswer. 12522func (sra SearchResultsAnswer) AsMovieTheater() (*MovieTheater, bool) { 12523 return nil, false 12524} 12525 12526// AsMediaObject is the BasicResponseBase implementation for SearchResultsAnswer. 12527func (sra SearchResultsAnswer) AsMediaObject() (*MediaObject, bool) { 12528 return nil, false 12529} 12530 12531// AsBasicMediaObject is the BasicResponseBase implementation for SearchResultsAnswer. 12532func (sra SearchResultsAnswer) AsBasicMediaObject() (BasicMediaObject, bool) { 12533 return nil, false 12534} 12535 12536// AsCivicStructure is the BasicResponseBase implementation for SearchResultsAnswer. 12537func (sra SearchResultsAnswer) AsCivicStructure() (*CivicStructure, bool) { 12538 return nil, false 12539} 12540 12541// AsBasicCivicStructure is the BasicResponseBase implementation for SearchResultsAnswer. 12542func (sra SearchResultsAnswer) AsBasicCivicStructure() (BasicCivicStructure, bool) { 12543 return nil, false 12544} 12545 12546// AsLocalBusiness is the BasicResponseBase implementation for SearchResultsAnswer. 12547func (sra SearchResultsAnswer) AsLocalBusiness() (*LocalBusiness, bool) { 12548 return nil, false 12549} 12550 12551// AsBasicLocalBusiness is the BasicResponseBase implementation for SearchResultsAnswer. 12552func (sra SearchResultsAnswer) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 12553 return nil, false 12554} 12555 12556// AsTouristAttraction is the BasicResponseBase implementation for SearchResultsAnswer. 12557func (sra SearchResultsAnswer) AsTouristAttraction() (*TouristAttraction, bool) { 12558 return nil, false 12559} 12560 12561// AsAirport is the BasicResponseBase implementation for SearchResultsAnswer. 12562func (sra SearchResultsAnswer) AsAirport() (*Airport, bool) { 12563 return nil, false 12564} 12565 12566// AsLicense is the BasicResponseBase implementation for SearchResultsAnswer. 12567func (sra SearchResultsAnswer) AsLicense() (*License, bool) { 12568 return nil, false 12569} 12570 12571// AsStructuredValue is the BasicResponseBase implementation for SearchResultsAnswer. 12572func (sra SearchResultsAnswer) AsStructuredValue() (*StructuredValue, bool) { 12573 return nil, false 12574} 12575 12576// AsBasicStructuredValue is the BasicResponseBase implementation for SearchResultsAnswer. 12577func (sra SearchResultsAnswer) AsBasicStructuredValue() (BasicStructuredValue, bool) { 12578 return nil, false 12579} 12580 12581// AsEntertainmentBusiness is the BasicResponseBase implementation for SearchResultsAnswer. 12582func (sra SearchResultsAnswer) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 12583 return nil, false 12584} 12585 12586// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for SearchResultsAnswer. 12587func (sra SearchResultsAnswer) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 12588 return nil, false 12589} 12590 12591// AsFoodEstablishment is the BasicResponseBase implementation for SearchResultsAnswer. 12592func (sra SearchResultsAnswer) AsFoodEstablishment() (*FoodEstablishment, bool) { 12593 return nil, false 12594} 12595 12596// AsBasicFoodEstablishment is the BasicResponseBase implementation for SearchResultsAnswer. 12597func (sra SearchResultsAnswer) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 12598 return nil, false 12599} 12600 12601// AsLodgingBusiness is the BasicResponseBase implementation for SearchResultsAnswer. 12602func (sra SearchResultsAnswer) AsLodgingBusiness() (*LodgingBusiness, bool) { 12603 return nil, false 12604} 12605 12606// AsBasicLodgingBusiness is the BasicResponseBase implementation for SearchResultsAnswer. 12607func (sra SearchResultsAnswer) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 12608 return nil, false 12609} 12610 12611// AsRestaurant is the BasicResponseBase implementation for SearchResultsAnswer. 12612func (sra SearchResultsAnswer) AsRestaurant() (*Restaurant, bool) { 12613 return nil, false 12614} 12615 12616// AsHotel is the BasicResponseBase implementation for SearchResultsAnswer. 12617func (sra SearchResultsAnswer) AsHotel() (*Hotel, bool) { 12618 return nil, false 12619} 12620 12621// AsResponseBase is the BasicResponseBase implementation for SearchResultsAnswer. 12622func (sra SearchResultsAnswer) AsResponseBase() (*ResponseBase, bool) { 12623 return nil, false 12624} 12625 12626// AsBasicResponseBase is the BasicResponseBase implementation for SearchResultsAnswer. 12627func (sra SearchResultsAnswer) AsBasicResponseBase() (BasicResponseBase, bool) { 12628 return &sra, true 12629} 12630 12631// UnmarshalJSON is the custom unmarshaler for SearchResultsAnswer struct. 12632func (sra *SearchResultsAnswer) UnmarshalJSON(body []byte) error { 12633 var m map[string]*json.RawMessage 12634 err := json.Unmarshal(body, &m) 12635 if err != nil { 12636 return err 12637 } 12638 for k, v := range m { 12639 switch k { 12640 case "queryContext": 12641 if v != nil { 12642 var queryContext QueryContext 12643 err = json.Unmarshal(*v, &queryContext) 12644 if err != nil { 12645 return err 12646 } 12647 sra.QueryContext = &queryContext 12648 } 12649 case "contractualRules": 12650 if v != nil { 12651 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 12652 if err != nil { 12653 return err 12654 } 12655 sra.ContractualRules = &contractualRules 12656 } 12657 case "webSearchUrl": 12658 if v != nil { 12659 var webSearchURL string 12660 err = json.Unmarshal(*v, &webSearchURL) 12661 if err != nil { 12662 return err 12663 } 12664 sra.WebSearchURL = &webSearchURL 12665 } 12666 case "id": 12667 if v != nil { 12668 var ID string 12669 err = json.Unmarshal(*v, &ID) 12670 if err != nil { 12671 return err 12672 } 12673 sra.ID = &ID 12674 } 12675 case "_type": 12676 if v != nil { 12677 var typeVar TypeBasicResponseBase 12678 err = json.Unmarshal(*v, &typeVar) 12679 if err != nil { 12680 return err 12681 } 12682 sra.Type = typeVar 12683 } 12684 } 12685 } 12686 12687 return nil 12688} 12689 12690// BasicStructuredValue ... 12691type BasicStructuredValue interface { 12692 AsPostalAddress() (*PostalAddress, bool) 12693 AsStructuredValue() (*StructuredValue, bool) 12694} 12695 12696// StructuredValue ... 12697type StructuredValue struct { 12698 // Name - The name of the thing represented by this object. 12699 Name *string `json:"name,omitempty"` 12700 // URL - The URL to get more information about the thing represented by this object. 12701 URL *string `json:"url,omitempty"` 12702 Image *ImageObject `json:"image,omitempty"` 12703 // Description - A short description of the item. 12704 Description *string `json:"description,omitempty"` 12705 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 12706 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 12707 // BingID - An ID that uniquely identifies this item. 12708 BingID *string `json:"bingId,omitempty"` 12709 // ContractualRules - A list of rules that you must adhere to if you display the item. 12710 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 12711 // WebSearchURL - The URL To Bing's search result for this item. 12712 WebSearchURL *string `json:"webSearchUrl,omitempty"` 12713 // ID - A String identifier. 12714 ID *string `json:"id,omitempty"` 12715 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 12716 Type TypeBasicResponseBase `json:"_type,omitempty"` 12717} 12718 12719func unmarshalBasicStructuredValue(body []byte) (BasicStructuredValue, error) { 12720 var m map[string]interface{} 12721 err := json.Unmarshal(body, &m) 12722 if err != nil { 12723 return nil, err 12724 } 12725 12726 switch m["_type"] { 12727 case string(TypePostalAddress): 12728 var pa PostalAddress 12729 err := json.Unmarshal(body, &pa) 12730 return pa, err 12731 default: 12732 var sv StructuredValue 12733 err := json.Unmarshal(body, &sv) 12734 return sv, err 12735 } 12736} 12737func unmarshalBasicStructuredValueArray(body []byte) ([]BasicStructuredValue, error) { 12738 var rawMessages []*json.RawMessage 12739 err := json.Unmarshal(body, &rawMessages) 12740 if err != nil { 12741 return nil, err 12742 } 12743 12744 svArray := make([]BasicStructuredValue, len(rawMessages)) 12745 12746 for index, rawMessage := range rawMessages { 12747 sv, err := unmarshalBasicStructuredValue(*rawMessage) 12748 if err != nil { 12749 return nil, err 12750 } 12751 svArray[index] = sv 12752 } 12753 return svArray, nil 12754} 12755 12756// MarshalJSON is the custom marshaler for StructuredValue. 12757func (sv StructuredValue) MarshalJSON() ([]byte, error) { 12758 sv.Type = TypeStructuredValue 12759 objectMap := make(map[string]interface{}) 12760 if sv.Name != nil { 12761 objectMap["name"] = sv.Name 12762 } 12763 if sv.URL != nil { 12764 objectMap["url"] = sv.URL 12765 } 12766 if sv.Image != nil { 12767 objectMap["image"] = sv.Image 12768 } 12769 if sv.Description != nil { 12770 objectMap["description"] = sv.Description 12771 } 12772 if sv.EntityPresentationInfo != nil { 12773 objectMap["entityPresentationInfo"] = sv.EntityPresentationInfo 12774 } 12775 if sv.BingID != nil { 12776 objectMap["bingId"] = sv.BingID 12777 } 12778 if sv.ContractualRules != nil { 12779 objectMap["contractualRules"] = sv.ContractualRules 12780 } 12781 if sv.WebSearchURL != nil { 12782 objectMap["webSearchUrl"] = sv.WebSearchURL 12783 } 12784 if sv.ID != nil { 12785 objectMap["id"] = sv.ID 12786 } 12787 if sv.Type != "" { 12788 objectMap["_type"] = sv.Type 12789 } 12790 return json.Marshal(objectMap) 12791} 12792 12793// AsImageObject is the BasicResponseBase implementation for StructuredValue. 12794func (sv StructuredValue) AsImageObject() (*ImageObject, bool) { 12795 return nil, false 12796} 12797 12798// AsThing is the BasicResponseBase implementation for StructuredValue. 12799func (sv StructuredValue) AsThing() (*Thing, bool) { 12800 return nil, false 12801} 12802 12803// AsBasicThing is the BasicResponseBase implementation for StructuredValue. 12804func (sv StructuredValue) AsBasicThing() (BasicThing, bool) { 12805 return &sv, true 12806} 12807 12808// AsEntities is the BasicResponseBase implementation for StructuredValue. 12809func (sv StructuredValue) AsEntities() (*Entities, bool) { 12810 return nil, false 12811} 12812 12813// AsPlaces is the BasicResponseBase implementation for StructuredValue. 12814func (sv StructuredValue) AsPlaces() (*Places, bool) { 12815 return nil, false 12816} 12817 12818// AsSearchResponse is the BasicResponseBase implementation for StructuredValue. 12819func (sv StructuredValue) AsSearchResponse() (*SearchResponse, bool) { 12820 return nil, false 12821} 12822 12823// AsResponse is the BasicResponseBase implementation for StructuredValue. 12824func (sv StructuredValue) AsResponse() (*Response, bool) { 12825 return nil, false 12826} 12827 12828// AsBasicResponse is the BasicResponseBase implementation for StructuredValue. 12829func (sv StructuredValue) AsBasicResponse() (BasicResponse, bool) { 12830 return &sv, true 12831} 12832 12833// AsSearchResultsAnswer is the BasicResponseBase implementation for StructuredValue. 12834func (sv StructuredValue) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 12835 return nil, false 12836} 12837 12838// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for StructuredValue. 12839func (sv StructuredValue) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 12840 return nil, false 12841} 12842 12843// AsIdentifiable is the BasicResponseBase implementation for StructuredValue. 12844func (sv StructuredValue) AsIdentifiable() (*Identifiable, bool) { 12845 return nil, false 12846} 12847 12848// AsBasicIdentifiable is the BasicResponseBase implementation for StructuredValue. 12849func (sv StructuredValue) AsBasicIdentifiable() (BasicIdentifiable, bool) { 12850 return &sv, true 12851} 12852 12853// AsAnswer is the BasicResponseBase implementation for StructuredValue. 12854func (sv StructuredValue) AsAnswer() (*Answer, bool) { 12855 return nil, false 12856} 12857 12858// AsBasicAnswer is the BasicResponseBase implementation for StructuredValue. 12859func (sv StructuredValue) AsBasicAnswer() (BasicAnswer, bool) { 12860 return nil, false 12861} 12862 12863// AsErrorResponse is the BasicResponseBase implementation for StructuredValue. 12864func (sv StructuredValue) AsErrorResponse() (*ErrorResponse, bool) { 12865 return nil, false 12866} 12867 12868// AsPostalAddress is the BasicResponseBase implementation for StructuredValue. 12869func (sv StructuredValue) AsPostalAddress() (*PostalAddress, bool) { 12870 return nil, false 12871} 12872 12873// AsPlace is the BasicResponseBase implementation for StructuredValue. 12874func (sv StructuredValue) AsPlace() (*Place, bool) { 12875 return nil, false 12876} 12877 12878// AsBasicPlace is the BasicResponseBase implementation for StructuredValue. 12879func (sv StructuredValue) AsBasicPlace() (BasicPlace, bool) { 12880 return nil, false 12881} 12882 12883// AsOrganization is the BasicResponseBase implementation for StructuredValue. 12884func (sv StructuredValue) AsOrganization() (*Organization, bool) { 12885 return nil, false 12886} 12887 12888// AsCreativeWork is the BasicResponseBase implementation for StructuredValue. 12889func (sv StructuredValue) AsCreativeWork() (*CreativeWork, bool) { 12890 return nil, false 12891} 12892 12893// AsBasicCreativeWork is the BasicResponseBase implementation for StructuredValue. 12894func (sv StructuredValue) AsBasicCreativeWork() (BasicCreativeWork, bool) { 12895 return nil, false 12896} 12897 12898// AsIntangible is the BasicResponseBase implementation for StructuredValue. 12899func (sv StructuredValue) AsIntangible() (*Intangible, bool) { 12900 return nil, false 12901} 12902 12903// AsBasicIntangible is the BasicResponseBase implementation for StructuredValue. 12904func (sv StructuredValue) AsBasicIntangible() (BasicIntangible, bool) { 12905 return &sv, true 12906} 12907 12908// AsMovieTheater is the BasicResponseBase implementation for StructuredValue. 12909func (sv StructuredValue) AsMovieTheater() (*MovieTheater, bool) { 12910 return nil, false 12911} 12912 12913// AsMediaObject is the BasicResponseBase implementation for StructuredValue. 12914func (sv StructuredValue) AsMediaObject() (*MediaObject, bool) { 12915 return nil, false 12916} 12917 12918// AsBasicMediaObject is the BasicResponseBase implementation for StructuredValue. 12919func (sv StructuredValue) AsBasicMediaObject() (BasicMediaObject, bool) { 12920 return nil, false 12921} 12922 12923// AsCivicStructure is the BasicResponseBase implementation for StructuredValue. 12924func (sv StructuredValue) AsCivicStructure() (*CivicStructure, bool) { 12925 return nil, false 12926} 12927 12928// AsBasicCivicStructure is the BasicResponseBase implementation for StructuredValue. 12929func (sv StructuredValue) AsBasicCivicStructure() (BasicCivicStructure, bool) { 12930 return nil, false 12931} 12932 12933// AsLocalBusiness is the BasicResponseBase implementation for StructuredValue. 12934func (sv StructuredValue) AsLocalBusiness() (*LocalBusiness, bool) { 12935 return nil, false 12936} 12937 12938// AsBasicLocalBusiness is the BasicResponseBase implementation for StructuredValue. 12939func (sv StructuredValue) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 12940 return nil, false 12941} 12942 12943// AsTouristAttraction is the BasicResponseBase implementation for StructuredValue. 12944func (sv StructuredValue) AsTouristAttraction() (*TouristAttraction, bool) { 12945 return nil, false 12946} 12947 12948// AsAirport is the BasicResponseBase implementation for StructuredValue. 12949func (sv StructuredValue) AsAirport() (*Airport, bool) { 12950 return nil, false 12951} 12952 12953// AsLicense is the BasicResponseBase implementation for StructuredValue. 12954func (sv StructuredValue) AsLicense() (*License, bool) { 12955 return nil, false 12956} 12957 12958// AsStructuredValue is the BasicResponseBase implementation for StructuredValue. 12959func (sv StructuredValue) AsStructuredValue() (*StructuredValue, bool) { 12960 return &sv, true 12961} 12962 12963// AsBasicStructuredValue is the BasicResponseBase implementation for StructuredValue. 12964func (sv StructuredValue) AsBasicStructuredValue() (BasicStructuredValue, bool) { 12965 return &sv, true 12966} 12967 12968// AsEntertainmentBusiness is the BasicResponseBase implementation for StructuredValue. 12969func (sv StructuredValue) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 12970 return nil, false 12971} 12972 12973// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for StructuredValue. 12974func (sv StructuredValue) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 12975 return nil, false 12976} 12977 12978// AsFoodEstablishment is the BasicResponseBase implementation for StructuredValue. 12979func (sv StructuredValue) AsFoodEstablishment() (*FoodEstablishment, bool) { 12980 return nil, false 12981} 12982 12983// AsBasicFoodEstablishment is the BasicResponseBase implementation for StructuredValue. 12984func (sv StructuredValue) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 12985 return nil, false 12986} 12987 12988// AsLodgingBusiness is the BasicResponseBase implementation for StructuredValue. 12989func (sv StructuredValue) AsLodgingBusiness() (*LodgingBusiness, bool) { 12990 return nil, false 12991} 12992 12993// AsBasicLodgingBusiness is the BasicResponseBase implementation for StructuredValue. 12994func (sv StructuredValue) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 12995 return nil, false 12996} 12997 12998// AsRestaurant is the BasicResponseBase implementation for StructuredValue. 12999func (sv StructuredValue) AsRestaurant() (*Restaurant, bool) { 13000 return nil, false 13001} 13002 13003// AsHotel is the BasicResponseBase implementation for StructuredValue. 13004func (sv StructuredValue) AsHotel() (*Hotel, bool) { 13005 return nil, false 13006} 13007 13008// AsResponseBase is the BasicResponseBase implementation for StructuredValue. 13009func (sv StructuredValue) AsResponseBase() (*ResponseBase, bool) { 13010 return nil, false 13011} 13012 13013// AsBasicResponseBase is the BasicResponseBase implementation for StructuredValue. 13014func (sv StructuredValue) AsBasicResponseBase() (BasicResponseBase, bool) { 13015 return &sv, true 13016} 13017 13018// UnmarshalJSON is the custom unmarshaler for StructuredValue struct. 13019func (sv *StructuredValue) UnmarshalJSON(body []byte) error { 13020 var m map[string]*json.RawMessage 13021 err := json.Unmarshal(body, &m) 13022 if err != nil { 13023 return err 13024 } 13025 for k, v := range m { 13026 switch k { 13027 case "name": 13028 if v != nil { 13029 var name string 13030 err = json.Unmarshal(*v, &name) 13031 if err != nil { 13032 return err 13033 } 13034 sv.Name = &name 13035 } 13036 case "url": 13037 if v != nil { 13038 var URL string 13039 err = json.Unmarshal(*v, &URL) 13040 if err != nil { 13041 return err 13042 } 13043 sv.URL = &URL 13044 } 13045 case "image": 13046 if v != nil { 13047 var imageVar ImageObject 13048 err = json.Unmarshal(*v, &imageVar) 13049 if err != nil { 13050 return err 13051 } 13052 sv.Image = &imageVar 13053 } 13054 case "description": 13055 if v != nil { 13056 var description string 13057 err = json.Unmarshal(*v, &description) 13058 if err != nil { 13059 return err 13060 } 13061 sv.Description = &description 13062 } 13063 case "entityPresentationInfo": 13064 if v != nil { 13065 var entityPresentationInfo EntitiesEntityPresentationInfo 13066 err = json.Unmarshal(*v, &entityPresentationInfo) 13067 if err != nil { 13068 return err 13069 } 13070 sv.EntityPresentationInfo = &entityPresentationInfo 13071 } 13072 case "bingId": 13073 if v != nil { 13074 var bingID string 13075 err = json.Unmarshal(*v, &bingID) 13076 if err != nil { 13077 return err 13078 } 13079 sv.BingID = &bingID 13080 } 13081 case "contractualRules": 13082 if v != nil { 13083 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 13084 if err != nil { 13085 return err 13086 } 13087 sv.ContractualRules = &contractualRules 13088 } 13089 case "webSearchUrl": 13090 if v != nil { 13091 var webSearchURL string 13092 err = json.Unmarshal(*v, &webSearchURL) 13093 if err != nil { 13094 return err 13095 } 13096 sv.WebSearchURL = &webSearchURL 13097 } 13098 case "id": 13099 if v != nil { 13100 var ID string 13101 err = json.Unmarshal(*v, &ID) 13102 if err != nil { 13103 return err 13104 } 13105 sv.ID = &ID 13106 } 13107 case "_type": 13108 if v != nil { 13109 var typeVar TypeBasicResponseBase 13110 err = json.Unmarshal(*v, &typeVar) 13111 if err != nil { 13112 return err 13113 } 13114 sv.Type = typeVar 13115 } 13116 } 13117 } 13118 13119 return nil 13120} 13121 13122// BasicThing ... 13123type BasicThing interface { 13124 AsImageObject() (*ImageObject, bool) 13125 AsPostalAddress() (*PostalAddress, bool) 13126 AsPlace() (*Place, bool) 13127 AsBasicPlace() (BasicPlace, bool) 13128 AsOrganization() (*Organization, bool) 13129 AsCreativeWork() (*CreativeWork, bool) 13130 AsBasicCreativeWork() (BasicCreativeWork, bool) 13131 AsIntangible() (*Intangible, bool) 13132 AsBasicIntangible() (BasicIntangible, bool) 13133 AsMovieTheater() (*MovieTheater, bool) 13134 AsMediaObject() (*MediaObject, bool) 13135 AsBasicMediaObject() (BasicMediaObject, bool) 13136 AsCivicStructure() (*CivicStructure, bool) 13137 AsBasicCivicStructure() (BasicCivicStructure, bool) 13138 AsLocalBusiness() (*LocalBusiness, bool) 13139 AsBasicLocalBusiness() (BasicLocalBusiness, bool) 13140 AsTouristAttraction() (*TouristAttraction, bool) 13141 AsAirport() (*Airport, bool) 13142 AsLicense() (*License, bool) 13143 AsStructuredValue() (*StructuredValue, bool) 13144 AsBasicStructuredValue() (BasicStructuredValue, bool) 13145 AsEntertainmentBusiness() (*EntertainmentBusiness, bool) 13146 AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) 13147 AsFoodEstablishment() (*FoodEstablishment, bool) 13148 AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) 13149 AsLodgingBusiness() (*LodgingBusiness, bool) 13150 AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) 13151 AsRestaurant() (*Restaurant, bool) 13152 AsHotel() (*Hotel, bool) 13153 AsThing() (*Thing, bool) 13154} 13155 13156// Thing ... 13157type Thing struct { 13158 // Name - The name of the thing represented by this object. 13159 Name *string `json:"name,omitempty"` 13160 // URL - The URL to get more information about the thing represented by this object. 13161 URL *string `json:"url,omitempty"` 13162 Image *ImageObject `json:"image,omitempty"` 13163 // Description - A short description of the item. 13164 Description *string `json:"description,omitempty"` 13165 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 13166 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 13167 // BingID - An ID that uniquely identifies this item. 13168 BingID *string `json:"bingId,omitempty"` 13169 // ContractualRules - A list of rules that you must adhere to if you display the item. 13170 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 13171 // WebSearchURL - The URL To Bing's search result for this item. 13172 WebSearchURL *string `json:"webSearchUrl,omitempty"` 13173 // ID - A String identifier. 13174 ID *string `json:"id,omitempty"` 13175 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 13176 Type TypeBasicResponseBase `json:"_type,omitempty"` 13177} 13178 13179func unmarshalBasicThing(body []byte) (BasicThing, error) { 13180 var m map[string]interface{} 13181 err := json.Unmarshal(body, &m) 13182 if err != nil { 13183 return nil, err 13184 } 13185 13186 switch m["_type"] { 13187 case string(TypeImageObject): 13188 var ioVar ImageObject 13189 err := json.Unmarshal(body, &ioVar) 13190 return ioVar, err 13191 case string(TypePostalAddress): 13192 var pa PostalAddress 13193 err := json.Unmarshal(body, &pa) 13194 return pa, err 13195 case string(TypePlace): 13196 var p Place 13197 err := json.Unmarshal(body, &p) 13198 return p, err 13199 case string(TypeOrganization): 13200 var o Organization 13201 err := json.Unmarshal(body, &o) 13202 return o, err 13203 case string(TypeCreativeWork): 13204 var cw CreativeWork 13205 err := json.Unmarshal(body, &cw) 13206 return cw, err 13207 case string(TypeIntangible): 13208 var i Intangible 13209 err := json.Unmarshal(body, &i) 13210 return i, err 13211 case string(TypeMovieTheater): 13212 var mt MovieTheater 13213 err := json.Unmarshal(body, &mt) 13214 return mt, err 13215 case string(TypeMediaObject): 13216 var mo MediaObject 13217 err := json.Unmarshal(body, &mo) 13218 return mo, err 13219 case string(TypeCivicStructure): 13220 var cs CivicStructure 13221 err := json.Unmarshal(body, &cs) 13222 return cs, err 13223 case string(TypeLocalBusiness): 13224 var lb LocalBusiness 13225 err := json.Unmarshal(body, &lb) 13226 return lb, err 13227 case string(TypeTouristAttraction): 13228 var ta TouristAttraction 13229 err := json.Unmarshal(body, &ta) 13230 return ta, err 13231 case string(TypeAirport): 13232 var a Airport 13233 err := json.Unmarshal(body, &a) 13234 return a, err 13235 case string(TypeLicense): 13236 var l License 13237 err := json.Unmarshal(body, &l) 13238 return l, err 13239 case string(TypeStructuredValue): 13240 var sv StructuredValue 13241 err := json.Unmarshal(body, &sv) 13242 return sv, err 13243 case string(TypeEntertainmentBusiness): 13244 var eb EntertainmentBusiness 13245 err := json.Unmarshal(body, &eb) 13246 return eb, err 13247 case string(TypeFoodEstablishment): 13248 var fe FoodEstablishment 13249 err := json.Unmarshal(body, &fe) 13250 return fe, err 13251 case string(TypeLodgingBusiness): 13252 var lb LodgingBusiness 13253 err := json.Unmarshal(body, &lb) 13254 return lb, err 13255 case string(TypeRestaurant): 13256 var r Restaurant 13257 err := json.Unmarshal(body, &r) 13258 return r, err 13259 case string(TypeHotel): 13260 var h Hotel 13261 err := json.Unmarshal(body, &h) 13262 return h, err 13263 default: 13264 var t Thing 13265 err := json.Unmarshal(body, &t) 13266 return t, err 13267 } 13268} 13269func unmarshalBasicThingArray(body []byte) ([]BasicThing, error) { 13270 var rawMessages []*json.RawMessage 13271 err := json.Unmarshal(body, &rawMessages) 13272 if err != nil { 13273 return nil, err 13274 } 13275 13276 tArray := make([]BasicThing, len(rawMessages)) 13277 13278 for index, rawMessage := range rawMessages { 13279 t, err := unmarshalBasicThing(*rawMessage) 13280 if err != nil { 13281 return nil, err 13282 } 13283 tArray[index] = t 13284 } 13285 return tArray, nil 13286} 13287 13288// MarshalJSON is the custom marshaler for Thing. 13289func (t Thing) MarshalJSON() ([]byte, error) { 13290 t.Type = TypeThing 13291 objectMap := make(map[string]interface{}) 13292 if t.Name != nil { 13293 objectMap["name"] = t.Name 13294 } 13295 if t.URL != nil { 13296 objectMap["url"] = t.URL 13297 } 13298 if t.Image != nil { 13299 objectMap["image"] = t.Image 13300 } 13301 if t.Description != nil { 13302 objectMap["description"] = t.Description 13303 } 13304 if t.EntityPresentationInfo != nil { 13305 objectMap["entityPresentationInfo"] = t.EntityPresentationInfo 13306 } 13307 if t.BingID != nil { 13308 objectMap["bingId"] = t.BingID 13309 } 13310 if t.ContractualRules != nil { 13311 objectMap["contractualRules"] = t.ContractualRules 13312 } 13313 if t.WebSearchURL != nil { 13314 objectMap["webSearchUrl"] = t.WebSearchURL 13315 } 13316 if t.ID != nil { 13317 objectMap["id"] = t.ID 13318 } 13319 if t.Type != "" { 13320 objectMap["_type"] = t.Type 13321 } 13322 return json.Marshal(objectMap) 13323} 13324 13325// AsImageObject is the BasicResponseBase implementation for Thing. 13326func (t Thing) AsImageObject() (*ImageObject, bool) { 13327 return nil, false 13328} 13329 13330// AsThing is the BasicResponseBase implementation for Thing. 13331func (t Thing) AsThing() (*Thing, bool) { 13332 return &t, true 13333} 13334 13335// AsBasicThing is the BasicResponseBase implementation for Thing. 13336func (t Thing) AsBasicThing() (BasicThing, bool) { 13337 return &t, true 13338} 13339 13340// AsEntities is the BasicResponseBase implementation for Thing. 13341func (t Thing) AsEntities() (*Entities, bool) { 13342 return nil, false 13343} 13344 13345// AsPlaces is the BasicResponseBase implementation for Thing. 13346func (t Thing) AsPlaces() (*Places, bool) { 13347 return nil, false 13348} 13349 13350// AsSearchResponse is the BasicResponseBase implementation for Thing. 13351func (t Thing) AsSearchResponse() (*SearchResponse, bool) { 13352 return nil, false 13353} 13354 13355// AsResponse is the BasicResponseBase implementation for Thing. 13356func (t Thing) AsResponse() (*Response, bool) { 13357 return nil, false 13358} 13359 13360// AsBasicResponse is the BasicResponseBase implementation for Thing. 13361func (t Thing) AsBasicResponse() (BasicResponse, bool) { 13362 return &t, true 13363} 13364 13365// AsSearchResultsAnswer is the BasicResponseBase implementation for Thing. 13366func (t Thing) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 13367 return nil, false 13368} 13369 13370// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Thing. 13371func (t Thing) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 13372 return nil, false 13373} 13374 13375// AsIdentifiable is the BasicResponseBase implementation for Thing. 13376func (t Thing) AsIdentifiable() (*Identifiable, bool) { 13377 return nil, false 13378} 13379 13380// AsBasicIdentifiable is the BasicResponseBase implementation for Thing. 13381func (t Thing) AsBasicIdentifiable() (BasicIdentifiable, bool) { 13382 return &t, true 13383} 13384 13385// AsAnswer is the BasicResponseBase implementation for Thing. 13386func (t Thing) AsAnswer() (*Answer, bool) { 13387 return nil, false 13388} 13389 13390// AsBasicAnswer is the BasicResponseBase implementation for Thing. 13391func (t Thing) AsBasicAnswer() (BasicAnswer, bool) { 13392 return nil, false 13393} 13394 13395// AsErrorResponse is the BasicResponseBase implementation for Thing. 13396func (t Thing) AsErrorResponse() (*ErrorResponse, bool) { 13397 return nil, false 13398} 13399 13400// AsPostalAddress is the BasicResponseBase implementation for Thing. 13401func (t Thing) AsPostalAddress() (*PostalAddress, bool) { 13402 return nil, false 13403} 13404 13405// AsPlace is the BasicResponseBase implementation for Thing. 13406func (t Thing) AsPlace() (*Place, bool) { 13407 return nil, false 13408} 13409 13410// AsBasicPlace is the BasicResponseBase implementation for Thing. 13411func (t Thing) AsBasicPlace() (BasicPlace, bool) { 13412 return nil, false 13413} 13414 13415// AsOrganization is the BasicResponseBase implementation for Thing. 13416func (t Thing) AsOrganization() (*Organization, bool) { 13417 return nil, false 13418} 13419 13420// AsCreativeWork is the BasicResponseBase implementation for Thing. 13421func (t Thing) AsCreativeWork() (*CreativeWork, bool) { 13422 return nil, false 13423} 13424 13425// AsBasicCreativeWork is the BasicResponseBase implementation for Thing. 13426func (t Thing) AsBasicCreativeWork() (BasicCreativeWork, bool) { 13427 return nil, false 13428} 13429 13430// AsIntangible is the BasicResponseBase implementation for Thing. 13431func (t Thing) AsIntangible() (*Intangible, bool) { 13432 return nil, false 13433} 13434 13435// AsBasicIntangible is the BasicResponseBase implementation for Thing. 13436func (t Thing) AsBasicIntangible() (BasicIntangible, bool) { 13437 return nil, false 13438} 13439 13440// AsMovieTheater is the BasicResponseBase implementation for Thing. 13441func (t Thing) AsMovieTheater() (*MovieTheater, bool) { 13442 return nil, false 13443} 13444 13445// AsMediaObject is the BasicResponseBase implementation for Thing. 13446func (t Thing) AsMediaObject() (*MediaObject, bool) { 13447 return nil, false 13448} 13449 13450// AsBasicMediaObject is the BasicResponseBase implementation for Thing. 13451func (t Thing) AsBasicMediaObject() (BasicMediaObject, bool) { 13452 return nil, false 13453} 13454 13455// AsCivicStructure is the BasicResponseBase implementation for Thing. 13456func (t Thing) AsCivicStructure() (*CivicStructure, bool) { 13457 return nil, false 13458} 13459 13460// AsBasicCivicStructure is the BasicResponseBase implementation for Thing. 13461func (t Thing) AsBasicCivicStructure() (BasicCivicStructure, bool) { 13462 return nil, false 13463} 13464 13465// AsLocalBusiness is the BasicResponseBase implementation for Thing. 13466func (t Thing) AsLocalBusiness() (*LocalBusiness, bool) { 13467 return nil, false 13468} 13469 13470// AsBasicLocalBusiness is the BasicResponseBase implementation for Thing. 13471func (t Thing) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 13472 return nil, false 13473} 13474 13475// AsTouristAttraction is the BasicResponseBase implementation for Thing. 13476func (t Thing) AsTouristAttraction() (*TouristAttraction, bool) { 13477 return nil, false 13478} 13479 13480// AsAirport is the BasicResponseBase implementation for Thing. 13481func (t Thing) AsAirport() (*Airport, bool) { 13482 return nil, false 13483} 13484 13485// AsLicense is the BasicResponseBase implementation for Thing. 13486func (t Thing) AsLicense() (*License, bool) { 13487 return nil, false 13488} 13489 13490// AsStructuredValue is the BasicResponseBase implementation for Thing. 13491func (t Thing) AsStructuredValue() (*StructuredValue, bool) { 13492 return nil, false 13493} 13494 13495// AsBasicStructuredValue is the BasicResponseBase implementation for Thing. 13496func (t Thing) AsBasicStructuredValue() (BasicStructuredValue, bool) { 13497 return nil, false 13498} 13499 13500// AsEntertainmentBusiness is the BasicResponseBase implementation for Thing. 13501func (t Thing) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 13502 return nil, false 13503} 13504 13505// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for Thing. 13506func (t Thing) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 13507 return nil, false 13508} 13509 13510// AsFoodEstablishment is the BasicResponseBase implementation for Thing. 13511func (t Thing) AsFoodEstablishment() (*FoodEstablishment, bool) { 13512 return nil, false 13513} 13514 13515// AsBasicFoodEstablishment is the BasicResponseBase implementation for Thing. 13516func (t Thing) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 13517 return nil, false 13518} 13519 13520// AsLodgingBusiness is the BasicResponseBase implementation for Thing. 13521func (t Thing) AsLodgingBusiness() (*LodgingBusiness, bool) { 13522 return nil, false 13523} 13524 13525// AsBasicLodgingBusiness is the BasicResponseBase implementation for Thing. 13526func (t Thing) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 13527 return nil, false 13528} 13529 13530// AsRestaurant is the BasicResponseBase implementation for Thing. 13531func (t Thing) AsRestaurant() (*Restaurant, bool) { 13532 return nil, false 13533} 13534 13535// AsHotel is the BasicResponseBase implementation for Thing. 13536func (t Thing) AsHotel() (*Hotel, bool) { 13537 return nil, false 13538} 13539 13540// AsResponseBase is the BasicResponseBase implementation for Thing. 13541func (t Thing) AsResponseBase() (*ResponseBase, bool) { 13542 return nil, false 13543} 13544 13545// AsBasicResponseBase is the BasicResponseBase implementation for Thing. 13546func (t Thing) AsBasicResponseBase() (BasicResponseBase, bool) { 13547 return &t, true 13548} 13549 13550// UnmarshalJSON is the custom unmarshaler for Thing struct. 13551func (t *Thing) UnmarshalJSON(body []byte) error { 13552 var m map[string]*json.RawMessage 13553 err := json.Unmarshal(body, &m) 13554 if err != nil { 13555 return err 13556 } 13557 for k, v := range m { 13558 switch k { 13559 case "name": 13560 if v != nil { 13561 var name string 13562 err = json.Unmarshal(*v, &name) 13563 if err != nil { 13564 return err 13565 } 13566 t.Name = &name 13567 } 13568 case "url": 13569 if v != nil { 13570 var URL string 13571 err = json.Unmarshal(*v, &URL) 13572 if err != nil { 13573 return err 13574 } 13575 t.URL = &URL 13576 } 13577 case "image": 13578 if v != nil { 13579 var imageVar ImageObject 13580 err = json.Unmarshal(*v, &imageVar) 13581 if err != nil { 13582 return err 13583 } 13584 t.Image = &imageVar 13585 } 13586 case "description": 13587 if v != nil { 13588 var description string 13589 err = json.Unmarshal(*v, &description) 13590 if err != nil { 13591 return err 13592 } 13593 t.Description = &description 13594 } 13595 case "entityPresentationInfo": 13596 if v != nil { 13597 var entityPresentationInfo EntitiesEntityPresentationInfo 13598 err = json.Unmarshal(*v, &entityPresentationInfo) 13599 if err != nil { 13600 return err 13601 } 13602 t.EntityPresentationInfo = &entityPresentationInfo 13603 } 13604 case "bingId": 13605 if v != nil { 13606 var bingID string 13607 err = json.Unmarshal(*v, &bingID) 13608 if err != nil { 13609 return err 13610 } 13611 t.BingID = &bingID 13612 } 13613 case "contractualRules": 13614 if v != nil { 13615 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 13616 if err != nil { 13617 return err 13618 } 13619 t.ContractualRules = &contractualRules 13620 } 13621 case "webSearchUrl": 13622 if v != nil { 13623 var webSearchURL string 13624 err = json.Unmarshal(*v, &webSearchURL) 13625 if err != nil { 13626 return err 13627 } 13628 t.WebSearchURL = &webSearchURL 13629 } 13630 case "id": 13631 if v != nil { 13632 var ID string 13633 err = json.Unmarshal(*v, &ID) 13634 if err != nil { 13635 return err 13636 } 13637 t.ID = &ID 13638 } 13639 case "_type": 13640 if v != nil { 13641 var typeVar TypeBasicResponseBase 13642 err = json.Unmarshal(*v, &typeVar) 13643 if err != nil { 13644 return err 13645 } 13646 t.Type = typeVar 13647 } 13648 } 13649 } 13650 13651 return nil 13652} 13653 13654// TouristAttraction ... 13655type TouristAttraction struct { 13656 // Address - The postal address of where the entity is located 13657 Address *PostalAddress `json:"address,omitempty"` 13658 // Telephone - The entity's telephone number 13659 Telephone *string `json:"telephone,omitempty"` 13660 // Name - The name of the thing represented by this object. 13661 Name *string `json:"name,omitempty"` 13662 // URL - The URL to get more information about the thing represented by this object. 13663 URL *string `json:"url,omitempty"` 13664 Image *ImageObject `json:"image,omitempty"` 13665 // Description - A short description of the item. 13666 Description *string `json:"description,omitempty"` 13667 // EntityPresentationInfo - Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields. 13668 EntityPresentationInfo *EntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"` 13669 // BingID - An ID that uniquely identifies this item. 13670 BingID *string `json:"bingId,omitempty"` 13671 // ContractualRules - A list of rules that you must adhere to if you display the item. 13672 ContractualRules *[]BasicContractualRulesContractualRule `json:"contractualRules,omitempty"` 13673 // WebSearchURL - The URL To Bing's search result for this item. 13674 WebSearchURL *string `json:"webSearchUrl,omitempty"` 13675 // ID - A String identifier. 13676 ID *string `json:"id,omitempty"` 13677 // Type - Possible values include: 'TypeResponseBase', 'TypeImageObject', 'TypeThing', 'TypeEntities', 'TypePlaces', 'TypeSearchResponse', 'TypeResponse', 'TypeSearchResultsAnswer', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypePostalAddress', 'TypePlace', 'TypeOrganization', 'TypeCreativeWork', 'TypeIntangible', 'TypeMovieTheater', 'TypeMediaObject', 'TypeCivicStructure', 'TypeLocalBusiness', 'TypeTouristAttraction', 'TypeAirport', 'TypeLicense', 'TypeStructuredValue', 'TypeEntertainmentBusiness', 'TypeFoodEstablishment', 'TypeLodgingBusiness', 'TypeRestaurant', 'TypeHotel' 13678 Type TypeBasicResponseBase `json:"_type,omitempty"` 13679} 13680 13681// MarshalJSON is the custom marshaler for TouristAttraction. 13682func (ta TouristAttraction) MarshalJSON() ([]byte, error) { 13683 ta.Type = TypeTouristAttraction 13684 objectMap := make(map[string]interface{}) 13685 if ta.Address != nil { 13686 objectMap["address"] = ta.Address 13687 } 13688 if ta.Telephone != nil { 13689 objectMap["telephone"] = ta.Telephone 13690 } 13691 if ta.Name != nil { 13692 objectMap["name"] = ta.Name 13693 } 13694 if ta.URL != nil { 13695 objectMap["url"] = ta.URL 13696 } 13697 if ta.Image != nil { 13698 objectMap["image"] = ta.Image 13699 } 13700 if ta.Description != nil { 13701 objectMap["description"] = ta.Description 13702 } 13703 if ta.EntityPresentationInfo != nil { 13704 objectMap["entityPresentationInfo"] = ta.EntityPresentationInfo 13705 } 13706 if ta.BingID != nil { 13707 objectMap["bingId"] = ta.BingID 13708 } 13709 if ta.ContractualRules != nil { 13710 objectMap["contractualRules"] = ta.ContractualRules 13711 } 13712 if ta.WebSearchURL != nil { 13713 objectMap["webSearchUrl"] = ta.WebSearchURL 13714 } 13715 if ta.ID != nil { 13716 objectMap["id"] = ta.ID 13717 } 13718 if ta.Type != "" { 13719 objectMap["_type"] = ta.Type 13720 } 13721 return json.Marshal(objectMap) 13722} 13723 13724// AsImageObject is the BasicResponseBase implementation for TouristAttraction. 13725func (ta TouristAttraction) AsImageObject() (*ImageObject, bool) { 13726 return nil, false 13727} 13728 13729// AsThing is the BasicResponseBase implementation for TouristAttraction. 13730func (ta TouristAttraction) AsThing() (*Thing, bool) { 13731 return nil, false 13732} 13733 13734// AsBasicThing is the BasicResponseBase implementation for TouristAttraction. 13735func (ta TouristAttraction) AsBasicThing() (BasicThing, bool) { 13736 return &ta, true 13737} 13738 13739// AsEntities is the BasicResponseBase implementation for TouristAttraction. 13740func (ta TouristAttraction) AsEntities() (*Entities, bool) { 13741 return nil, false 13742} 13743 13744// AsPlaces is the BasicResponseBase implementation for TouristAttraction. 13745func (ta TouristAttraction) AsPlaces() (*Places, bool) { 13746 return nil, false 13747} 13748 13749// AsSearchResponse is the BasicResponseBase implementation for TouristAttraction. 13750func (ta TouristAttraction) AsSearchResponse() (*SearchResponse, bool) { 13751 return nil, false 13752} 13753 13754// AsResponse is the BasicResponseBase implementation for TouristAttraction. 13755func (ta TouristAttraction) AsResponse() (*Response, bool) { 13756 return nil, false 13757} 13758 13759// AsBasicResponse is the BasicResponseBase implementation for TouristAttraction. 13760func (ta TouristAttraction) AsBasicResponse() (BasicResponse, bool) { 13761 return &ta, true 13762} 13763 13764// AsSearchResultsAnswer is the BasicResponseBase implementation for TouristAttraction. 13765func (ta TouristAttraction) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) { 13766 return nil, false 13767} 13768 13769// AsBasicSearchResultsAnswer is the BasicResponseBase implementation for TouristAttraction. 13770func (ta TouristAttraction) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) { 13771 return nil, false 13772} 13773 13774// AsIdentifiable is the BasicResponseBase implementation for TouristAttraction. 13775func (ta TouristAttraction) AsIdentifiable() (*Identifiable, bool) { 13776 return nil, false 13777} 13778 13779// AsBasicIdentifiable is the BasicResponseBase implementation for TouristAttraction. 13780func (ta TouristAttraction) AsBasicIdentifiable() (BasicIdentifiable, bool) { 13781 return &ta, true 13782} 13783 13784// AsAnswer is the BasicResponseBase implementation for TouristAttraction. 13785func (ta TouristAttraction) AsAnswer() (*Answer, bool) { 13786 return nil, false 13787} 13788 13789// AsBasicAnswer is the BasicResponseBase implementation for TouristAttraction. 13790func (ta TouristAttraction) AsBasicAnswer() (BasicAnswer, bool) { 13791 return nil, false 13792} 13793 13794// AsErrorResponse is the BasicResponseBase implementation for TouristAttraction. 13795func (ta TouristAttraction) AsErrorResponse() (*ErrorResponse, bool) { 13796 return nil, false 13797} 13798 13799// AsPostalAddress is the BasicResponseBase implementation for TouristAttraction. 13800func (ta TouristAttraction) AsPostalAddress() (*PostalAddress, bool) { 13801 return nil, false 13802} 13803 13804// AsPlace is the BasicResponseBase implementation for TouristAttraction. 13805func (ta TouristAttraction) AsPlace() (*Place, bool) { 13806 return nil, false 13807} 13808 13809// AsBasicPlace is the BasicResponseBase implementation for TouristAttraction. 13810func (ta TouristAttraction) AsBasicPlace() (BasicPlace, bool) { 13811 return &ta, true 13812} 13813 13814// AsOrganization is the BasicResponseBase implementation for TouristAttraction. 13815func (ta TouristAttraction) AsOrganization() (*Organization, bool) { 13816 return nil, false 13817} 13818 13819// AsCreativeWork is the BasicResponseBase implementation for TouristAttraction. 13820func (ta TouristAttraction) AsCreativeWork() (*CreativeWork, bool) { 13821 return nil, false 13822} 13823 13824// AsBasicCreativeWork is the BasicResponseBase implementation for TouristAttraction. 13825func (ta TouristAttraction) AsBasicCreativeWork() (BasicCreativeWork, bool) { 13826 return nil, false 13827} 13828 13829// AsIntangible is the BasicResponseBase implementation for TouristAttraction. 13830func (ta TouristAttraction) AsIntangible() (*Intangible, bool) { 13831 return nil, false 13832} 13833 13834// AsBasicIntangible is the BasicResponseBase implementation for TouristAttraction. 13835func (ta TouristAttraction) AsBasicIntangible() (BasicIntangible, bool) { 13836 return nil, false 13837} 13838 13839// AsMovieTheater is the BasicResponseBase implementation for TouristAttraction. 13840func (ta TouristAttraction) AsMovieTheater() (*MovieTheater, bool) { 13841 return nil, false 13842} 13843 13844// AsMediaObject is the BasicResponseBase implementation for TouristAttraction. 13845func (ta TouristAttraction) AsMediaObject() (*MediaObject, bool) { 13846 return nil, false 13847} 13848 13849// AsBasicMediaObject is the BasicResponseBase implementation for TouristAttraction. 13850func (ta TouristAttraction) AsBasicMediaObject() (BasicMediaObject, bool) { 13851 return nil, false 13852} 13853 13854// AsCivicStructure is the BasicResponseBase implementation for TouristAttraction. 13855func (ta TouristAttraction) AsCivicStructure() (*CivicStructure, bool) { 13856 return nil, false 13857} 13858 13859// AsBasicCivicStructure is the BasicResponseBase implementation for TouristAttraction. 13860func (ta TouristAttraction) AsBasicCivicStructure() (BasicCivicStructure, bool) { 13861 return nil, false 13862} 13863 13864// AsLocalBusiness is the BasicResponseBase implementation for TouristAttraction. 13865func (ta TouristAttraction) AsLocalBusiness() (*LocalBusiness, bool) { 13866 return nil, false 13867} 13868 13869// AsBasicLocalBusiness is the BasicResponseBase implementation for TouristAttraction. 13870func (ta TouristAttraction) AsBasicLocalBusiness() (BasicLocalBusiness, bool) { 13871 return nil, false 13872} 13873 13874// AsTouristAttraction is the BasicResponseBase implementation for TouristAttraction. 13875func (ta TouristAttraction) AsTouristAttraction() (*TouristAttraction, bool) { 13876 return &ta, true 13877} 13878 13879// AsAirport is the BasicResponseBase implementation for TouristAttraction. 13880func (ta TouristAttraction) AsAirport() (*Airport, bool) { 13881 return nil, false 13882} 13883 13884// AsLicense is the BasicResponseBase implementation for TouristAttraction. 13885func (ta TouristAttraction) AsLicense() (*License, bool) { 13886 return nil, false 13887} 13888 13889// AsStructuredValue is the BasicResponseBase implementation for TouristAttraction. 13890func (ta TouristAttraction) AsStructuredValue() (*StructuredValue, bool) { 13891 return nil, false 13892} 13893 13894// AsBasicStructuredValue is the BasicResponseBase implementation for TouristAttraction. 13895func (ta TouristAttraction) AsBasicStructuredValue() (BasicStructuredValue, bool) { 13896 return nil, false 13897} 13898 13899// AsEntertainmentBusiness is the BasicResponseBase implementation for TouristAttraction. 13900func (ta TouristAttraction) AsEntertainmentBusiness() (*EntertainmentBusiness, bool) { 13901 return nil, false 13902} 13903 13904// AsBasicEntertainmentBusiness is the BasicResponseBase implementation for TouristAttraction. 13905func (ta TouristAttraction) AsBasicEntertainmentBusiness() (BasicEntertainmentBusiness, bool) { 13906 return nil, false 13907} 13908 13909// AsFoodEstablishment is the BasicResponseBase implementation for TouristAttraction. 13910func (ta TouristAttraction) AsFoodEstablishment() (*FoodEstablishment, bool) { 13911 return nil, false 13912} 13913 13914// AsBasicFoodEstablishment is the BasicResponseBase implementation for TouristAttraction. 13915func (ta TouristAttraction) AsBasicFoodEstablishment() (BasicFoodEstablishment, bool) { 13916 return nil, false 13917} 13918 13919// AsLodgingBusiness is the BasicResponseBase implementation for TouristAttraction. 13920func (ta TouristAttraction) AsLodgingBusiness() (*LodgingBusiness, bool) { 13921 return nil, false 13922} 13923 13924// AsBasicLodgingBusiness is the BasicResponseBase implementation for TouristAttraction. 13925func (ta TouristAttraction) AsBasicLodgingBusiness() (BasicLodgingBusiness, bool) { 13926 return nil, false 13927} 13928 13929// AsRestaurant is the BasicResponseBase implementation for TouristAttraction. 13930func (ta TouristAttraction) AsRestaurant() (*Restaurant, bool) { 13931 return nil, false 13932} 13933 13934// AsHotel is the BasicResponseBase implementation for TouristAttraction. 13935func (ta TouristAttraction) AsHotel() (*Hotel, bool) { 13936 return nil, false 13937} 13938 13939// AsResponseBase is the BasicResponseBase implementation for TouristAttraction. 13940func (ta TouristAttraction) AsResponseBase() (*ResponseBase, bool) { 13941 return nil, false 13942} 13943 13944// AsBasicResponseBase is the BasicResponseBase implementation for TouristAttraction. 13945func (ta TouristAttraction) AsBasicResponseBase() (BasicResponseBase, bool) { 13946 return &ta, true 13947} 13948 13949// UnmarshalJSON is the custom unmarshaler for TouristAttraction struct. 13950func (ta *TouristAttraction) UnmarshalJSON(body []byte) error { 13951 var m map[string]*json.RawMessage 13952 err := json.Unmarshal(body, &m) 13953 if err != nil { 13954 return err 13955 } 13956 for k, v := range m { 13957 switch k { 13958 case "address": 13959 if v != nil { 13960 var address PostalAddress 13961 err = json.Unmarshal(*v, &address) 13962 if err != nil { 13963 return err 13964 } 13965 ta.Address = &address 13966 } 13967 case "telephone": 13968 if v != nil { 13969 var telephone string 13970 err = json.Unmarshal(*v, &telephone) 13971 if err != nil { 13972 return err 13973 } 13974 ta.Telephone = &telephone 13975 } 13976 case "name": 13977 if v != nil { 13978 var name string 13979 err = json.Unmarshal(*v, &name) 13980 if err != nil { 13981 return err 13982 } 13983 ta.Name = &name 13984 } 13985 case "url": 13986 if v != nil { 13987 var URL string 13988 err = json.Unmarshal(*v, &URL) 13989 if err != nil { 13990 return err 13991 } 13992 ta.URL = &URL 13993 } 13994 case "image": 13995 if v != nil { 13996 var imageVar ImageObject 13997 err = json.Unmarshal(*v, &imageVar) 13998 if err != nil { 13999 return err 14000 } 14001 ta.Image = &imageVar 14002 } 14003 case "description": 14004 if v != nil { 14005 var description string 14006 err = json.Unmarshal(*v, &description) 14007 if err != nil { 14008 return err 14009 } 14010 ta.Description = &description 14011 } 14012 case "entityPresentationInfo": 14013 if v != nil { 14014 var entityPresentationInfo EntitiesEntityPresentationInfo 14015 err = json.Unmarshal(*v, &entityPresentationInfo) 14016 if err != nil { 14017 return err 14018 } 14019 ta.EntityPresentationInfo = &entityPresentationInfo 14020 } 14021 case "bingId": 14022 if v != nil { 14023 var bingID string 14024 err = json.Unmarshal(*v, &bingID) 14025 if err != nil { 14026 return err 14027 } 14028 ta.BingID = &bingID 14029 } 14030 case "contractualRules": 14031 if v != nil { 14032 contractualRules, err := unmarshalBasicContractualRulesContractualRuleArray(*v) 14033 if err != nil { 14034 return err 14035 } 14036 ta.ContractualRules = &contractualRules 14037 } 14038 case "webSearchUrl": 14039 if v != nil { 14040 var webSearchURL string 14041 err = json.Unmarshal(*v, &webSearchURL) 14042 if err != nil { 14043 return err 14044 } 14045 ta.WebSearchURL = &webSearchURL 14046 } 14047 case "id": 14048 if v != nil { 14049 var ID string 14050 err = json.Unmarshal(*v, &ID) 14051 if err != nil { 14052 return err 14053 } 14054 ta.ID = &ID 14055 } 14056 case "_type": 14057 if v != nil { 14058 var typeVar TypeBasicResponseBase 14059 err = json.Unmarshal(*v, &typeVar) 14060 if err != nil { 14061 return err 14062 } 14063 ta.Type = typeVar 14064 } 14065 } 14066 } 14067 14068 return nil 14069} 14070