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