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