...

Source file src/github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/newssearch/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/newssearch

     1  package newssearch
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"encoding/json"
    11  	"github.com/Azure/go-autorest/autorest"
    12  )
    13  
    14  // The package's fully qualified name.
    15  const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/newssearch"
    16  
    17  // BasicAnswer defines an answer.
    18  type BasicAnswer interface {
    19  	AsNews() (*News, bool)
    20  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
    21  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
    22  	AsTrendingTopics() (*TrendingTopics, bool)
    23  	AsAnswer() (*Answer, bool)
    24  }
    25  
    26  // Answer defines an answer.
    27  type Answer struct {
    28  	// FollowUpQueries - READ-ONLY
    29  	FollowUpQueries *[]Query `json:"followUpQueries,omitempty"`
    30  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
    31  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
    32  	// ID - READ-ONLY; A String identifier.
    33  	ID *string `json:"id,omitempty"`
    34  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
    35  	Type Type `json:"_type,omitempty"`
    36  }
    37  
    38  func unmarshalBasicAnswer(body []byte) (BasicAnswer, error) {
    39  	var m map[string]interface{}
    40  	err := json.Unmarshal(body, &m)
    41  	if err != nil {
    42  		return nil, err
    43  	}
    44  
    45  	switch m["_type"] {
    46  	case string(TypeNews):
    47  		var n News
    48  		err := json.Unmarshal(body, &n)
    49  		return n, err
    50  	case string(TypeSearchResultsAnswer):
    51  		var sra SearchResultsAnswer
    52  		err := json.Unmarshal(body, &sra)
    53  		return sra, err
    54  	case string(TypeTrendingTopics):
    55  		var tt TrendingTopics
    56  		err := json.Unmarshal(body, &tt)
    57  		return tt, err
    58  	default:
    59  		var a Answer
    60  		err := json.Unmarshal(body, &a)
    61  		return a, err
    62  	}
    63  }
    64  func unmarshalBasicAnswerArray(body []byte) ([]BasicAnswer, error) {
    65  	var rawMessages []*json.RawMessage
    66  	err := json.Unmarshal(body, &rawMessages)
    67  	if err != nil {
    68  		return nil, err
    69  	}
    70  
    71  	aArray := make([]BasicAnswer, len(rawMessages))
    72  
    73  	for index, rawMessage := range rawMessages {
    74  		a, err := unmarshalBasicAnswer(*rawMessage)
    75  		if err != nil {
    76  			return nil, err
    77  		}
    78  		aArray[index] = a
    79  	}
    80  	return aArray, nil
    81  }
    82  
    83  // MarshalJSON is the custom marshaler for Answer.
    84  func (a Answer) MarshalJSON() ([]byte, error) {
    85  	a.Type = TypeAnswer
    86  	objectMap := make(map[string]interface{})
    87  	if a.Type != "" {
    88  		objectMap["_type"] = a.Type
    89  	}
    90  	return json.Marshal(objectMap)
    91  }
    92  
    93  // AsNewsArticle is the BasicResponseBase implementation for Answer.
    94  func (a Answer) AsNewsArticle() (*NewsArticle, bool) {
    95  	return nil, false
    96  }
    97  
    98  // AsNews is the BasicResponseBase implementation for Answer.
    99  func (a Answer) AsNews() (*News, bool) {
   100  	return nil, false
   101  }
   102  
   103  // AsSearchResultsAnswer is the BasicResponseBase implementation for Answer.
   104  func (a Answer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   105  	return nil, false
   106  }
   107  
   108  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Answer.
   109  func (a Answer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   110  	return nil, false
   111  }
   112  
   113  // AsImageObject is the BasicResponseBase implementation for Answer.
   114  func (a Answer) AsImageObject() (*ImageObject, bool) {
   115  	return nil, false
   116  }
   117  
   118  // AsNewsTopic is the BasicResponseBase implementation for Answer.
   119  func (a Answer) AsNewsTopic() (*NewsTopic, bool) {
   120  	return nil, false
   121  }
   122  
   123  // AsAnswer is the BasicResponseBase implementation for Answer.
   124  func (a Answer) AsAnswer() (*Answer, bool) {
   125  	return &a, true
   126  }
   127  
   128  // AsBasicAnswer is the BasicResponseBase implementation for Answer.
   129  func (a Answer) AsBasicAnswer() (BasicAnswer, bool) {
   130  	return &a, true
   131  }
   132  
   133  // AsArticle is the BasicResponseBase implementation for Answer.
   134  func (a Answer) AsArticle() (*Article, bool) {
   135  	return nil, false
   136  }
   137  
   138  // AsBasicArticle is the BasicResponseBase implementation for Answer.
   139  func (a Answer) AsBasicArticle() (BasicArticle, bool) {
   140  	return nil, false
   141  }
   142  
   143  // AsThing is the BasicResponseBase implementation for Answer.
   144  func (a Answer) AsThing() (*Thing, bool) {
   145  	return nil, false
   146  }
   147  
   148  // AsBasicThing is the BasicResponseBase implementation for Answer.
   149  func (a Answer) AsBasicThing() (BasicThing, bool) {
   150  	return nil, false
   151  }
   152  
   153  // AsResponse is the BasicResponseBase implementation for Answer.
   154  func (a Answer) AsResponse() (*Response, bool) {
   155  	return nil, false
   156  }
   157  
   158  // AsBasicResponse is the BasicResponseBase implementation for Answer.
   159  func (a Answer) AsBasicResponse() (BasicResponse, bool) {
   160  	return &a, true
   161  }
   162  
   163  // AsTrendingTopics is the BasicResponseBase implementation for Answer.
   164  func (a Answer) AsTrendingTopics() (*TrendingTopics, bool) {
   165  	return nil, false
   166  }
   167  
   168  // AsVideoObject is the BasicResponseBase implementation for Answer.
   169  func (a Answer) AsVideoObject() (*VideoObject, bool) {
   170  	return nil, false
   171  }
   172  
   173  // AsCreativeWork is the BasicResponseBase implementation for Answer.
   174  func (a Answer) AsCreativeWork() (*CreativeWork, bool) {
   175  	return nil, false
   176  }
   177  
   178  // AsBasicCreativeWork is the BasicResponseBase implementation for Answer.
   179  func (a Answer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
   180  	return nil, false
   181  }
   182  
   183  // AsOrganization is the BasicResponseBase implementation for Answer.
   184  func (a Answer) AsOrganization() (*Organization, bool) {
   185  	return nil, false
   186  }
   187  
   188  // AsIdentifiable is the BasicResponseBase implementation for Answer.
   189  func (a Answer) AsIdentifiable() (*Identifiable, bool) {
   190  	return nil, false
   191  }
   192  
   193  // AsBasicIdentifiable is the BasicResponseBase implementation for Answer.
   194  func (a Answer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
   195  	return &a, true
   196  }
   197  
   198  // AsErrorResponse is the BasicResponseBase implementation for Answer.
   199  func (a Answer) AsErrorResponse() (*ErrorResponse, bool) {
   200  	return nil, false
   201  }
   202  
   203  // AsMediaObject is the BasicResponseBase implementation for Answer.
   204  func (a Answer) AsMediaObject() (*MediaObject, bool) {
   205  	return nil, false
   206  }
   207  
   208  // AsBasicMediaObject is the BasicResponseBase implementation for Answer.
   209  func (a Answer) AsBasicMediaObject() (BasicMediaObject, bool) {
   210  	return nil, false
   211  }
   212  
   213  // AsResponseBase is the BasicResponseBase implementation for Answer.
   214  func (a Answer) AsResponseBase() (*ResponseBase, bool) {
   215  	return nil, false
   216  }
   217  
   218  // AsBasicResponseBase is the BasicResponseBase implementation for Answer.
   219  func (a Answer) AsBasicResponseBase() (BasicResponseBase, bool) {
   220  	return &a, true
   221  }
   222  
   223  // BasicArticle ...
   224  type BasicArticle interface {
   225  	AsNewsArticle() (*NewsArticle, bool)
   226  	AsArticle() (*Article, bool)
   227  }
   228  
   229  // Article ...
   230  type Article struct {
   231  	// WordCount - READ-ONLY; The number of words in the text of the Article.
   232  	WordCount *int32 `json:"wordCount,omitempty"`
   233  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
   234  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
   235  	// Provider - READ-ONLY; The source of the creative work.
   236  	Provider *[]BasicThing `json:"provider,omitempty"`
   237  	// DatePublished - READ-ONLY; The date on which the CreativeWork was published.
   238  	DatePublished *string `json:"datePublished,omitempty"`
   239  	// Video - READ-ONLY; A video of the item.
   240  	Video *VideoObject `json:"video,omitempty"`
   241  	// Name - READ-ONLY; The name of the thing represented by this object.
   242  	Name *string `json:"name,omitempty"`
   243  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
   244  	URL *string `json:"url,omitempty"`
   245  	// Image - READ-ONLY; An image of the item.
   246  	Image *ImageObject `json:"image,omitempty"`
   247  	// Description - READ-ONLY; A short description of the item.
   248  	Description *string `json:"description,omitempty"`
   249  	// AlternateName - READ-ONLY; An alias for the item
   250  	AlternateName *string `json:"alternateName,omitempty"`
   251  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
   252  	BingID *string `json:"bingId,omitempty"`
   253  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
   254  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
   255  	// ID - READ-ONLY; A String identifier.
   256  	ID *string `json:"id,omitempty"`
   257  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
   258  	Type Type `json:"_type,omitempty"`
   259  }
   260  
   261  func unmarshalBasicArticle(body []byte) (BasicArticle, error) {
   262  	var m map[string]interface{}
   263  	err := json.Unmarshal(body, &m)
   264  	if err != nil {
   265  		return nil, err
   266  	}
   267  
   268  	switch m["_type"] {
   269  	case string(TypeNewsArticle):
   270  		var na NewsArticle
   271  		err := json.Unmarshal(body, &na)
   272  		return na, err
   273  	default:
   274  		var a Article
   275  		err := json.Unmarshal(body, &a)
   276  		return a, err
   277  	}
   278  }
   279  func unmarshalBasicArticleArray(body []byte) ([]BasicArticle, error) {
   280  	var rawMessages []*json.RawMessage
   281  	err := json.Unmarshal(body, &rawMessages)
   282  	if err != nil {
   283  		return nil, err
   284  	}
   285  
   286  	aArray := make([]BasicArticle, len(rawMessages))
   287  
   288  	for index, rawMessage := range rawMessages {
   289  		a, err := unmarshalBasicArticle(*rawMessage)
   290  		if err != nil {
   291  			return nil, err
   292  		}
   293  		aArray[index] = a
   294  	}
   295  	return aArray, nil
   296  }
   297  
   298  // MarshalJSON is the custom marshaler for Article.
   299  func (a Article) MarshalJSON() ([]byte, error) {
   300  	a.Type = TypeArticle
   301  	objectMap := make(map[string]interface{})
   302  	if a.Type != "" {
   303  		objectMap["_type"] = a.Type
   304  	}
   305  	return json.Marshal(objectMap)
   306  }
   307  
   308  // AsNewsArticle is the BasicResponseBase implementation for Article.
   309  func (a Article) AsNewsArticle() (*NewsArticle, bool) {
   310  	return nil, false
   311  }
   312  
   313  // AsNews is the BasicResponseBase implementation for Article.
   314  func (a Article) AsNews() (*News, bool) {
   315  	return nil, false
   316  }
   317  
   318  // AsSearchResultsAnswer is the BasicResponseBase implementation for Article.
   319  func (a Article) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   320  	return nil, false
   321  }
   322  
   323  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Article.
   324  func (a Article) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   325  	return nil, false
   326  }
   327  
   328  // AsImageObject is the BasicResponseBase implementation for Article.
   329  func (a Article) AsImageObject() (*ImageObject, bool) {
   330  	return nil, false
   331  }
   332  
   333  // AsNewsTopic is the BasicResponseBase implementation for Article.
   334  func (a Article) AsNewsTopic() (*NewsTopic, bool) {
   335  	return nil, false
   336  }
   337  
   338  // AsAnswer is the BasicResponseBase implementation for Article.
   339  func (a Article) AsAnswer() (*Answer, bool) {
   340  	return nil, false
   341  }
   342  
   343  // AsBasicAnswer is the BasicResponseBase implementation for Article.
   344  func (a Article) AsBasicAnswer() (BasicAnswer, bool) {
   345  	return nil, false
   346  }
   347  
   348  // AsArticle is the BasicResponseBase implementation for Article.
   349  func (a Article) AsArticle() (*Article, bool) {
   350  	return &a, true
   351  }
   352  
   353  // AsBasicArticle is the BasicResponseBase implementation for Article.
   354  func (a Article) AsBasicArticle() (BasicArticle, bool) {
   355  	return &a, true
   356  }
   357  
   358  // AsThing is the BasicResponseBase implementation for Article.
   359  func (a Article) AsThing() (*Thing, bool) {
   360  	return nil, false
   361  }
   362  
   363  // AsBasicThing is the BasicResponseBase implementation for Article.
   364  func (a Article) AsBasicThing() (BasicThing, bool) {
   365  	return &a, true
   366  }
   367  
   368  // AsResponse is the BasicResponseBase implementation for Article.
   369  func (a Article) AsResponse() (*Response, bool) {
   370  	return nil, false
   371  }
   372  
   373  // AsBasicResponse is the BasicResponseBase implementation for Article.
   374  func (a Article) AsBasicResponse() (BasicResponse, bool) {
   375  	return &a, true
   376  }
   377  
   378  // AsTrendingTopics is the BasicResponseBase implementation for Article.
   379  func (a Article) AsTrendingTopics() (*TrendingTopics, bool) {
   380  	return nil, false
   381  }
   382  
   383  // AsVideoObject is the BasicResponseBase implementation for Article.
   384  func (a Article) AsVideoObject() (*VideoObject, bool) {
   385  	return nil, false
   386  }
   387  
   388  // AsCreativeWork is the BasicResponseBase implementation for Article.
   389  func (a Article) AsCreativeWork() (*CreativeWork, bool) {
   390  	return nil, false
   391  }
   392  
   393  // AsBasicCreativeWork is the BasicResponseBase implementation for Article.
   394  func (a Article) AsBasicCreativeWork() (BasicCreativeWork, bool) {
   395  	return &a, true
   396  }
   397  
   398  // AsOrganization is the BasicResponseBase implementation for Article.
   399  func (a Article) AsOrganization() (*Organization, bool) {
   400  	return nil, false
   401  }
   402  
   403  // AsIdentifiable is the BasicResponseBase implementation for Article.
   404  func (a Article) AsIdentifiable() (*Identifiable, bool) {
   405  	return nil, false
   406  }
   407  
   408  // AsBasicIdentifiable is the BasicResponseBase implementation for Article.
   409  func (a Article) AsBasicIdentifiable() (BasicIdentifiable, bool) {
   410  	return &a, true
   411  }
   412  
   413  // AsErrorResponse is the BasicResponseBase implementation for Article.
   414  func (a Article) AsErrorResponse() (*ErrorResponse, bool) {
   415  	return nil, false
   416  }
   417  
   418  // AsMediaObject is the BasicResponseBase implementation for Article.
   419  func (a Article) AsMediaObject() (*MediaObject, bool) {
   420  	return nil, false
   421  }
   422  
   423  // AsBasicMediaObject is the BasicResponseBase implementation for Article.
   424  func (a Article) AsBasicMediaObject() (BasicMediaObject, bool) {
   425  	return nil, false
   426  }
   427  
   428  // AsResponseBase is the BasicResponseBase implementation for Article.
   429  func (a Article) AsResponseBase() (*ResponseBase, bool) {
   430  	return nil, false
   431  }
   432  
   433  // AsBasicResponseBase is the BasicResponseBase implementation for Article.
   434  func (a Article) AsBasicResponseBase() (BasicResponseBase, bool) {
   435  	return &a, true
   436  }
   437  
   438  // UnmarshalJSON is the custom unmarshaler for Article struct.
   439  func (a *Article) UnmarshalJSON(body []byte) error {
   440  	var m map[string]*json.RawMessage
   441  	err := json.Unmarshal(body, &m)
   442  	if err != nil {
   443  		return err
   444  	}
   445  	for k, v := range m {
   446  		switch k {
   447  		case "wordCount":
   448  			if v != nil {
   449  				var wordCount int32
   450  				err = json.Unmarshal(*v, &wordCount)
   451  				if err != nil {
   452  					return err
   453  				}
   454  				a.WordCount = &wordCount
   455  			}
   456  		case "thumbnailUrl":
   457  			if v != nil {
   458  				var thumbnailURL string
   459  				err = json.Unmarshal(*v, &thumbnailURL)
   460  				if err != nil {
   461  					return err
   462  				}
   463  				a.ThumbnailURL = &thumbnailURL
   464  			}
   465  		case "provider":
   466  			if v != nil {
   467  				provider, err := unmarshalBasicThingArray(*v)
   468  				if err != nil {
   469  					return err
   470  				}
   471  				a.Provider = &provider
   472  			}
   473  		case "datePublished":
   474  			if v != nil {
   475  				var datePublished string
   476  				err = json.Unmarshal(*v, &datePublished)
   477  				if err != nil {
   478  					return err
   479  				}
   480  				a.DatePublished = &datePublished
   481  			}
   482  		case "video":
   483  			if v != nil {
   484  				var video VideoObject
   485  				err = json.Unmarshal(*v, &video)
   486  				if err != nil {
   487  					return err
   488  				}
   489  				a.Video = &video
   490  			}
   491  		case "name":
   492  			if v != nil {
   493  				var name string
   494  				err = json.Unmarshal(*v, &name)
   495  				if err != nil {
   496  					return err
   497  				}
   498  				a.Name = &name
   499  			}
   500  		case "url":
   501  			if v != nil {
   502  				var URL string
   503  				err = json.Unmarshal(*v, &URL)
   504  				if err != nil {
   505  					return err
   506  				}
   507  				a.URL = &URL
   508  			}
   509  		case "image":
   510  			if v != nil {
   511  				var imageVar ImageObject
   512  				err = json.Unmarshal(*v, &imageVar)
   513  				if err != nil {
   514  					return err
   515  				}
   516  				a.Image = &imageVar
   517  			}
   518  		case "description":
   519  			if v != nil {
   520  				var description string
   521  				err = json.Unmarshal(*v, &description)
   522  				if err != nil {
   523  					return err
   524  				}
   525  				a.Description = &description
   526  			}
   527  		case "alternateName":
   528  			if v != nil {
   529  				var alternateName string
   530  				err = json.Unmarshal(*v, &alternateName)
   531  				if err != nil {
   532  					return err
   533  				}
   534  				a.AlternateName = &alternateName
   535  			}
   536  		case "bingId":
   537  			if v != nil {
   538  				var bingID string
   539  				err = json.Unmarshal(*v, &bingID)
   540  				if err != nil {
   541  					return err
   542  				}
   543  				a.BingID = &bingID
   544  			}
   545  		case "webSearchUrl":
   546  			if v != nil {
   547  				var webSearchURL string
   548  				err = json.Unmarshal(*v, &webSearchURL)
   549  				if err != nil {
   550  					return err
   551  				}
   552  				a.WebSearchURL = &webSearchURL
   553  			}
   554  		case "id":
   555  			if v != nil {
   556  				var ID string
   557  				err = json.Unmarshal(*v, &ID)
   558  				if err != nil {
   559  					return err
   560  				}
   561  				a.ID = &ID
   562  			}
   563  		case "_type":
   564  			if v != nil {
   565  				var typeVar Type
   566  				err = json.Unmarshal(*v, &typeVar)
   567  				if err != nil {
   568  					return err
   569  				}
   570  				a.Type = typeVar
   571  			}
   572  		}
   573  	}
   574  
   575  	return nil
   576  }
   577  
   578  // BasicCreativeWork the most generic kind of creative work, including books, movies, photographs, software programs,
   579  // etc.
   580  type BasicCreativeWork interface {
   581  	AsNewsArticle() (*NewsArticle, bool)
   582  	AsImageObject() (*ImageObject, bool)
   583  	AsArticle() (*Article, bool)
   584  	AsBasicArticle() (BasicArticle, bool)
   585  	AsVideoObject() (*VideoObject, bool)
   586  	AsMediaObject() (*MediaObject, bool)
   587  	AsBasicMediaObject() (BasicMediaObject, bool)
   588  	AsCreativeWork() (*CreativeWork, bool)
   589  }
   590  
   591  // CreativeWork the most generic kind of creative work, including books, movies, photographs, software
   592  // programs, etc.
   593  type CreativeWork struct {
   594  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
   595  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
   596  	// Provider - READ-ONLY; The source of the creative work.
   597  	Provider *[]BasicThing `json:"provider,omitempty"`
   598  	// DatePublished - READ-ONLY; The date on which the CreativeWork was published.
   599  	DatePublished *string `json:"datePublished,omitempty"`
   600  	// Video - READ-ONLY; A video of the item.
   601  	Video *VideoObject `json:"video,omitempty"`
   602  	// Name - READ-ONLY; The name of the thing represented by this object.
   603  	Name *string `json:"name,omitempty"`
   604  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
   605  	URL *string `json:"url,omitempty"`
   606  	// Image - READ-ONLY; An image of the item.
   607  	Image *ImageObject `json:"image,omitempty"`
   608  	// Description - READ-ONLY; A short description of the item.
   609  	Description *string `json:"description,omitempty"`
   610  	// AlternateName - READ-ONLY; An alias for the item
   611  	AlternateName *string `json:"alternateName,omitempty"`
   612  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
   613  	BingID *string `json:"bingId,omitempty"`
   614  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
   615  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
   616  	// ID - READ-ONLY; A String identifier.
   617  	ID *string `json:"id,omitempty"`
   618  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
   619  	Type Type `json:"_type,omitempty"`
   620  }
   621  
   622  func unmarshalBasicCreativeWork(body []byte) (BasicCreativeWork, error) {
   623  	var m map[string]interface{}
   624  	err := json.Unmarshal(body, &m)
   625  	if err != nil {
   626  		return nil, err
   627  	}
   628  
   629  	switch m["_type"] {
   630  	case string(TypeNewsArticle):
   631  		var na NewsArticle
   632  		err := json.Unmarshal(body, &na)
   633  		return na, err
   634  	case string(TypeImageObject):
   635  		var ioVar ImageObject
   636  		err := json.Unmarshal(body, &ioVar)
   637  		return ioVar, err
   638  	case string(TypeArticle):
   639  		var a Article
   640  		err := json.Unmarshal(body, &a)
   641  		return a, err
   642  	case string(TypeVideoObject):
   643  		var vo VideoObject
   644  		err := json.Unmarshal(body, &vo)
   645  		return vo, err
   646  	case string(TypeMediaObject):
   647  		var mo MediaObject
   648  		err := json.Unmarshal(body, &mo)
   649  		return mo, err
   650  	default:
   651  		var cw CreativeWork
   652  		err := json.Unmarshal(body, &cw)
   653  		return cw, err
   654  	}
   655  }
   656  func unmarshalBasicCreativeWorkArray(body []byte) ([]BasicCreativeWork, error) {
   657  	var rawMessages []*json.RawMessage
   658  	err := json.Unmarshal(body, &rawMessages)
   659  	if err != nil {
   660  		return nil, err
   661  	}
   662  
   663  	cwArray := make([]BasicCreativeWork, len(rawMessages))
   664  
   665  	for index, rawMessage := range rawMessages {
   666  		cw, err := unmarshalBasicCreativeWork(*rawMessage)
   667  		if err != nil {
   668  			return nil, err
   669  		}
   670  		cwArray[index] = cw
   671  	}
   672  	return cwArray, nil
   673  }
   674  
   675  // MarshalJSON is the custom marshaler for CreativeWork.
   676  func (cw CreativeWork) MarshalJSON() ([]byte, error) {
   677  	cw.Type = TypeCreativeWork
   678  	objectMap := make(map[string]interface{})
   679  	if cw.Type != "" {
   680  		objectMap["_type"] = cw.Type
   681  	}
   682  	return json.Marshal(objectMap)
   683  }
   684  
   685  // AsNewsArticle is the BasicResponseBase implementation for CreativeWork.
   686  func (cw CreativeWork) AsNewsArticle() (*NewsArticle, bool) {
   687  	return nil, false
   688  }
   689  
   690  // AsNews is the BasicResponseBase implementation for CreativeWork.
   691  func (cw CreativeWork) AsNews() (*News, bool) {
   692  	return nil, false
   693  }
   694  
   695  // AsSearchResultsAnswer is the BasicResponseBase implementation for CreativeWork.
   696  func (cw CreativeWork) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   697  	return nil, false
   698  }
   699  
   700  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for CreativeWork.
   701  func (cw CreativeWork) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   702  	return nil, false
   703  }
   704  
   705  // AsImageObject is the BasicResponseBase implementation for CreativeWork.
   706  func (cw CreativeWork) AsImageObject() (*ImageObject, bool) {
   707  	return nil, false
   708  }
   709  
   710  // AsNewsTopic is the BasicResponseBase implementation for CreativeWork.
   711  func (cw CreativeWork) AsNewsTopic() (*NewsTopic, bool) {
   712  	return nil, false
   713  }
   714  
   715  // AsAnswer is the BasicResponseBase implementation for CreativeWork.
   716  func (cw CreativeWork) AsAnswer() (*Answer, bool) {
   717  	return nil, false
   718  }
   719  
   720  // AsBasicAnswer is the BasicResponseBase implementation for CreativeWork.
   721  func (cw CreativeWork) AsBasicAnswer() (BasicAnswer, bool) {
   722  	return nil, false
   723  }
   724  
   725  // AsArticle is the BasicResponseBase implementation for CreativeWork.
   726  func (cw CreativeWork) AsArticle() (*Article, bool) {
   727  	return nil, false
   728  }
   729  
   730  // AsBasicArticle is the BasicResponseBase implementation for CreativeWork.
   731  func (cw CreativeWork) AsBasicArticle() (BasicArticle, bool) {
   732  	return nil, false
   733  }
   734  
   735  // AsThing is the BasicResponseBase implementation for CreativeWork.
   736  func (cw CreativeWork) AsThing() (*Thing, bool) {
   737  	return nil, false
   738  }
   739  
   740  // AsBasicThing is the BasicResponseBase implementation for CreativeWork.
   741  func (cw CreativeWork) AsBasicThing() (BasicThing, bool) {
   742  	return &cw, true
   743  }
   744  
   745  // AsResponse is the BasicResponseBase implementation for CreativeWork.
   746  func (cw CreativeWork) AsResponse() (*Response, bool) {
   747  	return nil, false
   748  }
   749  
   750  // AsBasicResponse is the BasicResponseBase implementation for CreativeWork.
   751  func (cw CreativeWork) AsBasicResponse() (BasicResponse, bool) {
   752  	return &cw, true
   753  }
   754  
   755  // AsTrendingTopics is the BasicResponseBase implementation for CreativeWork.
   756  func (cw CreativeWork) AsTrendingTopics() (*TrendingTopics, bool) {
   757  	return nil, false
   758  }
   759  
   760  // AsVideoObject is the BasicResponseBase implementation for CreativeWork.
   761  func (cw CreativeWork) AsVideoObject() (*VideoObject, bool) {
   762  	return nil, false
   763  }
   764  
   765  // AsCreativeWork is the BasicResponseBase implementation for CreativeWork.
   766  func (cw CreativeWork) AsCreativeWork() (*CreativeWork, bool) {
   767  	return &cw, true
   768  }
   769  
   770  // AsBasicCreativeWork is the BasicResponseBase implementation for CreativeWork.
   771  func (cw CreativeWork) AsBasicCreativeWork() (BasicCreativeWork, bool) {
   772  	return &cw, true
   773  }
   774  
   775  // AsOrganization is the BasicResponseBase implementation for CreativeWork.
   776  func (cw CreativeWork) AsOrganization() (*Organization, bool) {
   777  	return nil, false
   778  }
   779  
   780  // AsIdentifiable is the BasicResponseBase implementation for CreativeWork.
   781  func (cw CreativeWork) AsIdentifiable() (*Identifiable, bool) {
   782  	return nil, false
   783  }
   784  
   785  // AsBasicIdentifiable is the BasicResponseBase implementation for CreativeWork.
   786  func (cw CreativeWork) AsBasicIdentifiable() (BasicIdentifiable, bool) {
   787  	return &cw, true
   788  }
   789  
   790  // AsErrorResponse is the BasicResponseBase implementation for CreativeWork.
   791  func (cw CreativeWork) AsErrorResponse() (*ErrorResponse, bool) {
   792  	return nil, false
   793  }
   794  
   795  // AsMediaObject is the BasicResponseBase implementation for CreativeWork.
   796  func (cw CreativeWork) AsMediaObject() (*MediaObject, bool) {
   797  	return nil, false
   798  }
   799  
   800  // AsBasicMediaObject is the BasicResponseBase implementation for CreativeWork.
   801  func (cw CreativeWork) AsBasicMediaObject() (BasicMediaObject, bool) {
   802  	return nil, false
   803  }
   804  
   805  // AsResponseBase is the BasicResponseBase implementation for CreativeWork.
   806  func (cw CreativeWork) AsResponseBase() (*ResponseBase, bool) {
   807  	return nil, false
   808  }
   809  
   810  // AsBasicResponseBase is the BasicResponseBase implementation for CreativeWork.
   811  func (cw CreativeWork) AsBasicResponseBase() (BasicResponseBase, bool) {
   812  	return &cw, true
   813  }
   814  
   815  // UnmarshalJSON is the custom unmarshaler for CreativeWork struct.
   816  func (cw *CreativeWork) UnmarshalJSON(body []byte) error {
   817  	var m map[string]*json.RawMessage
   818  	err := json.Unmarshal(body, &m)
   819  	if err != nil {
   820  		return err
   821  	}
   822  	for k, v := range m {
   823  		switch k {
   824  		case "thumbnailUrl":
   825  			if v != nil {
   826  				var thumbnailURL string
   827  				err = json.Unmarshal(*v, &thumbnailURL)
   828  				if err != nil {
   829  					return err
   830  				}
   831  				cw.ThumbnailURL = &thumbnailURL
   832  			}
   833  		case "provider":
   834  			if v != nil {
   835  				provider, err := unmarshalBasicThingArray(*v)
   836  				if err != nil {
   837  					return err
   838  				}
   839  				cw.Provider = &provider
   840  			}
   841  		case "datePublished":
   842  			if v != nil {
   843  				var datePublished string
   844  				err = json.Unmarshal(*v, &datePublished)
   845  				if err != nil {
   846  					return err
   847  				}
   848  				cw.DatePublished = &datePublished
   849  			}
   850  		case "video":
   851  			if v != nil {
   852  				var video VideoObject
   853  				err = json.Unmarshal(*v, &video)
   854  				if err != nil {
   855  					return err
   856  				}
   857  				cw.Video = &video
   858  			}
   859  		case "name":
   860  			if v != nil {
   861  				var name string
   862  				err = json.Unmarshal(*v, &name)
   863  				if err != nil {
   864  					return err
   865  				}
   866  				cw.Name = &name
   867  			}
   868  		case "url":
   869  			if v != nil {
   870  				var URL string
   871  				err = json.Unmarshal(*v, &URL)
   872  				if err != nil {
   873  					return err
   874  				}
   875  				cw.URL = &URL
   876  			}
   877  		case "image":
   878  			if v != nil {
   879  				var imageVar ImageObject
   880  				err = json.Unmarshal(*v, &imageVar)
   881  				if err != nil {
   882  					return err
   883  				}
   884  				cw.Image = &imageVar
   885  			}
   886  		case "description":
   887  			if v != nil {
   888  				var description string
   889  				err = json.Unmarshal(*v, &description)
   890  				if err != nil {
   891  					return err
   892  				}
   893  				cw.Description = &description
   894  			}
   895  		case "alternateName":
   896  			if v != nil {
   897  				var alternateName string
   898  				err = json.Unmarshal(*v, &alternateName)
   899  				if err != nil {
   900  					return err
   901  				}
   902  				cw.AlternateName = &alternateName
   903  			}
   904  		case "bingId":
   905  			if v != nil {
   906  				var bingID string
   907  				err = json.Unmarshal(*v, &bingID)
   908  				if err != nil {
   909  					return err
   910  				}
   911  				cw.BingID = &bingID
   912  			}
   913  		case "webSearchUrl":
   914  			if v != nil {
   915  				var webSearchURL string
   916  				err = json.Unmarshal(*v, &webSearchURL)
   917  				if err != nil {
   918  					return err
   919  				}
   920  				cw.WebSearchURL = &webSearchURL
   921  			}
   922  		case "id":
   923  			if v != nil {
   924  				var ID string
   925  				err = json.Unmarshal(*v, &ID)
   926  				if err != nil {
   927  					return err
   928  				}
   929  				cw.ID = &ID
   930  			}
   931  		case "_type":
   932  			if v != nil {
   933  				var typeVar Type
   934  				err = json.Unmarshal(*v, &typeVar)
   935  				if err != nil {
   936  					return err
   937  				}
   938  				cw.Type = typeVar
   939  			}
   940  		}
   941  	}
   942  
   943  	return nil
   944  }
   945  
   946  // Error defines the error that occurred.
   947  type Error struct {
   948  	// Code - The error code that identifies the category of error. Possible values include: 'None', 'ServerError', 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'
   949  	Code ErrorCode `json:"code,omitempty"`
   950  	// SubCode - READ-ONLY; The error code that further helps to identify the error. Possible values include: 'UnexpectedError', 'ResourceError', 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', 'HTTPNotAllowed', 'Blocked', 'AuthorizationMissing', 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired'
   951  	SubCode ErrorSubCode `json:"subCode,omitempty"`
   952  	// Message - A description of the error.
   953  	Message *string `json:"message,omitempty"`
   954  	// MoreDetails - READ-ONLY; A description that provides additional information about the error.
   955  	MoreDetails *string `json:"moreDetails,omitempty"`
   956  	// Parameter - READ-ONLY; The parameter in the request that caused the error.
   957  	Parameter *string `json:"parameter,omitempty"`
   958  	// Value - READ-ONLY; The parameter's value in the request that was not valid.
   959  	Value *string `json:"value,omitempty"`
   960  }
   961  
   962  // MarshalJSON is the custom marshaler for Error.
   963  func (e Error) MarshalJSON() ([]byte, error) {
   964  	objectMap := make(map[string]interface{})
   965  	if e.Code != "" {
   966  		objectMap["code"] = e.Code
   967  	}
   968  	if e.Message != nil {
   969  		objectMap["message"] = e.Message
   970  	}
   971  	return json.Marshal(objectMap)
   972  }
   973  
   974  // ErrorResponse the top-level response that represents a failed request.
   975  type ErrorResponse struct {
   976  	// Errors - A list of errors that describe the reasons why the request failed.
   977  	Errors *[]Error `json:"errors,omitempty"`
   978  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
   979  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
   980  	// ID - READ-ONLY; A String identifier.
   981  	ID *string `json:"id,omitempty"`
   982  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
   983  	Type Type `json:"_type,omitempty"`
   984  }
   985  
   986  // MarshalJSON is the custom marshaler for ErrorResponse.
   987  func (er ErrorResponse) MarshalJSON() ([]byte, error) {
   988  	er.Type = TypeErrorResponse
   989  	objectMap := make(map[string]interface{})
   990  	if er.Errors != nil {
   991  		objectMap["errors"] = er.Errors
   992  	}
   993  	if er.Type != "" {
   994  		objectMap["_type"] = er.Type
   995  	}
   996  	return json.Marshal(objectMap)
   997  }
   998  
   999  // AsNewsArticle is the BasicResponseBase implementation for ErrorResponse.
  1000  func (er ErrorResponse) AsNewsArticle() (*NewsArticle, bool) {
  1001  	return nil, false
  1002  }
  1003  
  1004  // AsNews is the BasicResponseBase implementation for ErrorResponse.
  1005  func (er ErrorResponse) AsNews() (*News, bool) {
  1006  	return nil, false
  1007  }
  1008  
  1009  // AsSearchResultsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1010  func (er ErrorResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1011  	return nil, false
  1012  }
  1013  
  1014  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1015  func (er ErrorResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  1016  	return nil, false
  1017  }
  1018  
  1019  // AsImageObject is the BasicResponseBase implementation for ErrorResponse.
  1020  func (er ErrorResponse) AsImageObject() (*ImageObject, bool) {
  1021  	return nil, false
  1022  }
  1023  
  1024  // AsNewsTopic is the BasicResponseBase implementation for ErrorResponse.
  1025  func (er ErrorResponse) AsNewsTopic() (*NewsTopic, bool) {
  1026  	return nil, false
  1027  }
  1028  
  1029  // AsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1030  func (er ErrorResponse) AsAnswer() (*Answer, bool) {
  1031  	return nil, false
  1032  }
  1033  
  1034  // AsBasicAnswer is the BasicResponseBase implementation for ErrorResponse.
  1035  func (er ErrorResponse) AsBasicAnswer() (BasicAnswer, bool) {
  1036  	return nil, false
  1037  }
  1038  
  1039  // AsArticle is the BasicResponseBase implementation for ErrorResponse.
  1040  func (er ErrorResponse) AsArticle() (*Article, bool) {
  1041  	return nil, false
  1042  }
  1043  
  1044  // AsBasicArticle is the BasicResponseBase implementation for ErrorResponse.
  1045  func (er ErrorResponse) AsBasicArticle() (BasicArticle, bool) {
  1046  	return nil, false
  1047  }
  1048  
  1049  // AsThing is the BasicResponseBase implementation for ErrorResponse.
  1050  func (er ErrorResponse) AsThing() (*Thing, bool) {
  1051  	return nil, false
  1052  }
  1053  
  1054  // AsBasicThing is the BasicResponseBase implementation for ErrorResponse.
  1055  func (er ErrorResponse) AsBasicThing() (BasicThing, bool) {
  1056  	return nil, false
  1057  }
  1058  
  1059  // AsResponse is the BasicResponseBase implementation for ErrorResponse.
  1060  func (er ErrorResponse) AsResponse() (*Response, bool) {
  1061  	return nil, false
  1062  }
  1063  
  1064  // AsBasicResponse is the BasicResponseBase implementation for ErrorResponse.
  1065  func (er ErrorResponse) AsBasicResponse() (BasicResponse, bool) {
  1066  	return &er, true
  1067  }
  1068  
  1069  // AsTrendingTopics is the BasicResponseBase implementation for ErrorResponse.
  1070  func (er ErrorResponse) AsTrendingTopics() (*TrendingTopics, bool) {
  1071  	return nil, false
  1072  }
  1073  
  1074  // AsVideoObject is the BasicResponseBase implementation for ErrorResponse.
  1075  func (er ErrorResponse) AsVideoObject() (*VideoObject, bool) {
  1076  	return nil, false
  1077  }
  1078  
  1079  // AsCreativeWork is the BasicResponseBase implementation for ErrorResponse.
  1080  func (er ErrorResponse) AsCreativeWork() (*CreativeWork, bool) {
  1081  	return nil, false
  1082  }
  1083  
  1084  // AsBasicCreativeWork is the BasicResponseBase implementation for ErrorResponse.
  1085  func (er ErrorResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1086  	return nil, false
  1087  }
  1088  
  1089  // AsOrganization is the BasicResponseBase implementation for ErrorResponse.
  1090  func (er ErrorResponse) AsOrganization() (*Organization, bool) {
  1091  	return nil, false
  1092  }
  1093  
  1094  // AsIdentifiable is the BasicResponseBase implementation for ErrorResponse.
  1095  func (er ErrorResponse) AsIdentifiable() (*Identifiable, bool) {
  1096  	return nil, false
  1097  }
  1098  
  1099  // AsBasicIdentifiable is the BasicResponseBase implementation for ErrorResponse.
  1100  func (er ErrorResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1101  	return &er, true
  1102  }
  1103  
  1104  // AsErrorResponse is the BasicResponseBase implementation for ErrorResponse.
  1105  func (er ErrorResponse) AsErrorResponse() (*ErrorResponse, bool) {
  1106  	return &er, true
  1107  }
  1108  
  1109  // AsMediaObject is the BasicResponseBase implementation for ErrorResponse.
  1110  func (er ErrorResponse) AsMediaObject() (*MediaObject, bool) {
  1111  	return nil, false
  1112  }
  1113  
  1114  // AsBasicMediaObject is the BasicResponseBase implementation for ErrorResponse.
  1115  func (er ErrorResponse) AsBasicMediaObject() (BasicMediaObject, bool) {
  1116  	return nil, false
  1117  }
  1118  
  1119  // AsResponseBase is the BasicResponseBase implementation for ErrorResponse.
  1120  func (er ErrorResponse) AsResponseBase() (*ResponseBase, bool) {
  1121  	return nil, false
  1122  }
  1123  
  1124  // AsBasicResponseBase is the BasicResponseBase implementation for ErrorResponse.
  1125  func (er ErrorResponse) AsBasicResponseBase() (BasicResponseBase, bool) {
  1126  	return &er, true
  1127  }
  1128  
  1129  // BasicIdentifiable defines the identity of a resource.
  1130  type BasicIdentifiable interface {
  1131  	AsNewsArticle() (*NewsArticle, bool)
  1132  	AsNews() (*News, bool)
  1133  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  1134  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  1135  	AsImageObject() (*ImageObject, bool)
  1136  	AsNewsTopic() (*NewsTopic, bool)
  1137  	AsAnswer() (*Answer, bool)
  1138  	AsBasicAnswer() (BasicAnswer, bool)
  1139  	AsArticle() (*Article, bool)
  1140  	AsBasicArticle() (BasicArticle, bool)
  1141  	AsThing() (*Thing, bool)
  1142  	AsBasicThing() (BasicThing, bool)
  1143  	AsResponse() (*Response, bool)
  1144  	AsBasicResponse() (BasicResponse, bool)
  1145  	AsTrendingTopics() (*TrendingTopics, bool)
  1146  	AsVideoObject() (*VideoObject, bool)
  1147  	AsCreativeWork() (*CreativeWork, bool)
  1148  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  1149  	AsOrganization() (*Organization, bool)
  1150  	AsErrorResponse() (*ErrorResponse, bool)
  1151  	AsMediaObject() (*MediaObject, bool)
  1152  	AsBasicMediaObject() (BasicMediaObject, bool)
  1153  	AsIdentifiable() (*Identifiable, bool)
  1154  }
  1155  
  1156  // Identifiable defines the identity of a resource.
  1157  type Identifiable struct {
  1158  	// ID - READ-ONLY; A String identifier.
  1159  	ID *string `json:"id,omitempty"`
  1160  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  1161  	Type Type `json:"_type,omitempty"`
  1162  }
  1163  
  1164  func unmarshalBasicIdentifiable(body []byte) (BasicIdentifiable, error) {
  1165  	var m map[string]interface{}
  1166  	err := json.Unmarshal(body, &m)
  1167  	if err != nil {
  1168  		return nil, err
  1169  	}
  1170  
  1171  	switch m["_type"] {
  1172  	case string(TypeNewsArticle):
  1173  		var na NewsArticle
  1174  		err := json.Unmarshal(body, &na)
  1175  		return na, err
  1176  	case string(TypeNews):
  1177  		var n News
  1178  		err := json.Unmarshal(body, &n)
  1179  		return n, err
  1180  	case string(TypeSearchResultsAnswer):
  1181  		var sra SearchResultsAnswer
  1182  		err := json.Unmarshal(body, &sra)
  1183  		return sra, err
  1184  	case string(TypeImageObject):
  1185  		var ioVar ImageObject
  1186  		err := json.Unmarshal(body, &ioVar)
  1187  		return ioVar, err
  1188  	case string(TypeNewsTopic):
  1189  		var nt NewsTopic
  1190  		err := json.Unmarshal(body, &nt)
  1191  		return nt, err
  1192  	case string(TypeAnswer):
  1193  		var a Answer
  1194  		err := json.Unmarshal(body, &a)
  1195  		return a, err
  1196  	case string(TypeArticle):
  1197  		var a Article
  1198  		err := json.Unmarshal(body, &a)
  1199  		return a, err
  1200  	case string(TypeThing):
  1201  		var t Thing
  1202  		err := json.Unmarshal(body, &t)
  1203  		return t, err
  1204  	case string(TypeResponse):
  1205  		var r Response
  1206  		err := json.Unmarshal(body, &r)
  1207  		return r, err
  1208  	case string(TypeTrendingTopics):
  1209  		var tt TrendingTopics
  1210  		err := json.Unmarshal(body, &tt)
  1211  		return tt, err
  1212  	case string(TypeVideoObject):
  1213  		var vo VideoObject
  1214  		err := json.Unmarshal(body, &vo)
  1215  		return vo, err
  1216  	case string(TypeCreativeWork):
  1217  		var cw CreativeWork
  1218  		err := json.Unmarshal(body, &cw)
  1219  		return cw, err
  1220  	case string(TypeOrganization):
  1221  		var o Organization
  1222  		err := json.Unmarshal(body, &o)
  1223  		return o, err
  1224  	case string(TypeErrorResponse):
  1225  		var er ErrorResponse
  1226  		err := json.Unmarshal(body, &er)
  1227  		return er, err
  1228  	case string(TypeMediaObject):
  1229  		var mo MediaObject
  1230  		err := json.Unmarshal(body, &mo)
  1231  		return mo, err
  1232  	default:
  1233  		var i Identifiable
  1234  		err := json.Unmarshal(body, &i)
  1235  		return i, err
  1236  	}
  1237  }
  1238  func unmarshalBasicIdentifiableArray(body []byte) ([]BasicIdentifiable, error) {
  1239  	var rawMessages []*json.RawMessage
  1240  	err := json.Unmarshal(body, &rawMessages)
  1241  	if err != nil {
  1242  		return nil, err
  1243  	}
  1244  
  1245  	iArray := make([]BasicIdentifiable, len(rawMessages))
  1246  
  1247  	for index, rawMessage := range rawMessages {
  1248  		i, err := unmarshalBasicIdentifiable(*rawMessage)
  1249  		if err != nil {
  1250  			return nil, err
  1251  		}
  1252  		iArray[index] = i
  1253  	}
  1254  	return iArray, nil
  1255  }
  1256  
  1257  // MarshalJSON is the custom marshaler for Identifiable.
  1258  func (i Identifiable) MarshalJSON() ([]byte, error) {
  1259  	i.Type = TypeIdentifiable
  1260  	objectMap := make(map[string]interface{})
  1261  	if i.Type != "" {
  1262  		objectMap["_type"] = i.Type
  1263  	}
  1264  	return json.Marshal(objectMap)
  1265  }
  1266  
  1267  // AsNewsArticle is the BasicResponseBase implementation for Identifiable.
  1268  func (i Identifiable) AsNewsArticle() (*NewsArticle, bool) {
  1269  	return nil, false
  1270  }
  1271  
  1272  // AsNews is the BasicResponseBase implementation for Identifiable.
  1273  func (i Identifiable) AsNews() (*News, bool) {
  1274  	return nil, false
  1275  }
  1276  
  1277  // AsSearchResultsAnswer is the BasicResponseBase implementation for Identifiable.
  1278  func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1279  	return nil, false
  1280  }
  1281  
  1282  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Identifiable.
  1283  func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  1284  	return nil, false
  1285  }
  1286  
  1287  // AsImageObject is the BasicResponseBase implementation for Identifiable.
  1288  func (i Identifiable) AsImageObject() (*ImageObject, bool) {
  1289  	return nil, false
  1290  }
  1291  
  1292  // AsNewsTopic is the BasicResponseBase implementation for Identifiable.
  1293  func (i Identifiable) AsNewsTopic() (*NewsTopic, bool) {
  1294  	return nil, false
  1295  }
  1296  
  1297  // AsAnswer is the BasicResponseBase implementation for Identifiable.
  1298  func (i Identifiable) AsAnswer() (*Answer, bool) {
  1299  	return nil, false
  1300  }
  1301  
  1302  // AsBasicAnswer is the BasicResponseBase implementation for Identifiable.
  1303  func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) {
  1304  	return nil, false
  1305  }
  1306  
  1307  // AsArticle is the BasicResponseBase implementation for Identifiable.
  1308  func (i Identifiable) AsArticle() (*Article, bool) {
  1309  	return nil, false
  1310  }
  1311  
  1312  // AsBasicArticle is the BasicResponseBase implementation for Identifiable.
  1313  func (i Identifiable) AsBasicArticle() (BasicArticle, bool) {
  1314  	return nil, false
  1315  }
  1316  
  1317  // AsThing is the BasicResponseBase implementation for Identifiable.
  1318  func (i Identifiable) AsThing() (*Thing, bool) {
  1319  	return nil, false
  1320  }
  1321  
  1322  // AsBasicThing is the BasicResponseBase implementation for Identifiable.
  1323  func (i Identifiable) AsBasicThing() (BasicThing, bool) {
  1324  	return nil, false
  1325  }
  1326  
  1327  // AsResponse is the BasicResponseBase implementation for Identifiable.
  1328  func (i Identifiable) AsResponse() (*Response, bool) {
  1329  	return nil, false
  1330  }
  1331  
  1332  // AsBasicResponse is the BasicResponseBase implementation for Identifiable.
  1333  func (i Identifiable) AsBasicResponse() (BasicResponse, bool) {
  1334  	return nil, false
  1335  }
  1336  
  1337  // AsTrendingTopics is the BasicResponseBase implementation for Identifiable.
  1338  func (i Identifiable) AsTrendingTopics() (*TrendingTopics, bool) {
  1339  	return nil, false
  1340  }
  1341  
  1342  // AsVideoObject is the BasicResponseBase implementation for Identifiable.
  1343  func (i Identifiable) AsVideoObject() (*VideoObject, bool) {
  1344  	return nil, false
  1345  }
  1346  
  1347  // AsCreativeWork is the BasicResponseBase implementation for Identifiable.
  1348  func (i Identifiable) AsCreativeWork() (*CreativeWork, bool) {
  1349  	return nil, false
  1350  }
  1351  
  1352  // AsBasicCreativeWork is the BasicResponseBase implementation for Identifiable.
  1353  func (i Identifiable) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1354  	return nil, false
  1355  }
  1356  
  1357  // AsOrganization is the BasicResponseBase implementation for Identifiable.
  1358  func (i Identifiable) AsOrganization() (*Organization, bool) {
  1359  	return nil, false
  1360  }
  1361  
  1362  // AsIdentifiable is the BasicResponseBase implementation for Identifiable.
  1363  func (i Identifiable) AsIdentifiable() (*Identifiable, bool) {
  1364  	return &i, true
  1365  }
  1366  
  1367  // AsBasicIdentifiable is the BasicResponseBase implementation for Identifiable.
  1368  func (i Identifiable) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1369  	return &i, true
  1370  }
  1371  
  1372  // AsErrorResponse is the BasicResponseBase implementation for Identifiable.
  1373  func (i Identifiable) AsErrorResponse() (*ErrorResponse, bool) {
  1374  	return nil, false
  1375  }
  1376  
  1377  // AsMediaObject is the BasicResponseBase implementation for Identifiable.
  1378  func (i Identifiable) AsMediaObject() (*MediaObject, bool) {
  1379  	return nil, false
  1380  }
  1381  
  1382  // AsBasicMediaObject is the BasicResponseBase implementation for Identifiable.
  1383  func (i Identifiable) AsBasicMediaObject() (BasicMediaObject, bool) {
  1384  	return nil, false
  1385  }
  1386  
  1387  // AsResponseBase is the BasicResponseBase implementation for Identifiable.
  1388  func (i Identifiable) AsResponseBase() (*ResponseBase, bool) {
  1389  	return nil, false
  1390  }
  1391  
  1392  // AsBasicResponseBase is the BasicResponseBase implementation for Identifiable.
  1393  func (i Identifiable) AsBasicResponseBase() (BasicResponseBase, bool) {
  1394  	return &i, true
  1395  }
  1396  
  1397  // ImageObject defines an image
  1398  type ImageObject struct {
  1399  	// Thumbnail - READ-ONLY; The URL to a thumbnail of the image
  1400  	Thumbnail *ImageObject `json:"thumbnail,omitempty"`
  1401  	// ContentURL - READ-ONLY; Original URL to retrieve the source (file) for the media object (e.g the source URL for the image).
  1402  	ContentURL *string `json:"contentUrl,omitempty"`
  1403  	// Width - READ-ONLY; The width of the source media object, in pixels.
  1404  	Width *int32 `json:"width,omitempty"`
  1405  	// Height - READ-ONLY; The height of the source media object, in pixels.
  1406  	Height *int32 `json:"height,omitempty"`
  1407  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
  1408  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
  1409  	// Provider - READ-ONLY; The source of the creative work.
  1410  	Provider *[]BasicThing `json:"provider,omitempty"`
  1411  	// DatePublished - READ-ONLY; The date on which the CreativeWork was published.
  1412  	DatePublished *string `json:"datePublished,omitempty"`
  1413  	// Video - READ-ONLY; A video of the item.
  1414  	Video *VideoObject `json:"video,omitempty"`
  1415  	// Name - READ-ONLY; The name of the thing represented by this object.
  1416  	Name *string `json:"name,omitempty"`
  1417  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  1418  	URL *string `json:"url,omitempty"`
  1419  	// Image - READ-ONLY; An image of the item.
  1420  	Image *ImageObject `json:"image,omitempty"`
  1421  	// Description - READ-ONLY; A short description of the item.
  1422  	Description *string `json:"description,omitempty"`
  1423  	// AlternateName - READ-ONLY; An alias for the item
  1424  	AlternateName *string `json:"alternateName,omitempty"`
  1425  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
  1426  	BingID *string `json:"bingId,omitempty"`
  1427  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  1428  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  1429  	// ID - READ-ONLY; A String identifier.
  1430  	ID *string `json:"id,omitempty"`
  1431  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  1432  	Type Type `json:"_type,omitempty"`
  1433  }
  1434  
  1435  // MarshalJSON is the custom marshaler for ImageObject.
  1436  func (ioVar ImageObject) MarshalJSON() ([]byte, error) {
  1437  	ioVar.Type = TypeImageObject
  1438  	objectMap := make(map[string]interface{})
  1439  	if ioVar.Type != "" {
  1440  		objectMap["_type"] = ioVar.Type
  1441  	}
  1442  	return json.Marshal(objectMap)
  1443  }
  1444  
  1445  // AsNewsArticle is the BasicResponseBase implementation for ImageObject.
  1446  func (ioVar ImageObject) AsNewsArticle() (*NewsArticle, bool) {
  1447  	return nil, false
  1448  }
  1449  
  1450  // AsNews is the BasicResponseBase implementation for ImageObject.
  1451  func (ioVar ImageObject) AsNews() (*News, bool) {
  1452  	return nil, false
  1453  }
  1454  
  1455  // AsSearchResultsAnswer is the BasicResponseBase implementation for ImageObject.
  1456  func (ioVar ImageObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1457  	return nil, false
  1458  }
  1459  
  1460  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ImageObject.
  1461  func (ioVar ImageObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  1462  	return nil, false
  1463  }
  1464  
  1465  // AsImageObject is the BasicResponseBase implementation for ImageObject.
  1466  func (ioVar ImageObject) AsImageObject() (*ImageObject, bool) {
  1467  	return &ioVar, true
  1468  }
  1469  
  1470  // AsNewsTopic is the BasicResponseBase implementation for ImageObject.
  1471  func (ioVar ImageObject) AsNewsTopic() (*NewsTopic, bool) {
  1472  	return nil, false
  1473  }
  1474  
  1475  // AsAnswer is the BasicResponseBase implementation for ImageObject.
  1476  func (ioVar ImageObject) AsAnswer() (*Answer, bool) {
  1477  	return nil, false
  1478  }
  1479  
  1480  // AsBasicAnswer is the BasicResponseBase implementation for ImageObject.
  1481  func (ioVar ImageObject) AsBasicAnswer() (BasicAnswer, bool) {
  1482  	return nil, false
  1483  }
  1484  
  1485  // AsArticle is the BasicResponseBase implementation for ImageObject.
  1486  func (ioVar ImageObject) AsArticle() (*Article, bool) {
  1487  	return nil, false
  1488  }
  1489  
  1490  // AsBasicArticle is the BasicResponseBase implementation for ImageObject.
  1491  func (ioVar ImageObject) AsBasicArticle() (BasicArticle, bool) {
  1492  	return nil, false
  1493  }
  1494  
  1495  // AsThing is the BasicResponseBase implementation for ImageObject.
  1496  func (ioVar ImageObject) AsThing() (*Thing, bool) {
  1497  	return nil, false
  1498  }
  1499  
  1500  // AsBasicThing is the BasicResponseBase implementation for ImageObject.
  1501  func (ioVar ImageObject) AsBasicThing() (BasicThing, bool) {
  1502  	return &ioVar, true
  1503  }
  1504  
  1505  // AsResponse is the BasicResponseBase implementation for ImageObject.
  1506  func (ioVar ImageObject) AsResponse() (*Response, bool) {
  1507  	return nil, false
  1508  }
  1509  
  1510  // AsBasicResponse is the BasicResponseBase implementation for ImageObject.
  1511  func (ioVar ImageObject) AsBasicResponse() (BasicResponse, bool) {
  1512  	return &ioVar, true
  1513  }
  1514  
  1515  // AsTrendingTopics is the BasicResponseBase implementation for ImageObject.
  1516  func (ioVar ImageObject) AsTrendingTopics() (*TrendingTopics, bool) {
  1517  	return nil, false
  1518  }
  1519  
  1520  // AsVideoObject is the BasicResponseBase implementation for ImageObject.
  1521  func (ioVar ImageObject) AsVideoObject() (*VideoObject, bool) {
  1522  	return nil, false
  1523  }
  1524  
  1525  // AsCreativeWork is the BasicResponseBase implementation for ImageObject.
  1526  func (ioVar ImageObject) AsCreativeWork() (*CreativeWork, bool) {
  1527  	return nil, false
  1528  }
  1529  
  1530  // AsBasicCreativeWork is the BasicResponseBase implementation for ImageObject.
  1531  func (ioVar ImageObject) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1532  	return &ioVar, true
  1533  }
  1534  
  1535  // AsOrganization is the BasicResponseBase implementation for ImageObject.
  1536  func (ioVar ImageObject) AsOrganization() (*Organization, bool) {
  1537  	return nil, false
  1538  }
  1539  
  1540  // AsIdentifiable is the BasicResponseBase implementation for ImageObject.
  1541  func (ioVar ImageObject) AsIdentifiable() (*Identifiable, bool) {
  1542  	return nil, false
  1543  }
  1544  
  1545  // AsBasicIdentifiable is the BasicResponseBase implementation for ImageObject.
  1546  func (ioVar ImageObject) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1547  	return &ioVar, true
  1548  }
  1549  
  1550  // AsErrorResponse is the BasicResponseBase implementation for ImageObject.
  1551  func (ioVar ImageObject) AsErrorResponse() (*ErrorResponse, bool) {
  1552  	return nil, false
  1553  }
  1554  
  1555  // AsMediaObject is the BasicResponseBase implementation for ImageObject.
  1556  func (ioVar ImageObject) AsMediaObject() (*MediaObject, bool) {
  1557  	return nil, false
  1558  }
  1559  
  1560  // AsBasicMediaObject is the BasicResponseBase implementation for ImageObject.
  1561  func (ioVar ImageObject) AsBasicMediaObject() (BasicMediaObject, bool) {
  1562  	return &ioVar, true
  1563  }
  1564  
  1565  // AsResponseBase is the BasicResponseBase implementation for ImageObject.
  1566  func (ioVar ImageObject) AsResponseBase() (*ResponseBase, bool) {
  1567  	return nil, false
  1568  }
  1569  
  1570  // AsBasicResponseBase is the BasicResponseBase implementation for ImageObject.
  1571  func (ioVar ImageObject) AsBasicResponseBase() (BasicResponseBase, bool) {
  1572  	return &ioVar, true
  1573  }
  1574  
  1575  // UnmarshalJSON is the custom unmarshaler for ImageObject struct.
  1576  func (ioVar *ImageObject) UnmarshalJSON(body []byte) error {
  1577  	var m map[string]*json.RawMessage
  1578  	err := json.Unmarshal(body, &m)
  1579  	if err != nil {
  1580  		return err
  1581  	}
  1582  	for k, v := range m {
  1583  		switch k {
  1584  		case "thumbnail":
  1585  			if v != nil {
  1586  				var thumbnail ImageObject
  1587  				err = json.Unmarshal(*v, &thumbnail)
  1588  				if err != nil {
  1589  					return err
  1590  				}
  1591  				ioVar.Thumbnail = &thumbnail
  1592  			}
  1593  		case "contentUrl":
  1594  			if v != nil {
  1595  				var contentURL string
  1596  				err = json.Unmarshal(*v, &contentURL)
  1597  				if err != nil {
  1598  					return err
  1599  				}
  1600  				ioVar.ContentURL = &contentURL
  1601  			}
  1602  		case "width":
  1603  			if v != nil {
  1604  				var width int32
  1605  				err = json.Unmarshal(*v, &width)
  1606  				if err != nil {
  1607  					return err
  1608  				}
  1609  				ioVar.Width = &width
  1610  			}
  1611  		case "height":
  1612  			if v != nil {
  1613  				var height int32
  1614  				err = json.Unmarshal(*v, &height)
  1615  				if err != nil {
  1616  					return err
  1617  				}
  1618  				ioVar.Height = &height
  1619  			}
  1620  		case "thumbnailUrl":
  1621  			if v != nil {
  1622  				var thumbnailURL string
  1623  				err = json.Unmarshal(*v, &thumbnailURL)
  1624  				if err != nil {
  1625  					return err
  1626  				}
  1627  				ioVar.ThumbnailURL = &thumbnailURL
  1628  			}
  1629  		case "provider":
  1630  			if v != nil {
  1631  				provider, err := unmarshalBasicThingArray(*v)
  1632  				if err != nil {
  1633  					return err
  1634  				}
  1635  				ioVar.Provider = &provider
  1636  			}
  1637  		case "datePublished":
  1638  			if v != nil {
  1639  				var datePublished string
  1640  				err = json.Unmarshal(*v, &datePublished)
  1641  				if err != nil {
  1642  					return err
  1643  				}
  1644  				ioVar.DatePublished = &datePublished
  1645  			}
  1646  		case "video":
  1647  			if v != nil {
  1648  				var video VideoObject
  1649  				err = json.Unmarshal(*v, &video)
  1650  				if err != nil {
  1651  					return err
  1652  				}
  1653  				ioVar.Video = &video
  1654  			}
  1655  		case "name":
  1656  			if v != nil {
  1657  				var name string
  1658  				err = json.Unmarshal(*v, &name)
  1659  				if err != nil {
  1660  					return err
  1661  				}
  1662  				ioVar.Name = &name
  1663  			}
  1664  		case "url":
  1665  			if v != nil {
  1666  				var URL string
  1667  				err = json.Unmarshal(*v, &URL)
  1668  				if err != nil {
  1669  					return err
  1670  				}
  1671  				ioVar.URL = &URL
  1672  			}
  1673  		case "image":
  1674  			if v != nil {
  1675  				var imageVar ImageObject
  1676  				err = json.Unmarshal(*v, &imageVar)
  1677  				if err != nil {
  1678  					return err
  1679  				}
  1680  				ioVar.Image = &imageVar
  1681  			}
  1682  		case "description":
  1683  			if v != nil {
  1684  				var description string
  1685  				err = json.Unmarshal(*v, &description)
  1686  				if err != nil {
  1687  					return err
  1688  				}
  1689  				ioVar.Description = &description
  1690  			}
  1691  		case "alternateName":
  1692  			if v != nil {
  1693  				var alternateName string
  1694  				err = json.Unmarshal(*v, &alternateName)
  1695  				if err != nil {
  1696  					return err
  1697  				}
  1698  				ioVar.AlternateName = &alternateName
  1699  			}
  1700  		case "bingId":
  1701  			if v != nil {
  1702  				var bingID string
  1703  				err = json.Unmarshal(*v, &bingID)
  1704  				if err != nil {
  1705  					return err
  1706  				}
  1707  				ioVar.BingID = &bingID
  1708  			}
  1709  		case "webSearchUrl":
  1710  			if v != nil {
  1711  				var webSearchURL string
  1712  				err = json.Unmarshal(*v, &webSearchURL)
  1713  				if err != nil {
  1714  					return err
  1715  				}
  1716  				ioVar.WebSearchURL = &webSearchURL
  1717  			}
  1718  		case "id":
  1719  			if v != nil {
  1720  				var ID string
  1721  				err = json.Unmarshal(*v, &ID)
  1722  				if err != nil {
  1723  					return err
  1724  				}
  1725  				ioVar.ID = &ID
  1726  			}
  1727  		case "_type":
  1728  			if v != nil {
  1729  				var typeVar Type
  1730  				err = json.Unmarshal(*v, &typeVar)
  1731  				if err != nil {
  1732  					return err
  1733  				}
  1734  				ioVar.Type = typeVar
  1735  			}
  1736  		}
  1737  	}
  1738  
  1739  	return nil
  1740  }
  1741  
  1742  // BasicMediaObject defines a media object.
  1743  type BasicMediaObject interface {
  1744  	AsImageObject() (*ImageObject, bool)
  1745  	AsVideoObject() (*VideoObject, bool)
  1746  	AsMediaObject() (*MediaObject, bool)
  1747  }
  1748  
  1749  // MediaObject defines a media object.
  1750  type MediaObject struct {
  1751  	// ContentURL - READ-ONLY; Original URL to retrieve the source (file) for the media object (e.g the source URL for the image).
  1752  	ContentURL *string `json:"contentUrl,omitempty"`
  1753  	// Width - READ-ONLY; The width of the source media object, in pixels.
  1754  	Width *int32 `json:"width,omitempty"`
  1755  	// Height - READ-ONLY; The height of the source media object, in pixels.
  1756  	Height *int32 `json:"height,omitempty"`
  1757  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
  1758  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
  1759  	// Provider - READ-ONLY; The source of the creative work.
  1760  	Provider *[]BasicThing `json:"provider,omitempty"`
  1761  	// DatePublished - READ-ONLY; The date on which the CreativeWork was published.
  1762  	DatePublished *string `json:"datePublished,omitempty"`
  1763  	// Video - READ-ONLY; A video of the item.
  1764  	Video *VideoObject `json:"video,omitempty"`
  1765  	// Name - READ-ONLY; The name of the thing represented by this object.
  1766  	Name *string `json:"name,omitempty"`
  1767  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  1768  	URL *string `json:"url,omitempty"`
  1769  	// Image - READ-ONLY; An image of the item.
  1770  	Image *ImageObject `json:"image,omitempty"`
  1771  	// Description - READ-ONLY; A short description of the item.
  1772  	Description *string `json:"description,omitempty"`
  1773  	// AlternateName - READ-ONLY; An alias for the item
  1774  	AlternateName *string `json:"alternateName,omitempty"`
  1775  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
  1776  	BingID *string `json:"bingId,omitempty"`
  1777  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  1778  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  1779  	// ID - READ-ONLY; A String identifier.
  1780  	ID *string `json:"id,omitempty"`
  1781  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  1782  	Type Type `json:"_type,omitempty"`
  1783  }
  1784  
  1785  func unmarshalBasicMediaObject(body []byte) (BasicMediaObject, error) {
  1786  	var m map[string]interface{}
  1787  	err := json.Unmarshal(body, &m)
  1788  	if err != nil {
  1789  		return nil, err
  1790  	}
  1791  
  1792  	switch m["_type"] {
  1793  	case string(TypeImageObject):
  1794  		var ioVar ImageObject
  1795  		err := json.Unmarshal(body, &ioVar)
  1796  		return ioVar, err
  1797  	case string(TypeVideoObject):
  1798  		var vo VideoObject
  1799  		err := json.Unmarshal(body, &vo)
  1800  		return vo, err
  1801  	default:
  1802  		var mo MediaObject
  1803  		err := json.Unmarshal(body, &mo)
  1804  		return mo, err
  1805  	}
  1806  }
  1807  func unmarshalBasicMediaObjectArray(body []byte) ([]BasicMediaObject, error) {
  1808  	var rawMessages []*json.RawMessage
  1809  	err := json.Unmarshal(body, &rawMessages)
  1810  	if err != nil {
  1811  		return nil, err
  1812  	}
  1813  
  1814  	moArray := make([]BasicMediaObject, len(rawMessages))
  1815  
  1816  	for index, rawMessage := range rawMessages {
  1817  		mo, err := unmarshalBasicMediaObject(*rawMessage)
  1818  		if err != nil {
  1819  			return nil, err
  1820  		}
  1821  		moArray[index] = mo
  1822  	}
  1823  	return moArray, nil
  1824  }
  1825  
  1826  // MarshalJSON is the custom marshaler for MediaObject.
  1827  func (mo MediaObject) MarshalJSON() ([]byte, error) {
  1828  	mo.Type = TypeMediaObject
  1829  	objectMap := make(map[string]interface{})
  1830  	if mo.Type != "" {
  1831  		objectMap["_type"] = mo.Type
  1832  	}
  1833  	return json.Marshal(objectMap)
  1834  }
  1835  
  1836  // AsNewsArticle is the BasicResponseBase implementation for MediaObject.
  1837  func (mo MediaObject) AsNewsArticle() (*NewsArticle, bool) {
  1838  	return nil, false
  1839  }
  1840  
  1841  // AsNews is the BasicResponseBase implementation for MediaObject.
  1842  func (mo MediaObject) AsNews() (*News, bool) {
  1843  	return nil, false
  1844  }
  1845  
  1846  // AsSearchResultsAnswer is the BasicResponseBase implementation for MediaObject.
  1847  func (mo MediaObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1848  	return nil, false
  1849  }
  1850  
  1851  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for MediaObject.
  1852  func (mo MediaObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  1853  	return nil, false
  1854  }
  1855  
  1856  // AsImageObject is the BasicResponseBase implementation for MediaObject.
  1857  func (mo MediaObject) AsImageObject() (*ImageObject, bool) {
  1858  	return nil, false
  1859  }
  1860  
  1861  // AsNewsTopic is the BasicResponseBase implementation for MediaObject.
  1862  func (mo MediaObject) AsNewsTopic() (*NewsTopic, bool) {
  1863  	return nil, false
  1864  }
  1865  
  1866  // AsAnswer is the BasicResponseBase implementation for MediaObject.
  1867  func (mo MediaObject) AsAnswer() (*Answer, bool) {
  1868  	return nil, false
  1869  }
  1870  
  1871  // AsBasicAnswer is the BasicResponseBase implementation for MediaObject.
  1872  func (mo MediaObject) AsBasicAnswer() (BasicAnswer, bool) {
  1873  	return nil, false
  1874  }
  1875  
  1876  // AsArticle is the BasicResponseBase implementation for MediaObject.
  1877  func (mo MediaObject) AsArticle() (*Article, bool) {
  1878  	return nil, false
  1879  }
  1880  
  1881  // AsBasicArticle is the BasicResponseBase implementation for MediaObject.
  1882  func (mo MediaObject) AsBasicArticle() (BasicArticle, bool) {
  1883  	return nil, false
  1884  }
  1885  
  1886  // AsThing is the BasicResponseBase implementation for MediaObject.
  1887  func (mo MediaObject) AsThing() (*Thing, bool) {
  1888  	return nil, false
  1889  }
  1890  
  1891  // AsBasicThing is the BasicResponseBase implementation for MediaObject.
  1892  func (mo MediaObject) AsBasicThing() (BasicThing, bool) {
  1893  	return &mo, true
  1894  }
  1895  
  1896  // AsResponse is the BasicResponseBase implementation for MediaObject.
  1897  func (mo MediaObject) AsResponse() (*Response, bool) {
  1898  	return nil, false
  1899  }
  1900  
  1901  // AsBasicResponse is the BasicResponseBase implementation for MediaObject.
  1902  func (mo MediaObject) AsBasicResponse() (BasicResponse, bool) {
  1903  	return &mo, true
  1904  }
  1905  
  1906  // AsTrendingTopics is the BasicResponseBase implementation for MediaObject.
  1907  func (mo MediaObject) AsTrendingTopics() (*TrendingTopics, bool) {
  1908  	return nil, false
  1909  }
  1910  
  1911  // AsVideoObject is the BasicResponseBase implementation for MediaObject.
  1912  func (mo MediaObject) AsVideoObject() (*VideoObject, bool) {
  1913  	return nil, false
  1914  }
  1915  
  1916  // AsCreativeWork is the BasicResponseBase implementation for MediaObject.
  1917  func (mo MediaObject) AsCreativeWork() (*CreativeWork, bool) {
  1918  	return nil, false
  1919  }
  1920  
  1921  // AsBasicCreativeWork is the BasicResponseBase implementation for MediaObject.
  1922  func (mo MediaObject) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1923  	return &mo, true
  1924  }
  1925  
  1926  // AsOrganization is the BasicResponseBase implementation for MediaObject.
  1927  func (mo MediaObject) AsOrganization() (*Organization, bool) {
  1928  	return nil, false
  1929  }
  1930  
  1931  // AsIdentifiable is the BasicResponseBase implementation for MediaObject.
  1932  func (mo MediaObject) AsIdentifiable() (*Identifiable, bool) {
  1933  	return nil, false
  1934  }
  1935  
  1936  // AsBasicIdentifiable is the BasicResponseBase implementation for MediaObject.
  1937  func (mo MediaObject) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1938  	return &mo, true
  1939  }
  1940  
  1941  // AsErrorResponse is the BasicResponseBase implementation for MediaObject.
  1942  func (mo MediaObject) AsErrorResponse() (*ErrorResponse, bool) {
  1943  	return nil, false
  1944  }
  1945  
  1946  // AsMediaObject is the BasicResponseBase implementation for MediaObject.
  1947  func (mo MediaObject) AsMediaObject() (*MediaObject, bool) {
  1948  	return &mo, true
  1949  }
  1950  
  1951  // AsBasicMediaObject is the BasicResponseBase implementation for MediaObject.
  1952  func (mo MediaObject) AsBasicMediaObject() (BasicMediaObject, bool) {
  1953  	return &mo, true
  1954  }
  1955  
  1956  // AsResponseBase is the BasicResponseBase implementation for MediaObject.
  1957  func (mo MediaObject) AsResponseBase() (*ResponseBase, bool) {
  1958  	return nil, false
  1959  }
  1960  
  1961  // AsBasicResponseBase is the BasicResponseBase implementation for MediaObject.
  1962  func (mo MediaObject) AsBasicResponseBase() (BasicResponseBase, bool) {
  1963  	return &mo, true
  1964  }
  1965  
  1966  // UnmarshalJSON is the custom unmarshaler for MediaObject struct.
  1967  func (mo *MediaObject) UnmarshalJSON(body []byte) error {
  1968  	var m map[string]*json.RawMessage
  1969  	err := json.Unmarshal(body, &m)
  1970  	if err != nil {
  1971  		return err
  1972  	}
  1973  	for k, v := range m {
  1974  		switch k {
  1975  		case "contentUrl":
  1976  			if v != nil {
  1977  				var contentURL string
  1978  				err = json.Unmarshal(*v, &contentURL)
  1979  				if err != nil {
  1980  					return err
  1981  				}
  1982  				mo.ContentURL = &contentURL
  1983  			}
  1984  		case "width":
  1985  			if v != nil {
  1986  				var width int32
  1987  				err = json.Unmarshal(*v, &width)
  1988  				if err != nil {
  1989  					return err
  1990  				}
  1991  				mo.Width = &width
  1992  			}
  1993  		case "height":
  1994  			if v != nil {
  1995  				var height int32
  1996  				err = json.Unmarshal(*v, &height)
  1997  				if err != nil {
  1998  					return err
  1999  				}
  2000  				mo.Height = &height
  2001  			}
  2002  		case "thumbnailUrl":
  2003  			if v != nil {
  2004  				var thumbnailURL string
  2005  				err = json.Unmarshal(*v, &thumbnailURL)
  2006  				if err != nil {
  2007  					return err
  2008  				}
  2009  				mo.ThumbnailURL = &thumbnailURL
  2010  			}
  2011  		case "provider":
  2012  			if v != nil {
  2013  				provider, err := unmarshalBasicThingArray(*v)
  2014  				if err != nil {
  2015  					return err
  2016  				}
  2017  				mo.Provider = &provider
  2018  			}
  2019  		case "datePublished":
  2020  			if v != nil {
  2021  				var datePublished string
  2022  				err = json.Unmarshal(*v, &datePublished)
  2023  				if err != nil {
  2024  					return err
  2025  				}
  2026  				mo.DatePublished = &datePublished
  2027  			}
  2028  		case "video":
  2029  			if v != nil {
  2030  				var video VideoObject
  2031  				err = json.Unmarshal(*v, &video)
  2032  				if err != nil {
  2033  					return err
  2034  				}
  2035  				mo.Video = &video
  2036  			}
  2037  		case "name":
  2038  			if v != nil {
  2039  				var name string
  2040  				err = json.Unmarshal(*v, &name)
  2041  				if err != nil {
  2042  					return err
  2043  				}
  2044  				mo.Name = &name
  2045  			}
  2046  		case "url":
  2047  			if v != nil {
  2048  				var URL string
  2049  				err = json.Unmarshal(*v, &URL)
  2050  				if err != nil {
  2051  					return err
  2052  				}
  2053  				mo.URL = &URL
  2054  			}
  2055  		case "image":
  2056  			if v != nil {
  2057  				var imageVar ImageObject
  2058  				err = json.Unmarshal(*v, &imageVar)
  2059  				if err != nil {
  2060  					return err
  2061  				}
  2062  				mo.Image = &imageVar
  2063  			}
  2064  		case "description":
  2065  			if v != nil {
  2066  				var description string
  2067  				err = json.Unmarshal(*v, &description)
  2068  				if err != nil {
  2069  					return err
  2070  				}
  2071  				mo.Description = &description
  2072  			}
  2073  		case "alternateName":
  2074  			if v != nil {
  2075  				var alternateName string
  2076  				err = json.Unmarshal(*v, &alternateName)
  2077  				if err != nil {
  2078  					return err
  2079  				}
  2080  				mo.AlternateName = &alternateName
  2081  			}
  2082  		case "bingId":
  2083  			if v != nil {
  2084  				var bingID string
  2085  				err = json.Unmarshal(*v, &bingID)
  2086  				if err != nil {
  2087  					return err
  2088  				}
  2089  				mo.BingID = &bingID
  2090  			}
  2091  		case "webSearchUrl":
  2092  			if v != nil {
  2093  				var webSearchURL string
  2094  				err = json.Unmarshal(*v, &webSearchURL)
  2095  				if err != nil {
  2096  					return err
  2097  				}
  2098  				mo.WebSearchURL = &webSearchURL
  2099  			}
  2100  		case "id":
  2101  			if v != nil {
  2102  				var ID string
  2103  				err = json.Unmarshal(*v, &ID)
  2104  				if err != nil {
  2105  					return err
  2106  				}
  2107  				mo.ID = &ID
  2108  			}
  2109  		case "_type":
  2110  			if v != nil {
  2111  				var typeVar Type
  2112  				err = json.Unmarshal(*v, &typeVar)
  2113  				if err != nil {
  2114  					return err
  2115  				}
  2116  				mo.Type = typeVar
  2117  			}
  2118  		}
  2119  	}
  2120  
  2121  	return nil
  2122  }
  2123  
  2124  // News defines a news answer.
  2125  type News struct {
  2126  	autorest.Response `json:"-"`
  2127  	// Value - An array of NewsArticle objects that contain information about news articles that are relevant to the query. If there are no results to return for the request, the array is empty.
  2128  	Value *[]NewsArticle `json:"value,omitempty"`
  2129  	// Location - READ-ONLY; Location of local news
  2130  	Location *string `json:"location,omitempty"`
  2131  	// TotalEstimatedMatches - READ-ONLY; The estimated number of webpages that are relevant to the query. Use this number along with the count and offset query parameters to page the results.
  2132  	TotalEstimatedMatches *int64 `json:"totalEstimatedMatches,omitempty"`
  2133  	// FollowUpQueries - READ-ONLY
  2134  	FollowUpQueries *[]Query `json:"followUpQueries,omitempty"`
  2135  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  2136  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2137  	// ID - READ-ONLY; A String identifier.
  2138  	ID *string `json:"id,omitempty"`
  2139  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  2140  	Type Type `json:"_type,omitempty"`
  2141  }
  2142  
  2143  // MarshalJSON is the custom marshaler for News.
  2144  func (n News) MarshalJSON() ([]byte, error) {
  2145  	n.Type = TypeNews
  2146  	objectMap := make(map[string]interface{})
  2147  	if n.Value != nil {
  2148  		objectMap["value"] = n.Value
  2149  	}
  2150  	if n.Type != "" {
  2151  		objectMap["_type"] = n.Type
  2152  	}
  2153  	return json.Marshal(objectMap)
  2154  }
  2155  
  2156  // AsNewsArticle is the BasicResponseBase implementation for News.
  2157  func (n News) AsNewsArticle() (*NewsArticle, bool) {
  2158  	return nil, false
  2159  }
  2160  
  2161  // AsNews is the BasicResponseBase implementation for News.
  2162  func (n News) AsNews() (*News, bool) {
  2163  	return &n, true
  2164  }
  2165  
  2166  // AsSearchResultsAnswer is the BasicResponseBase implementation for News.
  2167  func (n News) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2168  	return nil, false
  2169  }
  2170  
  2171  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for News.
  2172  func (n News) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2173  	return &n, true
  2174  }
  2175  
  2176  // AsImageObject is the BasicResponseBase implementation for News.
  2177  func (n News) AsImageObject() (*ImageObject, bool) {
  2178  	return nil, false
  2179  }
  2180  
  2181  // AsNewsTopic is the BasicResponseBase implementation for News.
  2182  func (n News) AsNewsTopic() (*NewsTopic, bool) {
  2183  	return nil, false
  2184  }
  2185  
  2186  // AsAnswer is the BasicResponseBase implementation for News.
  2187  func (n News) AsAnswer() (*Answer, bool) {
  2188  	return nil, false
  2189  }
  2190  
  2191  // AsBasicAnswer is the BasicResponseBase implementation for News.
  2192  func (n News) AsBasicAnswer() (BasicAnswer, bool) {
  2193  	return &n, true
  2194  }
  2195  
  2196  // AsArticle is the BasicResponseBase implementation for News.
  2197  func (n News) AsArticle() (*Article, bool) {
  2198  	return nil, false
  2199  }
  2200  
  2201  // AsBasicArticle is the BasicResponseBase implementation for News.
  2202  func (n News) AsBasicArticle() (BasicArticle, bool) {
  2203  	return nil, false
  2204  }
  2205  
  2206  // AsThing is the BasicResponseBase implementation for News.
  2207  func (n News) AsThing() (*Thing, bool) {
  2208  	return nil, false
  2209  }
  2210  
  2211  // AsBasicThing is the BasicResponseBase implementation for News.
  2212  func (n News) AsBasicThing() (BasicThing, bool) {
  2213  	return nil, false
  2214  }
  2215  
  2216  // AsResponse is the BasicResponseBase implementation for News.
  2217  func (n News) AsResponse() (*Response, bool) {
  2218  	return nil, false
  2219  }
  2220  
  2221  // AsBasicResponse is the BasicResponseBase implementation for News.
  2222  func (n News) AsBasicResponse() (BasicResponse, bool) {
  2223  	return &n, true
  2224  }
  2225  
  2226  // AsTrendingTopics is the BasicResponseBase implementation for News.
  2227  func (n News) AsTrendingTopics() (*TrendingTopics, bool) {
  2228  	return nil, false
  2229  }
  2230  
  2231  // AsVideoObject is the BasicResponseBase implementation for News.
  2232  func (n News) AsVideoObject() (*VideoObject, bool) {
  2233  	return nil, false
  2234  }
  2235  
  2236  // AsCreativeWork is the BasicResponseBase implementation for News.
  2237  func (n News) AsCreativeWork() (*CreativeWork, bool) {
  2238  	return nil, false
  2239  }
  2240  
  2241  // AsBasicCreativeWork is the BasicResponseBase implementation for News.
  2242  func (n News) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2243  	return nil, false
  2244  }
  2245  
  2246  // AsOrganization is the BasicResponseBase implementation for News.
  2247  func (n News) AsOrganization() (*Organization, bool) {
  2248  	return nil, false
  2249  }
  2250  
  2251  // AsIdentifiable is the BasicResponseBase implementation for News.
  2252  func (n News) AsIdentifiable() (*Identifiable, bool) {
  2253  	return nil, false
  2254  }
  2255  
  2256  // AsBasicIdentifiable is the BasicResponseBase implementation for News.
  2257  func (n News) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2258  	return &n, true
  2259  }
  2260  
  2261  // AsErrorResponse is the BasicResponseBase implementation for News.
  2262  func (n News) AsErrorResponse() (*ErrorResponse, bool) {
  2263  	return nil, false
  2264  }
  2265  
  2266  // AsMediaObject is the BasicResponseBase implementation for News.
  2267  func (n News) AsMediaObject() (*MediaObject, bool) {
  2268  	return nil, false
  2269  }
  2270  
  2271  // AsBasicMediaObject is the BasicResponseBase implementation for News.
  2272  func (n News) AsBasicMediaObject() (BasicMediaObject, bool) {
  2273  	return nil, false
  2274  }
  2275  
  2276  // AsResponseBase is the BasicResponseBase implementation for News.
  2277  func (n News) AsResponseBase() (*ResponseBase, bool) {
  2278  	return nil, false
  2279  }
  2280  
  2281  // AsBasicResponseBase is the BasicResponseBase implementation for News.
  2282  func (n News) AsBasicResponseBase() (BasicResponseBase, bool) {
  2283  	return &n, true
  2284  }
  2285  
  2286  // NewsArticle defines a news article.
  2287  type NewsArticle struct {
  2288  	// Category - READ-ONLY; The news category that the article belongs to. For example, Sports. If the news category cannot be determined, the article does not include this field.
  2289  	Category *string `json:"category,omitempty"`
  2290  	// Headline - READ-ONLY; A Boolean value that indicates whether the news article is a headline. If true, the article is a headline. The article includes this field only for news categories requests that do not specify the category query parameter.
  2291  	Headline *bool `json:"headline,omitempty"`
  2292  	// ClusteredArticles - READ-ONLY; A list of related news articles.
  2293  	ClusteredArticles *[]NewsArticle `json:"clusteredArticles,omitempty"`
  2294  	// WordCount - READ-ONLY; The number of words in the text of the Article.
  2295  	WordCount *int32 `json:"wordCount,omitempty"`
  2296  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
  2297  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
  2298  	// Provider - READ-ONLY; The source of the creative work.
  2299  	Provider *[]BasicThing `json:"provider,omitempty"`
  2300  	// DatePublished - READ-ONLY; The date on which the CreativeWork was published.
  2301  	DatePublished *string `json:"datePublished,omitempty"`
  2302  	// Video - READ-ONLY; A video of the item.
  2303  	Video *VideoObject `json:"video,omitempty"`
  2304  	// Name - READ-ONLY; The name of the thing represented by this object.
  2305  	Name *string `json:"name,omitempty"`
  2306  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  2307  	URL *string `json:"url,omitempty"`
  2308  	// Image - READ-ONLY; An image of the item.
  2309  	Image *ImageObject `json:"image,omitempty"`
  2310  	// Description - READ-ONLY; A short description of the item.
  2311  	Description *string `json:"description,omitempty"`
  2312  	// AlternateName - READ-ONLY; An alias for the item
  2313  	AlternateName *string `json:"alternateName,omitempty"`
  2314  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
  2315  	BingID *string `json:"bingId,omitempty"`
  2316  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  2317  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2318  	// ID - READ-ONLY; A String identifier.
  2319  	ID *string `json:"id,omitempty"`
  2320  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  2321  	Type Type `json:"_type,omitempty"`
  2322  }
  2323  
  2324  // MarshalJSON is the custom marshaler for NewsArticle.
  2325  func (na NewsArticle) MarshalJSON() ([]byte, error) {
  2326  	na.Type = TypeNewsArticle
  2327  	objectMap := make(map[string]interface{})
  2328  	if na.Type != "" {
  2329  		objectMap["_type"] = na.Type
  2330  	}
  2331  	return json.Marshal(objectMap)
  2332  }
  2333  
  2334  // AsNewsArticle is the BasicResponseBase implementation for NewsArticle.
  2335  func (na NewsArticle) AsNewsArticle() (*NewsArticle, bool) {
  2336  	return &na, true
  2337  }
  2338  
  2339  // AsNews is the BasicResponseBase implementation for NewsArticle.
  2340  func (na NewsArticle) AsNews() (*News, bool) {
  2341  	return nil, false
  2342  }
  2343  
  2344  // AsSearchResultsAnswer is the BasicResponseBase implementation for NewsArticle.
  2345  func (na NewsArticle) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2346  	return nil, false
  2347  }
  2348  
  2349  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for NewsArticle.
  2350  func (na NewsArticle) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2351  	return nil, false
  2352  }
  2353  
  2354  // AsImageObject is the BasicResponseBase implementation for NewsArticle.
  2355  func (na NewsArticle) AsImageObject() (*ImageObject, bool) {
  2356  	return nil, false
  2357  }
  2358  
  2359  // AsNewsTopic is the BasicResponseBase implementation for NewsArticle.
  2360  func (na NewsArticle) AsNewsTopic() (*NewsTopic, bool) {
  2361  	return nil, false
  2362  }
  2363  
  2364  // AsAnswer is the BasicResponseBase implementation for NewsArticle.
  2365  func (na NewsArticle) AsAnswer() (*Answer, bool) {
  2366  	return nil, false
  2367  }
  2368  
  2369  // AsBasicAnswer is the BasicResponseBase implementation for NewsArticle.
  2370  func (na NewsArticle) AsBasicAnswer() (BasicAnswer, bool) {
  2371  	return nil, false
  2372  }
  2373  
  2374  // AsArticle is the BasicResponseBase implementation for NewsArticle.
  2375  func (na NewsArticle) AsArticle() (*Article, bool) {
  2376  	return nil, false
  2377  }
  2378  
  2379  // AsBasicArticle is the BasicResponseBase implementation for NewsArticle.
  2380  func (na NewsArticle) AsBasicArticle() (BasicArticle, bool) {
  2381  	return &na, true
  2382  }
  2383  
  2384  // AsThing is the BasicResponseBase implementation for NewsArticle.
  2385  func (na NewsArticle) AsThing() (*Thing, bool) {
  2386  	return nil, false
  2387  }
  2388  
  2389  // AsBasicThing is the BasicResponseBase implementation for NewsArticle.
  2390  func (na NewsArticle) AsBasicThing() (BasicThing, bool) {
  2391  	return &na, true
  2392  }
  2393  
  2394  // AsResponse is the BasicResponseBase implementation for NewsArticle.
  2395  func (na NewsArticle) AsResponse() (*Response, bool) {
  2396  	return nil, false
  2397  }
  2398  
  2399  // AsBasicResponse is the BasicResponseBase implementation for NewsArticle.
  2400  func (na NewsArticle) AsBasicResponse() (BasicResponse, bool) {
  2401  	return &na, true
  2402  }
  2403  
  2404  // AsTrendingTopics is the BasicResponseBase implementation for NewsArticle.
  2405  func (na NewsArticle) AsTrendingTopics() (*TrendingTopics, bool) {
  2406  	return nil, false
  2407  }
  2408  
  2409  // AsVideoObject is the BasicResponseBase implementation for NewsArticle.
  2410  func (na NewsArticle) AsVideoObject() (*VideoObject, bool) {
  2411  	return nil, false
  2412  }
  2413  
  2414  // AsCreativeWork is the BasicResponseBase implementation for NewsArticle.
  2415  func (na NewsArticle) AsCreativeWork() (*CreativeWork, bool) {
  2416  	return nil, false
  2417  }
  2418  
  2419  // AsBasicCreativeWork is the BasicResponseBase implementation for NewsArticle.
  2420  func (na NewsArticle) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2421  	return &na, true
  2422  }
  2423  
  2424  // AsOrganization is the BasicResponseBase implementation for NewsArticle.
  2425  func (na NewsArticle) AsOrganization() (*Organization, bool) {
  2426  	return nil, false
  2427  }
  2428  
  2429  // AsIdentifiable is the BasicResponseBase implementation for NewsArticle.
  2430  func (na NewsArticle) AsIdentifiable() (*Identifiable, bool) {
  2431  	return nil, false
  2432  }
  2433  
  2434  // AsBasicIdentifiable is the BasicResponseBase implementation for NewsArticle.
  2435  func (na NewsArticle) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2436  	return &na, true
  2437  }
  2438  
  2439  // AsErrorResponse is the BasicResponseBase implementation for NewsArticle.
  2440  func (na NewsArticle) AsErrorResponse() (*ErrorResponse, bool) {
  2441  	return nil, false
  2442  }
  2443  
  2444  // AsMediaObject is the BasicResponseBase implementation for NewsArticle.
  2445  func (na NewsArticle) AsMediaObject() (*MediaObject, bool) {
  2446  	return nil, false
  2447  }
  2448  
  2449  // AsBasicMediaObject is the BasicResponseBase implementation for NewsArticle.
  2450  func (na NewsArticle) AsBasicMediaObject() (BasicMediaObject, bool) {
  2451  	return nil, false
  2452  }
  2453  
  2454  // AsResponseBase is the BasicResponseBase implementation for NewsArticle.
  2455  func (na NewsArticle) AsResponseBase() (*ResponseBase, bool) {
  2456  	return nil, false
  2457  }
  2458  
  2459  // AsBasicResponseBase is the BasicResponseBase implementation for NewsArticle.
  2460  func (na NewsArticle) AsBasicResponseBase() (BasicResponseBase, bool) {
  2461  	return &na, true
  2462  }
  2463  
  2464  // UnmarshalJSON is the custom unmarshaler for NewsArticle struct.
  2465  func (na *NewsArticle) UnmarshalJSON(body []byte) error {
  2466  	var m map[string]*json.RawMessage
  2467  	err := json.Unmarshal(body, &m)
  2468  	if err != nil {
  2469  		return err
  2470  	}
  2471  	for k, v := range m {
  2472  		switch k {
  2473  		case "category":
  2474  			if v != nil {
  2475  				var category string
  2476  				err = json.Unmarshal(*v, &category)
  2477  				if err != nil {
  2478  					return err
  2479  				}
  2480  				na.Category = &category
  2481  			}
  2482  		case "headline":
  2483  			if v != nil {
  2484  				var headline bool
  2485  				err = json.Unmarshal(*v, &headline)
  2486  				if err != nil {
  2487  					return err
  2488  				}
  2489  				na.Headline = &headline
  2490  			}
  2491  		case "clusteredArticles":
  2492  			if v != nil {
  2493  				var clusteredArticles []NewsArticle
  2494  				err = json.Unmarshal(*v, &clusteredArticles)
  2495  				if err != nil {
  2496  					return err
  2497  				}
  2498  				na.ClusteredArticles = &clusteredArticles
  2499  			}
  2500  		case "wordCount":
  2501  			if v != nil {
  2502  				var wordCount int32
  2503  				err = json.Unmarshal(*v, &wordCount)
  2504  				if err != nil {
  2505  					return err
  2506  				}
  2507  				na.WordCount = &wordCount
  2508  			}
  2509  		case "thumbnailUrl":
  2510  			if v != nil {
  2511  				var thumbnailURL string
  2512  				err = json.Unmarshal(*v, &thumbnailURL)
  2513  				if err != nil {
  2514  					return err
  2515  				}
  2516  				na.ThumbnailURL = &thumbnailURL
  2517  			}
  2518  		case "provider":
  2519  			if v != nil {
  2520  				provider, err := unmarshalBasicThingArray(*v)
  2521  				if err != nil {
  2522  					return err
  2523  				}
  2524  				na.Provider = &provider
  2525  			}
  2526  		case "datePublished":
  2527  			if v != nil {
  2528  				var datePublished string
  2529  				err = json.Unmarshal(*v, &datePublished)
  2530  				if err != nil {
  2531  					return err
  2532  				}
  2533  				na.DatePublished = &datePublished
  2534  			}
  2535  		case "video":
  2536  			if v != nil {
  2537  				var video VideoObject
  2538  				err = json.Unmarshal(*v, &video)
  2539  				if err != nil {
  2540  					return err
  2541  				}
  2542  				na.Video = &video
  2543  			}
  2544  		case "name":
  2545  			if v != nil {
  2546  				var name string
  2547  				err = json.Unmarshal(*v, &name)
  2548  				if err != nil {
  2549  					return err
  2550  				}
  2551  				na.Name = &name
  2552  			}
  2553  		case "url":
  2554  			if v != nil {
  2555  				var URL string
  2556  				err = json.Unmarshal(*v, &URL)
  2557  				if err != nil {
  2558  					return err
  2559  				}
  2560  				na.URL = &URL
  2561  			}
  2562  		case "image":
  2563  			if v != nil {
  2564  				var imageVar ImageObject
  2565  				err = json.Unmarshal(*v, &imageVar)
  2566  				if err != nil {
  2567  					return err
  2568  				}
  2569  				na.Image = &imageVar
  2570  			}
  2571  		case "description":
  2572  			if v != nil {
  2573  				var description string
  2574  				err = json.Unmarshal(*v, &description)
  2575  				if err != nil {
  2576  					return err
  2577  				}
  2578  				na.Description = &description
  2579  			}
  2580  		case "alternateName":
  2581  			if v != nil {
  2582  				var alternateName string
  2583  				err = json.Unmarshal(*v, &alternateName)
  2584  				if err != nil {
  2585  					return err
  2586  				}
  2587  				na.AlternateName = &alternateName
  2588  			}
  2589  		case "bingId":
  2590  			if v != nil {
  2591  				var bingID string
  2592  				err = json.Unmarshal(*v, &bingID)
  2593  				if err != nil {
  2594  					return err
  2595  				}
  2596  				na.BingID = &bingID
  2597  			}
  2598  		case "webSearchUrl":
  2599  			if v != nil {
  2600  				var webSearchURL string
  2601  				err = json.Unmarshal(*v, &webSearchURL)
  2602  				if err != nil {
  2603  					return err
  2604  				}
  2605  				na.WebSearchURL = &webSearchURL
  2606  			}
  2607  		case "id":
  2608  			if v != nil {
  2609  				var ID string
  2610  				err = json.Unmarshal(*v, &ID)
  2611  				if err != nil {
  2612  					return err
  2613  				}
  2614  				na.ID = &ID
  2615  			}
  2616  		case "_type":
  2617  			if v != nil {
  2618  				var typeVar Type
  2619  				err = json.Unmarshal(*v, &typeVar)
  2620  				if err != nil {
  2621  					return err
  2622  				}
  2623  				na.Type = typeVar
  2624  			}
  2625  		}
  2626  	}
  2627  
  2628  	return nil
  2629  }
  2630  
  2631  // NewsTopic ...
  2632  type NewsTopic struct {
  2633  	// IsBreakingNews - READ-ONLY; A Boolean value that indicates whether the topic is considered breaking news. If the topic is considered breaking news, the value is true.
  2634  	IsBreakingNews *bool `json:"isBreakingNews,omitempty"`
  2635  	// Query - READ-ONLY; A search query term that returns this trending topic.
  2636  	Query *Query `json:"query,omitempty"`
  2637  	// NewsSearchURL - READ-ONLY; The URL to the Bing News search results for the search query term
  2638  	NewsSearchURL *string `json:"newsSearchUrl,omitempty"`
  2639  	// Name - READ-ONLY; The name of the thing represented by this object.
  2640  	Name *string `json:"name,omitempty"`
  2641  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  2642  	URL *string `json:"url,omitempty"`
  2643  	// Image - READ-ONLY; An image of the item.
  2644  	Image *ImageObject `json:"image,omitempty"`
  2645  	// Description - READ-ONLY; A short description of the item.
  2646  	Description *string `json:"description,omitempty"`
  2647  	// AlternateName - READ-ONLY; An alias for the item
  2648  	AlternateName *string `json:"alternateName,omitempty"`
  2649  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
  2650  	BingID *string `json:"bingId,omitempty"`
  2651  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  2652  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2653  	// ID - READ-ONLY; A String identifier.
  2654  	ID *string `json:"id,omitempty"`
  2655  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  2656  	Type Type `json:"_type,omitempty"`
  2657  }
  2658  
  2659  // MarshalJSON is the custom marshaler for NewsTopic.
  2660  func (nt NewsTopic) MarshalJSON() ([]byte, error) {
  2661  	nt.Type = TypeNewsTopic
  2662  	objectMap := make(map[string]interface{})
  2663  	if nt.Type != "" {
  2664  		objectMap["_type"] = nt.Type
  2665  	}
  2666  	return json.Marshal(objectMap)
  2667  }
  2668  
  2669  // AsNewsArticle is the BasicResponseBase implementation for NewsTopic.
  2670  func (nt NewsTopic) AsNewsArticle() (*NewsArticle, bool) {
  2671  	return nil, false
  2672  }
  2673  
  2674  // AsNews is the BasicResponseBase implementation for NewsTopic.
  2675  func (nt NewsTopic) AsNews() (*News, bool) {
  2676  	return nil, false
  2677  }
  2678  
  2679  // AsSearchResultsAnswer is the BasicResponseBase implementation for NewsTopic.
  2680  func (nt NewsTopic) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2681  	return nil, false
  2682  }
  2683  
  2684  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for NewsTopic.
  2685  func (nt NewsTopic) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2686  	return nil, false
  2687  }
  2688  
  2689  // AsImageObject is the BasicResponseBase implementation for NewsTopic.
  2690  func (nt NewsTopic) AsImageObject() (*ImageObject, bool) {
  2691  	return nil, false
  2692  }
  2693  
  2694  // AsNewsTopic is the BasicResponseBase implementation for NewsTopic.
  2695  func (nt NewsTopic) AsNewsTopic() (*NewsTopic, bool) {
  2696  	return &nt, true
  2697  }
  2698  
  2699  // AsAnswer is the BasicResponseBase implementation for NewsTopic.
  2700  func (nt NewsTopic) AsAnswer() (*Answer, bool) {
  2701  	return nil, false
  2702  }
  2703  
  2704  // AsBasicAnswer is the BasicResponseBase implementation for NewsTopic.
  2705  func (nt NewsTopic) AsBasicAnswer() (BasicAnswer, bool) {
  2706  	return nil, false
  2707  }
  2708  
  2709  // AsArticle is the BasicResponseBase implementation for NewsTopic.
  2710  func (nt NewsTopic) AsArticle() (*Article, bool) {
  2711  	return nil, false
  2712  }
  2713  
  2714  // AsBasicArticle is the BasicResponseBase implementation for NewsTopic.
  2715  func (nt NewsTopic) AsBasicArticle() (BasicArticle, bool) {
  2716  	return nil, false
  2717  }
  2718  
  2719  // AsThing is the BasicResponseBase implementation for NewsTopic.
  2720  func (nt NewsTopic) AsThing() (*Thing, bool) {
  2721  	return nil, false
  2722  }
  2723  
  2724  // AsBasicThing is the BasicResponseBase implementation for NewsTopic.
  2725  func (nt NewsTopic) AsBasicThing() (BasicThing, bool) {
  2726  	return &nt, true
  2727  }
  2728  
  2729  // AsResponse is the BasicResponseBase implementation for NewsTopic.
  2730  func (nt NewsTopic) AsResponse() (*Response, bool) {
  2731  	return nil, false
  2732  }
  2733  
  2734  // AsBasicResponse is the BasicResponseBase implementation for NewsTopic.
  2735  func (nt NewsTopic) AsBasicResponse() (BasicResponse, bool) {
  2736  	return &nt, true
  2737  }
  2738  
  2739  // AsTrendingTopics is the BasicResponseBase implementation for NewsTopic.
  2740  func (nt NewsTopic) AsTrendingTopics() (*TrendingTopics, bool) {
  2741  	return nil, false
  2742  }
  2743  
  2744  // AsVideoObject is the BasicResponseBase implementation for NewsTopic.
  2745  func (nt NewsTopic) AsVideoObject() (*VideoObject, bool) {
  2746  	return nil, false
  2747  }
  2748  
  2749  // AsCreativeWork is the BasicResponseBase implementation for NewsTopic.
  2750  func (nt NewsTopic) AsCreativeWork() (*CreativeWork, bool) {
  2751  	return nil, false
  2752  }
  2753  
  2754  // AsBasicCreativeWork is the BasicResponseBase implementation for NewsTopic.
  2755  func (nt NewsTopic) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2756  	return nil, false
  2757  }
  2758  
  2759  // AsOrganization is the BasicResponseBase implementation for NewsTopic.
  2760  func (nt NewsTopic) AsOrganization() (*Organization, bool) {
  2761  	return nil, false
  2762  }
  2763  
  2764  // AsIdentifiable is the BasicResponseBase implementation for NewsTopic.
  2765  func (nt NewsTopic) AsIdentifiable() (*Identifiable, bool) {
  2766  	return nil, false
  2767  }
  2768  
  2769  // AsBasicIdentifiable is the BasicResponseBase implementation for NewsTopic.
  2770  func (nt NewsTopic) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2771  	return &nt, true
  2772  }
  2773  
  2774  // AsErrorResponse is the BasicResponseBase implementation for NewsTopic.
  2775  func (nt NewsTopic) AsErrorResponse() (*ErrorResponse, bool) {
  2776  	return nil, false
  2777  }
  2778  
  2779  // AsMediaObject is the BasicResponseBase implementation for NewsTopic.
  2780  func (nt NewsTopic) AsMediaObject() (*MediaObject, bool) {
  2781  	return nil, false
  2782  }
  2783  
  2784  // AsBasicMediaObject is the BasicResponseBase implementation for NewsTopic.
  2785  func (nt NewsTopic) AsBasicMediaObject() (BasicMediaObject, bool) {
  2786  	return nil, false
  2787  }
  2788  
  2789  // AsResponseBase is the BasicResponseBase implementation for NewsTopic.
  2790  func (nt NewsTopic) AsResponseBase() (*ResponseBase, bool) {
  2791  	return nil, false
  2792  }
  2793  
  2794  // AsBasicResponseBase is the BasicResponseBase implementation for NewsTopic.
  2795  func (nt NewsTopic) AsBasicResponseBase() (BasicResponseBase, bool) {
  2796  	return &nt, true
  2797  }
  2798  
  2799  // Organization defines an organization.
  2800  type Organization struct {
  2801  	// Name - READ-ONLY; The name of the thing represented by this object.
  2802  	Name *string `json:"name,omitempty"`
  2803  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  2804  	URL *string `json:"url,omitempty"`
  2805  	// Image - READ-ONLY; An image of the item.
  2806  	Image *ImageObject `json:"image,omitempty"`
  2807  	// Description - READ-ONLY; A short description of the item.
  2808  	Description *string `json:"description,omitempty"`
  2809  	// AlternateName - READ-ONLY; An alias for the item
  2810  	AlternateName *string `json:"alternateName,omitempty"`
  2811  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
  2812  	BingID *string `json:"bingId,omitempty"`
  2813  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  2814  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2815  	// ID - READ-ONLY; A String identifier.
  2816  	ID *string `json:"id,omitempty"`
  2817  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  2818  	Type Type `json:"_type,omitempty"`
  2819  }
  2820  
  2821  // MarshalJSON is the custom marshaler for Organization.
  2822  func (o Organization) MarshalJSON() ([]byte, error) {
  2823  	o.Type = TypeOrganization
  2824  	objectMap := make(map[string]interface{})
  2825  	if o.Type != "" {
  2826  		objectMap["_type"] = o.Type
  2827  	}
  2828  	return json.Marshal(objectMap)
  2829  }
  2830  
  2831  // AsNewsArticle is the BasicResponseBase implementation for Organization.
  2832  func (o Organization) AsNewsArticle() (*NewsArticle, bool) {
  2833  	return nil, false
  2834  }
  2835  
  2836  // AsNews is the BasicResponseBase implementation for Organization.
  2837  func (o Organization) AsNews() (*News, bool) {
  2838  	return nil, false
  2839  }
  2840  
  2841  // AsSearchResultsAnswer is the BasicResponseBase implementation for Organization.
  2842  func (o Organization) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2843  	return nil, false
  2844  }
  2845  
  2846  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Organization.
  2847  func (o Organization) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2848  	return nil, false
  2849  }
  2850  
  2851  // AsImageObject is the BasicResponseBase implementation for Organization.
  2852  func (o Organization) AsImageObject() (*ImageObject, bool) {
  2853  	return nil, false
  2854  }
  2855  
  2856  // AsNewsTopic is the BasicResponseBase implementation for Organization.
  2857  func (o Organization) AsNewsTopic() (*NewsTopic, bool) {
  2858  	return nil, false
  2859  }
  2860  
  2861  // AsAnswer is the BasicResponseBase implementation for Organization.
  2862  func (o Organization) AsAnswer() (*Answer, bool) {
  2863  	return nil, false
  2864  }
  2865  
  2866  // AsBasicAnswer is the BasicResponseBase implementation for Organization.
  2867  func (o Organization) AsBasicAnswer() (BasicAnswer, bool) {
  2868  	return nil, false
  2869  }
  2870  
  2871  // AsArticle is the BasicResponseBase implementation for Organization.
  2872  func (o Organization) AsArticle() (*Article, bool) {
  2873  	return nil, false
  2874  }
  2875  
  2876  // AsBasicArticle is the BasicResponseBase implementation for Organization.
  2877  func (o Organization) AsBasicArticle() (BasicArticle, bool) {
  2878  	return nil, false
  2879  }
  2880  
  2881  // AsThing is the BasicResponseBase implementation for Organization.
  2882  func (o Organization) AsThing() (*Thing, bool) {
  2883  	return nil, false
  2884  }
  2885  
  2886  // AsBasicThing is the BasicResponseBase implementation for Organization.
  2887  func (o Organization) AsBasicThing() (BasicThing, bool) {
  2888  	return &o, true
  2889  }
  2890  
  2891  // AsResponse is the BasicResponseBase implementation for Organization.
  2892  func (o Organization) AsResponse() (*Response, bool) {
  2893  	return nil, false
  2894  }
  2895  
  2896  // AsBasicResponse is the BasicResponseBase implementation for Organization.
  2897  func (o Organization) AsBasicResponse() (BasicResponse, bool) {
  2898  	return &o, true
  2899  }
  2900  
  2901  // AsTrendingTopics is the BasicResponseBase implementation for Organization.
  2902  func (o Organization) AsTrendingTopics() (*TrendingTopics, bool) {
  2903  	return nil, false
  2904  }
  2905  
  2906  // AsVideoObject is the BasicResponseBase implementation for Organization.
  2907  func (o Organization) AsVideoObject() (*VideoObject, bool) {
  2908  	return nil, false
  2909  }
  2910  
  2911  // AsCreativeWork is the BasicResponseBase implementation for Organization.
  2912  func (o Organization) AsCreativeWork() (*CreativeWork, bool) {
  2913  	return nil, false
  2914  }
  2915  
  2916  // AsBasicCreativeWork is the BasicResponseBase implementation for Organization.
  2917  func (o Organization) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2918  	return nil, false
  2919  }
  2920  
  2921  // AsOrganization is the BasicResponseBase implementation for Organization.
  2922  func (o Organization) AsOrganization() (*Organization, bool) {
  2923  	return &o, true
  2924  }
  2925  
  2926  // AsIdentifiable is the BasicResponseBase implementation for Organization.
  2927  func (o Organization) AsIdentifiable() (*Identifiable, bool) {
  2928  	return nil, false
  2929  }
  2930  
  2931  // AsBasicIdentifiable is the BasicResponseBase implementation for Organization.
  2932  func (o Organization) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2933  	return &o, true
  2934  }
  2935  
  2936  // AsErrorResponse is the BasicResponseBase implementation for Organization.
  2937  func (o Organization) AsErrorResponse() (*ErrorResponse, bool) {
  2938  	return nil, false
  2939  }
  2940  
  2941  // AsMediaObject is the BasicResponseBase implementation for Organization.
  2942  func (o Organization) AsMediaObject() (*MediaObject, bool) {
  2943  	return nil, false
  2944  }
  2945  
  2946  // AsBasicMediaObject is the BasicResponseBase implementation for Organization.
  2947  func (o Organization) AsBasicMediaObject() (BasicMediaObject, bool) {
  2948  	return nil, false
  2949  }
  2950  
  2951  // AsResponseBase is the BasicResponseBase implementation for Organization.
  2952  func (o Organization) AsResponseBase() (*ResponseBase, bool) {
  2953  	return nil, false
  2954  }
  2955  
  2956  // AsBasicResponseBase is the BasicResponseBase implementation for Organization.
  2957  func (o Organization) AsBasicResponseBase() (BasicResponseBase, bool) {
  2958  	return &o, true
  2959  }
  2960  
  2961  // Query defines a search query.
  2962  type Query struct {
  2963  	// Text - The query string. Use this string as the query term in a new search request.
  2964  	Text *string `json:"text,omitempty"`
  2965  	// DisplayText - READ-ONLY; The display version of the query term. This version of the query term may contain special characters that highlight the search term found in the query string. The string contains the highlighting characters only if the query enabled hit highlighting
  2966  	DisplayText *string `json:"displayText,omitempty"`
  2967  	// WebSearchURL - READ-ONLY; The URL that takes the user to the Bing search results page for the query.Only related search results include this field.
  2968  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2969  	// SearchLink - READ-ONLY; The URL that you use to get the results of the related search. Before using the URL, you must append query parameters as appropriate and include the Ocp-Apim-Subscription-Key header. Use this URL if you're displaying the results in your own user interface. Otherwise, use the webSearchUrl URL.
  2970  	SearchLink *string `json:"searchLink,omitempty"`
  2971  	// Thumbnail - READ-ONLY; The URL to a thumbnail of a related image.
  2972  	Thumbnail *ImageObject `json:"thumbnail,omitempty"`
  2973  }
  2974  
  2975  // MarshalJSON is the custom marshaler for Query.
  2976  func (q Query) MarshalJSON() ([]byte, error) {
  2977  	objectMap := make(map[string]interface{})
  2978  	if q.Text != nil {
  2979  		objectMap["text"] = q.Text
  2980  	}
  2981  	return json.Marshal(objectMap)
  2982  }
  2983  
  2984  // BasicResponse defines a response. All schemas that could be returned at the root of a response should inherit from
  2985  // this
  2986  type BasicResponse interface {
  2987  	AsNewsArticle() (*NewsArticle, bool)
  2988  	AsNews() (*News, bool)
  2989  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  2990  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  2991  	AsImageObject() (*ImageObject, bool)
  2992  	AsNewsTopic() (*NewsTopic, bool)
  2993  	AsAnswer() (*Answer, bool)
  2994  	AsBasicAnswer() (BasicAnswer, bool)
  2995  	AsArticle() (*Article, bool)
  2996  	AsBasicArticle() (BasicArticle, bool)
  2997  	AsThing() (*Thing, bool)
  2998  	AsBasicThing() (BasicThing, bool)
  2999  	AsTrendingTopics() (*TrendingTopics, bool)
  3000  	AsVideoObject() (*VideoObject, bool)
  3001  	AsCreativeWork() (*CreativeWork, bool)
  3002  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  3003  	AsOrganization() (*Organization, bool)
  3004  	AsErrorResponse() (*ErrorResponse, bool)
  3005  	AsMediaObject() (*MediaObject, bool)
  3006  	AsBasicMediaObject() (BasicMediaObject, bool)
  3007  	AsResponse() (*Response, bool)
  3008  }
  3009  
  3010  // Response defines a response. All schemas that could be returned at the root of a response should inherit
  3011  // from this
  3012  type Response struct {
  3013  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  3014  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  3015  	// ID - READ-ONLY; A String identifier.
  3016  	ID *string `json:"id,omitempty"`
  3017  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  3018  	Type Type `json:"_type,omitempty"`
  3019  }
  3020  
  3021  func unmarshalBasicResponse(body []byte) (BasicResponse, error) {
  3022  	var m map[string]interface{}
  3023  	err := json.Unmarshal(body, &m)
  3024  	if err != nil {
  3025  		return nil, err
  3026  	}
  3027  
  3028  	switch m["_type"] {
  3029  	case string(TypeNewsArticle):
  3030  		var na NewsArticle
  3031  		err := json.Unmarshal(body, &na)
  3032  		return na, err
  3033  	case string(TypeNews):
  3034  		var n News
  3035  		err := json.Unmarshal(body, &n)
  3036  		return n, err
  3037  	case string(TypeSearchResultsAnswer):
  3038  		var sra SearchResultsAnswer
  3039  		err := json.Unmarshal(body, &sra)
  3040  		return sra, err
  3041  	case string(TypeImageObject):
  3042  		var ioVar ImageObject
  3043  		err := json.Unmarshal(body, &ioVar)
  3044  		return ioVar, err
  3045  	case string(TypeNewsTopic):
  3046  		var nt NewsTopic
  3047  		err := json.Unmarshal(body, &nt)
  3048  		return nt, err
  3049  	case string(TypeAnswer):
  3050  		var a Answer
  3051  		err := json.Unmarshal(body, &a)
  3052  		return a, err
  3053  	case string(TypeArticle):
  3054  		var a Article
  3055  		err := json.Unmarshal(body, &a)
  3056  		return a, err
  3057  	case string(TypeThing):
  3058  		var t Thing
  3059  		err := json.Unmarshal(body, &t)
  3060  		return t, err
  3061  	case string(TypeTrendingTopics):
  3062  		var tt TrendingTopics
  3063  		err := json.Unmarshal(body, &tt)
  3064  		return tt, err
  3065  	case string(TypeVideoObject):
  3066  		var vo VideoObject
  3067  		err := json.Unmarshal(body, &vo)
  3068  		return vo, err
  3069  	case string(TypeCreativeWork):
  3070  		var cw CreativeWork
  3071  		err := json.Unmarshal(body, &cw)
  3072  		return cw, err
  3073  	case string(TypeOrganization):
  3074  		var o Organization
  3075  		err := json.Unmarshal(body, &o)
  3076  		return o, err
  3077  	case string(TypeErrorResponse):
  3078  		var er ErrorResponse
  3079  		err := json.Unmarshal(body, &er)
  3080  		return er, err
  3081  	case string(TypeMediaObject):
  3082  		var mo MediaObject
  3083  		err := json.Unmarshal(body, &mo)
  3084  		return mo, err
  3085  	default:
  3086  		var r Response
  3087  		err := json.Unmarshal(body, &r)
  3088  		return r, err
  3089  	}
  3090  }
  3091  func unmarshalBasicResponseArray(body []byte) ([]BasicResponse, error) {
  3092  	var rawMessages []*json.RawMessage
  3093  	err := json.Unmarshal(body, &rawMessages)
  3094  	if err != nil {
  3095  		return nil, err
  3096  	}
  3097  
  3098  	rArray := make([]BasicResponse, len(rawMessages))
  3099  
  3100  	for index, rawMessage := range rawMessages {
  3101  		r, err := unmarshalBasicResponse(*rawMessage)
  3102  		if err != nil {
  3103  			return nil, err
  3104  		}
  3105  		rArray[index] = r
  3106  	}
  3107  	return rArray, nil
  3108  }
  3109  
  3110  // MarshalJSON is the custom marshaler for Response.
  3111  func (r Response) MarshalJSON() ([]byte, error) {
  3112  	r.Type = TypeResponse
  3113  	objectMap := make(map[string]interface{})
  3114  	if r.Type != "" {
  3115  		objectMap["_type"] = r.Type
  3116  	}
  3117  	return json.Marshal(objectMap)
  3118  }
  3119  
  3120  // AsNewsArticle is the BasicResponseBase implementation for Response.
  3121  func (r Response) AsNewsArticle() (*NewsArticle, bool) {
  3122  	return nil, false
  3123  }
  3124  
  3125  // AsNews is the BasicResponseBase implementation for Response.
  3126  func (r Response) AsNews() (*News, bool) {
  3127  	return nil, false
  3128  }
  3129  
  3130  // AsSearchResultsAnswer is the BasicResponseBase implementation for Response.
  3131  func (r Response) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  3132  	return nil, false
  3133  }
  3134  
  3135  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Response.
  3136  func (r Response) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  3137  	return nil, false
  3138  }
  3139  
  3140  // AsImageObject is the BasicResponseBase implementation for Response.
  3141  func (r Response) AsImageObject() (*ImageObject, bool) {
  3142  	return nil, false
  3143  }
  3144  
  3145  // AsNewsTopic is the BasicResponseBase implementation for Response.
  3146  func (r Response) AsNewsTopic() (*NewsTopic, bool) {
  3147  	return nil, false
  3148  }
  3149  
  3150  // AsAnswer is the BasicResponseBase implementation for Response.
  3151  func (r Response) AsAnswer() (*Answer, bool) {
  3152  	return nil, false
  3153  }
  3154  
  3155  // AsBasicAnswer is the BasicResponseBase implementation for Response.
  3156  func (r Response) AsBasicAnswer() (BasicAnswer, bool) {
  3157  	return nil, false
  3158  }
  3159  
  3160  // AsArticle is the BasicResponseBase implementation for Response.
  3161  func (r Response) AsArticle() (*Article, bool) {
  3162  	return nil, false
  3163  }
  3164  
  3165  // AsBasicArticle is the BasicResponseBase implementation for Response.
  3166  func (r Response) AsBasicArticle() (BasicArticle, bool) {
  3167  	return nil, false
  3168  }
  3169  
  3170  // AsThing is the BasicResponseBase implementation for Response.
  3171  func (r Response) AsThing() (*Thing, bool) {
  3172  	return nil, false
  3173  }
  3174  
  3175  // AsBasicThing is the BasicResponseBase implementation for Response.
  3176  func (r Response) AsBasicThing() (BasicThing, bool) {
  3177  	return nil, false
  3178  }
  3179  
  3180  // AsResponse is the BasicResponseBase implementation for Response.
  3181  func (r Response) AsResponse() (*Response, bool) {
  3182  	return &r, true
  3183  }
  3184  
  3185  // AsBasicResponse is the BasicResponseBase implementation for Response.
  3186  func (r Response) AsBasicResponse() (BasicResponse, bool) {
  3187  	return &r, true
  3188  }
  3189  
  3190  // AsTrendingTopics is the BasicResponseBase implementation for Response.
  3191  func (r Response) AsTrendingTopics() (*TrendingTopics, bool) {
  3192  	return nil, false
  3193  }
  3194  
  3195  // AsVideoObject is the BasicResponseBase implementation for Response.
  3196  func (r Response) AsVideoObject() (*VideoObject, bool) {
  3197  	return nil, false
  3198  }
  3199  
  3200  // AsCreativeWork is the BasicResponseBase implementation for Response.
  3201  func (r Response) AsCreativeWork() (*CreativeWork, bool) {
  3202  	return nil, false
  3203  }
  3204  
  3205  // AsBasicCreativeWork is the BasicResponseBase implementation for Response.
  3206  func (r Response) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  3207  	return nil, false
  3208  }
  3209  
  3210  // AsOrganization is the BasicResponseBase implementation for Response.
  3211  func (r Response) AsOrganization() (*Organization, bool) {
  3212  	return nil, false
  3213  }
  3214  
  3215  // AsIdentifiable is the BasicResponseBase implementation for Response.
  3216  func (r Response) AsIdentifiable() (*Identifiable, bool) {
  3217  	return nil, false
  3218  }
  3219  
  3220  // AsBasicIdentifiable is the BasicResponseBase implementation for Response.
  3221  func (r Response) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  3222  	return &r, true
  3223  }
  3224  
  3225  // AsErrorResponse is the BasicResponseBase implementation for Response.
  3226  func (r Response) AsErrorResponse() (*ErrorResponse, bool) {
  3227  	return nil, false
  3228  }
  3229  
  3230  // AsMediaObject is the BasicResponseBase implementation for Response.
  3231  func (r Response) AsMediaObject() (*MediaObject, bool) {
  3232  	return nil, false
  3233  }
  3234  
  3235  // AsBasicMediaObject is the BasicResponseBase implementation for Response.
  3236  func (r Response) AsBasicMediaObject() (BasicMediaObject, bool) {
  3237  	return nil, false
  3238  }
  3239  
  3240  // AsResponseBase is the BasicResponseBase implementation for Response.
  3241  func (r Response) AsResponseBase() (*ResponseBase, bool) {
  3242  	return nil, false
  3243  }
  3244  
  3245  // AsBasicResponseBase is the BasicResponseBase implementation for Response.
  3246  func (r Response) AsBasicResponseBase() (BasicResponseBase, bool) {
  3247  	return &r, true
  3248  }
  3249  
  3250  // BasicResponseBase response base
  3251  type BasicResponseBase interface {
  3252  	AsNewsArticle() (*NewsArticle, bool)
  3253  	AsNews() (*News, bool)
  3254  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  3255  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  3256  	AsImageObject() (*ImageObject, bool)
  3257  	AsNewsTopic() (*NewsTopic, bool)
  3258  	AsAnswer() (*Answer, bool)
  3259  	AsBasicAnswer() (BasicAnswer, bool)
  3260  	AsArticle() (*Article, bool)
  3261  	AsBasicArticle() (BasicArticle, bool)
  3262  	AsThing() (*Thing, bool)
  3263  	AsBasicThing() (BasicThing, bool)
  3264  	AsResponse() (*Response, bool)
  3265  	AsBasicResponse() (BasicResponse, bool)
  3266  	AsTrendingTopics() (*TrendingTopics, bool)
  3267  	AsVideoObject() (*VideoObject, bool)
  3268  	AsCreativeWork() (*CreativeWork, bool)
  3269  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  3270  	AsOrganization() (*Organization, bool)
  3271  	AsIdentifiable() (*Identifiable, bool)
  3272  	AsBasicIdentifiable() (BasicIdentifiable, bool)
  3273  	AsErrorResponse() (*ErrorResponse, bool)
  3274  	AsMediaObject() (*MediaObject, bool)
  3275  	AsBasicMediaObject() (BasicMediaObject, bool)
  3276  	AsResponseBase() (*ResponseBase, bool)
  3277  }
  3278  
  3279  // ResponseBase response base
  3280  type ResponseBase struct {
  3281  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  3282  	Type Type `json:"_type,omitempty"`
  3283  }
  3284  
  3285  func unmarshalBasicResponseBase(body []byte) (BasicResponseBase, error) {
  3286  	var m map[string]interface{}
  3287  	err := json.Unmarshal(body, &m)
  3288  	if err != nil {
  3289  		return nil, err
  3290  	}
  3291  
  3292  	switch m["_type"] {
  3293  	case string(TypeNewsArticle):
  3294  		var na NewsArticle
  3295  		err := json.Unmarshal(body, &na)
  3296  		return na, err
  3297  	case string(TypeNews):
  3298  		var n News
  3299  		err := json.Unmarshal(body, &n)
  3300  		return n, err
  3301  	case string(TypeSearchResultsAnswer):
  3302  		var sra SearchResultsAnswer
  3303  		err := json.Unmarshal(body, &sra)
  3304  		return sra, err
  3305  	case string(TypeImageObject):
  3306  		var ioVar ImageObject
  3307  		err := json.Unmarshal(body, &ioVar)
  3308  		return ioVar, err
  3309  	case string(TypeNewsTopic):
  3310  		var nt NewsTopic
  3311  		err := json.Unmarshal(body, &nt)
  3312  		return nt, err
  3313  	case string(TypeAnswer):
  3314  		var a Answer
  3315  		err := json.Unmarshal(body, &a)
  3316  		return a, err
  3317  	case string(TypeArticle):
  3318  		var a Article
  3319  		err := json.Unmarshal(body, &a)
  3320  		return a, err
  3321  	case string(TypeThing):
  3322  		var t Thing
  3323  		err := json.Unmarshal(body, &t)
  3324  		return t, err
  3325  	case string(TypeResponse):
  3326  		var r Response
  3327  		err := json.Unmarshal(body, &r)
  3328  		return r, err
  3329  	case string(TypeTrendingTopics):
  3330  		var tt TrendingTopics
  3331  		err := json.Unmarshal(body, &tt)
  3332  		return tt, err
  3333  	case string(TypeVideoObject):
  3334  		var vo VideoObject
  3335  		err := json.Unmarshal(body, &vo)
  3336  		return vo, err
  3337  	case string(TypeCreativeWork):
  3338  		var cw CreativeWork
  3339  		err := json.Unmarshal(body, &cw)
  3340  		return cw, err
  3341  	case string(TypeOrganization):
  3342  		var o Organization
  3343  		err := json.Unmarshal(body, &o)
  3344  		return o, err
  3345  	case string(TypeIdentifiable):
  3346  		var i Identifiable
  3347  		err := json.Unmarshal(body, &i)
  3348  		return i, err
  3349  	case string(TypeErrorResponse):
  3350  		var er ErrorResponse
  3351  		err := json.Unmarshal(body, &er)
  3352  		return er, err
  3353  	case string(TypeMediaObject):
  3354  		var mo MediaObject
  3355  		err := json.Unmarshal(body, &mo)
  3356  		return mo, err
  3357  	default:
  3358  		var rb ResponseBase
  3359  		err := json.Unmarshal(body, &rb)
  3360  		return rb, err
  3361  	}
  3362  }
  3363  func unmarshalBasicResponseBaseArray(body []byte) ([]BasicResponseBase, error) {
  3364  	var rawMessages []*json.RawMessage
  3365  	err := json.Unmarshal(body, &rawMessages)
  3366  	if err != nil {
  3367  		return nil, err
  3368  	}
  3369  
  3370  	rbArray := make([]BasicResponseBase, len(rawMessages))
  3371  
  3372  	for index, rawMessage := range rawMessages {
  3373  		rb, err := unmarshalBasicResponseBase(*rawMessage)
  3374  		if err != nil {
  3375  			return nil, err
  3376  		}
  3377  		rbArray[index] = rb
  3378  	}
  3379  	return rbArray, nil
  3380  }
  3381  
  3382  // MarshalJSON is the custom marshaler for ResponseBase.
  3383  func (rb ResponseBase) MarshalJSON() ([]byte, error) {
  3384  	rb.Type = TypeResponseBase
  3385  	objectMap := make(map[string]interface{})
  3386  	if rb.Type != "" {
  3387  		objectMap["_type"] = rb.Type
  3388  	}
  3389  	return json.Marshal(objectMap)
  3390  }
  3391  
  3392  // AsNewsArticle is the BasicResponseBase implementation for ResponseBase.
  3393  func (rb ResponseBase) AsNewsArticle() (*NewsArticle, bool) {
  3394  	return nil, false
  3395  }
  3396  
  3397  // AsNews is the BasicResponseBase implementation for ResponseBase.
  3398  func (rb ResponseBase) AsNews() (*News, bool) {
  3399  	return nil, false
  3400  }
  3401  
  3402  // AsSearchResultsAnswer is the BasicResponseBase implementation for ResponseBase.
  3403  func (rb ResponseBase) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  3404  	return nil, false
  3405  }
  3406  
  3407  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ResponseBase.
  3408  func (rb ResponseBase) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  3409  	return nil, false
  3410  }
  3411  
  3412  // AsImageObject is the BasicResponseBase implementation for ResponseBase.
  3413  func (rb ResponseBase) AsImageObject() (*ImageObject, bool) {
  3414  	return nil, false
  3415  }
  3416  
  3417  // AsNewsTopic is the BasicResponseBase implementation for ResponseBase.
  3418  func (rb ResponseBase) AsNewsTopic() (*NewsTopic, bool) {
  3419  	return nil, false
  3420  }
  3421  
  3422  // AsAnswer is the BasicResponseBase implementation for ResponseBase.
  3423  func (rb ResponseBase) AsAnswer() (*Answer, bool) {
  3424  	return nil, false
  3425  }
  3426  
  3427  // AsBasicAnswer is the BasicResponseBase implementation for ResponseBase.
  3428  func (rb ResponseBase) AsBasicAnswer() (BasicAnswer, bool) {
  3429  	return nil, false
  3430  }
  3431  
  3432  // AsArticle is the BasicResponseBase implementation for ResponseBase.
  3433  func (rb ResponseBase) AsArticle() (*Article, bool) {
  3434  	return nil, false
  3435  }
  3436  
  3437  // AsBasicArticle is the BasicResponseBase implementation for ResponseBase.
  3438  func (rb ResponseBase) AsBasicArticle() (BasicArticle, bool) {
  3439  	return nil, false
  3440  }
  3441  
  3442  // AsThing is the BasicResponseBase implementation for ResponseBase.
  3443  func (rb ResponseBase) AsThing() (*Thing, bool) {
  3444  	return nil, false
  3445  }
  3446  
  3447  // AsBasicThing is the BasicResponseBase implementation for ResponseBase.
  3448  func (rb ResponseBase) AsBasicThing() (BasicThing, bool) {
  3449  	return nil, false
  3450  }
  3451  
  3452  // AsResponse is the BasicResponseBase implementation for ResponseBase.
  3453  func (rb ResponseBase) AsResponse() (*Response, bool) {
  3454  	return nil, false
  3455  }
  3456  
  3457  // AsBasicResponse is the BasicResponseBase implementation for ResponseBase.
  3458  func (rb ResponseBase) AsBasicResponse() (BasicResponse, bool) {
  3459  	return nil, false
  3460  }
  3461  
  3462  // AsTrendingTopics is the BasicResponseBase implementation for ResponseBase.
  3463  func (rb ResponseBase) AsTrendingTopics() (*TrendingTopics, bool) {
  3464  	return nil, false
  3465  }
  3466  
  3467  // AsVideoObject is the BasicResponseBase implementation for ResponseBase.
  3468  func (rb ResponseBase) AsVideoObject() (*VideoObject, bool) {
  3469  	return nil, false
  3470  }
  3471  
  3472  // AsCreativeWork is the BasicResponseBase implementation for ResponseBase.
  3473  func (rb ResponseBase) AsCreativeWork() (*CreativeWork, bool) {
  3474  	return nil, false
  3475  }
  3476  
  3477  // AsBasicCreativeWork is the BasicResponseBase implementation for ResponseBase.
  3478  func (rb ResponseBase) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  3479  	return nil, false
  3480  }
  3481  
  3482  // AsOrganization is the BasicResponseBase implementation for ResponseBase.
  3483  func (rb ResponseBase) AsOrganization() (*Organization, bool) {
  3484  	return nil, false
  3485  }
  3486  
  3487  // AsIdentifiable is the BasicResponseBase implementation for ResponseBase.
  3488  func (rb ResponseBase) AsIdentifiable() (*Identifiable, bool) {
  3489  	return nil, false
  3490  }
  3491  
  3492  // AsBasicIdentifiable is the BasicResponseBase implementation for ResponseBase.
  3493  func (rb ResponseBase) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  3494  	return nil, false
  3495  }
  3496  
  3497  // AsErrorResponse is the BasicResponseBase implementation for ResponseBase.
  3498  func (rb ResponseBase) AsErrorResponse() (*ErrorResponse, bool) {
  3499  	return nil, false
  3500  }
  3501  
  3502  // AsMediaObject is the BasicResponseBase implementation for ResponseBase.
  3503  func (rb ResponseBase) AsMediaObject() (*MediaObject, bool) {
  3504  	return nil, false
  3505  }
  3506  
  3507  // AsBasicMediaObject is the BasicResponseBase implementation for ResponseBase.
  3508  func (rb ResponseBase) AsBasicMediaObject() (BasicMediaObject, bool) {
  3509  	return nil, false
  3510  }
  3511  
  3512  // AsResponseBase is the BasicResponseBase implementation for ResponseBase.
  3513  func (rb ResponseBase) AsResponseBase() (*ResponseBase, bool) {
  3514  	return &rb, true
  3515  }
  3516  
  3517  // AsBasicResponseBase is the BasicResponseBase implementation for ResponseBase.
  3518  func (rb ResponseBase) AsBasicResponseBase() (BasicResponseBase, bool) {
  3519  	return &rb, true
  3520  }
  3521  
  3522  // BasicSearchResultsAnswer defines a search result answer.
  3523  type BasicSearchResultsAnswer interface {
  3524  	AsNews() (*News, bool)
  3525  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  3526  }
  3527  
  3528  // SearchResultsAnswer defines a search result answer.
  3529  type SearchResultsAnswer struct {
  3530  	// TotalEstimatedMatches - READ-ONLY; The estimated number of webpages that are relevant to the query. Use this number along with the count and offset query parameters to page the results.
  3531  	TotalEstimatedMatches *int64 `json:"totalEstimatedMatches,omitempty"`
  3532  	// FollowUpQueries - READ-ONLY
  3533  	FollowUpQueries *[]Query `json:"followUpQueries,omitempty"`
  3534  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  3535  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  3536  	// ID - READ-ONLY; A String identifier.
  3537  	ID *string `json:"id,omitempty"`
  3538  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  3539  	Type Type `json:"_type,omitempty"`
  3540  }
  3541  
  3542  func unmarshalBasicSearchResultsAnswer(body []byte) (BasicSearchResultsAnswer, error) {
  3543  	var m map[string]interface{}
  3544  	err := json.Unmarshal(body, &m)
  3545  	if err != nil {
  3546  		return nil, err
  3547  	}
  3548  
  3549  	switch m["_type"] {
  3550  	case string(TypeNews):
  3551  		var n News
  3552  		err := json.Unmarshal(body, &n)
  3553  		return n, err
  3554  	default:
  3555  		var sra SearchResultsAnswer
  3556  		err := json.Unmarshal(body, &sra)
  3557  		return sra, err
  3558  	}
  3559  }
  3560  func unmarshalBasicSearchResultsAnswerArray(body []byte) ([]BasicSearchResultsAnswer, error) {
  3561  	var rawMessages []*json.RawMessage
  3562  	err := json.Unmarshal(body, &rawMessages)
  3563  	if err != nil {
  3564  		return nil, err
  3565  	}
  3566  
  3567  	sraArray := make([]BasicSearchResultsAnswer, len(rawMessages))
  3568  
  3569  	for index, rawMessage := range rawMessages {
  3570  		sra, err := unmarshalBasicSearchResultsAnswer(*rawMessage)
  3571  		if err != nil {
  3572  			return nil, err
  3573  		}
  3574  		sraArray[index] = sra
  3575  	}
  3576  	return sraArray, nil
  3577  }
  3578  
  3579  // MarshalJSON is the custom marshaler for SearchResultsAnswer.
  3580  func (sra SearchResultsAnswer) MarshalJSON() ([]byte, error) {
  3581  	sra.Type = TypeSearchResultsAnswer
  3582  	objectMap := make(map[string]interface{})
  3583  	if sra.Type != "" {
  3584  		objectMap["_type"] = sra.Type
  3585  	}
  3586  	return json.Marshal(objectMap)
  3587  }
  3588  
  3589  // AsNewsArticle is the BasicResponseBase implementation for SearchResultsAnswer.
  3590  func (sra SearchResultsAnswer) AsNewsArticle() (*NewsArticle, bool) {
  3591  	return nil, false
  3592  }
  3593  
  3594  // AsNews is the BasicResponseBase implementation for SearchResultsAnswer.
  3595  func (sra SearchResultsAnswer) AsNews() (*News, bool) {
  3596  	return nil, false
  3597  }
  3598  
  3599  // AsSearchResultsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  3600  func (sra SearchResultsAnswer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  3601  	return &sra, true
  3602  }
  3603  
  3604  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  3605  func (sra SearchResultsAnswer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  3606  	return &sra, true
  3607  }
  3608  
  3609  // AsImageObject is the BasicResponseBase implementation for SearchResultsAnswer.
  3610  func (sra SearchResultsAnswer) AsImageObject() (*ImageObject, bool) {
  3611  	return nil, false
  3612  }
  3613  
  3614  // AsNewsTopic is the BasicResponseBase implementation for SearchResultsAnswer.
  3615  func (sra SearchResultsAnswer) AsNewsTopic() (*NewsTopic, bool) {
  3616  	return nil, false
  3617  }
  3618  
  3619  // AsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  3620  func (sra SearchResultsAnswer) AsAnswer() (*Answer, bool) {
  3621  	return nil, false
  3622  }
  3623  
  3624  // AsBasicAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  3625  func (sra SearchResultsAnswer) AsBasicAnswer() (BasicAnswer, bool) {
  3626  	return &sra, true
  3627  }
  3628  
  3629  // AsArticle is the BasicResponseBase implementation for SearchResultsAnswer.
  3630  func (sra SearchResultsAnswer) AsArticle() (*Article, bool) {
  3631  	return nil, false
  3632  }
  3633  
  3634  // AsBasicArticle is the BasicResponseBase implementation for SearchResultsAnswer.
  3635  func (sra SearchResultsAnswer) AsBasicArticle() (BasicArticle, bool) {
  3636  	return nil, false
  3637  }
  3638  
  3639  // AsThing is the BasicResponseBase implementation for SearchResultsAnswer.
  3640  func (sra SearchResultsAnswer) AsThing() (*Thing, bool) {
  3641  	return nil, false
  3642  }
  3643  
  3644  // AsBasicThing is the BasicResponseBase implementation for SearchResultsAnswer.
  3645  func (sra SearchResultsAnswer) AsBasicThing() (BasicThing, bool) {
  3646  	return nil, false
  3647  }
  3648  
  3649  // AsResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  3650  func (sra SearchResultsAnswer) AsResponse() (*Response, bool) {
  3651  	return nil, false
  3652  }
  3653  
  3654  // AsBasicResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  3655  func (sra SearchResultsAnswer) AsBasicResponse() (BasicResponse, bool) {
  3656  	return &sra, true
  3657  }
  3658  
  3659  // AsTrendingTopics is the BasicResponseBase implementation for SearchResultsAnswer.
  3660  func (sra SearchResultsAnswer) AsTrendingTopics() (*TrendingTopics, bool) {
  3661  	return nil, false
  3662  }
  3663  
  3664  // AsVideoObject is the BasicResponseBase implementation for SearchResultsAnswer.
  3665  func (sra SearchResultsAnswer) AsVideoObject() (*VideoObject, bool) {
  3666  	return nil, false
  3667  }
  3668  
  3669  // AsCreativeWork is the BasicResponseBase implementation for SearchResultsAnswer.
  3670  func (sra SearchResultsAnswer) AsCreativeWork() (*CreativeWork, bool) {
  3671  	return nil, false
  3672  }
  3673  
  3674  // AsBasicCreativeWork is the BasicResponseBase implementation for SearchResultsAnswer.
  3675  func (sra SearchResultsAnswer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  3676  	return nil, false
  3677  }
  3678  
  3679  // AsOrganization is the BasicResponseBase implementation for SearchResultsAnswer.
  3680  func (sra SearchResultsAnswer) AsOrganization() (*Organization, bool) {
  3681  	return nil, false
  3682  }
  3683  
  3684  // AsIdentifiable is the BasicResponseBase implementation for SearchResultsAnswer.
  3685  func (sra SearchResultsAnswer) AsIdentifiable() (*Identifiable, bool) {
  3686  	return nil, false
  3687  }
  3688  
  3689  // AsBasicIdentifiable is the BasicResponseBase implementation for SearchResultsAnswer.
  3690  func (sra SearchResultsAnswer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  3691  	return &sra, true
  3692  }
  3693  
  3694  // AsErrorResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  3695  func (sra SearchResultsAnswer) AsErrorResponse() (*ErrorResponse, bool) {
  3696  	return nil, false
  3697  }
  3698  
  3699  // AsMediaObject is the BasicResponseBase implementation for SearchResultsAnswer.
  3700  func (sra SearchResultsAnswer) AsMediaObject() (*MediaObject, bool) {
  3701  	return nil, false
  3702  }
  3703  
  3704  // AsBasicMediaObject is the BasicResponseBase implementation for SearchResultsAnswer.
  3705  func (sra SearchResultsAnswer) AsBasicMediaObject() (BasicMediaObject, bool) {
  3706  	return nil, false
  3707  }
  3708  
  3709  // AsResponseBase is the BasicResponseBase implementation for SearchResultsAnswer.
  3710  func (sra SearchResultsAnswer) AsResponseBase() (*ResponseBase, bool) {
  3711  	return nil, false
  3712  }
  3713  
  3714  // AsBasicResponseBase is the BasicResponseBase implementation for SearchResultsAnswer.
  3715  func (sra SearchResultsAnswer) AsBasicResponseBase() (BasicResponseBase, bool) {
  3716  	return &sra, true
  3717  }
  3718  
  3719  // BasicThing defines a thing.
  3720  type BasicThing interface {
  3721  	AsNewsArticle() (*NewsArticle, bool)
  3722  	AsImageObject() (*ImageObject, bool)
  3723  	AsNewsTopic() (*NewsTopic, bool)
  3724  	AsArticle() (*Article, bool)
  3725  	AsBasicArticle() (BasicArticle, bool)
  3726  	AsVideoObject() (*VideoObject, bool)
  3727  	AsCreativeWork() (*CreativeWork, bool)
  3728  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  3729  	AsOrganization() (*Organization, bool)
  3730  	AsMediaObject() (*MediaObject, bool)
  3731  	AsBasicMediaObject() (BasicMediaObject, bool)
  3732  	AsThing() (*Thing, bool)
  3733  }
  3734  
  3735  // Thing defines a thing.
  3736  type Thing struct {
  3737  	// Name - READ-ONLY; The name of the thing represented by this object.
  3738  	Name *string `json:"name,omitempty"`
  3739  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  3740  	URL *string `json:"url,omitempty"`
  3741  	// Image - READ-ONLY; An image of the item.
  3742  	Image *ImageObject `json:"image,omitempty"`
  3743  	// Description - READ-ONLY; A short description of the item.
  3744  	Description *string `json:"description,omitempty"`
  3745  	// AlternateName - READ-ONLY; An alias for the item
  3746  	AlternateName *string `json:"alternateName,omitempty"`
  3747  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
  3748  	BingID *string `json:"bingId,omitempty"`
  3749  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  3750  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  3751  	// ID - READ-ONLY; A String identifier.
  3752  	ID *string `json:"id,omitempty"`
  3753  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  3754  	Type Type `json:"_type,omitempty"`
  3755  }
  3756  
  3757  func unmarshalBasicThing(body []byte) (BasicThing, error) {
  3758  	var m map[string]interface{}
  3759  	err := json.Unmarshal(body, &m)
  3760  	if err != nil {
  3761  		return nil, err
  3762  	}
  3763  
  3764  	switch m["_type"] {
  3765  	case string(TypeNewsArticle):
  3766  		var na NewsArticle
  3767  		err := json.Unmarshal(body, &na)
  3768  		return na, err
  3769  	case string(TypeImageObject):
  3770  		var ioVar ImageObject
  3771  		err := json.Unmarshal(body, &ioVar)
  3772  		return ioVar, err
  3773  	case string(TypeNewsTopic):
  3774  		var nt NewsTopic
  3775  		err := json.Unmarshal(body, &nt)
  3776  		return nt, err
  3777  	case string(TypeArticle):
  3778  		var a Article
  3779  		err := json.Unmarshal(body, &a)
  3780  		return a, err
  3781  	case string(TypeVideoObject):
  3782  		var vo VideoObject
  3783  		err := json.Unmarshal(body, &vo)
  3784  		return vo, err
  3785  	case string(TypeCreativeWork):
  3786  		var cw CreativeWork
  3787  		err := json.Unmarshal(body, &cw)
  3788  		return cw, err
  3789  	case string(TypeOrganization):
  3790  		var o Organization
  3791  		err := json.Unmarshal(body, &o)
  3792  		return o, err
  3793  	case string(TypeMediaObject):
  3794  		var mo MediaObject
  3795  		err := json.Unmarshal(body, &mo)
  3796  		return mo, err
  3797  	default:
  3798  		var t Thing
  3799  		err := json.Unmarshal(body, &t)
  3800  		return t, err
  3801  	}
  3802  }
  3803  func unmarshalBasicThingArray(body []byte) ([]BasicThing, error) {
  3804  	var rawMessages []*json.RawMessage
  3805  	err := json.Unmarshal(body, &rawMessages)
  3806  	if err != nil {
  3807  		return nil, err
  3808  	}
  3809  
  3810  	tArray := make([]BasicThing, len(rawMessages))
  3811  
  3812  	for index, rawMessage := range rawMessages {
  3813  		t, err := unmarshalBasicThing(*rawMessage)
  3814  		if err != nil {
  3815  			return nil, err
  3816  		}
  3817  		tArray[index] = t
  3818  	}
  3819  	return tArray, nil
  3820  }
  3821  
  3822  // MarshalJSON is the custom marshaler for Thing.
  3823  func (t Thing) MarshalJSON() ([]byte, error) {
  3824  	t.Type = TypeThing
  3825  	objectMap := make(map[string]interface{})
  3826  	if t.Type != "" {
  3827  		objectMap["_type"] = t.Type
  3828  	}
  3829  	return json.Marshal(objectMap)
  3830  }
  3831  
  3832  // AsNewsArticle is the BasicResponseBase implementation for Thing.
  3833  func (t Thing) AsNewsArticle() (*NewsArticle, bool) {
  3834  	return nil, false
  3835  }
  3836  
  3837  // AsNews is the BasicResponseBase implementation for Thing.
  3838  func (t Thing) AsNews() (*News, bool) {
  3839  	return nil, false
  3840  }
  3841  
  3842  // AsSearchResultsAnswer is the BasicResponseBase implementation for Thing.
  3843  func (t Thing) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  3844  	return nil, false
  3845  }
  3846  
  3847  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Thing.
  3848  func (t Thing) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  3849  	return nil, false
  3850  }
  3851  
  3852  // AsImageObject is the BasicResponseBase implementation for Thing.
  3853  func (t Thing) AsImageObject() (*ImageObject, bool) {
  3854  	return nil, false
  3855  }
  3856  
  3857  // AsNewsTopic is the BasicResponseBase implementation for Thing.
  3858  func (t Thing) AsNewsTopic() (*NewsTopic, bool) {
  3859  	return nil, false
  3860  }
  3861  
  3862  // AsAnswer is the BasicResponseBase implementation for Thing.
  3863  func (t Thing) AsAnswer() (*Answer, bool) {
  3864  	return nil, false
  3865  }
  3866  
  3867  // AsBasicAnswer is the BasicResponseBase implementation for Thing.
  3868  func (t Thing) AsBasicAnswer() (BasicAnswer, bool) {
  3869  	return nil, false
  3870  }
  3871  
  3872  // AsArticle is the BasicResponseBase implementation for Thing.
  3873  func (t Thing) AsArticle() (*Article, bool) {
  3874  	return nil, false
  3875  }
  3876  
  3877  // AsBasicArticle is the BasicResponseBase implementation for Thing.
  3878  func (t Thing) AsBasicArticle() (BasicArticle, bool) {
  3879  	return nil, false
  3880  }
  3881  
  3882  // AsThing is the BasicResponseBase implementation for Thing.
  3883  func (t Thing) AsThing() (*Thing, bool) {
  3884  	return &t, true
  3885  }
  3886  
  3887  // AsBasicThing is the BasicResponseBase implementation for Thing.
  3888  func (t Thing) AsBasicThing() (BasicThing, bool) {
  3889  	return &t, true
  3890  }
  3891  
  3892  // AsResponse is the BasicResponseBase implementation for Thing.
  3893  func (t Thing) AsResponse() (*Response, bool) {
  3894  	return nil, false
  3895  }
  3896  
  3897  // AsBasicResponse is the BasicResponseBase implementation for Thing.
  3898  func (t Thing) AsBasicResponse() (BasicResponse, bool) {
  3899  	return &t, true
  3900  }
  3901  
  3902  // AsTrendingTopics is the BasicResponseBase implementation for Thing.
  3903  func (t Thing) AsTrendingTopics() (*TrendingTopics, bool) {
  3904  	return nil, false
  3905  }
  3906  
  3907  // AsVideoObject is the BasicResponseBase implementation for Thing.
  3908  func (t Thing) AsVideoObject() (*VideoObject, bool) {
  3909  	return nil, false
  3910  }
  3911  
  3912  // AsCreativeWork is the BasicResponseBase implementation for Thing.
  3913  func (t Thing) AsCreativeWork() (*CreativeWork, bool) {
  3914  	return nil, false
  3915  }
  3916  
  3917  // AsBasicCreativeWork is the BasicResponseBase implementation for Thing.
  3918  func (t Thing) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  3919  	return nil, false
  3920  }
  3921  
  3922  // AsOrganization is the BasicResponseBase implementation for Thing.
  3923  func (t Thing) AsOrganization() (*Organization, bool) {
  3924  	return nil, false
  3925  }
  3926  
  3927  // AsIdentifiable is the BasicResponseBase implementation for Thing.
  3928  func (t Thing) AsIdentifiable() (*Identifiable, bool) {
  3929  	return nil, false
  3930  }
  3931  
  3932  // AsBasicIdentifiable is the BasicResponseBase implementation for Thing.
  3933  func (t Thing) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  3934  	return &t, true
  3935  }
  3936  
  3937  // AsErrorResponse is the BasicResponseBase implementation for Thing.
  3938  func (t Thing) AsErrorResponse() (*ErrorResponse, bool) {
  3939  	return nil, false
  3940  }
  3941  
  3942  // AsMediaObject is the BasicResponseBase implementation for Thing.
  3943  func (t Thing) AsMediaObject() (*MediaObject, bool) {
  3944  	return nil, false
  3945  }
  3946  
  3947  // AsBasicMediaObject is the BasicResponseBase implementation for Thing.
  3948  func (t Thing) AsBasicMediaObject() (BasicMediaObject, bool) {
  3949  	return nil, false
  3950  }
  3951  
  3952  // AsResponseBase is the BasicResponseBase implementation for Thing.
  3953  func (t Thing) AsResponseBase() (*ResponseBase, bool) {
  3954  	return nil, false
  3955  }
  3956  
  3957  // AsBasicResponseBase is the BasicResponseBase implementation for Thing.
  3958  func (t Thing) AsBasicResponseBase() (BasicResponseBase, bool) {
  3959  	return &t, true
  3960  }
  3961  
  3962  // TrendingTopics ...
  3963  type TrendingTopics struct {
  3964  	autorest.Response `json:"-"`
  3965  	// Value - A list of trending news topics on Bing
  3966  	Value *[]NewsTopic `json:"value,omitempty"`
  3967  	// FollowUpQueries - READ-ONLY
  3968  	FollowUpQueries *[]Query `json:"followUpQueries,omitempty"`
  3969  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  3970  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  3971  	// ID - READ-ONLY; A String identifier.
  3972  	ID *string `json:"id,omitempty"`
  3973  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  3974  	Type Type `json:"_type,omitempty"`
  3975  }
  3976  
  3977  // MarshalJSON is the custom marshaler for TrendingTopics.
  3978  func (tt TrendingTopics) MarshalJSON() ([]byte, error) {
  3979  	tt.Type = TypeTrendingTopics
  3980  	objectMap := make(map[string]interface{})
  3981  	if tt.Value != nil {
  3982  		objectMap["value"] = tt.Value
  3983  	}
  3984  	if tt.Type != "" {
  3985  		objectMap["_type"] = tt.Type
  3986  	}
  3987  	return json.Marshal(objectMap)
  3988  }
  3989  
  3990  // AsNewsArticle is the BasicResponseBase implementation for TrendingTopics.
  3991  func (tt TrendingTopics) AsNewsArticle() (*NewsArticle, bool) {
  3992  	return nil, false
  3993  }
  3994  
  3995  // AsNews is the BasicResponseBase implementation for TrendingTopics.
  3996  func (tt TrendingTopics) AsNews() (*News, bool) {
  3997  	return nil, false
  3998  }
  3999  
  4000  // AsSearchResultsAnswer is the BasicResponseBase implementation for TrendingTopics.
  4001  func (tt TrendingTopics) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  4002  	return nil, false
  4003  }
  4004  
  4005  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for TrendingTopics.
  4006  func (tt TrendingTopics) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  4007  	return nil, false
  4008  }
  4009  
  4010  // AsImageObject is the BasicResponseBase implementation for TrendingTopics.
  4011  func (tt TrendingTopics) AsImageObject() (*ImageObject, bool) {
  4012  	return nil, false
  4013  }
  4014  
  4015  // AsNewsTopic is the BasicResponseBase implementation for TrendingTopics.
  4016  func (tt TrendingTopics) AsNewsTopic() (*NewsTopic, bool) {
  4017  	return nil, false
  4018  }
  4019  
  4020  // AsAnswer is the BasicResponseBase implementation for TrendingTopics.
  4021  func (tt TrendingTopics) AsAnswer() (*Answer, bool) {
  4022  	return nil, false
  4023  }
  4024  
  4025  // AsBasicAnswer is the BasicResponseBase implementation for TrendingTopics.
  4026  func (tt TrendingTopics) AsBasicAnswer() (BasicAnswer, bool) {
  4027  	return &tt, true
  4028  }
  4029  
  4030  // AsArticle is the BasicResponseBase implementation for TrendingTopics.
  4031  func (tt TrendingTopics) AsArticle() (*Article, bool) {
  4032  	return nil, false
  4033  }
  4034  
  4035  // AsBasicArticle is the BasicResponseBase implementation for TrendingTopics.
  4036  func (tt TrendingTopics) AsBasicArticle() (BasicArticle, bool) {
  4037  	return nil, false
  4038  }
  4039  
  4040  // AsThing is the BasicResponseBase implementation for TrendingTopics.
  4041  func (tt TrendingTopics) AsThing() (*Thing, bool) {
  4042  	return nil, false
  4043  }
  4044  
  4045  // AsBasicThing is the BasicResponseBase implementation for TrendingTopics.
  4046  func (tt TrendingTopics) AsBasicThing() (BasicThing, bool) {
  4047  	return nil, false
  4048  }
  4049  
  4050  // AsResponse is the BasicResponseBase implementation for TrendingTopics.
  4051  func (tt TrendingTopics) AsResponse() (*Response, bool) {
  4052  	return nil, false
  4053  }
  4054  
  4055  // AsBasicResponse is the BasicResponseBase implementation for TrendingTopics.
  4056  func (tt TrendingTopics) AsBasicResponse() (BasicResponse, bool) {
  4057  	return &tt, true
  4058  }
  4059  
  4060  // AsTrendingTopics is the BasicResponseBase implementation for TrendingTopics.
  4061  func (tt TrendingTopics) AsTrendingTopics() (*TrendingTopics, bool) {
  4062  	return &tt, true
  4063  }
  4064  
  4065  // AsVideoObject is the BasicResponseBase implementation for TrendingTopics.
  4066  func (tt TrendingTopics) AsVideoObject() (*VideoObject, bool) {
  4067  	return nil, false
  4068  }
  4069  
  4070  // AsCreativeWork is the BasicResponseBase implementation for TrendingTopics.
  4071  func (tt TrendingTopics) AsCreativeWork() (*CreativeWork, bool) {
  4072  	return nil, false
  4073  }
  4074  
  4075  // AsBasicCreativeWork is the BasicResponseBase implementation for TrendingTopics.
  4076  func (tt TrendingTopics) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  4077  	return nil, false
  4078  }
  4079  
  4080  // AsOrganization is the BasicResponseBase implementation for TrendingTopics.
  4081  func (tt TrendingTopics) AsOrganization() (*Organization, bool) {
  4082  	return nil, false
  4083  }
  4084  
  4085  // AsIdentifiable is the BasicResponseBase implementation for TrendingTopics.
  4086  func (tt TrendingTopics) AsIdentifiable() (*Identifiable, bool) {
  4087  	return nil, false
  4088  }
  4089  
  4090  // AsBasicIdentifiable is the BasicResponseBase implementation for TrendingTopics.
  4091  func (tt TrendingTopics) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  4092  	return &tt, true
  4093  }
  4094  
  4095  // AsErrorResponse is the BasicResponseBase implementation for TrendingTopics.
  4096  func (tt TrendingTopics) AsErrorResponse() (*ErrorResponse, bool) {
  4097  	return nil, false
  4098  }
  4099  
  4100  // AsMediaObject is the BasicResponseBase implementation for TrendingTopics.
  4101  func (tt TrendingTopics) AsMediaObject() (*MediaObject, bool) {
  4102  	return nil, false
  4103  }
  4104  
  4105  // AsBasicMediaObject is the BasicResponseBase implementation for TrendingTopics.
  4106  func (tt TrendingTopics) AsBasicMediaObject() (BasicMediaObject, bool) {
  4107  	return nil, false
  4108  }
  4109  
  4110  // AsResponseBase is the BasicResponseBase implementation for TrendingTopics.
  4111  func (tt TrendingTopics) AsResponseBase() (*ResponseBase, bool) {
  4112  	return nil, false
  4113  }
  4114  
  4115  // AsBasicResponseBase is the BasicResponseBase implementation for TrendingTopics.
  4116  func (tt TrendingTopics) AsBasicResponseBase() (BasicResponseBase, bool) {
  4117  	return &tt, true
  4118  }
  4119  
  4120  // VideoObject defines a video object that is relevant to the query.
  4121  type VideoObject struct {
  4122  	// MotionThumbnailURL - READ-ONLY
  4123  	MotionThumbnailURL *string `json:"motionThumbnailUrl,omitempty"`
  4124  	// MotionThumbnailID - READ-ONLY
  4125  	MotionThumbnailID *string `json:"motionThumbnailId,omitempty"`
  4126  	// EmbedHTML - READ-ONLY
  4127  	EmbedHTML *string `json:"embedHtml,omitempty"`
  4128  	// AllowHTTPSEmbed - READ-ONLY
  4129  	AllowHTTPSEmbed *bool `json:"allowHttpsEmbed,omitempty"`
  4130  	// ViewCount - READ-ONLY
  4131  	ViewCount *int32 `json:"viewCount,omitempty"`
  4132  	// Thumbnail - READ-ONLY
  4133  	Thumbnail *ImageObject `json:"thumbnail,omitempty"`
  4134  	// VideoID - READ-ONLY
  4135  	VideoID *string `json:"videoId,omitempty"`
  4136  	// AllowMobileEmbed - READ-ONLY
  4137  	AllowMobileEmbed *bool `json:"allowMobileEmbed,omitempty"`
  4138  	// IsSuperfresh - READ-ONLY
  4139  	IsSuperfresh *bool `json:"isSuperfresh,omitempty"`
  4140  	// ContentURL - READ-ONLY; Original URL to retrieve the source (file) for the media object (e.g the source URL for the image).
  4141  	ContentURL *string `json:"contentUrl,omitempty"`
  4142  	// Width - READ-ONLY; The width of the source media object, in pixels.
  4143  	Width *int32 `json:"width,omitempty"`
  4144  	// Height - READ-ONLY; The height of the source media object, in pixels.
  4145  	Height *int32 `json:"height,omitempty"`
  4146  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
  4147  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
  4148  	// Provider - READ-ONLY; The source of the creative work.
  4149  	Provider *[]BasicThing `json:"provider,omitempty"`
  4150  	// DatePublished - READ-ONLY; The date on which the CreativeWork was published.
  4151  	DatePublished *string `json:"datePublished,omitempty"`
  4152  	// Video - READ-ONLY; A video of the item.
  4153  	Video *VideoObject `json:"video,omitempty"`
  4154  	// Name - READ-ONLY; The name of the thing represented by this object.
  4155  	Name *string `json:"name,omitempty"`
  4156  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  4157  	URL *string `json:"url,omitempty"`
  4158  	// Image - READ-ONLY; An image of the item.
  4159  	Image *ImageObject `json:"image,omitempty"`
  4160  	// Description - READ-ONLY; A short description of the item.
  4161  	Description *string `json:"description,omitempty"`
  4162  	// AlternateName - READ-ONLY; An alias for the item
  4163  	AlternateName *string `json:"alternateName,omitempty"`
  4164  	// BingID - READ-ONLY; An ID that uniquely identifies this item.
  4165  	BingID *string `json:"bingId,omitempty"`
  4166  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  4167  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  4168  	// ID - READ-ONLY; A String identifier.
  4169  	ID *string `json:"id,omitempty"`
  4170  	// Type - Possible values include: 'TypeResponseBase', 'TypeNewsArticle', 'TypeNews', 'TypeSearchResultsAnswer', 'TypeImageObject', 'TypeNewsTopic', 'TypeAnswer', 'TypeArticle', 'TypeThing', 'TypeResponse', 'TypeTrendingTopics', 'TypeVideoObject', 'TypeCreativeWork', 'TypeOrganization', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeMediaObject'
  4171  	Type Type `json:"_type,omitempty"`
  4172  }
  4173  
  4174  // MarshalJSON is the custom marshaler for VideoObject.
  4175  func (vo VideoObject) MarshalJSON() ([]byte, error) {
  4176  	vo.Type = TypeVideoObject
  4177  	objectMap := make(map[string]interface{})
  4178  	if vo.Type != "" {
  4179  		objectMap["_type"] = vo.Type
  4180  	}
  4181  	return json.Marshal(objectMap)
  4182  }
  4183  
  4184  // AsNewsArticle is the BasicResponseBase implementation for VideoObject.
  4185  func (vo VideoObject) AsNewsArticle() (*NewsArticle, bool) {
  4186  	return nil, false
  4187  }
  4188  
  4189  // AsNews is the BasicResponseBase implementation for VideoObject.
  4190  func (vo VideoObject) AsNews() (*News, bool) {
  4191  	return nil, false
  4192  }
  4193  
  4194  // AsSearchResultsAnswer is the BasicResponseBase implementation for VideoObject.
  4195  func (vo VideoObject) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  4196  	return nil, false
  4197  }
  4198  
  4199  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for VideoObject.
  4200  func (vo VideoObject) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  4201  	return nil, false
  4202  }
  4203  
  4204  // AsImageObject is the BasicResponseBase implementation for VideoObject.
  4205  func (vo VideoObject) AsImageObject() (*ImageObject, bool) {
  4206  	return nil, false
  4207  }
  4208  
  4209  // AsNewsTopic is the BasicResponseBase implementation for VideoObject.
  4210  func (vo VideoObject) AsNewsTopic() (*NewsTopic, bool) {
  4211  	return nil, false
  4212  }
  4213  
  4214  // AsAnswer is the BasicResponseBase implementation for VideoObject.
  4215  func (vo VideoObject) AsAnswer() (*Answer, bool) {
  4216  	return nil, false
  4217  }
  4218  
  4219  // AsBasicAnswer is the BasicResponseBase implementation for VideoObject.
  4220  func (vo VideoObject) AsBasicAnswer() (BasicAnswer, bool) {
  4221  	return nil, false
  4222  }
  4223  
  4224  // AsArticle is the BasicResponseBase implementation for VideoObject.
  4225  func (vo VideoObject) AsArticle() (*Article, bool) {
  4226  	return nil, false
  4227  }
  4228  
  4229  // AsBasicArticle is the BasicResponseBase implementation for VideoObject.
  4230  func (vo VideoObject) AsBasicArticle() (BasicArticle, bool) {
  4231  	return nil, false
  4232  }
  4233  
  4234  // AsThing is the BasicResponseBase implementation for VideoObject.
  4235  func (vo VideoObject) AsThing() (*Thing, bool) {
  4236  	return nil, false
  4237  }
  4238  
  4239  // AsBasicThing is the BasicResponseBase implementation for VideoObject.
  4240  func (vo VideoObject) AsBasicThing() (BasicThing, bool) {
  4241  	return &vo, true
  4242  }
  4243  
  4244  // AsResponse is the BasicResponseBase implementation for VideoObject.
  4245  func (vo VideoObject) AsResponse() (*Response, bool) {
  4246  	return nil, false
  4247  }
  4248  
  4249  // AsBasicResponse is the BasicResponseBase implementation for VideoObject.
  4250  func (vo VideoObject) AsBasicResponse() (BasicResponse, bool) {
  4251  	return &vo, true
  4252  }
  4253  
  4254  // AsTrendingTopics is the BasicResponseBase implementation for VideoObject.
  4255  func (vo VideoObject) AsTrendingTopics() (*TrendingTopics, bool) {
  4256  	return nil, false
  4257  }
  4258  
  4259  // AsVideoObject is the BasicResponseBase implementation for VideoObject.
  4260  func (vo VideoObject) AsVideoObject() (*VideoObject, bool) {
  4261  	return &vo, true
  4262  }
  4263  
  4264  // AsCreativeWork is the BasicResponseBase implementation for VideoObject.
  4265  func (vo VideoObject) AsCreativeWork() (*CreativeWork, bool) {
  4266  	return nil, false
  4267  }
  4268  
  4269  // AsBasicCreativeWork is the BasicResponseBase implementation for VideoObject.
  4270  func (vo VideoObject) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  4271  	return &vo, true
  4272  }
  4273  
  4274  // AsOrganization is the BasicResponseBase implementation for VideoObject.
  4275  func (vo VideoObject) AsOrganization() (*Organization, bool) {
  4276  	return nil, false
  4277  }
  4278  
  4279  // AsIdentifiable is the BasicResponseBase implementation for VideoObject.
  4280  func (vo VideoObject) AsIdentifiable() (*Identifiable, bool) {
  4281  	return nil, false
  4282  }
  4283  
  4284  // AsBasicIdentifiable is the BasicResponseBase implementation for VideoObject.
  4285  func (vo VideoObject) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  4286  	return &vo, true
  4287  }
  4288  
  4289  // AsErrorResponse is the BasicResponseBase implementation for VideoObject.
  4290  func (vo VideoObject) AsErrorResponse() (*ErrorResponse, bool) {
  4291  	return nil, false
  4292  }
  4293  
  4294  // AsMediaObject is the BasicResponseBase implementation for VideoObject.
  4295  func (vo VideoObject) AsMediaObject() (*MediaObject, bool) {
  4296  	return nil, false
  4297  }
  4298  
  4299  // AsBasicMediaObject is the BasicResponseBase implementation for VideoObject.
  4300  func (vo VideoObject) AsBasicMediaObject() (BasicMediaObject, bool) {
  4301  	return &vo, true
  4302  }
  4303  
  4304  // AsResponseBase is the BasicResponseBase implementation for VideoObject.
  4305  func (vo VideoObject) AsResponseBase() (*ResponseBase, bool) {
  4306  	return nil, false
  4307  }
  4308  
  4309  // AsBasicResponseBase is the BasicResponseBase implementation for VideoObject.
  4310  func (vo VideoObject) AsBasicResponseBase() (BasicResponseBase, bool) {
  4311  	return &vo, true
  4312  }
  4313  
  4314  // UnmarshalJSON is the custom unmarshaler for VideoObject struct.
  4315  func (vo *VideoObject) UnmarshalJSON(body []byte) error {
  4316  	var m map[string]*json.RawMessage
  4317  	err := json.Unmarshal(body, &m)
  4318  	if err != nil {
  4319  		return err
  4320  	}
  4321  	for k, v := range m {
  4322  		switch k {
  4323  		case "motionThumbnailUrl":
  4324  			if v != nil {
  4325  				var motionThumbnailURL string
  4326  				err = json.Unmarshal(*v, &motionThumbnailURL)
  4327  				if err != nil {
  4328  					return err
  4329  				}
  4330  				vo.MotionThumbnailURL = &motionThumbnailURL
  4331  			}
  4332  		case "motionThumbnailId":
  4333  			if v != nil {
  4334  				var motionThumbnailID string
  4335  				err = json.Unmarshal(*v, &motionThumbnailID)
  4336  				if err != nil {
  4337  					return err
  4338  				}
  4339  				vo.MotionThumbnailID = &motionThumbnailID
  4340  			}
  4341  		case "embedHtml":
  4342  			if v != nil {
  4343  				var embedHTML string
  4344  				err = json.Unmarshal(*v, &embedHTML)
  4345  				if err != nil {
  4346  					return err
  4347  				}
  4348  				vo.EmbedHTML = &embedHTML
  4349  			}
  4350  		case "allowHttpsEmbed":
  4351  			if v != nil {
  4352  				var allowHTTPSEmbed bool
  4353  				err = json.Unmarshal(*v, &allowHTTPSEmbed)
  4354  				if err != nil {
  4355  					return err
  4356  				}
  4357  				vo.AllowHTTPSEmbed = &allowHTTPSEmbed
  4358  			}
  4359  		case "viewCount":
  4360  			if v != nil {
  4361  				var viewCount int32
  4362  				err = json.Unmarshal(*v, &viewCount)
  4363  				if err != nil {
  4364  					return err
  4365  				}
  4366  				vo.ViewCount = &viewCount
  4367  			}
  4368  		case "thumbnail":
  4369  			if v != nil {
  4370  				var thumbnail ImageObject
  4371  				err = json.Unmarshal(*v, &thumbnail)
  4372  				if err != nil {
  4373  					return err
  4374  				}
  4375  				vo.Thumbnail = &thumbnail
  4376  			}
  4377  		case "videoId":
  4378  			if v != nil {
  4379  				var videoID string
  4380  				err = json.Unmarshal(*v, &videoID)
  4381  				if err != nil {
  4382  					return err
  4383  				}
  4384  				vo.VideoID = &videoID
  4385  			}
  4386  		case "allowMobileEmbed":
  4387  			if v != nil {
  4388  				var allowMobileEmbed bool
  4389  				err = json.Unmarshal(*v, &allowMobileEmbed)
  4390  				if err != nil {
  4391  					return err
  4392  				}
  4393  				vo.AllowMobileEmbed = &allowMobileEmbed
  4394  			}
  4395  		case "isSuperfresh":
  4396  			if v != nil {
  4397  				var isSuperfresh bool
  4398  				err = json.Unmarshal(*v, &isSuperfresh)
  4399  				if err != nil {
  4400  					return err
  4401  				}
  4402  				vo.IsSuperfresh = &isSuperfresh
  4403  			}
  4404  		case "contentUrl":
  4405  			if v != nil {
  4406  				var contentURL string
  4407  				err = json.Unmarshal(*v, &contentURL)
  4408  				if err != nil {
  4409  					return err
  4410  				}
  4411  				vo.ContentURL = &contentURL
  4412  			}
  4413  		case "width":
  4414  			if v != nil {
  4415  				var width int32
  4416  				err = json.Unmarshal(*v, &width)
  4417  				if err != nil {
  4418  					return err
  4419  				}
  4420  				vo.Width = &width
  4421  			}
  4422  		case "height":
  4423  			if v != nil {
  4424  				var height int32
  4425  				err = json.Unmarshal(*v, &height)
  4426  				if err != nil {
  4427  					return err
  4428  				}
  4429  				vo.Height = &height
  4430  			}
  4431  		case "thumbnailUrl":
  4432  			if v != nil {
  4433  				var thumbnailURL string
  4434  				err = json.Unmarshal(*v, &thumbnailURL)
  4435  				if err != nil {
  4436  					return err
  4437  				}
  4438  				vo.ThumbnailURL = &thumbnailURL
  4439  			}
  4440  		case "provider":
  4441  			if v != nil {
  4442  				provider, err := unmarshalBasicThingArray(*v)
  4443  				if err != nil {
  4444  					return err
  4445  				}
  4446  				vo.Provider = &provider
  4447  			}
  4448  		case "datePublished":
  4449  			if v != nil {
  4450  				var datePublished string
  4451  				err = json.Unmarshal(*v, &datePublished)
  4452  				if err != nil {
  4453  					return err
  4454  				}
  4455  				vo.DatePublished = &datePublished
  4456  			}
  4457  		case "video":
  4458  			if v != nil {
  4459  				var video VideoObject
  4460  				err = json.Unmarshal(*v, &video)
  4461  				if err != nil {
  4462  					return err
  4463  				}
  4464  				vo.Video = &video
  4465  			}
  4466  		case "name":
  4467  			if v != nil {
  4468  				var name string
  4469  				err = json.Unmarshal(*v, &name)
  4470  				if err != nil {
  4471  					return err
  4472  				}
  4473  				vo.Name = &name
  4474  			}
  4475  		case "url":
  4476  			if v != nil {
  4477  				var URL string
  4478  				err = json.Unmarshal(*v, &URL)
  4479  				if err != nil {
  4480  					return err
  4481  				}
  4482  				vo.URL = &URL
  4483  			}
  4484  		case "image":
  4485  			if v != nil {
  4486  				var imageVar ImageObject
  4487  				err = json.Unmarshal(*v, &imageVar)
  4488  				if err != nil {
  4489  					return err
  4490  				}
  4491  				vo.Image = &imageVar
  4492  			}
  4493  		case "description":
  4494  			if v != nil {
  4495  				var description string
  4496  				err = json.Unmarshal(*v, &description)
  4497  				if err != nil {
  4498  					return err
  4499  				}
  4500  				vo.Description = &description
  4501  			}
  4502  		case "alternateName":
  4503  			if v != nil {
  4504  				var alternateName string
  4505  				err = json.Unmarshal(*v, &alternateName)
  4506  				if err != nil {
  4507  					return err
  4508  				}
  4509  				vo.AlternateName = &alternateName
  4510  			}
  4511  		case "bingId":
  4512  			if v != nil {
  4513  				var bingID string
  4514  				err = json.Unmarshal(*v, &bingID)
  4515  				if err != nil {
  4516  					return err
  4517  				}
  4518  				vo.BingID = &bingID
  4519  			}
  4520  		case "webSearchUrl":
  4521  			if v != nil {
  4522  				var webSearchURL string
  4523  				err = json.Unmarshal(*v, &webSearchURL)
  4524  				if err != nil {
  4525  					return err
  4526  				}
  4527  				vo.WebSearchURL = &webSearchURL
  4528  			}
  4529  		case "id":
  4530  			if v != nil {
  4531  				var ID string
  4532  				err = json.Unmarshal(*v, &ID)
  4533  				if err != nil {
  4534  					return err
  4535  				}
  4536  				vo.ID = &ID
  4537  			}
  4538  		case "_type":
  4539  			if v != nil {
  4540  				var typeVar Type
  4541  				err = json.Unmarshal(*v, &typeVar)
  4542  				if err != nil {
  4543  					return err
  4544  				}
  4545  				vo.Type = typeVar
  4546  			}
  4547  		}
  4548  	}
  4549  
  4550  	return nil
  4551  }
  4552  

View as plain text