...

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

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

     1  package localsearch
     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/localsearch"
    16  
    17  // BasicAction defines an action.
    18  type BasicAction interface {
    19  	AsSearchAction() (*SearchAction, bool)
    20  	AsAction() (*Action, bool)
    21  }
    22  
    23  // Action defines an action.
    24  type Action struct {
    25  	// Location - READ-ONLY
    26  	Location *[]Place `json:"location,omitempty"`
    27  	// Result - READ-ONLY; The result produced in the action.
    28  	Result *[]BasicThing `json:"result,omitempty"`
    29  	// DisplayName - READ-ONLY; A display name for the action.
    30  	DisplayName *string `json:"displayName,omitempty"`
    31  	// IsTopAction - READ-ONLY; A Boolean representing whether this result is the top action.
    32  	IsTopAction *bool `json:"isTopAction,omitempty"`
    33  	// ServiceURL - READ-ONLY; Use this URL to get additional data to determine how to take the appropriate action. For example, the serviceUrl might return JSON along with an image URL.
    34  	ServiceURL *string `json:"serviceUrl,omitempty"`
    35  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
    36  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
    37  	// About - READ-ONLY; For internal use only.
    38  	About *[]BasicThing `json:"about,omitempty"`
    39  	// Mentions - READ-ONLY; For internal use only.
    40  	Mentions *[]BasicThing `json:"mentions,omitempty"`
    41  	// Provider - READ-ONLY; The source of the creative work.
    42  	Provider *[]BasicThing `json:"provider,omitempty"`
    43  	// Creator - READ-ONLY
    44  	Creator BasicThing `json:"creator,omitempty"`
    45  	// Text - READ-ONLY; Text content of this creative work
    46  	Text *string `json:"text,omitempty"`
    47  	// DiscussionURL - READ-ONLY
    48  	DiscussionURL *string `json:"discussionUrl,omitempty"`
    49  	// CommentCount - READ-ONLY
    50  	CommentCount *int32 `json:"commentCount,omitempty"`
    51  	// MainEntity - READ-ONLY
    52  	MainEntity BasicThing `json:"mainEntity,omitempty"`
    53  	// HeadLine - READ-ONLY
    54  	HeadLine *string `json:"headLine,omitempty"`
    55  	// CopyrightHolder - READ-ONLY
    56  	CopyrightHolder BasicThing `json:"copyrightHolder,omitempty"`
    57  	// CopyrightYear - READ-ONLY
    58  	CopyrightYear *int32 `json:"copyrightYear,omitempty"`
    59  	// Disclaimer - READ-ONLY
    60  	Disclaimer *string `json:"disclaimer,omitempty"`
    61  	// IsAccessibleForFree - READ-ONLY
    62  	IsAccessibleForFree *bool `json:"isAccessibleForFree,omitempty"`
    63  	// Genre - READ-ONLY
    64  	Genre *[]string `json:"genre,omitempty"`
    65  	// IsFamilyFriendly - READ-ONLY
    66  	IsFamilyFriendly *bool `json:"isFamilyFriendly,omitempty"`
    67  	// Name - READ-ONLY; The name of the thing represented by this object.
    68  	Name *string `json:"name,omitempty"`
    69  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
    70  	URL *string `json:"url,omitempty"`
    71  	// EntityPresentationInfo - READ-ONLY; Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields.
    72  	EntityPresentationInfo BasicEntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
    73  	// ReadLink - READ-ONLY; The URL that returns this resource.
    74  	ReadLink *string `json:"readLink,omitempty"`
    75  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
    76  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
    77  	// PotentialAction - READ-ONLY
    78  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
    79  	// ImmediateAction - READ-ONLY
    80  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
    81  	// PreferredClickthroughURL - READ-ONLY
    82  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
    83  	// AdaptiveCard - READ-ONLY
    84  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
    85  	// ID - READ-ONLY; A String identifier.
    86  	ID *string `json:"id,omitempty"`
    87  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
    88  	Type TypeBasicResponseBase `json:"_type,omitempty"`
    89  }
    90  
    91  func unmarshalBasicAction(body []byte) (BasicAction, error) {
    92  	var m map[string]interface{}
    93  	err := json.Unmarshal(body, &m)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  
    98  	switch m["_type"] {
    99  	case string(TypeSearchAction):
   100  		var sa SearchAction
   101  		err := json.Unmarshal(body, &sa)
   102  		return sa, err
   103  	default:
   104  		var a Action
   105  		err := json.Unmarshal(body, &a)
   106  		return a, err
   107  	}
   108  }
   109  func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) {
   110  	var rawMessages []*json.RawMessage
   111  	err := json.Unmarshal(body, &rawMessages)
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  
   116  	aArray := make([]BasicAction, len(rawMessages))
   117  
   118  	for index, rawMessage := range rawMessages {
   119  		a, err := unmarshalBasicAction(*rawMessage)
   120  		if err != nil {
   121  			return nil, err
   122  		}
   123  		aArray[index] = a
   124  	}
   125  	return aArray, nil
   126  }
   127  
   128  // MarshalJSON is the custom marshaler for Action.
   129  func (a Action) MarshalJSON() ([]byte, error) {
   130  	a.Type = TypeAction
   131  	objectMap := make(map[string]interface{})
   132  	if a.Type != "" {
   133  		objectMap["_type"] = a.Type
   134  	}
   135  	return json.Marshal(objectMap)
   136  }
   137  
   138  // AsThing is the BasicResponseBase implementation for Action.
   139  func (a Action) AsThing() (*Thing, bool) {
   140  	return nil, false
   141  }
   142  
   143  // AsBasicThing is the BasicResponseBase implementation for Action.
   144  func (a Action) AsBasicThing() (BasicThing, bool) {
   145  	return &a, true
   146  }
   147  
   148  // AsPlaces is the BasicResponseBase implementation for Action.
   149  func (a Action) AsPlaces() (*Places, bool) {
   150  	return nil, false
   151  }
   152  
   153  // AsSearchResultsAnswer is the BasicResponseBase implementation for Action.
   154  func (a Action) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   155  	return nil, false
   156  }
   157  
   158  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Action.
   159  func (a Action) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   160  	return nil, false
   161  }
   162  
   163  // AsSearchResponse is the BasicResponseBase implementation for Action.
   164  func (a Action) AsSearchResponse() (*SearchResponse, bool) {
   165  	return nil, false
   166  }
   167  
   168  // AsPostalAddress is the BasicResponseBase implementation for Action.
   169  func (a Action) AsPostalAddress() (*PostalAddress, bool) {
   170  	return nil, false
   171  }
   172  
   173  // AsPlace is the BasicResponseBase implementation for Action.
   174  func (a Action) AsPlace() (*Place, bool) {
   175  	return nil, false
   176  }
   177  
   178  // AsAction is the BasicResponseBase implementation for Action.
   179  func (a Action) AsAction() (*Action, bool) {
   180  	return &a, true
   181  }
   182  
   183  // AsBasicAction is the BasicResponseBase implementation for Action.
   184  func (a Action) AsBasicAction() (BasicAction, bool) {
   185  	return &a, true
   186  }
   187  
   188  // AsResponse is the BasicResponseBase implementation for Action.
   189  func (a Action) AsResponse() (*Response, bool) {
   190  	return nil, false
   191  }
   192  
   193  // AsBasicResponse is the BasicResponseBase implementation for Action.
   194  func (a Action) AsBasicResponse() (BasicResponse, bool) {
   195  	return &a, true
   196  }
   197  
   198  // AsIdentifiable is the BasicResponseBase implementation for Action.
   199  func (a Action) AsIdentifiable() (*Identifiable, bool) {
   200  	return nil, false
   201  }
   202  
   203  // AsBasicIdentifiable is the BasicResponseBase implementation for Action.
   204  func (a Action) AsBasicIdentifiable() (BasicIdentifiable, bool) {
   205  	return &a, true
   206  }
   207  
   208  // AsAnswer is the BasicResponseBase implementation for Action.
   209  func (a Action) AsAnswer() (*Answer, bool) {
   210  	return nil, false
   211  }
   212  
   213  // AsBasicAnswer is the BasicResponseBase implementation for Action.
   214  func (a Action) AsBasicAnswer() (BasicAnswer, bool) {
   215  	return nil, false
   216  }
   217  
   218  // AsErrorResponse is the BasicResponseBase implementation for Action.
   219  func (a Action) AsErrorResponse() (*ErrorResponse, bool) {
   220  	return nil, false
   221  }
   222  
   223  // AsCreativeWork is the BasicResponseBase implementation for Action.
   224  func (a Action) AsCreativeWork() (*CreativeWork, bool) {
   225  	return nil, false
   226  }
   227  
   228  // AsBasicCreativeWork is the BasicResponseBase implementation for Action.
   229  func (a Action) AsBasicCreativeWork() (BasicCreativeWork, bool) {
   230  	return &a, true
   231  }
   232  
   233  // AsIntangible is the BasicResponseBase implementation for Action.
   234  func (a Action) AsIntangible() (*Intangible, bool) {
   235  	return nil, false
   236  }
   237  
   238  // AsBasicIntangible is the BasicResponseBase implementation for Action.
   239  func (a Action) AsBasicIntangible() (BasicIntangible, bool) {
   240  	return nil, false
   241  }
   242  
   243  // AsSearchAction is the BasicResponseBase implementation for Action.
   244  func (a Action) AsSearchAction() (*SearchAction, bool) {
   245  	return nil, false
   246  }
   247  
   248  // AsStructuredValue is the BasicResponseBase implementation for Action.
   249  func (a Action) AsStructuredValue() (*StructuredValue, bool) {
   250  	return nil, false
   251  }
   252  
   253  // AsBasicStructuredValue is the BasicResponseBase implementation for Action.
   254  func (a Action) AsBasicStructuredValue() (BasicStructuredValue, bool) {
   255  	return nil, false
   256  }
   257  
   258  // AsResponseBase is the BasicResponseBase implementation for Action.
   259  func (a Action) AsResponseBase() (*ResponseBase, bool) {
   260  	return nil, false
   261  }
   262  
   263  // AsBasicResponseBase is the BasicResponseBase implementation for Action.
   264  func (a Action) AsBasicResponseBase() (BasicResponseBase, bool) {
   265  	return &a, true
   266  }
   267  
   268  // UnmarshalJSON is the custom unmarshaler for Action struct.
   269  func (a *Action) UnmarshalJSON(body []byte) error {
   270  	var m map[string]*json.RawMessage
   271  	err := json.Unmarshal(body, &m)
   272  	if err != nil {
   273  		return err
   274  	}
   275  	for k, v := range m {
   276  		switch k {
   277  		case "location":
   278  			if v != nil {
   279  				var location []Place
   280  				err = json.Unmarshal(*v, &location)
   281  				if err != nil {
   282  					return err
   283  				}
   284  				a.Location = &location
   285  			}
   286  		case "result":
   287  			if v != nil {
   288  				resultVar, err := unmarshalBasicThingArray(*v)
   289  				if err != nil {
   290  					return err
   291  				}
   292  				a.Result = &resultVar
   293  			}
   294  		case "displayName":
   295  			if v != nil {
   296  				var displayName string
   297  				err = json.Unmarshal(*v, &displayName)
   298  				if err != nil {
   299  					return err
   300  				}
   301  				a.DisplayName = &displayName
   302  			}
   303  		case "isTopAction":
   304  			if v != nil {
   305  				var isTopAction bool
   306  				err = json.Unmarshal(*v, &isTopAction)
   307  				if err != nil {
   308  					return err
   309  				}
   310  				a.IsTopAction = &isTopAction
   311  			}
   312  		case "serviceUrl":
   313  			if v != nil {
   314  				var serviceURL string
   315  				err = json.Unmarshal(*v, &serviceURL)
   316  				if err != nil {
   317  					return err
   318  				}
   319  				a.ServiceURL = &serviceURL
   320  			}
   321  		case "thumbnailUrl":
   322  			if v != nil {
   323  				var thumbnailURL string
   324  				err = json.Unmarshal(*v, &thumbnailURL)
   325  				if err != nil {
   326  					return err
   327  				}
   328  				a.ThumbnailURL = &thumbnailURL
   329  			}
   330  		case "about":
   331  			if v != nil {
   332  				about, err := unmarshalBasicThingArray(*v)
   333  				if err != nil {
   334  					return err
   335  				}
   336  				a.About = &about
   337  			}
   338  		case "mentions":
   339  			if v != nil {
   340  				mentions, err := unmarshalBasicThingArray(*v)
   341  				if err != nil {
   342  					return err
   343  				}
   344  				a.Mentions = &mentions
   345  			}
   346  		case "provider":
   347  			if v != nil {
   348  				provider, err := unmarshalBasicThingArray(*v)
   349  				if err != nil {
   350  					return err
   351  				}
   352  				a.Provider = &provider
   353  			}
   354  		case "creator":
   355  			if v != nil {
   356  				creator, err := unmarshalBasicThing(*v)
   357  				if err != nil {
   358  					return err
   359  				}
   360  				a.Creator = creator
   361  			}
   362  		case "text":
   363  			if v != nil {
   364  				var textVar string
   365  				err = json.Unmarshal(*v, &textVar)
   366  				if err != nil {
   367  					return err
   368  				}
   369  				a.Text = &textVar
   370  			}
   371  		case "discussionUrl":
   372  			if v != nil {
   373  				var discussionURL string
   374  				err = json.Unmarshal(*v, &discussionURL)
   375  				if err != nil {
   376  					return err
   377  				}
   378  				a.DiscussionURL = &discussionURL
   379  			}
   380  		case "commentCount":
   381  			if v != nil {
   382  				var commentCount int32
   383  				err = json.Unmarshal(*v, &commentCount)
   384  				if err != nil {
   385  					return err
   386  				}
   387  				a.CommentCount = &commentCount
   388  			}
   389  		case "mainEntity":
   390  			if v != nil {
   391  				mainEntity, err := unmarshalBasicThing(*v)
   392  				if err != nil {
   393  					return err
   394  				}
   395  				a.MainEntity = mainEntity
   396  			}
   397  		case "headLine":
   398  			if v != nil {
   399  				var headLine string
   400  				err = json.Unmarshal(*v, &headLine)
   401  				if err != nil {
   402  					return err
   403  				}
   404  				a.HeadLine = &headLine
   405  			}
   406  		case "copyrightHolder":
   407  			if v != nil {
   408  				copyrightHolder, err := unmarshalBasicThing(*v)
   409  				if err != nil {
   410  					return err
   411  				}
   412  				a.CopyrightHolder = copyrightHolder
   413  			}
   414  		case "copyrightYear":
   415  			if v != nil {
   416  				var copyrightYear int32
   417  				err = json.Unmarshal(*v, &copyrightYear)
   418  				if err != nil {
   419  					return err
   420  				}
   421  				a.CopyrightYear = &copyrightYear
   422  			}
   423  		case "disclaimer":
   424  			if v != nil {
   425  				var disclaimer string
   426  				err = json.Unmarshal(*v, &disclaimer)
   427  				if err != nil {
   428  					return err
   429  				}
   430  				a.Disclaimer = &disclaimer
   431  			}
   432  		case "isAccessibleForFree":
   433  			if v != nil {
   434  				var isAccessibleForFree bool
   435  				err = json.Unmarshal(*v, &isAccessibleForFree)
   436  				if err != nil {
   437  					return err
   438  				}
   439  				a.IsAccessibleForFree = &isAccessibleForFree
   440  			}
   441  		case "genre":
   442  			if v != nil {
   443  				var genre []string
   444  				err = json.Unmarshal(*v, &genre)
   445  				if err != nil {
   446  					return err
   447  				}
   448  				a.Genre = &genre
   449  			}
   450  		case "isFamilyFriendly":
   451  			if v != nil {
   452  				var isFamilyFriendly bool
   453  				err = json.Unmarshal(*v, &isFamilyFriendly)
   454  				if err != nil {
   455  					return err
   456  				}
   457  				a.IsFamilyFriendly = &isFamilyFriendly
   458  			}
   459  		case "name":
   460  			if v != nil {
   461  				var name string
   462  				err = json.Unmarshal(*v, &name)
   463  				if err != nil {
   464  					return err
   465  				}
   466  				a.Name = &name
   467  			}
   468  		case "url":
   469  			if v != nil {
   470  				var URL string
   471  				err = json.Unmarshal(*v, &URL)
   472  				if err != nil {
   473  					return err
   474  				}
   475  				a.URL = &URL
   476  			}
   477  		case "entityPresentationInfo":
   478  			if v != nil {
   479  				entityPresentationInfo, err := unmarshalBasicEntitiesEntityPresentationInfo(*v)
   480  				if err != nil {
   481  					return err
   482  				}
   483  				a.EntityPresentationInfo = entityPresentationInfo
   484  			}
   485  		case "readLink":
   486  			if v != nil {
   487  				var readLink string
   488  				err = json.Unmarshal(*v, &readLink)
   489  				if err != nil {
   490  					return err
   491  				}
   492  				a.ReadLink = &readLink
   493  			}
   494  		case "webSearchUrl":
   495  			if v != nil {
   496  				var webSearchURL string
   497  				err = json.Unmarshal(*v, &webSearchURL)
   498  				if err != nil {
   499  					return err
   500  				}
   501  				a.WebSearchURL = &webSearchURL
   502  			}
   503  		case "potentialAction":
   504  			if v != nil {
   505  				potentialAction, err := unmarshalBasicActionArray(*v)
   506  				if err != nil {
   507  					return err
   508  				}
   509  				a.PotentialAction = &potentialAction
   510  			}
   511  		case "immediateAction":
   512  			if v != nil {
   513  				immediateAction, err := unmarshalBasicActionArray(*v)
   514  				if err != nil {
   515  					return err
   516  				}
   517  				a.ImmediateAction = &immediateAction
   518  			}
   519  		case "preferredClickthroughUrl":
   520  			if v != nil {
   521  				var preferredClickthroughURL string
   522  				err = json.Unmarshal(*v, &preferredClickthroughURL)
   523  				if err != nil {
   524  					return err
   525  				}
   526  				a.PreferredClickthroughURL = &preferredClickthroughURL
   527  			}
   528  		case "adaptiveCard":
   529  			if v != nil {
   530  				var adaptiveCard string
   531  				err = json.Unmarshal(*v, &adaptiveCard)
   532  				if err != nil {
   533  					return err
   534  				}
   535  				a.AdaptiveCard = &adaptiveCard
   536  			}
   537  		case "id":
   538  			if v != nil {
   539  				var ID string
   540  				err = json.Unmarshal(*v, &ID)
   541  				if err != nil {
   542  					return err
   543  				}
   544  				a.ID = &ID
   545  			}
   546  		case "_type":
   547  			if v != nil {
   548  				var typeVar TypeBasicResponseBase
   549  				err = json.Unmarshal(*v, &typeVar)
   550  				if err != nil {
   551  					return err
   552  				}
   553  				a.Type = typeVar
   554  			}
   555  		}
   556  	}
   557  
   558  	return nil
   559  }
   560  
   561  // BasicAnswer defines an answer.
   562  type BasicAnswer interface {
   563  	AsPlaces() (*Places, bool)
   564  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
   565  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
   566  	AsAnswer() (*Answer, bool)
   567  }
   568  
   569  // Answer defines an answer.
   570  type Answer struct {
   571  	// ReadLink - READ-ONLY; The URL that returns this resource.
   572  	ReadLink *string `json:"readLink,omitempty"`
   573  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
   574  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
   575  	// PotentialAction - READ-ONLY
   576  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
   577  	// ImmediateAction - READ-ONLY
   578  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
   579  	// PreferredClickthroughURL - READ-ONLY
   580  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
   581  	// AdaptiveCard - READ-ONLY
   582  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
   583  	// ID - READ-ONLY; A String identifier.
   584  	ID *string `json:"id,omitempty"`
   585  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
   586  	Type TypeBasicResponseBase `json:"_type,omitempty"`
   587  }
   588  
   589  func unmarshalBasicAnswer(body []byte) (BasicAnswer, error) {
   590  	var m map[string]interface{}
   591  	err := json.Unmarshal(body, &m)
   592  	if err != nil {
   593  		return nil, err
   594  	}
   595  
   596  	switch m["_type"] {
   597  	case string(TypePlaces):
   598  		var p Places
   599  		err := json.Unmarshal(body, &p)
   600  		return p, err
   601  	case string(TypeSearchResultsAnswer):
   602  		var sra SearchResultsAnswer
   603  		err := json.Unmarshal(body, &sra)
   604  		return sra, err
   605  	default:
   606  		var a Answer
   607  		err := json.Unmarshal(body, &a)
   608  		return a, err
   609  	}
   610  }
   611  func unmarshalBasicAnswerArray(body []byte) ([]BasicAnswer, error) {
   612  	var rawMessages []*json.RawMessage
   613  	err := json.Unmarshal(body, &rawMessages)
   614  	if err != nil {
   615  		return nil, err
   616  	}
   617  
   618  	aArray := make([]BasicAnswer, len(rawMessages))
   619  
   620  	for index, rawMessage := range rawMessages {
   621  		a, err := unmarshalBasicAnswer(*rawMessage)
   622  		if err != nil {
   623  			return nil, err
   624  		}
   625  		aArray[index] = a
   626  	}
   627  	return aArray, nil
   628  }
   629  
   630  // MarshalJSON is the custom marshaler for Answer.
   631  func (a Answer) MarshalJSON() ([]byte, error) {
   632  	a.Type = TypeAnswer
   633  	objectMap := make(map[string]interface{})
   634  	if a.Type != "" {
   635  		objectMap["_type"] = a.Type
   636  	}
   637  	return json.Marshal(objectMap)
   638  }
   639  
   640  // AsThing is the BasicResponseBase implementation for Answer.
   641  func (a Answer) AsThing() (*Thing, bool) {
   642  	return nil, false
   643  }
   644  
   645  // AsBasicThing is the BasicResponseBase implementation for Answer.
   646  func (a Answer) AsBasicThing() (BasicThing, bool) {
   647  	return nil, false
   648  }
   649  
   650  // AsPlaces is the BasicResponseBase implementation for Answer.
   651  func (a Answer) AsPlaces() (*Places, bool) {
   652  	return nil, false
   653  }
   654  
   655  // AsSearchResultsAnswer is the BasicResponseBase implementation for Answer.
   656  func (a Answer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   657  	return nil, false
   658  }
   659  
   660  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Answer.
   661  func (a Answer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   662  	return nil, false
   663  }
   664  
   665  // AsSearchResponse is the BasicResponseBase implementation for Answer.
   666  func (a Answer) AsSearchResponse() (*SearchResponse, bool) {
   667  	return nil, false
   668  }
   669  
   670  // AsPostalAddress is the BasicResponseBase implementation for Answer.
   671  func (a Answer) AsPostalAddress() (*PostalAddress, bool) {
   672  	return nil, false
   673  }
   674  
   675  // AsPlace is the BasicResponseBase implementation for Answer.
   676  func (a Answer) AsPlace() (*Place, bool) {
   677  	return nil, false
   678  }
   679  
   680  // AsAction is the BasicResponseBase implementation for Answer.
   681  func (a Answer) AsAction() (*Action, bool) {
   682  	return nil, false
   683  }
   684  
   685  // AsBasicAction is the BasicResponseBase implementation for Answer.
   686  func (a Answer) AsBasicAction() (BasicAction, bool) {
   687  	return nil, false
   688  }
   689  
   690  // AsResponse is the BasicResponseBase implementation for Answer.
   691  func (a Answer) AsResponse() (*Response, bool) {
   692  	return nil, false
   693  }
   694  
   695  // AsBasicResponse is the BasicResponseBase implementation for Answer.
   696  func (a Answer) AsBasicResponse() (BasicResponse, bool) {
   697  	return &a, true
   698  }
   699  
   700  // AsIdentifiable is the BasicResponseBase implementation for Answer.
   701  func (a Answer) AsIdentifiable() (*Identifiable, bool) {
   702  	return nil, false
   703  }
   704  
   705  // AsBasicIdentifiable is the BasicResponseBase implementation for Answer.
   706  func (a Answer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
   707  	return &a, true
   708  }
   709  
   710  // AsAnswer is the BasicResponseBase implementation for Answer.
   711  func (a Answer) AsAnswer() (*Answer, bool) {
   712  	return &a, true
   713  }
   714  
   715  // AsBasicAnswer is the BasicResponseBase implementation for Answer.
   716  func (a Answer) AsBasicAnswer() (BasicAnswer, bool) {
   717  	return &a, true
   718  }
   719  
   720  // AsErrorResponse is the BasicResponseBase implementation for Answer.
   721  func (a Answer) AsErrorResponse() (*ErrorResponse, bool) {
   722  	return nil, false
   723  }
   724  
   725  // AsCreativeWork is the BasicResponseBase implementation for Answer.
   726  func (a Answer) AsCreativeWork() (*CreativeWork, bool) {
   727  	return nil, false
   728  }
   729  
   730  // AsBasicCreativeWork is the BasicResponseBase implementation for Answer.
   731  func (a Answer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
   732  	return nil, false
   733  }
   734  
   735  // AsIntangible is the BasicResponseBase implementation for Answer.
   736  func (a Answer) AsIntangible() (*Intangible, bool) {
   737  	return nil, false
   738  }
   739  
   740  // AsBasicIntangible is the BasicResponseBase implementation for Answer.
   741  func (a Answer) AsBasicIntangible() (BasicIntangible, bool) {
   742  	return nil, false
   743  }
   744  
   745  // AsSearchAction is the BasicResponseBase implementation for Answer.
   746  func (a Answer) AsSearchAction() (*SearchAction, bool) {
   747  	return nil, false
   748  }
   749  
   750  // AsStructuredValue is the BasicResponseBase implementation for Answer.
   751  func (a Answer) AsStructuredValue() (*StructuredValue, bool) {
   752  	return nil, false
   753  }
   754  
   755  // AsBasicStructuredValue is the BasicResponseBase implementation for Answer.
   756  func (a Answer) AsBasicStructuredValue() (BasicStructuredValue, bool) {
   757  	return nil, false
   758  }
   759  
   760  // AsResponseBase is the BasicResponseBase implementation for Answer.
   761  func (a Answer) AsResponseBase() (*ResponseBase, bool) {
   762  	return nil, false
   763  }
   764  
   765  // AsBasicResponseBase is the BasicResponseBase implementation for Answer.
   766  func (a Answer) AsBasicResponseBase() (BasicResponseBase, bool) {
   767  	return &a, true
   768  }
   769  
   770  // UnmarshalJSON is the custom unmarshaler for Answer struct.
   771  func (a *Answer) UnmarshalJSON(body []byte) error {
   772  	var m map[string]*json.RawMessage
   773  	err := json.Unmarshal(body, &m)
   774  	if err != nil {
   775  		return err
   776  	}
   777  	for k, v := range m {
   778  		switch k {
   779  		case "readLink":
   780  			if v != nil {
   781  				var readLink string
   782  				err = json.Unmarshal(*v, &readLink)
   783  				if err != nil {
   784  					return err
   785  				}
   786  				a.ReadLink = &readLink
   787  			}
   788  		case "webSearchUrl":
   789  			if v != nil {
   790  				var webSearchURL string
   791  				err = json.Unmarshal(*v, &webSearchURL)
   792  				if err != nil {
   793  					return err
   794  				}
   795  				a.WebSearchURL = &webSearchURL
   796  			}
   797  		case "potentialAction":
   798  			if v != nil {
   799  				potentialAction, err := unmarshalBasicActionArray(*v)
   800  				if err != nil {
   801  					return err
   802  				}
   803  				a.PotentialAction = &potentialAction
   804  			}
   805  		case "immediateAction":
   806  			if v != nil {
   807  				immediateAction, err := unmarshalBasicActionArray(*v)
   808  				if err != nil {
   809  					return err
   810  				}
   811  				a.ImmediateAction = &immediateAction
   812  			}
   813  		case "preferredClickthroughUrl":
   814  			if v != nil {
   815  				var preferredClickthroughURL string
   816  				err = json.Unmarshal(*v, &preferredClickthroughURL)
   817  				if err != nil {
   818  					return err
   819  				}
   820  				a.PreferredClickthroughURL = &preferredClickthroughURL
   821  			}
   822  		case "adaptiveCard":
   823  			if v != nil {
   824  				var adaptiveCard string
   825  				err = json.Unmarshal(*v, &adaptiveCard)
   826  				if err != nil {
   827  					return err
   828  				}
   829  				a.AdaptiveCard = &adaptiveCard
   830  			}
   831  		case "id":
   832  			if v != nil {
   833  				var ID string
   834  				err = json.Unmarshal(*v, &ID)
   835  				if err != nil {
   836  					return err
   837  				}
   838  				a.ID = &ID
   839  			}
   840  		case "_type":
   841  			if v != nil {
   842  				var typeVar TypeBasicResponseBase
   843  				err = json.Unmarshal(*v, &typeVar)
   844  				if err != nil {
   845  					return err
   846  				}
   847  				a.Type = typeVar
   848  			}
   849  		}
   850  	}
   851  
   852  	return nil
   853  }
   854  
   855  // BasicCreativeWork the most generic kind of creative work, including books, movies, photographs, software programs,
   856  // etc.
   857  type BasicCreativeWork interface {
   858  	AsAction() (*Action, bool)
   859  	AsBasicAction() (BasicAction, bool)
   860  	AsSearchAction() (*SearchAction, bool)
   861  	AsCreativeWork() (*CreativeWork, bool)
   862  }
   863  
   864  // CreativeWork the most generic kind of creative work, including books, movies, photographs, software
   865  // programs, etc.
   866  type CreativeWork struct {
   867  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
   868  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
   869  	// About - READ-ONLY; For internal use only.
   870  	About *[]BasicThing `json:"about,omitempty"`
   871  	// Mentions - READ-ONLY; For internal use only.
   872  	Mentions *[]BasicThing `json:"mentions,omitempty"`
   873  	// Provider - READ-ONLY; The source of the creative work.
   874  	Provider *[]BasicThing `json:"provider,omitempty"`
   875  	// Creator - READ-ONLY
   876  	Creator BasicThing `json:"creator,omitempty"`
   877  	// Text - READ-ONLY; Text content of this creative work
   878  	Text *string `json:"text,omitempty"`
   879  	// DiscussionURL - READ-ONLY
   880  	DiscussionURL *string `json:"discussionUrl,omitempty"`
   881  	// CommentCount - READ-ONLY
   882  	CommentCount *int32 `json:"commentCount,omitempty"`
   883  	// MainEntity - READ-ONLY
   884  	MainEntity BasicThing `json:"mainEntity,omitempty"`
   885  	// HeadLine - READ-ONLY
   886  	HeadLine *string `json:"headLine,omitempty"`
   887  	// CopyrightHolder - READ-ONLY
   888  	CopyrightHolder BasicThing `json:"copyrightHolder,omitempty"`
   889  	// CopyrightYear - READ-ONLY
   890  	CopyrightYear *int32 `json:"copyrightYear,omitempty"`
   891  	// Disclaimer - READ-ONLY
   892  	Disclaimer *string `json:"disclaimer,omitempty"`
   893  	// IsAccessibleForFree - READ-ONLY
   894  	IsAccessibleForFree *bool `json:"isAccessibleForFree,omitempty"`
   895  	// Genre - READ-ONLY
   896  	Genre *[]string `json:"genre,omitempty"`
   897  	// IsFamilyFriendly - READ-ONLY
   898  	IsFamilyFriendly *bool `json:"isFamilyFriendly,omitempty"`
   899  	// Name - READ-ONLY; The name of the thing represented by this object.
   900  	Name *string `json:"name,omitempty"`
   901  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
   902  	URL *string `json:"url,omitempty"`
   903  	// EntityPresentationInfo - READ-ONLY; Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields.
   904  	EntityPresentationInfo BasicEntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
   905  	// ReadLink - READ-ONLY; The URL that returns this resource.
   906  	ReadLink *string `json:"readLink,omitempty"`
   907  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
   908  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
   909  	// PotentialAction - READ-ONLY
   910  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
   911  	// ImmediateAction - READ-ONLY
   912  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
   913  	// PreferredClickthroughURL - READ-ONLY
   914  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
   915  	// AdaptiveCard - READ-ONLY
   916  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
   917  	// ID - READ-ONLY; A String identifier.
   918  	ID *string `json:"id,omitempty"`
   919  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
   920  	Type TypeBasicResponseBase `json:"_type,omitempty"`
   921  }
   922  
   923  func unmarshalBasicCreativeWork(body []byte) (BasicCreativeWork, error) {
   924  	var m map[string]interface{}
   925  	err := json.Unmarshal(body, &m)
   926  	if err != nil {
   927  		return nil, err
   928  	}
   929  
   930  	switch m["_type"] {
   931  	case string(TypeAction):
   932  		var a Action
   933  		err := json.Unmarshal(body, &a)
   934  		return a, err
   935  	case string(TypeSearchAction):
   936  		var sa SearchAction
   937  		err := json.Unmarshal(body, &sa)
   938  		return sa, err
   939  	default:
   940  		var cw CreativeWork
   941  		err := json.Unmarshal(body, &cw)
   942  		return cw, err
   943  	}
   944  }
   945  func unmarshalBasicCreativeWorkArray(body []byte) ([]BasicCreativeWork, error) {
   946  	var rawMessages []*json.RawMessage
   947  	err := json.Unmarshal(body, &rawMessages)
   948  	if err != nil {
   949  		return nil, err
   950  	}
   951  
   952  	cwArray := make([]BasicCreativeWork, len(rawMessages))
   953  
   954  	for index, rawMessage := range rawMessages {
   955  		cw, err := unmarshalBasicCreativeWork(*rawMessage)
   956  		if err != nil {
   957  			return nil, err
   958  		}
   959  		cwArray[index] = cw
   960  	}
   961  	return cwArray, nil
   962  }
   963  
   964  // MarshalJSON is the custom marshaler for CreativeWork.
   965  func (cw CreativeWork) MarshalJSON() ([]byte, error) {
   966  	cw.Type = TypeCreativeWork
   967  	objectMap := make(map[string]interface{})
   968  	if cw.Type != "" {
   969  		objectMap["_type"] = cw.Type
   970  	}
   971  	return json.Marshal(objectMap)
   972  }
   973  
   974  // AsThing is the BasicResponseBase implementation for CreativeWork.
   975  func (cw CreativeWork) AsThing() (*Thing, bool) {
   976  	return nil, false
   977  }
   978  
   979  // AsBasicThing is the BasicResponseBase implementation for CreativeWork.
   980  func (cw CreativeWork) AsBasicThing() (BasicThing, bool) {
   981  	return &cw, true
   982  }
   983  
   984  // AsPlaces is the BasicResponseBase implementation for CreativeWork.
   985  func (cw CreativeWork) AsPlaces() (*Places, bool) {
   986  	return nil, false
   987  }
   988  
   989  // AsSearchResultsAnswer is the BasicResponseBase implementation for CreativeWork.
   990  func (cw CreativeWork) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   991  	return nil, false
   992  }
   993  
   994  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for CreativeWork.
   995  func (cw CreativeWork) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   996  	return nil, false
   997  }
   998  
   999  // AsSearchResponse is the BasicResponseBase implementation for CreativeWork.
  1000  func (cw CreativeWork) AsSearchResponse() (*SearchResponse, bool) {
  1001  	return nil, false
  1002  }
  1003  
  1004  // AsPostalAddress is the BasicResponseBase implementation for CreativeWork.
  1005  func (cw CreativeWork) AsPostalAddress() (*PostalAddress, bool) {
  1006  	return nil, false
  1007  }
  1008  
  1009  // AsPlace is the BasicResponseBase implementation for CreativeWork.
  1010  func (cw CreativeWork) AsPlace() (*Place, bool) {
  1011  	return nil, false
  1012  }
  1013  
  1014  // AsAction is the BasicResponseBase implementation for CreativeWork.
  1015  func (cw CreativeWork) AsAction() (*Action, bool) {
  1016  	return nil, false
  1017  }
  1018  
  1019  // AsBasicAction is the BasicResponseBase implementation for CreativeWork.
  1020  func (cw CreativeWork) AsBasicAction() (BasicAction, bool) {
  1021  	return nil, false
  1022  }
  1023  
  1024  // AsResponse is the BasicResponseBase implementation for CreativeWork.
  1025  func (cw CreativeWork) AsResponse() (*Response, bool) {
  1026  	return nil, false
  1027  }
  1028  
  1029  // AsBasicResponse is the BasicResponseBase implementation for CreativeWork.
  1030  func (cw CreativeWork) AsBasicResponse() (BasicResponse, bool) {
  1031  	return &cw, true
  1032  }
  1033  
  1034  // AsIdentifiable is the BasicResponseBase implementation for CreativeWork.
  1035  func (cw CreativeWork) AsIdentifiable() (*Identifiable, bool) {
  1036  	return nil, false
  1037  }
  1038  
  1039  // AsBasicIdentifiable is the BasicResponseBase implementation for CreativeWork.
  1040  func (cw CreativeWork) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1041  	return &cw, true
  1042  }
  1043  
  1044  // AsAnswer is the BasicResponseBase implementation for CreativeWork.
  1045  func (cw CreativeWork) AsAnswer() (*Answer, bool) {
  1046  	return nil, false
  1047  }
  1048  
  1049  // AsBasicAnswer is the BasicResponseBase implementation for CreativeWork.
  1050  func (cw CreativeWork) AsBasicAnswer() (BasicAnswer, bool) {
  1051  	return nil, false
  1052  }
  1053  
  1054  // AsErrorResponse is the BasicResponseBase implementation for CreativeWork.
  1055  func (cw CreativeWork) AsErrorResponse() (*ErrorResponse, bool) {
  1056  	return nil, false
  1057  }
  1058  
  1059  // AsCreativeWork is the BasicResponseBase implementation for CreativeWork.
  1060  func (cw CreativeWork) AsCreativeWork() (*CreativeWork, bool) {
  1061  	return &cw, true
  1062  }
  1063  
  1064  // AsBasicCreativeWork is the BasicResponseBase implementation for CreativeWork.
  1065  func (cw CreativeWork) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1066  	return &cw, true
  1067  }
  1068  
  1069  // AsIntangible is the BasicResponseBase implementation for CreativeWork.
  1070  func (cw CreativeWork) AsIntangible() (*Intangible, bool) {
  1071  	return nil, false
  1072  }
  1073  
  1074  // AsBasicIntangible is the BasicResponseBase implementation for CreativeWork.
  1075  func (cw CreativeWork) AsBasicIntangible() (BasicIntangible, bool) {
  1076  	return nil, false
  1077  }
  1078  
  1079  // AsSearchAction is the BasicResponseBase implementation for CreativeWork.
  1080  func (cw CreativeWork) AsSearchAction() (*SearchAction, bool) {
  1081  	return nil, false
  1082  }
  1083  
  1084  // AsStructuredValue is the BasicResponseBase implementation for CreativeWork.
  1085  func (cw CreativeWork) AsStructuredValue() (*StructuredValue, bool) {
  1086  	return nil, false
  1087  }
  1088  
  1089  // AsBasicStructuredValue is the BasicResponseBase implementation for CreativeWork.
  1090  func (cw CreativeWork) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  1091  	return nil, false
  1092  }
  1093  
  1094  // AsResponseBase is the BasicResponseBase implementation for CreativeWork.
  1095  func (cw CreativeWork) AsResponseBase() (*ResponseBase, bool) {
  1096  	return nil, false
  1097  }
  1098  
  1099  // AsBasicResponseBase is the BasicResponseBase implementation for CreativeWork.
  1100  func (cw CreativeWork) AsBasicResponseBase() (BasicResponseBase, bool) {
  1101  	return &cw, true
  1102  }
  1103  
  1104  // UnmarshalJSON is the custom unmarshaler for CreativeWork struct.
  1105  func (cw *CreativeWork) UnmarshalJSON(body []byte) error {
  1106  	var m map[string]*json.RawMessage
  1107  	err := json.Unmarshal(body, &m)
  1108  	if err != nil {
  1109  		return err
  1110  	}
  1111  	for k, v := range m {
  1112  		switch k {
  1113  		case "thumbnailUrl":
  1114  			if v != nil {
  1115  				var thumbnailURL string
  1116  				err = json.Unmarshal(*v, &thumbnailURL)
  1117  				if err != nil {
  1118  					return err
  1119  				}
  1120  				cw.ThumbnailURL = &thumbnailURL
  1121  			}
  1122  		case "about":
  1123  			if v != nil {
  1124  				about, err := unmarshalBasicThingArray(*v)
  1125  				if err != nil {
  1126  					return err
  1127  				}
  1128  				cw.About = &about
  1129  			}
  1130  		case "mentions":
  1131  			if v != nil {
  1132  				mentions, err := unmarshalBasicThingArray(*v)
  1133  				if err != nil {
  1134  					return err
  1135  				}
  1136  				cw.Mentions = &mentions
  1137  			}
  1138  		case "provider":
  1139  			if v != nil {
  1140  				provider, err := unmarshalBasicThingArray(*v)
  1141  				if err != nil {
  1142  					return err
  1143  				}
  1144  				cw.Provider = &provider
  1145  			}
  1146  		case "creator":
  1147  			if v != nil {
  1148  				creator, err := unmarshalBasicThing(*v)
  1149  				if err != nil {
  1150  					return err
  1151  				}
  1152  				cw.Creator = creator
  1153  			}
  1154  		case "text":
  1155  			if v != nil {
  1156  				var textVar string
  1157  				err = json.Unmarshal(*v, &textVar)
  1158  				if err != nil {
  1159  					return err
  1160  				}
  1161  				cw.Text = &textVar
  1162  			}
  1163  		case "discussionUrl":
  1164  			if v != nil {
  1165  				var discussionURL string
  1166  				err = json.Unmarshal(*v, &discussionURL)
  1167  				if err != nil {
  1168  					return err
  1169  				}
  1170  				cw.DiscussionURL = &discussionURL
  1171  			}
  1172  		case "commentCount":
  1173  			if v != nil {
  1174  				var commentCount int32
  1175  				err = json.Unmarshal(*v, &commentCount)
  1176  				if err != nil {
  1177  					return err
  1178  				}
  1179  				cw.CommentCount = &commentCount
  1180  			}
  1181  		case "mainEntity":
  1182  			if v != nil {
  1183  				mainEntity, err := unmarshalBasicThing(*v)
  1184  				if err != nil {
  1185  					return err
  1186  				}
  1187  				cw.MainEntity = mainEntity
  1188  			}
  1189  		case "headLine":
  1190  			if v != nil {
  1191  				var headLine string
  1192  				err = json.Unmarshal(*v, &headLine)
  1193  				if err != nil {
  1194  					return err
  1195  				}
  1196  				cw.HeadLine = &headLine
  1197  			}
  1198  		case "copyrightHolder":
  1199  			if v != nil {
  1200  				copyrightHolder, err := unmarshalBasicThing(*v)
  1201  				if err != nil {
  1202  					return err
  1203  				}
  1204  				cw.CopyrightHolder = copyrightHolder
  1205  			}
  1206  		case "copyrightYear":
  1207  			if v != nil {
  1208  				var copyrightYear int32
  1209  				err = json.Unmarshal(*v, &copyrightYear)
  1210  				if err != nil {
  1211  					return err
  1212  				}
  1213  				cw.CopyrightYear = &copyrightYear
  1214  			}
  1215  		case "disclaimer":
  1216  			if v != nil {
  1217  				var disclaimer string
  1218  				err = json.Unmarshal(*v, &disclaimer)
  1219  				if err != nil {
  1220  					return err
  1221  				}
  1222  				cw.Disclaimer = &disclaimer
  1223  			}
  1224  		case "isAccessibleForFree":
  1225  			if v != nil {
  1226  				var isAccessibleForFree bool
  1227  				err = json.Unmarshal(*v, &isAccessibleForFree)
  1228  				if err != nil {
  1229  					return err
  1230  				}
  1231  				cw.IsAccessibleForFree = &isAccessibleForFree
  1232  			}
  1233  		case "genre":
  1234  			if v != nil {
  1235  				var genre []string
  1236  				err = json.Unmarshal(*v, &genre)
  1237  				if err != nil {
  1238  					return err
  1239  				}
  1240  				cw.Genre = &genre
  1241  			}
  1242  		case "isFamilyFriendly":
  1243  			if v != nil {
  1244  				var isFamilyFriendly bool
  1245  				err = json.Unmarshal(*v, &isFamilyFriendly)
  1246  				if err != nil {
  1247  					return err
  1248  				}
  1249  				cw.IsFamilyFriendly = &isFamilyFriendly
  1250  			}
  1251  		case "name":
  1252  			if v != nil {
  1253  				var name string
  1254  				err = json.Unmarshal(*v, &name)
  1255  				if err != nil {
  1256  					return err
  1257  				}
  1258  				cw.Name = &name
  1259  			}
  1260  		case "url":
  1261  			if v != nil {
  1262  				var URL string
  1263  				err = json.Unmarshal(*v, &URL)
  1264  				if err != nil {
  1265  					return err
  1266  				}
  1267  				cw.URL = &URL
  1268  			}
  1269  		case "entityPresentationInfo":
  1270  			if v != nil {
  1271  				entityPresentationInfo, err := unmarshalBasicEntitiesEntityPresentationInfo(*v)
  1272  				if err != nil {
  1273  					return err
  1274  				}
  1275  				cw.EntityPresentationInfo = entityPresentationInfo
  1276  			}
  1277  		case "readLink":
  1278  			if v != nil {
  1279  				var readLink string
  1280  				err = json.Unmarshal(*v, &readLink)
  1281  				if err != nil {
  1282  					return err
  1283  				}
  1284  				cw.ReadLink = &readLink
  1285  			}
  1286  		case "webSearchUrl":
  1287  			if v != nil {
  1288  				var webSearchURL string
  1289  				err = json.Unmarshal(*v, &webSearchURL)
  1290  				if err != nil {
  1291  					return err
  1292  				}
  1293  				cw.WebSearchURL = &webSearchURL
  1294  			}
  1295  		case "potentialAction":
  1296  			if v != nil {
  1297  				potentialAction, err := unmarshalBasicActionArray(*v)
  1298  				if err != nil {
  1299  					return err
  1300  				}
  1301  				cw.PotentialAction = &potentialAction
  1302  			}
  1303  		case "immediateAction":
  1304  			if v != nil {
  1305  				immediateAction, err := unmarshalBasicActionArray(*v)
  1306  				if err != nil {
  1307  					return err
  1308  				}
  1309  				cw.ImmediateAction = &immediateAction
  1310  			}
  1311  		case "preferredClickthroughUrl":
  1312  			if v != nil {
  1313  				var preferredClickthroughURL string
  1314  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  1315  				if err != nil {
  1316  					return err
  1317  				}
  1318  				cw.PreferredClickthroughURL = &preferredClickthroughURL
  1319  			}
  1320  		case "adaptiveCard":
  1321  			if v != nil {
  1322  				var adaptiveCard string
  1323  				err = json.Unmarshal(*v, &adaptiveCard)
  1324  				if err != nil {
  1325  					return err
  1326  				}
  1327  				cw.AdaptiveCard = &adaptiveCard
  1328  			}
  1329  		case "id":
  1330  			if v != nil {
  1331  				var ID string
  1332  				err = json.Unmarshal(*v, &ID)
  1333  				if err != nil {
  1334  					return err
  1335  				}
  1336  				cw.ID = &ID
  1337  			}
  1338  		case "_type":
  1339  			if v != nil {
  1340  				var typeVar TypeBasicResponseBase
  1341  				err = json.Unmarshal(*v, &typeVar)
  1342  				if err != nil {
  1343  					return err
  1344  				}
  1345  				cw.Type = typeVar
  1346  			}
  1347  		}
  1348  	}
  1349  
  1350  	return nil
  1351  }
  1352  
  1353  // BasicEntitiesEntityPresentationInfo defines additional information about an entity such as type hints.
  1354  type BasicEntitiesEntityPresentationInfo interface {
  1355  	AsEntitiesEntityPresentationInfo() (*EntitiesEntityPresentationInfo, bool)
  1356  }
  1357  
  1358  // EntitiesEntityPresentationInfo defines additional information about an entity such as type hints.
  1359  type EntitiesEntityPresentationInfo struct {
  1360  	// EntityScenario - The supported scenario. Possible values include: 'DominantEntity', 'DisambiguationItem', 'ListItem'
  1361  	EntityScenario EntityScenario `json:"entityScenario,omitempty"`
  1362  	// EntityTypeHints - READ-ONLY; A list of hints that indicate the entity's type. The list could contain a single hint such as Movie or a list of hints such as Place, LocalBusiness, Restaurant. Each successive hint in the array narrows the entity's type.
  1363  	EntityTypeHints *[]EntityType `json:"entityTypeHints,omitempty"`
  1364  	// EntityTypeDisplayHint - READ-ONLY; A display version of the entity hint. For example, if entityTypeHints is Artist, this field may be set to American Singer.
  1365  	EntityTypeDisplayHint *string `json:"entityTypeDisplayHint,omitempty"`
  1366  	// Query - READ-ONLY
  1367  	Query *string `json:"query,omitempty"`
  1368  	// EntitySubTypeHints - READ-ONLY
  1369  	EntitySubTypeHints *[]string `json:"entitySubTypeHints,omitempty"`
  1370  	// Type - Possible values include: 'TypeEntitiesEntityPresentationInfo'
  1371  	Type TypeBasicEntitiesEntityPresentationInfo `json:"_type,omitempty"`
  1372  }
  1373  
  1374  func unmarshalBasicEntitiesEntityPresentationInfo(body []byte) (BasicEntitiesEntityPresentationInfo, error) {
  1375  	var m map[string]interface{}
  1376  	err := json.Unmarshal(body, &m)
  1377  	if err != nil {
  1378  		return nil, err
  1379  	}
  1380  
  1381  	switch m["_type"] {
  1382  	default:
  1383  		var eepi EntitiesEntityPresentationInfo
  1384  		err := json.Unmarshal(body, &eepi)
  1385  		return eepi, err
  1386  	}
  1387  }
  1388  func unmarshalBasicEntitiesEntityPresentationInfoArray(body []byte) ([]BasicEntitiesEntityPresentationInfo, error) {
  1389  	var rawMessages []*json.RawMessage
  1390  	err := json.Unmarshal(body, &rawMessages)
  1391  	if err != nil {
  1392  		return nil, err
  1393  	}
  1394  
  1395  	eepiArray := make([]BasicEntitiesEntityPresentationInfo, len(rawMessages))
  1396  
  1397  	for index, rawMessage := range rawMessages {
  1398  		eepi, err := unmarshalBasicEntitiesEntityPresentationInfo(*rawMessage)
  1399  		if err != nil {
  1400  			return nil, err
  1401  		}
  1402  		eepiArray[index] = eepi
  1403  	}
  1404  	return eepiArray, nil
  1405  }
  1406  
  1407  // MarshalJSON is the custom marshaler for EntitiesEntityPresentationInfo.
  1408  func (eepi EntitiesEntityPresentationInfo) MarshalJSON() ([]byte, error) {
  1409  	eepi.Type = TypeEntitiesEntityPresentationInfo
  1410  	objectMap := make(map[string]interface{})
  1411  	if eepi.EntityScenario != "" {
  1412  		objectMap["entityScenario"] = eepi.EntityScenario
  1413  	}
  1414  	if eepi.Type != "" {
  1415  		objectMap["_type"] = eepi.Type
  1416  	}
  1417  	return json.Marshal(objectMap)
  1418  }
  1419  
  1420  // AsEntitiesEntityPresentationInfo is the BasicEntitiesEntityPresentationInfo implementation for EntitiesEntityPresentationInfo.
  1421  func (eepi EntitiesEntityPresentationInfo) AsEntitiesEntityPresentationInfo() (*EntitiesEntityPresentationInfo, bool) {
  1422  	return &eepi, true
  1423  }
  1424  
  1425  // AsBasicEntitiesEntityPresentationInfo is the BasicEntitiesEntityPresentationInfo implementation for EntitiesEntityPresentationInfo.
  1426  func (eepi EntitiesEntityPresentationInfo) AsBasicEntitiesEntityPresentationInfo() (BasicEntitiesEntityPresentationInfo, bool) {
  1427  	return &eepi, true
  1428  }
  1429  
  1430  // BasicError defines the error that occurred.
  1431  type BasicError interface {
  1432  	AsError() (*Error, bool)
  1433  }
  1434  
  1435  // Error defines the error that occurred.
  1436  type Error struct {
  1437  	// Code - The error code that identifies the category of error. Possible values include: 'None', 'ServerError', 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'
  1438  	Code ErrorCode `json:"code,omitempty"`
  1439  	// 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'
  1440  	SubCode ErrorSubCode `json:"subCode,omitempty"`
  1441  	// Message - A description of the error.
  1442  	Message *string `json:"message,omitempty"`
  1443  	// MoreDetails - READ-ONLY; A description that provides additional information about the error.
  1444  	MoreDetails *string `json:"moreDetails,omitempty"`
  1445  	// Parameter - READ-ONLY; The parameter in the request that caused the error.
  1446  	Parameter *string `json:"parameter,omitempty"`
  1447  	// Value - READ-ONLY; The parameter's value in the request that was not valid.
  1448  	Value *string `json:"value,omitempty"`
  1449  	// Type - Possible values include: 'TypeError'
  1450  	Type TypeBasicError `json:"_type,omitempty"`
  1451  }
  1452  
  1453  func unmarshalBasicError(body []byte) (BasicError, error) {
  1454  	var m map[string]interface{}
  1455  	err := json.Unmarshal(body, &m)
  1456  	if err != nil {
  1457  		return nil, err
  1458  	}
  1459  
  1460  	switch m["_type"] {
  1461  	default:
  1462  		var e Error
  1463  		err := json.Unmarshal(body, &e)
  1464  		return e, err
  1465  	}
  1466  }
  1467  func unmarshalBasicErrorArray(body []byte) ([]BasicError, error) {
  1468  	var rawMessages []*json.RawMessage
  1469  	err := json.Unmarshal(body, &rawMessages)
  1470  	if err != nil {
  1471  		return nil, err
  1472  	}
  1473  
  1474  	eArray := make([]BasicError, len(rawMessages))
  1475  
  1476  	for index, rawMessage := range rawMessages {
  1477  		e, err := unmarshalBasicError(*rawMessage)
  1478  		if err != nil {
  1479  			return nil, err
  1480  		}
  1481  		eArray[index] = e
  1482  	}
  1483  	return eArray, nil
  1484  }
  1485  
  1486  // MarshalJSON is the custom marshaler for Error.
  1487  func (e Error) MarshalJSON() ([]byte, error) {
  1488  	e.Type = TypeError
  1489  	objectMap := make(map[string]interface{})
  1490  	if e.Code != "" {
  1491  		objectMap["code"] = e.Code
  1492  	}
  1493  	if e.Message != nil {
  1494  		objectMap["message"] = e.Message
  1495  	}
  1496  	if e.Type != "" {
  1497  		objectMap["_type"] = e.Type
  1498  	}
  1499  	return json.Marshal(objectMap)
  1500  }
  1501  
  1502  // AsError is the BasicError implementation for Error.
  1503  func (e Error) AsError() (*Error, bool) {
  1504  	return &e, true
  1505  }
  1506  
  1507  // AsBasicError is the BasicError implementation for Error.
  1508  func (e Error) AsBasicError() (BasicError, bool) {
  1509  	return &e, true
  1510  }
  1511  
  1512  // ErrorResponse the top-level response that represents a failed request.
  1513  type ErrorResponse struct {
  1514  	// Errors - A list of errors that describe the reasons why the request failed.
  1515  	Errors *[]BasicError `json:"errors,omitempty"`
  1516  	// ReadLink - READ-ONLY; The URL that returns this resource.
  1517  	ReadLink *string `json:"readLink,omitempty"`
  1518  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  1519  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  1520  	// PotentialAction - READ-ONLY
  1521  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  1522  	// ImmediateAction - READ-ONLY
  1523  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  1524  	// PreferredClickthroughURL - READ-ONLY
  1525  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  1526  	// AdaptiveCard - READ-ONLY
  1527  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  1528  	// ID - READ-ONLY; A String identifier.
  1529  	ID *string `json:"id,omitempty"`
  1530  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  1531  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  1532  }
  1533  
  1534  // MarshalJSON is the custom marshaler for ErrorResponse.
  1535  func (er ErrorResponse) MarshalJSON() ([]byte, error) {
  1536  	er.Type = TypeErrorResponse
  1537  	objectMap := make(map[string]interface{})
  1538  	if er.Errors != nil {
  1539  		objectMap["errors"] = er.Errors
  1540  	}
  1541  	if er.Type != "" {
  1542  		objectMap["_type"] = er.Type
  1543  	}
  1544  	return json.Marshal(objectMap)
  1545  }
  1546  
  1547  // AsThing is the BasicResponseBase implementation for ErrorResponse.
  1548  func (er ErrorResponse) AsThing() (*Thing, bool) {
  1549  	return nil, false
  1550  }
  1551  
  1552  // AsBasicThing is the BasicResponseBase implementation for ErrorResponse.
  1553  func (er ErrorResponse) AsBasicThing() (BasicThing, bool) {
  1554  	return nil, false
  1555  }
  1556  
  1557  // AsPlaces is the BasicResponseBase implementation for ErrorResponse.
  1558  func (er ErrorResponse) AsPlaces() (*Places, bool) {
  1559  	return nil, false
  1560  }
  1561  
  1562  // AsSearchResultsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1563  func (er ErrorResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1564  	return nil, false
  1565  }
  1566  
  1567  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1568  func (er ErrorResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  1569  	return nil, false
  1570  }
  1571  
  1572  // AsSearchResponse is the BasicResponseBase implementation for ErrorResponse.
  1573  func (er ErrorResponse) AsSearchResponse() (*SearchResponse, bool) {
  1574  	return nil, false
  1575  }
  1576  
  1577  // AsPostalAddress is the BasicResponseBase implementation for ErrorResponse.
  1578  func (er ErrorResponse) AsPostalAddress() (*PostalAddress, bool) {
  1579  	return nil, false
  1580  }
  1581  
  1582  // AsPlace is the BasicResponseBase implementation for ErrorResponse.
  1583  func (er ErrorResponse) AsPlace() (*Place, bool) {
  1584  	return nil, false
  1585  }
  1586  
  1587  // AsAction is the BasicResponseBase implementation for ErrorResponse.
  1588  func (er ErrorResponse) AsAction() (*Action, bool) {
  1589  	return nil, false
  1590  }
  1591  
  1592  // AsBasicAction is the BasicResponseBase implementation for ErrorResponse.
  1593  func (er ErrorResponse) AsBasicAction() (BasicAction, bool) {
  1594  	return nil, false
  1595  }
  1596  
  1597  // AsResponse is the BasicResponseBase implementation for ErrorResponse.
  1598  func (er ErrorResponse) AsResponse() (*Response, bool) {
  1599  	return nil, false
  1600  }
  1601  
  1602  // AsBasicResponse is the BasicResponseBase implementation for ErrorResponse.
  1603  func (er ErrorResponse) AsBasicResponse() (BasicResponse, bool) {
  1604  	return &er, true
  1605  }
  1606  
  1607  // AsIdentifiable is the BasicResponseBase implementation for ErrorResponse.
  1608  func (er ErrorResponse) AsIdentifiable() (*Identifiable, bool) {
  1609  	return nil, false
  1610  }
  1611  
  1612  // AsBasicIdentifiable is the BasicResponseBase implementation for ErrorResponse.
  1613  func (er ErrorResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1614  	return &er, true
  1615  }
  1616  
  1617  // AsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1618  func (er ErrorResponse) AsAnswer() (*Answer, bool) {
  1619  	return nil, false
  1620  }
  1621  
  1622  // AsBasicAnswer is the BasicResponseBase implementation for ErrorResponse.
  1623  func (er ErrorResponse) AsBasicAnswer() (BasicAnswer, bool) {
  1624  	return nil, false
  1625  }
  1626  
  1627  // AsErrorResponse is the BasicResponseBase implementation for ErrorResponse.
  1628  func (er ErrorResponse) AsErrorResponse() (*ErrorResponse, bool) {
  1629  	return &er, true
  1630  }
  1631  
  1632  // AsCreativeWork is the BasicResponseBase implementation for ErrorResponse.
  1633  func (er ErrorResponse) AsCreativeWork() (*CreativeWork, bool) {
  1634  	return nil, false
  1635  }
  1636  
  1637  // AsBasicCreativeWork is the BasicResponseBase implementation for ErrorResponse.
  1638  func (er ErrorResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1639  	return nil, false
  1640  }
  1641  
  1642  // AsIntangible is the BasicResponseBase implementation for ErrorResponse.
  1643  func (er ErrorResponse) AsIntangible() (*Intangible, bool) {
  1644  	return nil, false
  1645  }
  1646  
  1647  // AsBasicIntangible is the BasicResponseBase implementation for ErrorResponse.
  1648  func (er ErrorResponse) AsBasicIntangible() (BasicIntangible, bool) {
  1649  	return nil, false
  1650  }
  1651  
  1652  // AsSearchAction is the BasicResponseBase implementation for ErrorResponse.
  1653  func (er ErrorResponse) AsSearchAction() (*SearchAction, bool) {
  1654  	return nil, false
  1655  }
  1656  
  1657  // AsStructuredValue is the BasicResponseBase implementation for ErrorResponse.
  1658  func (er ErrorResponse) AsStructuredValue() (*StructuredValue, bool) {
  1659  	return nil, false
  1660  }
  1661  
  1662  // AsBasicStructuredValue is the BasicResponseBase implementation for ErrorResponse.
  1663  func (er ErrorResponse) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  1664  	return nil, false
  1665  }
  1666  
  1667  // AsResponseBase is the BasicResponseBase implementation for ErrorResponse.
  1668  func (er ErrorResponse) AsResponseBase() (*ResponseBase, bool) {
  1669  	return nil, false
  1670  }
  1671  
  1672  // AsBasicResponseBase is the BasicResponseBase implementation for ErrorResponse.
  1673  func (er ErrorResponse) AsBasicResponseBase() (BasicResponseBase, bool) {
  1674  	return &er, true
  1675  }
  1676  
  1677  // UnmarshalJSON is the custom unmarshaler for ErrorResponse struct.
  1678  func (er *ErrorResponse) UnmarshalJSON(body []byte) error {
  1679  	var m map[string]*json.RawMessage
  1680  	err := json.Unmarshal(body, &m)
  1681  	if err != nil {
  1682  		return err
  1683  	}
  1684  	for k, v := range m {
  1685  		switch k {
  1686  		case "errors":
  1687  			if v != nil {
  1688  				errorsVar, err := unmarshalBasicErrorArray(*v)
  1689  				if err != nil {
  1690  					return err
  1691  				}
  1692  				er.Errors = &errorsVar
  1693  			}
  1694  		case "readLink":
  1695  			if v != nil {
  1696  				var readLink string
  1697  				err = json.Unmarshal(*v, &readLink)
  1698  				if err != nil {
  1699  					return err
  1700  				}
  1701  				er.ReadLink = &readLink
  1702  			}
  1703  		case "webSearchUrl":
  1704  			if v != nil {
  1705  				var webSearchURL string
  1706  				err = json.Unmarshal(*v, &webSearchURL)
  1707  				if err != nil {
  1708  					return err
  1709  				}
  1710  				er.WebSearchURL = &webSearchURL
  1711  			}
  1712  		case "potentialAction":
  1713  			if v != nil {
  1714  				potentialAction, err := unmarshalBasicActionArray(*v)
  1715  				if err != nil {
  1716  					return err
  1717  				}
  1718  				er.PotentialAction = &potentialAction
  1719  			}
  1720  		case "immediateAction":
  1721  			if v != nil {
  1722  				immediateAction, err := unmarshalBasicActionArray(*v)
  1723  				if err != nil {
  1724  					return err
  1725  				}
  1726  				er.ImmediateAction = &immediateAction
  1727  			}
  1728  		case "preferredClickthroughUrl":
  1729  			if v != nil {
  1730  				var preferredClickthroughURL string
  1731  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  1732  				if err != nil {
  1733  					return err
  1734  				}
  1735  				er.PreferredClickthroughURL = &preferredClickthroughURL
  1736  			}
  1737  		case "adaptiveCard":
  1738  			if v != nil {
  1739  				var adaptiveCard string
  1740  				err = json.Unmarshal(*v, &adaptiveCard)
  1741  				if err != nil {
  1742  					return err
  1743  				}
  1744  				er.AdaptiveCard = &adaptiveCard
  1745  			}
  1746  		case "id":
  1747  			if v != nil {
  1748  				var ID string
  1749  				err = json.Unmarshal(*v, &ID)
  1750  				if err != nil {
  1751  					return err
  1752  				}
  1753  				er.ID = &ID
  1754  			}
  1755  		case "_type":
  1756  			if v != nil {
  1757  				var typeVar TypeBasicResponseBase
  1758  				err = json.Unmarshal(*v, &typeVar)
  1759  				if err != nil {
  1760  					return err
  1761  				}
  1762  				er.Type = typeVar
  1763  			}
  1764  		}
  1765  	}
  1766  
  1767  	return nil
  1768  }
  1769  
  1770  // BasicGeoCoordinates ...
  1771  type BasicGeoCoordinates interface {
  1772  	AsGeoCoordinates() (*GeoCoordinates, bool)
  1773  }
  1774  
  1775  // GeoCoordinates ...
  1776  type GeoCoordinates struct {
  1777  	Latitude  *float64 `json:"latitude,omitempty"`
  1778  	Longitude *float64 `json:"longitude,omitempty"`
  1779  	// Elevation - READ-ONLY
  1780  	Elevation *float64 `json:"elevation,omitempty"`
  1781  	// Type - Possible values include: 'TypeGeoCoordinates'
  1782  	Type TypeBasicGeoCoordinates `json:"_type,omitempty"`
  1783  }
  1784  
  1785  func unmarshalBasicGeoCoordinates(body []byte) (BasicGeoCoordinates, 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  	default:
  1794  		var gc GeoCoordinates
  1795  		err := json.Unmarshal(body, &gc)
  1796  		return gc, err
  1797  	}
  1798  }
  1799  func unmarshalBasicGeoCoordinatesArray(body []byte) ([]BasicGeoCoordinates, error) {
  1800  	var rawMessages []*json.RawMessage
  1801  	err := json.Unmarshal(body, &rawMessages)
  1802  	if err != nil {
  1803  		return nil, err
  1804  	}
  1805  
  1806  	gcArray := make([]BasicGeoCoordinates, len(rawMessages))
  1807  
  1808  	for index, rawMessage := range rawMessages {
  1809  		gc, err := unmarshalBasicGeoCoordinates(*rawMessage)
  1810  		if err != nil {
  1811  			return nil, err
  1812  		}
  1813  		gcArray[index] = gc
  1814  	}
  1815  	return gcArray, nil
  1816  }
  1817  
  1818  // MarshalJSON is the custom marshaler for GeoCoordinates.
  1819  func (gc GeoCoordinates) MarshalJSON() ([]byte, error) {
  1820  	gc.Type = TypeGeoCoordinates
  1821  	objectMap := make(map[string]interface{})
  1822  	if gc.Latitude != nil {
  1823  		objectMap["latitude"] = gc.Latitude
  1824  	}
  1825  	if gc.Longitude != nil {
  1826  		objectMap["longitude"] = gc.Longitude
  1827  	}
  1828  	if gc.Type != "" {
  1829  		objectMap["_type"] = gc.Type
  1830  	}
  1831  	return json.Marshal(objectMap)
  1832  }
  1833  
  1834  // AsGeoCoordinates is the BasicGeoCoordinates implementation for GeoCoordinates.
  1835  func (gc GeoCoordinates) AsGeoCoordinates() (*GeoCoordinates, bool) {
  1836  	return &gc, true
  1837  }
  1838  
  1839  // AsBasicGeoCoordinates is the BasicGeoCoordinates implementation for GeoCoordinates.
  1840  func (gc GeoCoordinates) AsBasicGeoCoordinates() (BasicGeoCoordinates, bool) {
  1841  	return &gc, true
  1842  }
  1843  
  1844  // BasicIdentifiable defines the identity of a resource.
  1845  type BasicIdentifiable interface {
  1846  	AsThing() (*Thing, bool)
  1847  	AsBasicThing() (BasicThing, bool)
  1848  	AsPlaces() (*Places, bool)
  1849  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  1850  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  1851  	AsSearchResponse() (*SearchResponse, bool)
  1852  	AsPostalAddress() (*PostalAddress, bool)
  1853  	AsPlace() (*Place, bool)
  1854  	AsAction() (*Action, bool)
  1855  	AsBasicAction() (BasicAction, bool)
  1856  	AsResponse() (*Response, bool)
  1857  	AsBasicResponse() (BasicResponse, bool)
  1858  	AsAnswer() (*Answer, bool)
  1859  	AsBasicAnswer() (BasicAnswer, bool)
  1860  	AsErrorResponse() (*ErrorResponse, bool)
  1861  	AsCreativeWork() (*CreativeWork, bool)
  1862  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  1863  	AsIntangible() (*Intangible, bool)
  1864  	AsBasicIntangible() (BasicIntangible, bool)
  1865  	AsSearchAction() (*SearchAction, bool)
  1866  	AsStructuredValue() (*StructuredValue, bool)
  1867  	AsBasicStructuredValue() (BasicStructuredValue, bool)
  1868  	AsIdentifiable() (*Identifiable, bool)
  1869  }
  1870  
  1871  // Identifiable defines the identity of a resource.
  1872  type Identifiable struct {
  1873  	// ID - READ-ONLY; A String identifier.
  1874  	ID *string `json:"id,omitempty"`
  1875  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  1876  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  1877  }
  1878  
  1879  func unmarshalBasicIdentifiable(body []byte) (BasicIdentifiable, error) {
  1880  	var m map[string]interface{}
  1881  	err := json.Unmarshal(body, &m)
  1882  	if err != nil {
  1883  		return nil, err
  1884  	}
  1885  
  1886  	switch m["_type"] {
  1887  	case string(TypeThing):
  1888  		var t Thing
  1889  		err := json.Unmarshal(body, &t)
  1890  		return t, err
  1891  	case string(TypePlaces):
  1892  		var p Places
  1893  		err := json.Unmarshal(body, &p)
  1894  		return p, err
  1895  	case string(TypeSearchResultsAnswer):
  1896  		var sra SearchResultsAnswer
  1897  		err := json.Unmarshal(body, &sra)
  1898  		return sra, err
  1899  	case string(TypeSearchResponse):
  1900  		var sr SearchResponse
  1901  		err := json.Unmarshal(body, &sr)
  1902  		return sr, err
  1903  	case string(TypePostalAddress):
  1904  		var pa PostalAddress
  1905  		err := json.Unmarshal(body, &pa)
  1906  		return pa, err
  1907  	case string(TypePlace):
  1908  		var p Place
  1909  		err := json.Unmarshal(body, &p)
  1910  		return p, err
  1911  	case string(TypeAction):
  1912  		var a Action
  1913  		err := json.Unmarshal(body, &a)
  1914  		return a, err
  1915  	case string(TypeResponse):
  1916  		var r Response
  1917  		err := json.Unmarshal(body, &r)
  1918  		return r, err
  1919  	case string(TypeAnswer):
  1920  		var a Answer
  1921  		err := json.Unmarshal(body, &a)
  1922  		return a, err
  1923  	case string(TypeErrorResponse):
  1924  		var er ErrorResponse
  1925  		err := json.Unmarshal(body, &er)
  1926  		return er, err
  1927  	case string(TypeCreativeWork):
  1928  		var cw CreativeWork
  1929  		err := json.Unmarshal(body, &cw)
  1930  		return cw, err
  1931  	case string(TypeIntangible):
  1932  		var i Intangible
  1933  		err := json.Unmarshal(body, &i)
  1934  		return i, err
  1935  	case string(TypeSearchAction):
  1936  		var sa SearchAction
  1937  		err := json.Unmarshal(body, &sa)
  1938  		return sa, err
  1939  	case string(TypeStructuredValue):
  1940  		var sv StructuredValue
  1941  		err := json.Unmarshal(body, &sv)
  1942  		return sv, err
  1943  	default:
  1944  		var i Identifiable
  1945  		err := json.Unmarshal(body, &i)
  1946  		return i, err
  1947  	}
  1948  }
  1949  func unmarshalBasicIdentifiableArray(body []byte) ([]BasicIdentifiable, error) {
  1950  	var rawMessages []*json.RawMessage
  1951  	err := json.Unmarshal(body, &rawMessages)
  1952  	if err != nil {
  1953  		return nil, err
  1954  	}
  1955  
  1956  	iArray := make([]BasicIdentifiable, len(rawMessages))
  1957  
  1958  	for index, rawMessage := range rawMessages {
  1959  		i, err := unmarshalBasicIdentifiable(*rawMessage)
  1960  		if err != nil {
  1961  			return nil, err
  1962  		}
  1963  		iArray[index] = i
  1964  	}
  1965  	return iArray, nil
  1966  }
  1967  
  1968  // MarshalJSON is the custom marshaler for Identifiable.
  1969  func (i Identifiable) MarshalJSON() ([]byte, error) {
  1970  	i.Type = TypeIdentifiable
  1971  	objectMap := make(map[string]interface{})
  1972  	if i.Type != "" {
  1973  		objectMap["_type"] = i.Type
  1974  	}
  1975  	return json.Marshal(objectMap)
  1976  }
  1977  
  1978  // AsThing is the BasicResponseBase implementation for Identifiable.
  1979  func (i Identifiable) AsThing() (*Thing, bool) {
  1980  	return nil, false
  1981  }
  1982  
  1983  // AsBasicThing is the BasicResponseBase implementation for Identifiable.
  1984  func (i Identifiable) AsBasicThing() (BasicThing, bool) {
  1985  	return nil, false
  1986  }
  1987  
  1988  // AsPlaces is the BasicResponseBase implementation for Identifiable.
  1989  func (i Identifiable) AsPlaces() (*Places, bool) {
  1990  	return nil, false
  1991  }
  1992  
  1993  // AsSearchResultsAnswer is the BasicResponseBase implementation for Identifiable.
  1994  func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1995  	return nil, false
  1996  }
  1997  
  1998  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Identifiable.
  1999  func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2000  	return nil, false
  2001  }
  2002  
  2003  // AsSearchResponse is the BasicResponseBase implementation for Identifiable.
  2004  func (i Identifiable) AsSearchResponse() (*SearchResponse, bool) {
  2005  	return nil, false
  2006  }
  2007  
  2008  // AsPostalAddress is the BasicResponseBase implementation for Identifiable.
  2009  func (i Identifiable) AsPostalAddress() (*PostalAddress, bool) {
  2010  	return nil, false
  2011  }
  2012  
  2013  // AsPlace is the BasicResponseBase implementation for Identifiable.
  2014  func (i Identifiable) AsPlace() (*Place, bool) {
  2015  	return nil, false
  2016  }
  2017  
  2018  // AsAction is the BasicResponseBase implementation for Identifiable.
  2019  func (i Identifiable) AsAction() (*Action, bool) {
  2020  	return nil, false
  2021  }
  2022  
  2023  // AsBasicAction is the BasicResponseBase implementation for Identifiable.
  2024  func (i Identifiable) AsBasicAction() (BasicAction, bool) {
  2025  	return nil, false
  2026  }
  2027  
  2028  // AsResponse is the BasicResponseBase implementation for Identifiable.
  2029  func (i Identifiable) AsResponse() (*Response, bool) {
  2030  	return nil, false
  2031  }
  2032  
  2033  // AsBasicResponse is the BasicResponseBase implementation for Identifiable.
  2034  func (i Identifiable) AsBasicResponse() (BasicResponse, bool) {
  2035  	return nil, false
  2036  }
  2037  
  2038  // AsIdentifiable is the BasicResponseBase implementation for Identifiable.
  2039  func (i Identifiable) AsIdentifiable() (*Identifiable, bool) {
  2040  	return &i, true
  2041  }
  2042  
  2043  // AsBasicIdentifiable is the BasicResponseBase implementation for Identifiable.
  2044  func (i Identifiable) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2045  	return &i, true
  2046  }
  2047  
  2048  // AsAnswer is the BasicResponseBase implementation for Identifiable.
  2049  func (i Identifiable) AsAnswer() (*Answer, bool) {
  2050  	return nil, false
  2051  }
  2052  
  2053  // AsBasicAnswer is the BasicResponseBase implementation for Identifiable.
  2054  func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) {
  2055  	return nil, false
  2056  }
  2057  
  2058  // AsErrorResponse is the BasicResponseBase implementation for Identifiable.
  2059  func (i Identifiable) AsErrorResponse() (*ErrorResponse, bool) {
  2060  	return nil, false
  2061  }
  2062  
  2063  // AsCreativeWork is the BasicResponseBase implementation for Identifiable.
  2064  func (i Identifiable) AsCreativeWork() (*CreativeWork, bool) {
  2065  	return nil, false
  2066  }
  2067  
  2068  // AsBasicCreativeWork is the BasicResponseBase implementation for Identifiable.
  2069  func (i Identifiable) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2070  	return nil, false
  2071  }
  2072  
  2073  // AsIntangible is the BasicResponseBase implementation for Identifiable.
  2074  func (i Identifiable) AsIntangible() (*Intangible, bool) {
  2075  	return nil, false
  2076  }
  2077  
  2078  // AsBasicIntangible is the BasicResponseBase implementation for Identifiable.
  2079  func (i Identifiable) AsBasicIntangible() (BasicIntangible, bool) {
  2080  	return nil, false
  2081  }
  2082  
  2083  // AsSearchAction is the BasicResponseBase implementation for Identifiable.
  2084  func (i Identifiable) AsSearchAction() (*SearchAction, bool) {
  2085  	return nil, false
  2086  }
  2087  
  2088  // AsStructuredValue is the BasicResponseBase implementation for Identifiable.
  2089  func (i Identifiable) AsStructuredValue() (*StructuredValue, bool) {
  2090  	return nil, false
  2091  }
  2092  
  2093  // AsBasicStructuredValue is the BasicResponseBase implementation for Identifiable.
  2094  func (i Identifiable) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  2095  	return nil, false
  2096  }
  2097  
  2098  // AsResponseBase is the BasicResponseBase implementation for Identifiable.
  2099  func (i Identifiable) AsResponseBase() (*ResponseBase, bool) {
  2100  	return nil, false
  2101  }
  2102  
  2103  // AsBasicResponseBase is the BasicResponseBase implementation for Identifiable.
  2104  func (i Identifiable) AsBasicResponseBase() (BasicResponseBase, bool) {
  2105  	return &i, true
  2106  }
  2107  
  2108  // BasicIntangible a utility class that serves as the umbrella for a number of 'intangible' things such as quantities,
  2109  // structured values, etc.
  2110  type BasicIntangible interface {
  2111  	AsPostalAddress() (*PostalAddress, bool)
  2112  	AsStructuredValue() (*StructuredValue, bool)
  2113  	AsBasicStructuredValue() (BasicStructuredValue, bool)
  2114  	AsIntangible() (*Intangible, bool)
  2115  }
  2116  
  2117  // Intangible a utility class that serves as the umbrella for a number of 'intangible' things such as
  2118  // quantities, structured values, etc.
  2119  type Intangible struct {
  2120  	// Name - READ-ONLY; The name of the thing represented by this object.
  2121  	Name *string `json:"name,omitempty"`
  2122  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  2123  	URL *string `json:"url,omitempty"`
  2124  	// EntityPresentationInfo - READ-ONLY; Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields.
  2125  	EntityPresentationInfo BasicEntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
  2126  	// ReadLink - READ-ONLY; The URL that returns this resource.
  2127  	ReadLink *string `json:"readLink,omitempty"`
  2128  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  2129  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2130  	// PotentialAction - READ-ONLY
  2131  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  2132  	// ImmediateAction - READ-ONLY
  2133  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  2134  	// PreferredClickthroughURL - READ-ONLY
  2135  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  2136  	// AdaptiveCard - READ-ONLY
  2137  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  2138  	// ID - READ-ONLY; A String identifier.
  2139  	ID *string `json:"id,omitempty"`
  2140  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  2141  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  2142  }
  2143  
  2144  func unmarshalBasicIntangible(body []byte) (BasicIntangible, error) {
  2145  	var m map[string]interface{}
  2146  	err := json.Unmarshal(body, &m)
  2147  	if err != nil {
  2148  		return nil, err
  2149  	}
  2150  
  2151  	switch m["_type"] {
  2152  	case string(TypePostalAddress):
  2153  		var pa PostalAddress
  2154  		err := json.Unmarshal(body, &pa)
  2155  		return pa, err
  2156  	case string(TypeStructuredValue):
  2157  		var sv StructuredValue
  2158  		err := json.Unmarshal(body, &sv)
  2159  		return sv, err
  2160  	default:
  2161  		var i Intangible
  2162  		err := json.Unmarshal(body, &i)
  2163  		return i, err
  2164  	}
  2165  }
  2166  func unmarshalBasicIntangibleArray(body []byte) ([]BasicIntangible, error) {
  2167  	var rawMessages []*json.RawMessage
  2168  	err := json.Unmarshal(body, &rawMessages)
  2169  	if err != nil {
  2170  		return nil, err
  2171  	}
  2172  
  2173  	iArray := make([]BasicIntangible, len(rawMessages))
  2174  
  2175  	for index, rawMessage := range rawMessages {
  2176  		i, err := unmarshalBasicIntangible(*rawMessage)
  2177  		if err != nil {
  2178  			return nil, err
  2179  		}
  2180  		iArray[index] = i
  2181  	}
  2182  	return iArray, nil
  2183  }
  2184  
  2185  // MarshalJSON is the custom marshaler for Intangible.
  2186  func (i Intangible) MarshalJSON() ([]byte, error) {
  2187  	i.Type = TypeIntangible
  2188  	objectMap := make(map[string]interface{})
  2189  	if i.Type != "" {
  2190  		objectMap["_type"] = i.Type
  2191  	}
  2192  	return json.Marshal(objectMap)
  2193  }
  2194  
  2195  // AsThing is the BasicResponseBase implementation for Intangible.
  2196  func (i Intangible) AsThing() (*Thing, bool) {
  2197  	return nil, false
  2198  }
  2199  
  2200  // AsBasicThing is the BasicResponseBase implementation for Intangible.
  2201  func (i Intangible) AsBasicThing() (BasicThing, bool) {
  2202  	return &i, true
  2203  }
  2204  
  2205  // AsPlaces is the BasicResponseBase implementation for Intangible.
  2206  func (i Intangible) AsPlaces() (*Places, bool) {
  2207  	return nil, false
  2208  }
  2209  
  2210  // AsSearchResultsAnswer is the BasicResponseBase implementation for Intangible.
  2211  func (i Intangible) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2212  	return nil, false
  2213  }
  2214  
  2215  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Intangible.
  2216  func (i Intangible) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2217  	return nil, false
  2218  }
  2219  
  2220  // AsSearchResponse is the BasicResponseBase implementation for Intangible.
  2221  func (i Intangible) AsSearchResponse() (*SearchResponse, bool) {
  2222  	return nil, false
  2223  }
  2224  
  2225  // AsPostalAddress is the BasicResponseBase implementation for Intangible.
  2226  func (i Intangible) AsPostalAddress() (*PostalAddress, bool) {
  2227  	return nil, false
  2228  }
  2229  
  2230  // AsPlace is the BasicResponseBase implementation for Intangible.
  2231  func (i Intangible) AsPlace() (*Place, bool) {
  2232  	return nil, false
  2233  }
  2234  
  2235  // AsAction is the BasicResponseBase implementation for Intangible.
  2236  func (i Intangible) AsAction() (*Action, bool) {
  2237  	return nil, false
  2238  }
  2239  
  2240  // AsBasicAction is the BasicResponseBase implementation for Intangible.
  2241  func (i Intangible) AsBasicAction() (BasicAction, bool) {
  2242  	return nil, false
  2243  }
  2244  
  2245  // AsResponse is the BasicResponseBase implementation for Intangible.
  2246  func (i Intangible) AsResponse() (*Response, bool) {
  2247  	return nil, false
  2248  }
  2249  
  2250  // AsBasicResponse is the BasicResponseBase implementation for Intangible.
  2251  func (i Intangible) AsBasicResponse() (BasicResponse, bool) {
  2252  	return &i, true
  2253  }
  2254  
  2255  // AsIdentifiable is the BasicResponseBase implementation for Intangible.
  2256  func (i Intangible) AsIdentifiable() (*Identifiable, bool) {
  2257  	return nil, false
  2258  }
  2259  
  2260  // AsBasicIdentifiable is the BasicResponseBase implementation for Intangible.
  2261  func (i Intangible) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2262  	return &i, true
  2263  }
  2264  
  2265  // AsAnswer is the BasicResponseBase implementation for Intangible.
  2266  func (i Intangible) AsAnswer() (*Answer, bool) {
  2267  	return nil, false
  2268  }
  2269  
  2270  // AsBasicAnswer is the BasicResponseBase implementation for Intangible.
  2271  func (i Intangible) AsBasicAnswer() (BasicAnswer, bool) {
  2272  	return nil, false
  2273  }
  2274  
  2275  // AsErrorResponse is the BasicResponseBase implementation for Intangible.
  2276  func (i Intangible) AsErrorResponse() (*ErrorResponse, bool) {
  2277  	return nil, false
  2278  }
  2279  
  2280  // AsCreativeWork is the BasicResponseBase implementation for Intangible.
  2281  func (i Intangible) AsCreativeWork() (*CreativeWork, bool) {
  2282  	return nil, false
  2283  }
  2284  
  2285  // AsBasicCreativeWork is the BasicResponseBase implementation for Intangible.
  2286  func (i Intangible) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2287  	return nil, false
  2288  }
  2289  
  2290  // AsIntangible is the BasicResponseBase implementation for Intangible.
  2291  func (i Intangible) AsIntangible() (*Intangible, bool) {
  2292  	return &i, true
  2293  }
  2294  
  2295  // AsBasicIntangible is the BasicResponseBase implementation for Intangible.
  2296  func (i Intangible) AsBasicIntangible() (BasicIntangible, bool) {
  2297  	return &i, true
  2298  }
  2299  
  2300  // AsSearchAction is the BasicResponseBase implementation for Intangible.
  2301  func (i Intangible) AsSearchAction() (*SearchAction, bool) {
  2302  	return nil, false
  2303  }
  2304  
  2305  // AsStructuredValue is the BasicResponseBase implementation for Intangible.
  2306  func (i Intangible) AsStructuredValue() (*StructuredValue, bool) {
  2307  	return nil, false
  2308  }
  2309  
  2310  // AsBasicStructuredValue is the BasicResponseBase implementation for Intangible.
  2311  func (i Intangible) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  2312  	return nil, false
  2313  }
  2314  
  2315  // AsResponseBase is the BasicResponseBase implementation for Intangible.
  2316  func (i Intangible) AsResponseBase() (*ResponseBase, bool) {
  2317  	return nil, false
  2318  }
  2319  
  2320  // AsBasicResponseBase is the BasicResponseBase implementation for Intangible.
  2321  func (i Intangible) AsBasicResponseBase() (BasicResponseBase, bool) {
  2322  	return &i, true
  2323  }
  2324  
  2325  // UnmarshalJSON is the custom unmarshaler for Intangible struct.
  2326  func (i *Intangible) UnmarshalJSON(body []byte) error {
  2327  	var m map[string]*json.RawMessage
  2328  	err := json.Unmarshal(body, &m)
  2329  	if err != nil {
  2330  		return err
  2331  	}
  2332  	for k, v := range m {
  2333  		switch k {
  2334  		case "name":
  2335  			if v != nil {
  2336  				var name string
  2337  				err = json.Unmarshal(*v, &name)
  2338  				if err != nil {
  2339  					return err
  2340  				}
  2341  				i.Name = &name
  2342  			}
  2343  		case "url":
  2344  			if v != nil {
  2345  				var URL string
  2346  				err = json.Unmarshal(*v, &URL)
  2347  				if err != nil {
  2348  					return err
  2349  				}
  2350  				i.URL = &URL
  2351  			}
  2352  		case "entityPresentationInfo":
  2353  			if v != nil {
  2354  				entityPresentationInfo, err := unmarshalBasicEntitiesEntityPresentationInfo(*v)
  2355  				if err != nil {
  2356  					return err
  2357  				}
  2358  				i.EntityPresentationInfo = entityPresentationInfo
  2359  			}
  2360  		case "readLink":
  2361  			if v != nil {
  2362  				var readLink string
  2363  				err = json.Unmarshal(*v, &readLink)
  2364  				if err != nil {
  2365  					return err
  2366  				}
  2367  				i.ReadLink = &readLink
  2368  			}
  2369  		case "webSearchUrl":
  2370  			if v != nil {
  2371  				var webSearchURL string
  2372  				err = json.Unmarshal(*v, &webSearchURL)
  2373  				if err != nil {
  2374  					return err
  2375  				}
  2376  				i.WebSearchURL = &webSearchURL
  2377  			}
  2378  		case "potentialAction":
  2379  			if v != nil {
  2380  				potentialAction, err := unmarshalBasicActionArray(*v)
  2381  				if err != nil {
  2382  					return err
  2383  				}
  2384  				i.PotentialAction = &potentialAction
  2385  			}
  2386  		case "immediateAction":
  2387  			if v != nil {
  2388  				immediateAction, err := unmarshalBasicActionArray(*v)
  2389  				if err != nil {
  2390  					return err
  2391  				}
  2392  				i.ImmediateAction = &immediateAction
  2393  			}
  2394  		case "preferredClickthroughUrl":
  2395  			if v != nil {
  2396  				var preferredClickthroughURL string
  2397  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  2398  				if err != nil {
  2399  					return err
  2400  				}
  2401  				i.PreferredClickthroughURL = &preferredClickthroughURL
  2402  			}
  2403  		case "adaptiveCard":
  2404  			if v != nil {
  2405  				var adaptiveCard string
  2406  				err = json.Unmarshal(*v, &adaptiveCard)
  2407  				if err != nil {
  2408  					return err
  2409  				}
  2410  				i.AdaptiveCard = &adaptiveCard
  2411  			}
  2412  		case "id":
  2413  			if v != nil {
  2414  				var ID string
  2415  				err = json.Unmarshal(*v, &ID)
  2416  				if err != nil {
  2417  					return err
  2418  				}
  2419  				i.ID = &ID
  2420  			}
  2421  		case "_type":
  2422  			if v != nil {
  2423  				var typeVar TypeBasicResponseBase
  2424  				err = json.Unmarshal(*v, &typeVar)
  2425  				if err != nil {
  2426  					return err
  2427  				}
  2428  				i.Type = typeVar
  2429  			}
  2430  		}
  2431  	}
  2432  
  2433  	return nil
  2434  }
  2435  
  2436  // Place defines information about a local entity, such as a restaurant or hotel.
  2437  type Place struct {
  2438  	// Geo - READ-ONLY
  2439  	Geo BasicGeoCoordinates `json:"geo,omitempty"`
  2440  	// RoutablePoint - READ-ONLY
  2441  	RoutablePoint BasicGeoCoordinates `json:"routablePoint,omitempty"`
  2442  	// Address - READ-ONLY; The postal address of where the entity is located
  2443  	Address *PostalAddress `json:"address,omitempty"`
  2444  	// Telephone - READ-ONLY; The entity's telephone number
  2445  	Telephone *string `json:"telephone,omitempty"`
  2446  	// Name - READ-ONLY; The name of the thing represented by this object.
  2447  	Name *string `json:"name,omitempty"`
  2448  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  2449  	URL *string `json:"url,omitempty"`
  2450  	// EntityPresentationInfo - READ-ONLY; Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields.
  2451  	EntityPresentationInfo BasicEntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
  2452  	// ReadLink - READ-ONLY; The URL that returns this resource.
  2453  	ReadLink *string `json:"readLink,omitempty"`
  2454  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  2455  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2456  	// PotentialAction - READ-ONLY
  2457  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  2458  	// ImmediateAction - READ-ONLY
  2459  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  2460  	// PreferredClickthroughURL - READ-ONLY
  2461  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  2462  	// AdaptiveCard - READ-ONLY
  2463  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  2464  	// ID - READ-ONLY; A String identifier.
  2465  	ID *string `json:"id,omitempty"`
  2466  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  2467  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  2468  }
  2469  
  2470  // MarshalJSON is the custom marshaler for Place.
  2471  func (p Place) MarshalJSON() ([]byte, error) {
  2472  	p.Type = TypePlace
  2473  	objectMap := make(map[string]interface{})
  2474  	if p.Type != "" {
  2475  		objectMap["_type"] = p.Type
  2476  	}
  2477  	return json.Marshal(objectMap)
  2478  }
  2479  
  2480  // AsThing is the BasicResponseBase implementation for Place.
  2481  func (p Place) AsThing() (*Thing, bool) {
  2482  	return nil, false
  2483  }
  2484  
  2485  // AsBasicThing is the BasicResponseBase implementation for Place.
  2486  func (p Place) AsBasicThing() (BasicThing, bool) {
  2487  	return &p, true
  2488  }
  2489  
  2490  // AsPlaces is the BasicResponseBase implementation for Place.
  2491  func (p Place) AsPlaces() (*Places, bool) {
  2492  	return nil, false
  2493  }
  2494  
  2495  // AsSearchResultsAnswer is the BasicResponseBase implementation for Place.
  2496  func (p Place) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2497  	return nil, false
  2498  }
  2499  
  2500  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Place.
  2501  func (p Place) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2502  	return nil, false
  2503  }
  2504  
  2505  // AsSearchResponse is the BasicResponseBase implementation for Place.
  2506  func (p Place) AsSearchResponse() (*SearchResponse, bool) {
  2507  	return nil, false
  2508  }
  2509  
  2510  // AsPostalAddress is the BasicResponseBase implementation for Place.
  2511  func (p Place) AsPostalAddress() (*PostalAddress, bool) {
  2512  	return nil, false
  2513  }
  2514  
  2515  // AsPlace is the BasicResponseBase implementation for Place.
  2516  func (p Place) AsPlace() (*Place, bool) {
  2517  	return &p, true
  2518  }
  2519  
  2520  // AsAction is the BasicResponseBase implementation for Place.
  2521  func (p Place) AsAction() (*Action, bool) {
  2522  	return nil, false
  2523  }
  2524  
  2525  // AsBasicAction is the BasicResponseBase implementation for Place.
  2526  func (p Place) AsBasicAction() (BasicAction, bool) {
  2527  	return nil, false
  2528  }
  2529  
  2530  // AsResponse is the BasicResponseBase implementation for Place.
  2531  func (p Place) AsResponse() (*Response, bool) {
  2532  	return nil, false
  2533  }
  2534  
  2535  // AsBasicResponse is the BasicResponseBase implementation for Place.
  2536  func (p Place) AsBasicResponse() (BasicResponse, bool) {
  2537  	return &p, true
  2538  }
  2539  
  2540  // AsIdentifiable is the BasicResponseBase implementation for Place.
  2541  func (p Place) AsIdentifiable() (*Identifiable, bool) {
  2542  	return nil, false
  2543  }
  2544  
  2545  // AsBasicIdentifiable is the BasicResponseBase implementation for Place.
  2546  func (p Place) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2547  	return &p, true
  2548  }
  2549  
  2550  // AsAnswer is the BasicResponseBase implementation for Place.
  2551  func (p Place) AsAnswer() (*Answer, bool) {
  2552  	return nil, false
  2553  }
  2554  
  2555  // AsBasicAnswer is the BasicResponseBase implementation for Place.
  2556  func (p Place) AsBasicAnswer() (BasicAnswer, bool) {
  2557  	return nil, false
  2558  }
  2559  
  2560  // AsErrorResponse is the BasicResponseBase implementation for Place.
  2561  func (p Place) AsErrorResponse() (*ErrorResponse, bool) {
  2562  	return nil, false
  2563  }
  2564  
  2565  // AsCreativeWork is the BasicResponseBase implementation for Place.
  2566  func (p Place) AsCreativeWork() (*CreativeWork, bool) {
  2567  	return nil, false
  2568  }
  2569  
  2570  // AsBasicCreativeWork is the BasicResponseBase implementation for Place.
  2571  func (p Place) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2572  	return nil, false
  2573  }
  2574  
  2575  // AsIntangible is the BasicResponseBase implementation for Place.
  2576  func (p Place) AsIntangible() (*Intangible, bool) {
  2577  	return nil, false
  2578  }
  2579  
  2580  // AsBasicIntangible is the BasicResponseBase implementation for Place.
  2581  func (p Place) AsBasicIntangible() (BasicIntangible, bool) {
  2582  	return nil, false
  2583  }
  2584  
  2585  // AsSearchAction is the BasicResponseBase implementation for Place.
  2586  func (p Place) AsSearchAction() (*SearchAction, bool) {
  2587  	return nil, false
  2588  }
  2589  
  2590  // AsStructuredValue is the BasicResponseBase implementation for Place.
  2591  func (p Place) AsStructuredValue() (*StructuredValue, bool) {
  2592  	return nil, false
  2593  }
  2594  
  2595  // AsBasicStructuredValue is the BasicResponseBase implementation for Place.
  2596  func (p Place) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  2597  	return nil, false
  2598  }
  2599  
  2600  // AsResponseBase is the BasicResponseBase implementation for Place.
  2601  func (p Place) AsResponseBase() (*ResponseBase, bool) {
  2602  	return nil, false
  2603  }
  2604  
  2605  // AsBasicResponseBase is the BasicResponseBase implementation for Place.
  2606  func (p Place) AsBasicResponseBase() (BasicResponseBase, bool) {
  2607  	return &p, true
  2608  }
  2609  
  2610  // UnmarshalJSON is the custom unmarshaler for Place struct.
  2611  func (p *Place) UnmarshalJSON(body []byte) error {
  2612  	var m map[string]*json.RawMessage
  2613  	err := json.Unmarshal(body, &m)
  2614  	if err != nil {
  2615  		return err
  2616  	}
  2617  	for k, v := range m {
  2618  		switch k {
  2619  		case "geo":
  2620  			if v != nil {
  2621  				geo, err := unmarshalBasicGeoCoordinates(*v)
  2622  				if err != nil {
  2623  					return err
  2624  				}
  2625  				p.Geo = geo
  2626  			}
  2627  		case "routablePoint":
  2628  			if v != nil {
  2629  				routablePoint, err := unmarshalBasicGeoCoordinates(*v)
  2630  				if err != nil {
  2631  					return err
  2632  				}
  2633  				p.RoutablePoint = routablePoint
  2634  			}
  2635  		case "address":
  2636  			if v != nil {
  2637  				var address PostalAddress
  2638  				err = json.Unmarshal(*v, &address)
  2639  				if err != nil {
  2640  					return err
  2641  				}
  2642  				p.Address = &address
  2643  			}
  2644  		case "telephone":
  2645  			if v != nil {
  2646  				var telephone string
  2647  				err = json.Unmarshal(*v, &telephone)
  2648  				if err != nil {
  2649  					return err
  2650  				}
  2651  				p.Telephone = &telephone
  2652  			}
  2653  		case "name":
  2654  			if v != nil {
  2655  				var name string
  2656  				err = json.Unmarshal(*v, &name)
  2657  				if err != nil {
  2658  					return err
  2659  				}
  2660  				p.Name = &name
  2661  			}
  2662  		case "url":
  2663  			if v != nil {
  2664  				var URL string
  2665  				err = json.Unmarshal(*v, &URL)
  2666  				if err != nil {
  2667  					return err
  2668  				}
  2669  				p.URL = &URL
  2670  			}
  2671  		case "entityPresentationInfo":
  2672  			if v != nil {
  2673  				entityPresentationInfo, err := unmarshalBasicEntitiesEntityPresentationInfo(*v)
  2674  				if err != nil {
  2675  					return err
  2676  				}
  2677  				p.EntityPresentationInfo = entityPresentationInfo
  2678  			}
  2679  		case "readLink":
  2680  			if v != nil {
  2681  				var readLink string
  2682  				err = json.Unmarshal(*v, &readLink)
  2683  				if err != nil {
  2684  					return err
  2685  				}
  2686  				p.ReadLink = &readLink
  2687  			}
  2688  		case "webSearchUrl":
  2689  			if v != nil {
  2690  				var webSearchURL string
  2691  				err = json.Unmarshal(*v, &webSearchURL)
  2692  				if err != nil {
  2693  					return err
  2694  				}
  2695  				p.WebSearchURL = &webSearchURL
  2696  			}
  2697  		case "potentialAction":
  2698  			if v != nil {
  2699  				potentialAction, err := unmarshalBasicActionArray(*v)
  2700  				if err != nil {
  2701  					return err
  2702  				}
  2703  				p.PotentialAction = &potentialAction
  2704  			}
  2705  		case "immediateAction":
  2706  			if v != nil {
  2707  				immediateAction, err := unmarshalBasicActionArray(*v)
  2708  				if err != nil {
  2709  					return err
  2710  				}
  2711  				p.ImmediateAction = &immediateAction
  2712  			}
  2713  		case "preferredClickthroughUrl":
  2714  			if v != nil {
  2715  				var preferredClickthroughURL string
  2716  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  2717  				if err != nil {
  2718  					return err
  2719  				}
  2720  				p.PreferredClickthroughURL = &preferredClickthroughURL
  2721  			}
  2722  		case "adaptiveCard":
  2723  			if v != nil {
  2724  				var adaptiveCard string
  2725  				err = json.Unmarshal(*v, &adaptiveCard)
  2726  				if err != nil {
  2727  					return err
  2728  				}
  2729  				p.AdaptiveCard = &adaptiveCard
  2730  			}
  2731  		case "id":
  2732  			if v != nil {
  2733  				var ID string
  2734  				err = json.Unmarshal(*v, &ID)
  2735  				if err != nil {
  2736  					return err
  2737  				}
  2738  				p.ID = &ID
  2739  			}
  2740  		case "_type":
  2741  			if v != nil {
  2742  				var typeVar TypeBasicResponseBase
  2743  				err = json.Unmarshal(*v, &typeVar)
  2744  				if err != nil {
  2745  					return err
  2746  				}
  2747  				p.Type = typeVar
  2748  			}
  2749  		}
  2750  	}
  2751  
  2752  	return nil
  2753  }
  2754  
  2755  // Places defines a local entity answer.
  2756  type Places struct {
  2757  	// Value - A list of local entities, such as restaurants or hotels.
  2758  	Value *[]BasicThing `json:"value,omitempty"`
  2759  	// QueryContext - READ-ONLY
  2760  	QueryContext BasicQueryContext `json:"queryContext,omitempty"`
  2761  	// 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.
  2762  	TotalEstimatedMatches *int64 `json:"totalEstimatedMatches,omitempty"`
  2763  	// IsFamilyFriendly - READ-ONLY
  2764  	IsFamilyFriendly *bool `json:"isFamilyFriendly,omitempty"`
  2765  	// ReadLink - READ-ONLY; The URL that returns this resource.
  2766  	ReadLink *string `json:"readLink,omitempty"`
  2767  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  2768  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2769  	// PotentialAction - READ-ONLY
  2770  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  2771  	// ImmediateAction - READ-ONLY
  2772  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  2773  	// PreferredClickthroughURL - READ-ONLY
  2774  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  2775  	// AdaptiveCard - READ-ONLY
  2776  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  2777  	// ID - READ-ONLY; A String identifier.
  2778  	ID *string `json:"id,omitempty"`
  2779  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  2780  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  2781  }
  2782  
  2783  // MarshalJSON is the custom marshaler for Places.
  2784  func (p Places) MarshalJSON() ([]byte, error) {
  2785  	p.Type = TypePlaces
  2786  	objectMap := make(map[string]interface{})
  2787  	if p.Value != nil {
  2788  		objectMap["value"] = p.Value
  2789  	}
  2790  	if p.Type != "" {
  2791  		objectMap["_type"] = p.Type
  2792  	}
  2793  	return json.Marshal(objectMap)
  2794  }
  2795  
  2796  // AsThing is the BasicResponseBase implementation for Places.
  2797  func (p Places) AsThing() (*Thing, bool) {
  2798  	return nil, false
  2799  }
  2800  
  2801  // AsBasicThing is the BasicResponseBase implementation for Places.
  2802  func (p Places) AsBasicThing() (BasicThing, bool) {
  2803  	return nil, false
  2804  }
  2805  
  2806  // AsPlaces is the BasicResponseBase implementation for Places.
  2807  func (p Places) AsPlaces() (*Places, bool) {
  2808  	return &p, true
  2809  }
  2810  
  2811  // AsSearchResultsAnswer is the BasicResponseBase implementation for Places.
  2812  func (p Places) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2813  	return nil, false
  2814  }
  2815  
  2816  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Places.
  2817  func (p Places) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2818  	return &p, true
  2819  }
  2820  
  2821  // AsSearchResponse is the BasicResponseBase implementation for Places.
  2822  func (p Places) AsSearchResponse() (*SearchResponse, bool) {
  2823  	return nil, false
  2824  }
  2825  
  2826  // AsPostalAddress is the BasicResponseBase implementation for Places.
  2827  func (p Places) AsPostalAddress() (*PostalAddress, bool) {
  2828  	return nil, false
  2829  }
  2830  
  2831  // AsPlace is the BasicResponseBase implementation for Places.
  2832  func (p Places) AsPlace() (*Place, bool) {
  2833  	return nil, false
  2834  }
  2835  
  2836  // AsAction is the BasicResponseBase implementation for Places.
  2837  func (p Places) AsAction() (*Action, bool) {
  2838  	return nil, false
  2839  }
  2840  
  2841  // AsBasicAction is the BasicResponseBase implementation for Places.
  2842  func (p Places) AsBasicAction() (BasicAction, bool) {
  2843  	return nil, false
  2844  }
  2845  
  2846  // AsResponse is the BasicResponseBase implementation for Places.
  2847  func (p Places) AsResponse() (*Response, bool) {
  2848  	return nil, false
  2849  }
  2850  
  2851  // AsBasicResponse is the BasicResponseBase implementation for Places.
  2852  func (p Places) AsBasicResponse() (BasicResponse, bool) {
  2853  	return &p, true
  2854  }
  2855  
  2856  // AsIdentifiable is the BasicResponseBase implementation for Places.
  2857  func (p Places) AsIdentifiable() (*Identifiable, bool) {
  2858  	return nil, false
  2859  }
  2860  
  2861  // AsBasicIdentifiable is the BasicResponseBase implementation for Places.
  2862  func (p Places) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2863  	return &p, true
  2864  }
  2865  
  2866  // AsAnswer is the BasicResponseBase implementation for Places.
  2867  func (p Places) AsAnswer() (*Answer, bool) {
  2868  	return nil, false
  2869  }
  2870  
  2871  // AsBasicAnswer is the BasicResponseBase implementation for Places.
  2872  func (p Places) AsBasicAnswer() (BasicAnswer, bool) {
  2873  	return &p, true
  2874  }
  2875  
  2876  // AsErrorResponse is the BasicResponseBase implementation for Places.
  2877  func (p Places) AsErrorResponse() (*ErrorResponse, bool) {
  2878  	return nil, false
  2879  }
  2880  
  2881  // AsCreativeWork is the BasicResponseBase implementation for Places.
  2882  func (p Places) AsCreativeWork() (*CreativeWork, bool) {
  2883  	return nil, false
  2884  }
  2885  
  2886  // AsBasicCreativeWork is the BasicResponseBase implementation for Places.
  2887  func (p Places) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2888  	return nil, false
  2889  }
  2890  
  2891  // AsIntangible is the BasicResponseBase implementation for Places.
  2892  func (p Places) AsIntangible() (*Intangible, bool) {
  2893  	return nil, false
  2894  }
  2895  
  2896  // AsBasicIntangible is the BasicResponseBase implementation for Places.
  2897  func (p Places) AsBasicIntangible() (BasicIntangible, bool) {
  2898  	return nil, false
  2899  }
  2900  
  2901  // AsSearchAction is the BasicResponseBase implementation for Places.
  2902  func (p Places) AsSearchAction() (*SearchAction, bool) {
  2903  	return nil, false
  2904  }
  2905  
  2906  // AsStructuredValue is the BasicResponseBase implementation for Places.
  2907  func (p Places) AsStructuredValue() (*StructuredValue, bool) {
  2908  	return nil, false
  2909  }
  2910  
  2911  // AsBasicStructuredValue is the BasicResponseBase implementation for Places.
  2912  func (p Places) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  2913  	return nil, false
  2914  }
  2915  
  2916  // AsResponseBase is the BasicResponseBase implementation for Places.
  2917  func (p Places) AsResponseBase() (*ResponseBase, bool) {
  2918  	return nil, false
  2919  }
  2920  
  2921  // AsBasicResponseBase is the BasicResponseBase implementation for Places.
  2922  func (p Places) AsBasicResponseBase() (BasicResponseBase, bool) {
  2923  	return &p, true
  2924  }
  2925  
  2926  // UnmarshalJSON is the custom unmarshaler for Places struct.
  2927  func (p *Places) UnmarshalJSON(body []byte) error {
  2928  	var m map[string]*json.RawMessage
  2929  	err := json.Unmarshal(body, &m)
  2930  	if err != nil {
  2931  		return err
  2932  	}
  2933  	for k, v := range m {
  2934  		switch k {
  2935  		case "value":
  2936  			if v != nil {
  2937  				value, err := unmarshalBasicThingArray(*v)
  2938  				if err != nil {
  2939  					return err
  2940  				}
  2941  				p.Value = &value
  2942  			}
  2943  		case "queryContext":
  2944  			if v != nil {
  2945  				queryContext, err := unmarshalBasicQueryContext(*v)
  2946  				if err != nil {
  2947  					return err
  2948  				}
  2949  				p.QueryContext = queryContext
  2950  			}
  2951  		case "totalEstimatedMatches":
  2952  			if v != nil {
  2953  				var totalEstimatedMatches int64
  2954  				err = json.Unmarshal(*v, &totalEstimatedMatches)
  2955  				if err != nil {
  2956  					return err
  2957  				}
  2958  				p.TotalEstimatedMatches = &totalEstimatedMatches
  2959  			}
  2960  		case "isFamilyFriendly":
  2961  			if v != nil {
  2962  				var isFamilyFriendly bool
  2963  				err = json.Unmarshal(*v, &isFamilyFriendly)
  2964  				if err != nil {
  2965  					return err
  2966  				}
  2967  				p.IsFamilyFriendly = &isFamilyFriendly
  2968  			}
  2969  		case "readLink":
  2970  			if v != nil {
  2971  				var readLink string
  2972  				err = json.Unmarshal(*v, &readLink)
  2973  				if err != nil {
  2974  					return err
  2975  				}
  2976  				p.ReadLink = &readLink
  2977  			}
  2978  		case "webSearchUrl":
  2979  			if v != nil {
  2980  				var webSearchURL string
  2981  				err = json.Unmarshal(*v, &webSearchURL)
  2982  				if err != nil {
  2983  					return err
  2984  				}
  2985  				p.WebSearchURL = &webSearchURL
  2986  			}
  2987  		case "potentialAction":
  2988  			if v != nil {
  2989  				potentialAction, err := unmarshalBasicActionArray(*v)
  2990  				if err != nil {
  2991  					return err
  2992  				}
  2993  				p.PotentialAction = &potentialAction
  2994  			}
  2995  		case "immediateAction":
  2996  			if v != nil {
  2997  				immediateAction, err := unmarshalBasicActionArray(*v)
  2998  				if err != nil {
  2999  					return err
  3000  				}
  3001  				p.ImmediateAction = &immediateAction
  3002  			}
  3003  		case "preferredClickthroughUrl":
  3004  			if v != nil {
  3005  				var preferredClickthroughURL string
  3006  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  3007  				if err != nil {
  3008  					return err
  3009  				}
  3010  				p.PreferredClickthroughURL = &preferredClickthroughURL
  3011  			}
  3012  		case "adaptiveCard":
  3013  			if v != nil {
  3014  				var adaptiveCard string
  3015  				err = json.Unmarshal(*v, &adaptiveCard)
  3016  				if err != nil {
  3017  					return err
  3018  				}
  3019  				p.AdaptiveCard = &adaptiveCard
  3020  			}
  3021  		case "id":
  3022  			if v != nil {
  3023  				var ID string
  3024  				err = json.Unmarshal(*v, &ID)
  3025  				if err != nil {
  3026  					return err
  3027  				}
  3028  				p.ID = &ID
  3029  			}
  3030  		case "_type":
  3031  			if v != nil {
  3032  				var typeVar TypeBasicResponseBase
  3033  				err = json.Unmarshal(*v, &typeVar)
  3034  				if err != nil {
  3035  					return err
  3036  				}
  3037  				p.Type = typeVar
  3038  			}
  3039  		}
  3040  	}
  3041  
  3042  	return nil
  3043  }
  3044  
  3045  // PostalAddress defines a postal address.
  3046  type PostalAddress struct {
  3047  	// StreetAddress - READ-ONLY
  3048  	StreetAddress *string `json:"streetAddress,omitempty"`
  3049  	// AddressLocality - READ-ONLY; The city where the street address is located. For example, Seattle.
  3050  	AddressLocality *string `json:"addressLocality,omitempty"`
  3051  	// AddressSubregion - READ-ONLY
  3052  	AddressSubregion *string `json:"addressSubregion,omitempty"`
  3053  	// AddressRegion - READ-ONLY; The state or province code where the street address is located. This could be the two-letter code. For example, WA, or the full name , Washington.
  3054  	AddressRegion *string `json:"addressRegion,omitempty"`
  3055  	// PostalCode - READ-ONLY; The zip code or postal code where the street address is located. For example, 98052.
  3056  	PostalCode *string `json:"postalCode,omitempty"`
  3057  	// PostOfficeBoxNumber - READ-ONLY
  3058  	PostOfficeBoxNumber *string `json:"postOfficeBoxNumber,omitempty"`
  3059  	// AddressCountry - READ-ONLY; The country/region where the street address is located. This could be the two-letter ISO code. For example, US, or the full name, United States.
  3060  	AddressCountry *string `json:"addressCountry,omitempty"`
  3061  	// CountryIso - READ-ONLY; The two letter ISO code of this country. For example, US.
  3062  	CountryIso *string `json:"countryIso,omitempty"`
  3063  	// Neighborhood - READ-ONLY; The neighborhood where the street address is located. For example, Westlake.
  3064  	Neighborhood *string `json:"neighborhood,omitempty"`
  3065  	// AddressRegionAbbreviation - READ-ONLY; Region Abbreviation. For example, WA.
  3066  	AddressRegionAbbreviation *string `json:"addressRegionAbbreviation,omitempty"`
  3067  	// Text - READ-ONLY; The complete address. For example, 2100 Westlake Ave N, Bellevue, WA 98052.
  3068  	Text *string `json:"text,omitempty"`
  3069  	// HouseNumber - READ-ONLY
  3070  	HouseNumber *string `json:"houseNumber,omitempty"`
  3071  	// StreetName - READ-ONLY
  3072  	StreetName *string `json:"streetName,omitempty"`
  3073  	// FormattingRuleID - READ-ONLY
  3074  	FormattingRuleID *string `json:"formattingRuleId,omitempty"`
  3075  	// Name - READ-ONLY; The name of the thing represented by this object.
  3076  	Name *string `json:"name,omitempty"`
  3077  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  3078  	URL *string `json:"url,omitempty"`
  3079  	// EntityPresentationInfo - READ-ONLY; Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields.
  3080  	EntityPresentationInfo BasicEntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
  3081  	// ReadLink - READ-ONLY; The URL that returns this resource.
  3082  	ReadLink *string `json:"readLink,omitempty"`
  3083  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  3084  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  3085  	// PotentialAction - READ-ONLY
  3086  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  3087  	// ImmediateAction - READ-ONLY
  3088  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  3089  	// PreferredClickthroughURL - READ-ONLY
  3090  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  3091  	// AdaptiveCard - READ-ONLY
  3092  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  3093  	// ID - READ-ONLY; A String identifier.
  3094  	ID *string `json:"id,omitempty"`
  3095  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  3096  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  3097  }
  3098  
  3099  // MarshalJSON is the custom marshaler for PostalAddress.
  3100  func (pa PostalAddress) MarshalJSON() ([]byte, error) {
  3101  	pa.Type = TypePostalAddress
  3102  	objectMap := make(map[string]interface{})
  3103  	if pa.Type != "" {
  3104  		objectMap["_type"] = pa.Type
  3105  	}
  3106  	return json.Marshal(objectMap)
  3107  }
  3108  
  3109  // AsThing is the BasicResponseBase implementation for PostalAddress.
  3110  func (pa PostalAddress) AsThing() (*Thing, bool) {
  3111  	return nil, false
  3112  }
  3113  
  3114  // AsBasicThing is the BasicResponseBase implementation for PostalAddress.
  3115  func (pa PostalAddress) AsBasicThing() (BasicThing, bool) {
  3116  	return &pa, true
  3117  }
  3118  
  3119  // AsPlaces is the BasicResponseBase implementation for PostalAddress.
  3120  func (pa PostalAddress) AsPlaces() (*Places, bool) {
  3121  	return nil, false
  3122  }
  3123  
  3124  // AsSearchResultsAnswer is the BasicResponseBase implementation for PostalAddress.
  3125  func (pa PostalAddress) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  3126  	return nil, false
  3127  }
  3128  
  3129  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for PostalAddress.
  3130  func (pa PostalAddress) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  3131  	return nil, false
  3132  }
  3133  
  3134  // AsSearchResponse is the BasicResponseBase implementation for PostalAddress.
  3135  func (pa PostalAddress) AsSearchResponse() (*SearchResponse, bool) {
  3136  	return nil, false
  3137  }
  3138  
  3139  // AsPostalAddress is the BasicResponseBase implementation for PostalAddress.
  3140  func (pa PostalAddress) AsPostalAddress() (*PostalAddress, bool) {
  3141  	return &pa, true
  3142  }
  3143  
  3144  // AsPlace is the BasicResponseBase implementation for PostalAddress.
  3145  func (pa PostalAddress) AsPlace() (*Place, bool) {
  3146  	return nil, false
  3147  }
  3148  
  3149  // AsAction is the BasicResponseBase implementation for PostalAddress.
  3150  func (pa PostalAddress) AsAction() (*Action, bool) {
  3151  	return nil, false
  3152  }
  3153  
  3154  // AsBasicAction is the BasicResponseBase implementation for PostalAddress.
  3155  func (pa PostalAddress) AsBasicAction() (BasicAction, bool) {
  3156  	return nil, false
  3157  }
  3158  
  3159  // AsResponse is the BasicResponseBase implementation for PostalAddress.
  3160  func (pa PostalAddress) AsResponse() (*Response, bool) {
  3161  	return nil, false
  3162  }
  3163  
  3164  // AsBasicResponse is the BasicResponseBase implementation for PostalAddress.
  3165  func (pa PostalAddress) AsBasicResponse() (BasicResponse, bool) {
  3166  	return &pa, true
  3167  }
  3168  
  3169  // AsIdentifiable is the BasicResponseBase implementation for PostalAddress.
  3170  func (pa PostalAddress) AsIdentifiable() (*Identifiable, bool) {
  3171  	return nil, false
  3172  }
  3173  
  3174  // AsBasicIdentifiable is the BasicResponseBase implementation for PostalAddress.
  3175  func (pa PostalAddress) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  3176  	return &pa, true
  3177  }
  3178  
  3179  // AsAnswer is the BasicResponseBase implementation for PostalAddress.
  3180  func (pa PostalAddress) AsAnswer() (*Answer, bool) {
  3181  	return nil, false
  3182  }
  3183  
  3184  // AsBasicAnswer is the BasicResponseBase implementation for PostalAddress.
  3185  func (pa PostalAddress) AsBasicAnswer() (BasicAnswer, bool) {
  3186  	return nil, false
  3187  }
  3188  
  3189  // AsErrorResponse is the BasicResponseBase implementation for PostalAddress.
  3190  func (pa PostalAddress) AsErrorResponse() (*ErrorResponse, bool) {
  3191  	return nil, false
  3192  }
  3193  
  3194  // AsCreativeWork is the BasicResponseBase implementation for PostalAddress.
  3195  func (pa PostalAddress) AsCreativeWork() (*CreativeWork, bool) {
  3196  	return nil, false
  3197  }
  3198  
  3199  // AsBasicCreativeWork is the BasicResponseBase implementation for PostalAddress.
  3200  func (pa PostalAddress) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  3201  	return nil, false
  3202  }
  3203  
  3204  // AsIntangible is the BasicResponseBase implementation for PostalAddress.
  3205  func (pa PostalAddress) AsIntangible() (*Intangible, bool) {
  3206  	return nil, false
  3207  }
  3208  
  3209  // AsBasicIntangible is the BasicResponseBase implementation for PostalAddress.
  3210  func (pa PostalAddress) AsBasicIntangible() (BasicIntangible, bool) {
  3211  	return &pa, true
  3212  }
  3213  
  3214  // AsSearchAction is the BasicResponseBase implementation for PostalAddress.
  3215  func (pa PostalAddress) AsSearchAction() (*SearchAction, bool) {
  3216  	return nil, false
  3217  }
  3218  
  3219  // AsStructuredValue is the BasicResponseBase implementation for PostalAddress.
  3220  func (pa PostalAddress) AsStructuredValue() (*StructuredValue, bool) {
  3221  	return nil, false
  3222  }
  3223  
  3224  // AsBasicStructuredValue is the BasicResponseBase implementation for PostalAddress.
  3225  func (pa PostalAddress) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  3226  	return &pa, true
  3227  }
  3228  
  3229  // AsResponseBase is the BasicResponseBase implementation for PostalAddress.
  3230  func (pa PostalAddress) AsResponseBase() (*ResponseBase, bool) {
  3231  	return nil, false
  3232  }
  3233  
  3234  // AsBasicResponseBase is the BasicResponseBase implementation for PostalAddress.
  3235  func (pa PostalAddress) AsBasicResponseBase() (BasicResponseBase, bool) {
  3236  	return &pa, true
  3237  }
  3238  
  3239  // UnmarshalJSON is the custom unmarshaler for PostalAddress struct.
  3240  func (pa *PostalAddress) UnmarshalJSON(body []byte) error {
  3241  	var m map[string]*json.RawMessage
  3242  	err := json.Unmarshal(body, &m)
  3243  	if err != nil {
  3244  		return err
  3245  	}
  3246  	for k, v := range m {
  3247  		switch k {
  3248  		case "streetAddress":
  3249  			if v != nil {
  3250  				var streetAddress string
  3251  				err = json.Unmarshal(*v, &streetAddress)
  3252  				if err != nil {
  3253  					return err
  3254  				}
  3255  				pa.StreetAddress = &streetAddress
  3256  			}
  3257  		case "addressLocality":
  3258  			if v != nil {
  3259  				var addressLocality string
  3260  				err = json.Unmarshal(*v, &addressLocality)
  3261  				if err != nil {
  3262  					return err
  3263  				}
  3264  				pa.AddressLocality = &addressLocality
  3265  			}
  3266  		case "addressSubregion":
  3267  			if v != nil {
  3268  				var addressSubregion string
  3269  				err = json.Unmarshal(*v, &addressSubregion)
  3270  				if err != nil {
  3271  					return err
  3272  				}
  3273  				pa.AddressSubregion = &addressSubregion
  3274  			}
  3275  		case "addressRegion":
  3276  			if v != nil {
  3277  				var addressRegion string
  3278  				err = json.Unmarshal(*v, &addressRegion)
  3279  				if err != nil {
  3280  					return err
  3281  				}
  3282  				pa.AddressRegion = &addressRegion
  3283  			}
  3284  		case "postalCode":
  3285  			if v != nil {
  3286  				var postalCode string
  3287  				err = json.Unmarshal(*v, &postalCode)
  3288  				if err != nil {
  3289  					return err
  3290  				}
  3291  				pa.PostalCode = &postalCode
  3292  			}
  3293  		case "postOfficeBoxNumber":
  3294  			if v != nil {
  3295  				var postOfficeBoxNumber string
  3296  				err = json.Unmarshal(*v, &postOfficeBoxNumber)
  3297  				if err != nil {
  3298  					return err
  3299  				}
  3300  				pa.PostOfficeBoxNumber = &postOfficeBoxNumber
  3301  			}
  3302  		case "addressCountry":
  3303  			if v != nil {
  3304  				var addressCountry string
  3305  				err = json.Unmarshal(*v, &addressCountry)
  3306  				if err != nil {
  3307  					return err
  3308  				}
  3309  				pa.AddressCountry = &addressCountry
  3310  			}
  3311  		case "countryIso":
  3312  			if v != nil {
  3313  				var countryIso string
  3314  				err = json.Unmarshal(*v, &countryIso)
  3315  				if err != nil {
  3316  					return err
  3317  				}
  3318  				pa.CountryIso = &countryIso
  3319  			}
  3320  		case "neighborhood":
  3321  			if v != nil {
  3322  				var neighborhood string
  3323  				err = json.Unmarshal(*v, &neighborhood)
  3324  				if err != nil {
  3325  					return err
  3326  				}
  3327  				pa.Neighborhood = &neighborhood
  3328  			}
  3329  		case "addressRegionAbbreviation":
  3330  			if v != nil {
  3331  				var addressRegionAbbreviation string
  3332  				err = json.Unmarshal(*v, &addressRegionAbbreviation)
  3333  				if err != nil {
  3334  					return err
  3335  				}
  3336  				pa.AddressRegionAbbreviation = &addressRegionAbbreviation
  3337  			}
  3338  		case "text":
  3339  			if v != nil {
  3340  				var textVar string
  3341  				err = json.Unmarshal(*v, &textVar)
  3342  				if err != nil {
  3343  					return err
  3344  				}
  3345  				pa.Text = &textVar
  3346  			}
  3347  		case "houseNumber":
  3348  			if v != nil {
  3349  				var houseNumber string
  3350  				err = json.Unmarshal(*v, &houseNumber)
  3351  				if err != nil {
  3352  					return err
  3353  				}
  3354  				pa.HouseNumber = &houseNumber
  3355  			}
  3356  		case "streetName":
  3357  			if v != nil {
  3358  				var streetName string
  3359  				err = json.Unmarshal(*v, &streetName)
  3360  				if err != nil {
  3361  					return err
  3362  				}
  3363  				pa.StreetName = &streetName
  3364  			}
  3365  		case "formattingRuleId":
  3366  			if v != nil {
  3367  				var formattingRuleID string
  3368  				err = json.Unmarshal(*v, &formattingRuleID)
  3369  				if err != nil {
  3370  					return err
  3371  				}
  3372  				pa.FormattingRuleID = &formattingRuleID
  3373  			}
  3374  		case "name":
  3375  			if v != nil {
  3376  				var name string
  3377  				err = json.Unmarshal(*v, &name)
  3378  				if err != nil {
  3379  					return err
  3380  				}
  3381  				pa.Name = &name
  3382  			}
  3383  		case "url":
  3384  			if v != nil {
  3385  				var URL string
  3386  				err = json.Unmarshal(*v, &URL)
  3387  				if err != nil {
  3388  					return err
  3389  				}
  3390  				pa.URL = &URL
  3391  			}
  3392  		case "entityPresentationInfo":
  3393  			if v != nil {
  3394  				entityPresentationInfo, err := unmarshalBasicEntitiesEntityPresentationInfo(*v)
  3395  				if err != nil {
  3396  					return err
  3397  				}
  3398  				pa.EntityPresentationInfo = entityPresentationInfo
  3399  			}
  3400  		case "readLink":
  3401  			if v != nil {
  3402  				var readLink string
  3403  				err = json.Unmarshal(*v, &readLink)
  3404  				if err != nil {
  3405  					return err
  3406  				}
  3407  				pa.ReadLink = &readLink
  3408  			}
  3409  		case "webSearchUrl":
  3410  			if v != nil {
  3411  				var webSearchURL string
  3412  				err = json.Unmarshal(*v, &webSearchURL)
  3413  				if err != nil {
  3414  					return err
  3415  				}
  3416  				pa.WebSearchURL = &webSearchURL
  3417  			}
  3418  		case "potentialAction":
  3419  			if v != nil {
  3420  				potentialAction, err := unmarshalBasicActionArray(*v)
  3421  				if err != nil {
  3422  					return err
  3423  				}
  3424  				pa.PotentialAction = &potentialAction
  3425  			}
  3426  		case "immediateAction":
  3427  			if v != nil {
  3428  				immediateAction, err := unmarshalBasicActionArray(*v)
  3429  				if err != nil {
  3430  					return err
  3431  				}
  3432  				pa.ImmediateAction = &immediateAction
  3433  			}
  3434  		case "preferredClickthroughUrl":
  3435  			if v != nil {
  3436  				var preferredClickthroughURL string
  3437  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  3438  				if err != nil {
  3439  					return err
  3440  				}
  3441  				pa.PreferredClickthroughURL = &preferredClickthroughURL
  3442  			}
  3443  		case "adaptiveCard":
  3444  			if v != nil {
  3445  				var adaptiveCard string
  3446  				err = json.Unmarshal(*v, &adaptiveCard)
  3447  				if err != nil {
  3448  					return err
  3449  				}
  3450  				pa.AdaptiveCard = &adaptiveCard
  3451  			}
  3452  		case "id":
  3453  			if v != nil {
  3454  				var ID string
  3455  				err = json.Unmarshal(*v, &ID)
  3456  				if err != nil {
  3457  					return err
  3458  				}
  3459  				pa.ID = &ID
  3460  			}
  3461  		case "_type":
  3462  			if v != nil {
  3463  				var typeVar TypeBasicResponseBase
  3464  				err = json.Unmarshal(*v, &typeVar)
  3465  				if err != nil {
  3466  					return err
  3467  				}
  3468  				pa.Type = typeVar
  3469  			}
  3470  		}
  3471  	}
  3472  
  3473  	return nil
  3474  }
  3475  
  3476  // BasicQueryContext defines the query context that Bing used for the request.
  3477  type BasicQueryContext interface {
  3478  	AsQueryContext() (*QueryContext, bool)
  3479  }
  3480  
  3481  // QueryContext defines the query context that Bing used for the request.
  3482  type QueryContext struct {
  3483  	// OriginalQuery - The query string as specified in the request.
  3484  	OriginalQuery *string `json:"originalQuery,omitempty"`
  3485  	// AlteredQuery - READ-ONLY; The query string used by Bing to perform the query. Bing uses the altered query string if the original query string contained spelling mistakes. For example, if the query string is "saling downwind", the altered query string will be "sailing downwind". This field is included only if the original query string contains a spelling mistake.
  3486  	AlteredQuery *string `json:"alteredQuery,omitempty"`
  3487  	// AlterationDisplayQuery - READ-ONLY; AlteredQuery that is formatted for display purpose. The query string in the AlterationDisplayQuery can be html-escaped and can contain hit-highlighting characters
  3488  	AlterationDisplayQuery *string `json:"alterationDisplayQuery,omitempty"`
  3489  	// AlterationOverrideQuery - READ-ONLY; The query string to use to force Bing to use the original string. For example, if the query string is "saling downwind", the override query string will be "+saling downwind". Remember to encode the query string which results in "%2Bsaling+downwind". This field is included only if the original query string contains a spelling mistake.
  3490  	AlterationOverrideQuery *string `json:"alterationOverrideQuery,omitempty"`
  3491  	// AdultIntent - READ-ONLY; A Boolean value that indicates whether the specified query has adult intent. The value is true if the query has adult intent; otherwise, false.
  3492  	AdultIntent *bool `json:"adultIntent,omitempty"`
  3493  	// AskUserForLocation - READ-ONLY; A Boolean value that indicates whether Bing requires the user's location to provide accurate results. If you specified the user's location by using the X-MSEdge-ClientIP and X-Search-Location headers, you can ignore this field. For location aware queries, such as "today's weather" or "restaurants near me" that need the user's location to provide accurate results, this field is set to true. For location aware queries that include the location (for example, "Seattle weather"), this field is set to false. This field is also set to false for queries that are not location aware, such as "best sellers".
  3494  	AskUserForLocation *bool `json:"askUserForLocation,omitempty"`
  3495  	// IsTransactional - READ-ONLY
  3496  	IsTransactional *bool `json:"isTransactional,omitempty"`
  3497  	// Type - Possible values include: 'TypeQueryContext'
  3498  	Type Type `json:"_type,omitempty"`
  3499  }
  3500  
  3501  func unmarshalBasicQueryContext(body []byte) (BasicQueryContext, error) {
  3502  	var m map[string]interface{}
  3503  	err := json.Unmarshal(body, &m)
  3504  	if err != nil {
  3505  		return nil, err
  3506  	}
  3507  
  3508  	switch m["_type"] {
  3509  	default:
  3510  		var qc QueryContext
  3511  		err := json.Unmarshal(body, &qc)
  3512  		return qc, err
  3513  	}
  3514  }
  3515  func unmarshalBasicQueryContextArray(body []byte) ([]BasicQueryContext, error) {
  3516  	var rawMessages []*json.RawMessage
  3517  	err := json.Unmarshal(body, &rawMessages)
  3518  	if err != nil {
  3519  		return nil, err
  3520  	}
  3521  
  3522  	qcArray := make([]BasicQueryContext, len(rawMessages))
  3523  
  3524  	for index, rawMessage := range rawMessages {
  3525  		qc, err := unmarshalBasicQueryContext(*rawMessage)
  3526  		if err != nil {
  3527  			return nil, err
  3528  		}
  3529  		qcArray[index] = qc
  3530  	}
  3531  	return qcArray, nil
  3532  }
  3533  
  3534  // MarshalJSON is the custom marshaler for QueryContext.
  3535  func (qc QueryContext) MarshalJSON() ([]byte, error) {
  3536  	qc.Type = TypeQueryContext
  3537  	objectMap := make(map[string]interface{})
  3538  	if qc.OriginalQuery != nil {
  3539  		objectMap["originalQuery"] = qc.OriginalQuery
  3540  	}
  3541  	if qc.Type != "" {
  3542  		objectMap["_type"] = qc.Type
  3543  	}
  3544  	return json.Marshal(objectMap)
  3545  }
  3546  
  3547  // AsQueryContext is the BasicQueryContext implementation for QueryContext.
  3548  func (qc QueryContext) AsQueryContext() (*QueryContext, bool) {
  3549  	return &qc, true
  3550  }
  3551  
  3552  // AsBasicQueryContext is the BasicQueryContext implementation for QueryContext.
  3553  func (qc QueryContext) AsBasicQueryContext() (BasicQueryContext, bool) {
  3554  	return &qc, true
  3555  }
  3556  
  3557  // BasicResponse defines a response. All schemas that return at the root of the response must inherit from this object.
  3558  type BasicResponse interface {
  3559  	AsThing() (*Thing, bool)
  3560  	AsBasicThing() (BasicThing, bool)
  3561  	AsPlaces() (*Places, bool)
  3562  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  3563  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  3564  	AsSearchResponse() (*SearchResponse, bool)
  3565  	AsPostalAddress() (*PostalAddress, bool)
  3566  	AsPlace() (*Place, bool)
  3567  	AsAction() (*Action, bool)
  3568  	AsBasicAction() (BasicAction, bool)
  3569  	AsAnswer() (*Answer, bool)
  3570  	AsBasicAnswer() (BasicAnswer, bool)
  3571  	AsErrorResponse() (*ErrorResponse, bool)
  3572  	AsCreativeWork() (*CreativeWork, bool)
  3573  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  3574  	AsIntangible() (*Intangible, bool)
  3575  	AsBasicIntangible() (BasicIntangible, bool)
  3576  	AsSearchAction() (*SearchAction, bool)
  3577  	AsStructuredValue() (*StructuredValue, bool)
  3578  	AsBasicStructuredValue() (BasicStructuredValue, bool)
  3579  	AsResponse() (*Response, bool)
  3580  }
  3581  
  3582  // Response defines a response. All schemas that return at the root of the response must inherit from this
  3583  // object.
  3584  type Response struct {
  3585  	// ReadLink - READ-ONLY; The URL that returns this resource.
  3586  	ReadLink *string `json:"readLink,omitempty"`
  3587  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  3588  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  3589  	// PotentialAction - READ-ONLY
  3590  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  3591  	// ImmediateAction - READ-ONLY
  3592  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  3593  	// PreferredClickthroughURL - READ-ONLY
  3594  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  3595  	// AdaptiveCard - READ-ONLY
  3596  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  3597  	// ID - READ-ONLY; A String identifier.
  3598  	ID *string `json:"id,omitempty"`
  3599  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  3600  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  3601  }
  3602  
  3603  func unmarshalBasicResponse(body []byte) (BasicResponse, error) {
  3604  	var m map[string]interface{}
  3605  	err := json.Unmarshal(body, &m)
  3606  	if err != nil {
  3607  		return nil, err
  3608  	}
  3609  
  3610  	switch m["_type"] {
  3611  	case string(TypeThing):
  3612  		var t Thing
  3613  		err := json.Unmarshal(body, &t)
  3614  		return t, err
  3615  	case string(TypePlaces):
  3616  		var p Places
  3617  		err := json.Unmarshal(body, &p)
  3618  		return p, err
  3619  	case string(TypeSearchResultsAnswer):
  3620  		var sra SearchResultsAnswer
  3621  		err := json.Unmarshal(body, &sra)
  3622  		return sra, err
  3623  	case string(TypeSearchResponse):
  3624  		var sr SearchResponse
  3625  		err := json.Unmarshal(body, &sr)
  3626  		return sr, err
  3627  	case string(TypePostalAddress):
  3628  		var pa PostalAddress
  3629  		err := json.Unmarshal(body, &pa)
  3630  		return pa, err
  3631  	case string(TypePlace):
  3632  		var p Place
  3633  		err := json.Unmarshal(body, &p)
  3634  		return p, err
  3635  	case string(TypeAction):
  3636  		var a Action
  3637  		err := json.Unmarshal(body, &a)
  3638  		return a, err
  3639  	case string(TypeAnswer):
  3640  		var a Answer
  3641  		err := json.Unmarshal(body, &a)
  3642  		return a, err
  3643  	case string(TypeErrorResponse):
  3644  		var er ErrorResponse
  3645  		err := json.Unmarshal(body, &er)
  3646  		return er, err
  3647  	case string(TypeCreativeWork):
  3648  		var cw CreativeWork
  3649  		err := json.Unmarshal(body, &cw)
  3650  		return cw, err
  3651  	case string(TypeIntangible):
  3652  		var i Intangible
  3653  		err := json.Unmarshal(body, &i)
  3654  		return i, err
  3655  	case string(TypeSearchAction):
  3656  		var sa SearchAction
  3657  		err := json.Unmarshal(body, &sa)
  3658  		return sa, err
  3659  	case string(TypeStructuredValue):
  3660  		var sv StructuredValue
  3661  		err := json.Unmarshal(body, &sv)
  3662  		return sv, err
  3663  	default:
  3664  		var r Response
  3665  		err := json.Unmarshal(body, &r)
  3666  		return r, err
  3667  	}
  3668  }
  3669  func unmarshalBasicResponseArray(body []byte) ([]BasicResponse, error) {
  3670  	var rawMessages []*json.RawMessage
  3671  	err := json.Unmarshal(body, &rawMessages)
  3672  	if err != nil {
  3673  		return nil, err
  3674  	}
  3675  
  3676  	rArray := make([]BasicResponse, len(rawMessages))
  3677  
  3678  	for index, rawMessage := range rawMessages {
  3679  		r, err := unmarshalBasicResponse(*rawMessage)
  3680  		if err != nil {
  3681  			return nil, err
  3682  		}
  3683  		rArray[index] = r
  3684  	}
  3685  	return rArray, nil
  3686  }
  3687  
  3688  // MarshalJSON is the custom marshaler for Response.
  3689  func (r Response) MarshalJSON() ([]byte, error) {
  3690  	r.Type = TypeResponse
  3691  	objectMap := make(map[string]interface{})
  3692  	if r.Type != "" {
  3693  		objectMap["_type"] = r.Type
  3694  	}
  3695  	return json.Marshal(objectMap)
  3696  }
  3697  
  3698  // AsThing is the BasicResponseBase implementation for Response.
  3699  func (r Response) AsThing() (*Thing, bool) {
  3700  	return nil, false
  3701  }
  3702  
  3703  // AsBasicThing is the BasicResponseBase implementation for Response.
  3704  func (r Response) AsBasicThing() (BasicThing, bool) {
  3705  	return nil, false
  3706  }
  3707  
  3708  // AsPlaces is the BasicResponseBase implementation for Response.
  3709  func (r Response) AsPlaces() (*Places, bool) {
  3710  	return nil, false
  3711  }
  3712  
  3713  // AsSearchResultsAnswer is the BasicResponseBase implementation for Response.
  3714  func (r Response) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  3715  	return nil, false
  3716  }
  3717  
  3718  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Response.
  3719  func (r Response) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  3720  	return nil, false
  3721  }
  3722  
  3723  // AsSearchResponse is the BasicResponseBase implementation for Response.
  3724  func (r Response) AsSearchResponse() (*SearchResponse, bool) {
  3725  	return nil, false
  3726  }
  3727  
  3728  // AsPostalAddress is the BasicResponseBase implementation for Response.
  3729  func (r Response) AsPostalAddress() (*PostalAddress, bool) {
  3730  	return nil, false
  3731  }
  3732  
  3733  // AsPlace is the BasicResponseBase implementation for Response.
  3734  func (r Response) AsPlace() (*Place, bool) {
  3735  	return nil, false
  3736  }
  3737  
  3738  // AsAction is the BasicResponseBase implementation for Response.
  3739  func (r Response) AsAction() (*Action, bool) {
  3740  	return nil, false
  3741  }
  3742  
  3743  // AsBasicAction is the BasicResponseBase implementation for Response.
  3744  func (r Response) AsBasicAction() (BasicAction, bool) {
  3745  	return nil, false
  3746  }
  3747  
  3748  // AsResponse is the BasicResponseBase implementation for Response.
  3749  func (r Response) AsResponse() (*Response, bool) {
  3750  	return &r, true
  3751  }
  3752  
  3753  // AsBasicResponse is the BasicResponseBase implementation for Response.
  3754  func (r Response) AsBasicResponse() (BasicResponse, bool) {
  3755  	return &r, true
  3756  }
  3757  
  3758  // AsIdentifiable is the BasicResponseBase implementation for Response.
  3759  func (r Response) AsIdentifiable() (*Identifiable, bool) {
  3760  	return nil, false
  3761  }
  3762  
  3763  // AsBasicIdentifiable is the BasicResponseBase implementation for Response.
  3764  func (r Response) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  3765  	return &r, true
  3766  }
  3767  
  3768  // AsAnswer is the BasicResponseBase implementation for Response.
  3769  func (r Response) AsAnswer() (*Answer, bool) {
  3770  	return nil, false
  3771  }
  3772  
  3773  // AsBasicAnswer is the BasicResponseBase implementation for Response.
  3774  func (r Response) AsBasicAnswer() (BasicAnswer, bool) {
  3775  	return nil, false
  3776  }
  3777  
  3778  // AsErrorResponse is the BasicResponseBase implementation for Response.
  3779  func (r Response) AsErrorResponse() (*ErrorResponse, bool) {
  3780  	return nil, false
  3781  }
  3782  
  3783  // AsCreativeWork is the BasicResponseBase implementation for Response.
  3784  func (r Response) AsCreativeWork() (*CreativeWork, bool) {
  3785  	return nil, false
  3786  }
  3787  
  3788  // AsBasicCreativeWork is the BasicResponseBase implementation for Response.
  3789  func (r Response) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  3790  	return nil, false
  3791  }
  3792  
  3793  // AsIntangible is the BasicResponseBase implementation for Response.
  3794  func (r Response) AsIntangible() (*Intangible, bool) {
  3795  	return nil, false
  3796  }
  3797  
  3798  // AsBasicIntangible is the BasicResponseBase implementation for Response.
  3799  func (r Response) AsBasicIntangible() (BasicIntangible, bool) {
  3800  	return nil, false
  3801  }
  3802  
  3803  // AsSearchAction is the BasicResponseBase implementation for Response.
  3804  func (r Response) AsSearchAction() (*SearchAction, bool) {
  3805  	return nil, false
  3806  }
  3807  
  3808  // AsStructuredValue is the BasicResponseBase implementation for Response.
  3809  func (r Response) AsStructuredValue() (*StructuredValue, bool) {
  3810  	return nil, false
  3811  }
  3812  
  3813  // AsBasicStructuredValue is the BasicResponseBase implementation for Response.
  3814  func (r Response) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  3815  	return nil, false
  3816  }
  3817  
  3818  // AsResponseBase is the BasicResponseBase implementation for Response.
  3819  func (r Response) AsResponseBase() (*ResponseBase, bool) {
  3820  	return nil, false
  3821  }
  3822  
  3823  // AsBasicResponseBase is the BasicResponseBase implementation for Response.
  3824  func (r Response) AsBasicResponseBase() (BasicResponseBase, bool) {
  3825  	return &r, true
  3826  }
  3827  
  3828  // UnmarshalJSON is the custom unmarshaler for Response struct.
  3829  func (r *Response) UnmarshalJSON(body []byte) error {
  3830  	var m map[string]*json.RawMessage
  3831  	err := json.Unmarshal(body, &m)
  3832  	if err != nil {
  3833  		return err
  3834  	}
  3835  	for k, v := range m {
  3836  		switch k {
  3837  		case "readLink":
  3838  			if v != nil {
  3839  				var readLink string
  3840  				err = json.Unmarshal(*v, &readLink)
  3841  				if err != nil {
  3842  					return err
  3843  				}
  3844  				r.ReadLink = &readLink
  3845  			}
  3846  		case "webSearchUrl":
  3847  			if v != nil {
  3848  				var webSearchURL string
  3849  				err = json.Unmarshal(*v, &webSearchURL)
  3850  				if err != nil {
  3851  					return err
  3852  				}
  3853  				r.WebSearchURL = &webSearchURL
  3854  			}
  3855  		case "potentialAction":
  3856  			if v != nil {
  3857  				potentialAction, err := unmarshalBasicActionArray(*v)
  3858  				if err != nil {
  3859  					return err
  3860  				}
  3861  				r.PotentialAction = &potentialAction
  3862  			}
  3863  		case "immediateAction":
  3864  			if v != nil {
  3865  				immediateAction, err := unmarshalBasicActionArray(*v)
  3866  				if err != nil {
  3867  					return err
  3868  				}
  3869  				r.ImmediateAction = &immediateAction
  3870  			}
  3871  		case "preferredClickthroughUrl":
  3872  			if v != nil {
  3873  				var preferredClickthroughURL string
  3874  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  3875  				if err != nil {
  3876  					return err
  3877  				}
  3878  				r.PreferredClickthroughURL = &preferredClickthroughURL
  3879  			}
  3880  		case "adaptiveCard":
  3881  			if v != nil {
  3882  				var adaptiveCard string
  3883  				err = json.Unmarshal(*v, &adaptiveCard)
  3884  				if err != nil {
  3885  					return err
  3886  				}
  3887  				r.AdaptiveCard = &adaptiveCard
  3888  			}
  3889  		case "id":
  3890  			if v != nil {
  3891  				var ID string
  3892  				err = json.Unmarshal(*v, &ID)
  3893  				if err != nil {
  3894  					return err
  3895  				}
  3896  				r.ID = &ID
  3897  			}
  3898  		case "_type":
  3899  			if v != nil {
  3900  				var typeVar TypeBasicResponseBase
  3901  				err = json.Unmarshal(*v, &typeVar)
  3902  				if err != nil {
  3903  					return err
  3904  				}
  3905  				r.Type = typeVar
  3906  			}
  3907  		}
  3908  	}
  3909  
  3910  	return nil
  3911  }
  3912  
  3913  // BasicResponseBase response base
  3914  type BasicResponseBase interface {
  3915  	AsThing() (*Thing, bool)
  3916  	AsBasicThing() (BasicThing, bool)
  3917  	AsPlaces() (*Places, bool)
  3918  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  3919  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  3920  	AsSearchResponse() (*SearchResponse, bool)
  3921  	AsPostalAddress() (*PostalAddress, bool)
  3922  	AsPlace() (*Place, bool)
  3923  	AsAction() (*Action, bool)
  3924  	AsBasicAction() (BasicAction, bool)
  3925  	AsResponse() (*Response, bool)
  3926  	AsBasicResponse() (BasicResponse, bool)
  3927  	AsIdentifiable() (*Identifiable, bool)
  3928  	AsBasicIdentifiable() (BasicIdentifiable, bool)
  3929  	AsAnswer() (*Answer, bool)
  3930  	AsBasicAnswer() (BasicAnswer, bool)
  3931  	AsErrorResponse() (*ErrorResponse, bool)
  3932  	AsCreativeWork() (*CreativeWork, bool)
  3933  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  3934  	AsIntangible() (*Intangible, bool)
  3935  	AsBasicIntangible() (BasicIntangible, bool)
  3936  	AsSearchAction() (*SearchAction, bool)
  3937  	AsStructuredValue() (*StructuredValue, bool)
  3938  	AsBasicStructuredValue() (BasicStructuredValue, bool)
  3939  	AsResponseBase() (*ResponseBase, bool)
  3940  }
  3941  
  3942  // ResponseBase response base
  3943  type ResponseBase struct {
  3944  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  3945  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  3946  }
  3947  
  3948  func unmarshalBasicResponseBase(body []byte) (BasicResponseBase, error) {
  3949  	var m map[string]interface{}
  3950  	err := json.Unmarshal(body, &m)
  3951  	if err != nil {
  3952  		return nil, err
  3953  	}
  3954  
  3955  	switch m["_type"] {
  3956  	case string(TypeThing):
  3957  		var t Thing
  3958  		err := json.Unmarshal(body, &t)
  3959  		return t, err
  3960  	case string(TypePlaces):
  3961  		var p Places
  3962  		err := json.Unmarshal(body, &p)
  3963  		return p, err
  3964  	case string(TypeSearchResultsAnswer):
  3965  		var sra SearchResultsAnswer
  3966  		err := json.Unmarshal(body, &sra)
  3967  		return sra, err
  3968  	case string(TypeSearchResponse):
  3969  		var sr SearchResponse
  3970  		err := json.Unmarshal(body, &sr)
  3971  		return sr, err
  3972  	case string(TypePostalAddress):
  3973  		var pa PostalAddress
  3974  		err := json.Unmarshal(body, &pa)
  3975  		return pa, err
  3976  	case string(TypePlace):
  3977  		var p Place
  3978  		err := json.Unmarshal(body, &p)
  3979  		return p, err
  3980  	case string(TypeAction):
  3981  		var a Action
  3982  		err := json.Unmarshal(body, &a)
  3983  		return a, err
  3984  	case string(TypeResponse):
  3985  		var r Response
  3986  		err := json.Unmarshal(body, &r)
  3987  		return r, err
  3988  	case string(TypeIdentifiable):
  3989  		var i Identifiable
  3990  		err := json.Unmarshal(body, &i)
  3991  		return i, err
  3992  	case string(TypeAnswer):
  3993  		var a Answer
  3994  		err := json.Unmarshal(body, &a)
  3995  		return a, err
  3996  	case string(TypeErrorResponse):
  3997  		var er ErrorResponse
  3998  		err := json.Unmarshal(body, &er)
  3999  		return er, err
  4000  	case string(TypeCreativeWork):
  4001  		var cw CreativeWork
  4002  		err := json.Unmarshal(body, &cw)
  4003  		return cw, err
  4004  	case string(TypeIntangible):
  4005  		var i Intangible
  4006  		err := json.Unmarshal(body, &i)
  4007  		return i, err
  4008  	case string(TypeSearchAction):
  4009  		var sa SearchAction
  4010  		err := json.Unmarshal(body, &sa)
  4011  		return sa, err
  4012  	case string(TypeStructuredValue):
  4013  		var sv StructuredValue
  4014  		err := json.Unmarshal(body, &sv)
  4015  		return sv, err
  4016  	default:
  4017  		var rb ResponseBase
  4018  		err := json.Unmarshal(body, &rb)
  4019  		return rb, err
  4020  	}
  4021  }
  4022  func unmarshalBasicResponseBaseArray(body []byte) ([]BasicResponseBase, error) {
  4023  	var rawMessages []*json.RawMessage
  4024  	err := json.Unmarshal(body, &rawMessages)
  4025  	if err != nil {
  4026  		return nil, err
  4027  	}
  4028  
  4029  	rbArray := make([]BasicResponseBase, len(rawMessages))
  4030  
  4031  	for index, rawMessage := range rawMessages {
  4032  		rb, err := unmarshalBasicResponseBase(*rawMessage)
  4033  		if err != nil {
  4034  			return nil, err
  4035  		}
  4036  		rbArray[index] = rb
  4037  	}
  4038  	return rbArray, nil
  4039  }
  4040  
  4041  // MarshalJSON is the custom marshaler for ResponseBase.
  4042  func (rb ResponseBase) MarshalJSON() ([]byte, error) {
  4043  	rb.Type = TypeResponseBase
  4044  	objectMap := make(map[string]interface{})
  4045  	if rb.Type != "" {
  4046  		objectMap["_type"] = rb.Type
  4047  	}
  4048  	return json.Marshal(objectMap)
  4049  }
  4050  
  4051  // AsThing is the BasicResponseBase implementation for ResponseBase.
  4052  func (rb ResponseBase) AsThing() (*Thing, bool) {
  4053  	return nil, false
  4054  }
  4055  
  4056  // AsBasicThing is the BasicResponseBase implementation for ResponseBase.
  4057  func (rb ResponseBase) AsBasicThing() (BasicThing, bool) {
  4058  	return nil, false
  4059  }
  4060  
  4061  // AsPlaces is the BasicResponseBase implementation for ResponseBase.
  4062  func (rb ResponseBase) AsPlaces() (*Places, bool) {
  4063  	return nil, false
  4064  }
  4065  
  4066  // AsSearchResultsAnswer is the BasicResponseBase implementation for ResponseBase.
  4067  func (rb ResponseBase) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  4068  	return nil, false
  4069  }
  4070  
  4071  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ResponseBase.
  4072  func (rb ResponseBase) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  4073  	return nil, false
  4074  }
  4075  
  4076  // AsSearchResponse is the BasicResponseBase implementation for ResponseBase.
  4077  func (rb ResponseBase) AsSearchResponse() (*SearchResponse, bool) {
  4078  	return nil, false
  4079  }
  4080  
  4081  // AsPostalAddress is the BasicResponseBase implementation for ResponseBase.
  4082  func (rb ResponseBase) AsPostalAddress() (*PostalAddress, bool) {
  4083  	return nil, false
  4084  }
  4085  
  4086  // AsPlace is the BasicResponseBase implementation for ResponseBase.
  4087  func (rb ResponseBase) AsPlace() (*Place, bool) {
  4088  	return nil, false
  4089  }
  4090  
  4091  // AsAction is the BasicResponseBase implementation for ResponseBase.
  4092  func (rb ResponseBase) AsAction() (*Action, bool) {
  4093  	return nil, false
  4094  }
  4095  
  4096  // AsBasicAction is the BasicResponseBase implementation for ResponseBase.
  4097  func (rb ResponseBase) AsBasicAction() (BasicAction, bool) {
  4098  	return nil, false
  4099  }
  4100  
  4101  // AsResponse is the BasicResponseBase implementation for ResponseBase.
  4102  func (rb ResponseBase) AsResponse() (*Response, bool) {
  4103  	return nil, false
  4104  }
  4105  
  4106  // AsBasicResponse is the BasicResponseBase implementation for ResponseBase.
  4107  func (rb ResponseBase) AsBasicResponse() (BasicResponse, bool) {
  4108  	return nil, false
  4109  }
  4110  
  4111  // AsIdentifiable is the BasicResponseBase implementation for ResponseBase.
  4112  func (rb ResponseBase) AsIdentifiable() (*Identifiable, bool) {
  4113  	return nil, false
  4114  }
  4115  
  4116  // AsBasicIdentifiable is the BasicResponseBase implementation for ResponseBase.
  4117  func (rb ResponseBase) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  4118  	return nil, false
  4119  }
  4120  
  4121  // AsAnswer is the BasicResponseBase implementation for ResponseBase.
  4122  func (rb ResponseBase) AsAnswer() (*Answer, bool) {
  4123  	return nil, false
  4124  }
  4125  
  4126  // AsBasicAnswer is the BasicResponseBase implementation for ResponseBase.
  4127  func (rb ResponseBase) AsBasicAnswer() (BasicAnswer, bool) {
  4128  	return nil, false
  4129  }
  4130  
  4131  // AsErrorResponse is the BasicResponseBase implementation for ResponseBase.
  4132  func (rb ResponseBase) AsErrorResponse() (*ErrorResponse, bool) {
  4133  	return nil, false
  4134  }
  4135  
  4136  // AsCreativeWork is the BasicResponseBase implementation for ResponseBase.
  4137  func (rb ResponseBase) AsCreativeWork() (*CreativeWork, bool) {
  4138  	return nil, false
  4139  }
  4140  
  4141  // AsBasicCreativeWork is the BasicResponseBase implementation for ResponseBase.
  4142  func (rb ResponseBase) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  4143  	return nil, false
  4144  }
  4145  
  4146  // AsIntangible is the BasicResponseBase implementation for ResponseBase.
  4147  func (rb ResponseBase) AsIntangible() (*Intangible, bool) {
  4148  	return nil, false
  4149  }
  4150  
  4151  // AsBasicIntangible is the BasicResponseBase implementation for ResponseBase.
  4152  func (rb ResponseBase) AsBasicIntangible() (BasicIntangible, bool) {
  4153  	return nil, false
  4154  }
  4155  
  4156  // AsSearchAction is the BasicResponseBase implementation for ResponseBase.
  4157  func (rb ResponseBase) AsSearchAction() (*SearchAction, bool) {
  4158  	return nil, false
  4159  }
  4160  
  4161  // AsStructuredValue is the BasicResponseBase implementation for ResponseBase.
  4162  func (rb ResponseBase) AsStructuredValue() (*StructuredValue, bool) {
  4163  	return nil, false
  4164  }
  4165  
  4166  // AsBasicStructuredValue is the BasicResponseBase implementation for ResponseBase.
  4167  func (rb ResponseBase) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  4168  	return nil, false
  4169  }
  4170  
  4171  // AsResponseBase is the BasicResponseBase implementation for ResponseBase.
  4172  func (rb ResponseBase) AsResponseBase() (*ResponseBase, bool) {
  4173  	return &rb, true
  4174  }
  4175  
  4176  // AsBasicResponseBase is the BasicResponseBase implementation for ResponseBase.
  4177  func (rb ResponseBase) AsBasicResponseBase() (BasicResponseBase, bool) {
  4178  	return &rb, true
  4179  }
  4180  
  4181  // SearchAction ...
  4182  type SearchAction struct {
  4183  	// DisplayText - READ-ONLY
  4184  	DisplayText *string `json:"displayText,omitempty"`
  4185  	// Query - READ-ONLY
  4186  	Query *string `json:"query,omitempty"`
  4187  	// RichContent - READ-ONLY
  4188  	RichContent *[]BasicAnswer `json:"richContent,omitempty"`
  4189  	// FormattingRuleID - READ-ONLY
  4190  	FormattingRuleID *string `json:"formattingRuleId,omitempty"`
  4191  	// Location - READ-ONLY
  4192  	Location *[]Place `json:"location,omitempty"`
  4193  	// Result - READ-ONLY; The result produced in the action.
  4194  	Result *[]BasicThing `json:"result,omitempty"`
  4195  	// DisplayName - READ-ONLY; A display name for the action.
  4196  	DisplayName *string `json:"displayName,omitempty"`
  4197  	// IsTopAction - READ-ONLY; A Boolean representing whether this result is the top action.
  4198  	IsTopAction *bool `json:"isTopAction,omitempty"`
  4199  	// ServiceURL - READ-ONLY; Use this URL to get additional data to determine how to take the appropriate action. For example, the serviceUrl might return JSON along with an image URL.
  4200  	ServiceURL *string `json:"serviceUrl,omitempty"`
  4201  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
  4202  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
  4203  	// About - READ-ONLY; For internal use only.
  4204  	About *[]BasicThing `json:"about,omitempty"`
  4205  	// Mentions - READ-ONLY; For internal use only.
  4206  	Mentions *[]BasicThing `json:"mentions,omitempty"`
  4207  	// Provider - READ-ONLY; The source of the creative work.
  4208  	Provider *[]BasicThing `json:"provider,omitempty"`
  4209  	// Creator - READ-ONLY
  4210  	Creator BasicThing `json:"creator,omitempty"`
  4211  	// Text - READ-ONLY; Text content of this creative work
  4212  	Text *string `json:"text,omitempty"`
  4213  	// DiscussionURL - READ-ONLY
  4214  	DiscussionURL *string `json:"discussionUrl,omitempty"`
  4215  	// CommentCount - READ-ONLY
  4216  	CommentCount *int32 `json:"commentCount,omitempty"`
  4217  	// MainEntity - READ-ONLY
  4218  	MainEntity BasicThing `json:"mainEntity,omitempty"`
  4219  	// HeadLine - READ-ONLY
  4220  	HeadLine *string `json:"headLine,omitempty"`
  4221  	// CopyrightHolder - READ-ONLY
  4222  	CopyrightHolder BasicThing `json:"copyrightHolder,omitempty"`
  4223  	// CopyrightYear - READ-ONLY
  4224  	CopyrightYear *int32 `json:"copyrightYear,omitempty"`
  4225  	// Disclaimer - READ-ONLY
  4226  	Disclaimer *string `json:"disclaimer,omitempty"`
  4227  	// IsAccessibleForFree - READ-ONLY
  4228  	IsAccessibleForFree *bool `json:"isAccessibleForFree,omitempty"`
  4229  	// Genre - READ-ONLY
  4230  	Genre *[]string `json:"genre,omitempty"`
  4231  	// IsFamilyFriendly - READ-ONLY
  4232  	IsFamilyFriendly *bool `json:"isFamilyFriendly,omitempty"`
  4233  	// Name - READ-ONLY; The name of the thing represented by this object.
  4234  	Name *string `json:"name,omitempty"`
  4235  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  4236  	URL *string `json:"url,omitempty"`
  4237  	// EntityPresentationInfo - READ-ONLY; Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields.
  4238  	EntityPresentationInfo BasicEntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
  4239  	// ReadLink - READ-ONLY; The URL that returns this resource.
  4240  	ReadLink *string `json:"readLink,omitempty"`
  4241  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  4242  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  4243  	// PotentialAction - READ-ONLY
  4244  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  4245  	// ImmediateAction - READ-ONLY
  4246  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  4247  	// PreferredClickthroughURL - READ-ONLY
  4248  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  4249  	// AdaptiveCard - READ-ONLY
  4250  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  4251  	// ID - READ-ONLY; A String identifier.
  4252  	ID *string `json:"id,omitempty"`
  4253  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  4254  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  4255  }
  4256  
  4257  // MarshalJSON is the custom marshaler for SearchAction.
  4258  func (sa SearchAction) MarshalJSON() ([]byte, error) {
  4259  	sa.Type = TypeSearchAction
  4260  	objectMap := make(map[string]interface{})
  4261  	if sa.Type != "" {
  4262  		objectMap["_type"] = sa.Type
  4263  	}
  4264  	return json.Marshal(objectMap)
  4265  }
  4266  
  4267  // AsThing is the BasicResponseBase implementation for SearchAction.
  4268  func (sa SearchAction) AsThing() (*Thing, bool) {
  4269  	return nil, false
  4270  }
  4271  
  4272  // AsBasicThing is the BasicResponseBase implementation for SearchAction.
  4273  func (sa SearchAction) AsBasicThing() (BasicThing, bool) {
  4274  	return &sa, true
  4275  }
  4276  
  4277  // AsPlaces is the BasicResponseBase implementation for SearchAction.
  4278  func (sa SearchAction) AsPlaces() (*Places, bool) {
  4279  	return nil, false
  4280  }
  4281  
  4282  // AsSearchResultsAnswer is the BasicResponseBase implementation for SearchAction.
  4283  func (sa SearchAction) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  4284  	return nil, false
  4285  }
  4286  
  4287  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for SearchAction.
  4288  func (sa SearchAction) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  4289  	return nil, false
  4290  }
  4291  
  4292  // AsSearchResponse is the BasicResponseBase implementation for SearchAction.
  4293  func (sa SearchAction) AsSearchResponse() (*SearchResponse, bool) {
  4294  	return nil, false
  4295  }
  4296  
  4297  // AsPostalAddress is the BasicResponseBase implementation for SearchAction.
  4298  func (sa SearchAction) AsPostalAddress() (*PostalAddress, bool) {
  4299  	return nil, false
  4300  }
  4301  
  4302  // AsPlace is the BasicResponseBase implementation for SearchAction.
  4303  func (sa SearchAction) AsPlace() (*Place, bool) {
  4304  	return nil, false
  4305  }
  4306  
  4307  // AsAction is the BasicResponseBase implementation for SearchAction.
  4308  func (sa SearchAction) AsAction() (*Action, bool) {
  4309  	return nil, false
  4310  }
  4311  
  4312  // AsBasicAction is the BasicResponseBase implementation for SearchAction.
  4313  func (sa SearchAction) AsBasicAction() (BasicAction, bool) {
  4314  	return &sa, true
  4315  }
  4316  
  4317  // AsResponse is the BasicResponseBase implementation for SearchAction.
  4318  func (sa SearchAction) AsResponse() (*Response, bool) {
  4319  	return nil, false
  4320  }
  4321  
  4322  // AsBasicResponse is the BasicResponseBase implementation for SearchAction.
  4323  func (sa SearchAction) AsBasicResponse() (BasicResponse, bool) {
  4324  	return &sa, true
  4325  }
  4326  
  4327  // AsIdentifiable is the BasicResponseBase implementation for SearchAction.
  4328  func (sa SearchAction) AsIdentifiable() (*Identifiable, bool) {
  4329  	return nil, false
  4330  }
  4331  
  4332  // AsBasicIdentifiable is the BasicResponseBase implementation for SearchAction.
  4333  func (sa SearchAction) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  4334  	return &sa, true
  4335  }
  4336  
  4337  // AsAnswer is the BasicResponseBase implementation for SearchAction.
  4338  func (sa SearchAction) AsAnswer() (*Answer, bool) {
  4339  	return nil, false
  4340  }
  4341  
  4342  // AsBasicAnswer is the BasicResponseBase implementation for SearchAction.
  4343  func (sa SearchAction) AsBasicAnswer() (BasicAnswer, bool) {
  4344  	return nil, false
  4345  }
  4346  
  4347  // AsErrorResponse is the BasicResponseBase implementation for SearchAction.
  4348  func (sa SearchAction) AsErrorResponse() (*ErrorResponse, bool) {
  4349  	return nil, false
  4350  }
  4351  
  4352  // AsCreativeWork is the BasicResponseBase implementation for SearchAction.
  4353  func (sa SearchAction) AsCreativeWork() (*CreativeWork, bool) {
  4354  	return nil, false
  4355  }
  4356  
  4357  // AsBasicCreativeWork is the BasicResponseBase implementation for SearchAction.
  4358  func (sa SearchAction) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  4359  	return &sa, true
  4360  }
  4361  
  4362  // AsIntangible is the BasicResponseBase implementation for SearchAction.
  4363  func (sa SearchAction) AsIntangible() (*Intangible, bool) {
  4364  	return nil, false
  4365  }
  4366  
  4367  // AsBasicIntangible is the BasicResponseBase implementation for SearchAction.
  4368  func (sa SearchAction) AsBasicIntangible() (BasicIntangible, bool) {
  4369  	return nil, false
  4370  }
  4371  
  4372  // AsSearchAction is the BasicResponseBase implementation for SearchAction.
  4373  func (sa SearchAction) AsSearchAction() (*SearchAction, bool) {
  4374  	return &sa, true
  4375  }
  4376  
  4377  // AsStructuredValue is the BasicResponseBase implementation for SearchAction.
  4378  func (sa SearchAction) AsStructuredValue() (*StructuredValue, bool) {
  4379  	return nil, false
  4380  }
  4381  
  4382  // AsBasicStructuredValue is the BasicResponseBase implementation for SearchAction.
  4383  func (sa SearchAction) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  4384  	return nil, false
  4385  }
  4386  
  4387  // AsResponseBase is the BasicResponseBase implementation for SearchAction.
  4388  func (sa SearchAction) AsResponseBase() (*ResponseBase, bool) {
  4389  	return nil, false
  4390  }
  4391  
  4392  // AsBasicResponseBase is the BasicResponseBase implementation for SearchAction.
  4393  func (sa SearchAction) AsBasicResponseBase() (BasicResponseBase, bool) {
  4394  	return &sa, true
  4395  }
  4396  
  4397  // UnmarshalJSON is the custom unmarshaler for SearchAction struct.
  4398  func (sa *SearchAction) UnmarshalJSON(body []byte) error {
  4399  	var m map[string]*json.RawMessage
  4400  	err := json.Unmarshal(body, &m)
  4401  	if err != nil {
  4402  		return err
  4403  	}
  4404  	for k, v := range m {
  4405  		switch k {
  4406  		case "displayText":
  4407  			if v != nil {
  4408  				var displayText string
  4409  				err = json.Unmarshal(*v, &displayText)
  4410  				if err != nil {
  4411  					return err
  4412  				}
  4413  				sa.DisplayText = &displayText
  4414  			}
  4415  		case "query":
  4416  			if v != nil {
  4417  				var query string
  4418  				err = json.Unmarshal(*v, &query)
  4419  				if err != nil {
  4420  					return err
  4421  				}
  4422  				sa.Query = &query
  4423  			}
  4424  		case "richContent":
  4425  			if v != nil {
  4426  				richContent, err := unmarshalBasicAnswerArray(*v)
  4427  				if err != nil {
  4428  					return err
  4429  				}
  4430  				sa.RichContent = &richContent
  4431  			}
  4432  		case "formattingRuleId":
  4433  			if v != nil {
  4434  				var formattingRuleID string
  4435  				err = json.Unmarshal(*v, &formattingRuleID)
  4436  				if err != nil {
  4437  					return err
  4438  				}
  4439  				sa.FormattingRuleID = &formattingRuleID
  4440  			}
  4441  		case "location":
  4442  			if v != nil {
  4443  				var location []Place
  4444  				err = json.Unmarshal(*v, &location)
  4445  				if err != nil {
  4446  					return err
  4447  				}
  4448  				sa.Location = &location
  4449  			}
  4450  		case "result":
  4451  			if v != nil {
  4452  				resultVar, err := unmarshalBasicThingArray(*v)
  4453  				if err != nil {
  4454  					return err
  4455  				}
  4456  				sa.Result = &resultVar
  4457  			}
  4458  		case "displayName":
  4459  			if v != nil {
  4460  				var displayName string
  4461  				err = json.Unmarshal(*v, &displayName)
  4462  				if err != nil {
  4463  					return err
  4464  				}
  4465  				sa.DisplayName = &displayName
  4466  			}
  4467  		case "isTopAction":
  4468  			if v != nil {
  4469  				var isTopAction bool
  4470  				err = json.Unmarshal(*v, &isTopAction)
  4471  				if err != nil {
  4472  					return err
  4473  				}
  4474  				sa.IsTopAction = &isTopAction
  4475  			}
  4476  		case "serviceUrl":
  4477  			if v != nil {
  4478  				var serviceURL string
  4479  				err = json.Unmarshal(*v, &serviceURL)
  4480  				if err != nil {
  4481  					return err
  4482  				}
  4483  				sa.ServiceURL = &serviceURL
  4484  			}
  4485  		case "thumbnailUrl":
  4486  			if v != nil {
  4487  				var thumbnailURL string
  4488  				err = json.Unmarshal(*v, &thumbnailURL)
  4489  				if err != nil {
  4490  					return err
  4491  				}
  4492  				sa.ThumbnailURL = &thumbnailURL
  4493  			}
  4494  		case "about":
  4495  			if v != nil {
  4496  				about, err := unmarshalBasicThingArray(*v)
  4497  				if err != nil {
  4498  					return err
  4499  				}
  4500  				sa.About = &about
  4501  			}
  4502  		case "mentions":
  4503  			if v != nil {
  4504  				mentions, err := unmarshalBasicThingArray(*v)
  4505  				if err != nil {
  4506  					return err
  4507  				}
  4508  				sa.Mentions = &mentions
  4509  			}
  4510  		case "provider":
  4511  			if v != nil {
  4512  				provider, err := unmarshalBasicThingArray(*v)
  4513  				if err != nil {
  4514  					return err
  4515  				}
  4516  				sa.Provider = &provider
  4517  			}
  4518  		case "creator":
  4519  			if v != nil {
  4520  				creator, err := unmarshalBasicThing(*v)
  4521  				if err != nil {
  4522  					return err
  4523  				}
  4524  				sa.Creator = creator
  4525  			}
  4526  		case "text":
  4527  			if v != nil {
  4528  				var textVar string
  4529  				err = json.Unmarshal(*v, &textVar)
  4530  				if err != nil {
  4531  					return err
  4532  				}
  4533  				sa.Text = &textVar
  4534  			}
  4535  		case "discussionUrl":
  4536  			if v != nil {
  4537  				var discussionURL string
  4538  				err = json.Unmarshal(*v, &discussionURL)
  4539  				if err != nil {
  4540  					return err
  4541  				}
  4542  				sa.DiscussionURL = &discussionURL
  4543  			}
  4544  		case "commentCount":
  4545  			if v != nil {
  4546  				var commentCount int32
  4547  				err = json.Unmarshal(*v, &commentCount)
  4548  				if err != nil {
  4549  					return err
  4550  				}
  4551  				sa.CommentCount = &commentCount
  4552  			}
  4553  		case "mainEntity":
  4554  			if v != nil {
  4555  				mainEntity, err := unmarshalBasicThing(*v)
  4556  				if err != nil {
  4557  					return err
  4558  				}
  4559  				sa.MainEntity = mainEntity
  4560  			}
  4561  		case "headLine":
  4562  			if v != nil {
  4563  				var headLine string
  4564  				err = json.Unmarshal(*v, &headLine)
  4565  				if err != nil {
  4566  					return err
  4567  				}
  4568  				sa.HeadLine = &headLine
  4569  			}
  4570  		case "copyrightHolder":
  4571  			if v != nil {
  4572  				copyrightHolder, err := unmarshalBasicThing(*v)
  4573  				if err != nil {
  4574  					return err
  4575  				}
  4576  				sa.CopyrightHolder = copyrightHolder
  4577  			}
  4578  		case "copyrightYear":
  4579  			if v != nil {
  4580  				var copyrightYear int32
  4581  				err = json.Unmarshal(*v, &copyrightYear)
  4582  				if err != nil {
  4583  					return err
  4584  				}
  4585  				sa.CopyrightYear = &copyrightYear
  4586  			}
  4587  		case "disclaimer":
  4588  			if v != nil {
  4589  				var disclaimer string
  4590  				err = json.Unmarshal(*v, &disclaimer)
  4591  				if err != nil {
  4592  					return err
  4593  				}
  4594  				sa.Disclaimer = &disclaimer
  4595  			}
  4596  		case "isAccessibleForFree":
  4597  			if v != nil {
  4598  				var isAccessibleForFree bool
  4599  				err = json.Unmarshal(*v, &isAccessibleForFree)
  4600  				if err != nil {
  4601  					return err
  4602  				}
  4603  				sa.IsAccessibleForFree = &isAccessibleForFree
  4604  			}
  4605  		case "genre":
  4606  			if v != nil {
  4607  				var genre []string
  4608  				err = json.Unmarshal(*v, &genre)
  4609  				if err != nil {
  4610  					return err
  4611  				}
  4612  				sa.Genre = &genre
  4613  			}
  4614  		case "isFamilyFriendly":
  4615  			if v != nil {
  4616  				var isFamilyFriendly bool
  4617  				err = json.Unmarshal(*v, &isFamilyFriendly)
  4618  				if err != nil {
  4619  					return err
  4620  				}
  4621  				sa.IsFamilyFriendly = &isFamilyFriendly
  4622  			}
  4623  		case "name":
  4624  			if v != nil {
  4625  				var name string
  4626  				err = json.Unmarshal(*v, &name)
  4627  				if err != nil {
  4628  					return err
  4629  				}
  4630  				sa.Name = &name
  4631  			}
  4632  		case "url":
  4633  			if v != nil {
  4634  				var URL string
  4635  				err = json.Unmarshal(*v, &URL)
  4636  				if err != nil {
  4637  					return err
  4638  				}
  4639  				sa.URL = &URL
  4640  			}
  4641  		case "entityPresentationInfo":
  4642  			if v != nil {
  4643  				entityPresentationInfo, err := unmarshalBasicEntitiesEntityPresentationInfo(*v)
  4644  				if err != nil {
  4645  					return err
  4646  				}
  4647  				sa.EntityPresentationInfo = entityPresentationInfo
  4648  			}
  4649  		case "readLink":
  4650  			if v != nil {
  4651  				var readLink string
  4652  				err = json.Unmarshal(*v, &readLink)
  4653  				if err != nil {
  4654  					return err
  4655  				}
  4656  				sa.ReadLink = &readLink
  4657  			}
  4658  		case "webSearchUrl":
  4659  			if v != nil {
  4660  				var webSearchURL string
  4661  				err = json.Unmarshal(*v, &webSearchURL)
  4662  				if err != nil {
  4663  					return err
  4664  				}
  4665  				sa.WebSearchURL = &webSearchURL
  4666  			}
  4667  		case "potentialAction":
  4668  			if v != nil {
  4669  				potentialAction, err := unmarshalBasicActionArray(*v)
  4670  				if err != nil {
  4671  					return err
  4672  				}
  4673  				sa.PotentialAction = &potentialAction
  4674  			}
  4675  		case "immediateAction":
  4676  			if v != nil {
  4677  				immediateAction, err := unmarshalBasicActionArray(*v)
  4678  				if err != nil {
  4679  					return err
  4680  				}
  4681  				sa.ImmediateAction = &immediateAction
  4682  			}
  4683  		case "preferredClickthroughUrl":
  4684  			if v != nil {
  4685  				var preferredClickthroughURL string
  4686  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  4687  				if err != nil {
  4688  					return err
  4689  				}
  4690  				sa.PreferredClickthroughURL = &preferredClickthroughURL
  4691  			}
  4692  		case "adaptiveCard":
  4693  			if v != nil {
  4694  				var adaptiveCard string
  4695  				err = json.Unmarshal(*v, &adaptiveCard)
  4696  				if err != nil {
  4697  					return err
  4698  				}
  4699  				sa.AdaptiveCard = &adaptiveCard
  4700  			}
  4701  		case "id":
  4702  			if v != nil {
  4703  				var ID string
  4704  				err = json.Unmarshal(*v, &ID)
  4705  				if err != nil {
  4706  					return err
  4707  				}
  4708  				sa.ID = &ID
  4709  			}
  4710  		case "_type":
  4711  			if v != nil {
  4712  				var typeVar TypeBasicResponseBase
  4713  				err = json.Unmarshal(*v, &typeVar)
  4714  				if err != nil {
  4715  					return err
  4716  				}
  4717  				sa.Type = typeVar
  4718  			}
  4719  		}
  4720  	}
  4721  
  4722  	return nil
  4723  }
  4724  
  4725  // SearchResponse defines the top-level object that the response includes when the request succeeds.
  4726  type SearchResponse struct {
  4727  	autorest.Response `json:"-"`
  4728  	// QueryContext - READ-ONLY; An object that contains the query string that Bing used for the request. This object contains the query string as entered by the user. It may also contain an altered query string that Bing used for the query if the query string contained a spelling mistake.
  4729  	QueryContext BasicQueryContext `json:"queryContext,omitempty"`
  4730  	// Places - READ-ONLY; A list of local entities such as restaurants or hotels that are relevant to the query.
  4731  	Places *Places `json:"places,omitempty"`
  4732  	// Lottery - READ-ONLY
  4733  	Lottery BasicSearchResultsAnswer `json:"lottery,omitempty"`
  4734  	// SearchResultsConfidenceScore - READ-ONLY
  4735  	SearchResultsConfidenceScore *float64 `json:"searchResultsConfidenceScore,omitempty"`
  4736  	// ReadLink - READ-ONLY; The URL that returns this resource.
  4737  	ReadLink *string `json:"readLink,omitempty"`
  4738  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  4739  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  4740  	// PotentialAction - READ-ONLY
  4741  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  4742  	// ImmediateAction - READ-ONLY
  4743  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  4744  	// PreferredClickthroughURL - READ-ONLY
  4745  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  4746  	// AdaptiveCard - READ-ONLY
  4747  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  4748  	// ID - READ-ONLY; A String identifier.
  4749  	ID *string `json:"id,omitempty"`
  4750  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  4751  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  4752  }
  4753  
  4754  // MarshalJSON is the custom marshaler for SearchResponse.
  4755  func (sr SearchResponse) MarshalJSON() ([]byte, error) {
  4756  	sr.Type = TypeSearchResponse
  4757  	objectMap := make(map[string]interface{})
  4758  	if sr.Type != "" {
  4759  		objectMap["_type"] = sr.Type
  4760  	}
  4761  	return json.Marshal(objectMap)
  4762  }
  4763  
  4764  // AsThing is the BasicResponseBase implementation for SearchResponse.
  4765  func (sr SearchResponse) AsThing() (*Thing, bool) {
  4766  	return nil, false
  4767  }
  4768  
  4769  // AsBasicThing is the BasicResponseBase implementation for SearchResponse.
  4770  func (sr SearchResponse) AsBasicThing() (BasicThing, bool) {
  4771  	return nil, false
  4772  }
  4773  
  4774  // AsPlaces is the BasicResponseBase implementation for SearchResponse.
  4775  func (sr SearchResponse) AsPlaces() (*Places, bool) {
  4776  	return nil, false
  4777  }
  4778  
  4779  // AsSearchResultsAnswer is the BasicResponseBase implementation for SearchResponse.
  4780  func (sr SearchResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  4781  	return nil, false
  4782  }
  4783  
  4784  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for SearchResponse.
  4785  func (sr SearchResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  4786  	return nil, false
  4787  }
  4788  
  4789  // AsSearchResponse is the BasicResponseBase implementation for SearchResponse.
  4790  func (sr SearchResponse) AsSearchResponse() (*SearchResponse, bool) {
  4791  	return &sr, true
  4792  }
  4793  
  4794  // AsPostalAddress is the BasicResponseBase implementation for SearchResponse.
  4795  func (sr SearchResponse) AsPostalAddress() (*PostalAddress, bool) {
  4796  	return nil, false
  4797  }
  4798  
  4799  // AsPlace is the BasicResponseBase implementation for SearchResponse.
  4800  func (sr SearchResponse) AsPlace() (*Place, bool) {
  4801  	return nil, false
  4802  }
  4803  
  4804  // AsAction is the BasicResponseBase implementation for SearchResponse.
  4805  func (sr SearchResponse) AsAction() (*Action, bool) {
  4806  	return nil, false
  4807  }
  4808  
  4809  // AsBasicAction is the BasicResponseBase implementation for SearchResponse.
  4810  func (sr SearchResponse) AsBasicAction() (BasicAction, bool) {
  4811  	return nil, false
  4812  }
  4813  
  4814  // AsResponse is the BasicResponseBase implementation for SearchResponse.
  4815  func (sr SearchResponse) AsResponse() (*Response, bool) {
  4816  	return nil, false
  4817  }
  4818  
  4819  // AsBasicResponse is the BasicResponseBase implementation for SearchResponse.
  4820  func (sr SearchResponse) AsBasicResponse() (BasicResponse, bool) {
  4821  	return &sr, true
  4822  }
  4823  
  4824  // AsIdentifiable is the BasicResponseBase implementation for SearchResponse.
  4825  func (sr SearchResponse) AsIdentifiable() (*Identifiable, bool) {
  4826  	return nil, false
  4827  }
  4828  
  4829  // AsBasicIdentifiable is the BasicResponseBase implementation for SearchResponse.
  4830  func (sr SearchResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  4831  	return &sr, true
  4832  }
  4833  
  4834  // AsAnswer is the BasicResponseBase implementation for SearchResponse.
  4835  func (sr SearchResponse) AsAnswer() (*Answer, bool) {
  4836  	return nil, false
  4837  }
  4838  
  4839  // AsBasicAnswer is the BasicResponseBase implementation for SearchResponse.
  4840  func (sr SearchResponse) AsBasicAnswer() (BasicAnswer, bool) {
  4841  	return nil, false
  4842  }
  4843  
  4844  // AsErrorResponse is the BasicResponseBase implementation for SearchResponse.
  4845  func (sr SearchResponse) AsErrorResponse() (*ErrorResponse, bool) {
  4846  	return nil, false
  4847  }
  4848  
  4849  // AsCreativeWork is the BasicResponseBase implementation for SearchResponse.
  4850  func (sr SearchResponse) AsCreativeWork() (*CreativeWork, bool) {
  4851  	return nil, false
  4852  }
  4853  
  4854  // AsBasicCreativeWork is the BasicResponseBase implementation for SearchResponse.
  4855  func (sr SearchResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  4856  	return nil, false
  4857  }
  4858  
  4859  // AsIntangible is the BasicResponseBase implementation for SearchResponse.
  4860  func (sr SearchResponse) AsIntangible() (*Intangible, bool) {
  4861  	return nil, false
  4862  }
  4863  
  4864  // AsBasicIntangible is the BasicResponseBase implementation for SearchResponse.
  4865  func (sr SearchResponse) AsBasicIntangible() (BasicIntangible, bool) {
  4866  	return nil, false
  4867  }
  4868  
  4869  // AsSearchAction is the BasicResponseBase implementation for SearchResponse.
  4870  func (sr SearchResponse) AsSearchAction() (*SearchAction, bool) {
  4871  	return nil, false
  4872  }
  4873  
  4874  // AsStructuredValue is the BasicResponseBase implementation for SearchResponse.
  4875  func (sr SearchResponse) AsStructuredValue() (*StructuredValue, bool) {
  4876  	return nil, false
  4877  }
  4878  
  4879  // AsBasicStructuredValue is the BasicResponseBase implementation for SearchResponse.
  4880  func (sr SearchResponse) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  4881  	return nil, false
  4882  }
  4883  
  4884  // AsResponseBase is the BasicResponseBase implementation for SearchResponse.
  4885  func (sr SearchResponse) AsResponseBase() (*ResponseBase, bool) {
  4886  	return nil, false
  4887  }
  4888  
  4889  // AsBasicResponseBase is the BasicResponseBase implementation for SearchResponse.
  4890  func (sr SearchResponse) AsBasicResponseBase() (BasicResponseBase, bool) {
  4891  	return &sr, true
  4892  }
  4893  
  4894  // UnmarshalJSON is the custom unmarshaler for SearchResponse struct.
  4895  func (sr *SearchResponse) UnmarshalJSON(body []byte) error {
  4896  	var m map[string]*json.RawMessage
  4897  	err := json.Unmarshal(body, &m)
  4898  	if err != nil {
  4899  		return err
  4900  	}
  4901  	for k, v := range m {
  4902  		switch k {
  4903  		case "queryContext":
  4904  			if v != nil {
  4905  				queryContext, err := unmarshalBasicQueryContext(*v)
  4906  				if err != nil {
  4907  					return err
  4908  				}
  4909  				sr.QueryContext = queryContext
  4910  			}
  4911  		case "places":
  4912  			if v != nil {
  4913  				var places Places
  4914  				err = json.Unmarshal(*v, &places)
  4915  				if err != nil {
  4916  					return err
  4917  				}
  4918  				sr.Places = &places
  4919  			}
  4920  		case "lottery":
  4921  			if v != nil {
  4922  				lottery, err := unmarshalBasicSearchResultsAnswer(*v)
  4923  				if err != nil {
  4924  					return err
  4925  				}
  4926  				sr.Lottery = lottery
  4927  			}
  4928  		case "searchResultsConfidenceScore":
  4929  			if v != nil {
  4930  				var searchResultsConfidenceScore float64
  4931  				err = json.Unmarshal(*v, &searchResultsConfidenceScore)
  4932  				if err != nil {
  4933  					return err
  4934  				}
  4935  				sr.SearchResultsConfidenceScore = &searchResultsConfidenceScore
  4936  			}
  4937  		case "readLink":
  4938  			if v != nil {
  4939  				var readLink string
  4940  				err = json.Unmarshal(*v, &readLink)
  4941  				if err != nil {
  4942  					return err
  4943  				}
  4944  				sr.ReadLink = &readLink
  4945  			}
  4946  		case "webSearchUrl":
  4947  			if v != nil {
  4948  				var webSearchURL string
  4949  				err = json.Unmarshal(*v, &webSearchURL)
  4950  				if err != nil {
  4951  					return err
  4952  				}
  4953  				sr.WebSearchURL = &webSearchURL
  4954  			}
  4955  		case "potentialAction":
  4956  			if v != nil {
  4957  				potentialAction, err := unmarshalBasicActionArray(*v)
  4958  				if err != nil {
  4959  					return err
  4960  				}
  4961  				sr.PotentialAction = &potentialAction
  4962  			}
  4963  		case "immediateAction":
  4964  			if v != nil {
  4965  				immediateAction, err := unmarshalBasicActionArray(*v)
  4966  				if err != nil {
  4967  					return err
  4968  				}
  4969  				sr.ImmediateAction = &immediateAction
  4970  			}
  4971  		case "preferredClickthroughUrl":
  4972  			if v != nil {
  4973  				var preferredClickthroughURL string
  4974  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  4975  				if err != nil {
  4976  					return err
  4977  				}
  4978  				sr.PreferredClickthroughURL = &preferredClickthroughURL
  4979  			}
  4980  		case "adaptiveCard":
  4981  			if v != nil {
  4982  				var adaptiveCard string
  4983  				err = json.Unmarshal(*v, &adaptiveCard)
  4984  				if err != nil {
  4985  					return err
  4986  				}
  4987  				sr.AdaptiveCard = &adaptiveCard
  4988  			}
  4989  		case "id":
  4990  			if v != nil {
  4991  				var ID string
  4992  				err = json.Unmarshal(*v, &ID)
  4993  				if err != nil {
  4994  					return err
  4995  				}
  4996  				sr.ID = &ID
  4997  			}
  4998  		case "_type":
  4999  			if v != nil {
  5000  				var typeVar TypeBasicResponseBase
  5001  				err = json.Unmarshal(*v, &typeVar)
  5002  				if err != nil {
  5003  					return err
  5004  				}
  5005  				sr.Type = typeVar
  5006  			}
  5007  		}
  5008  	}
  5009  
  5010  	return nil
  5011  }
  5012  
  5013  // BasicSearchResultsAnswer defines a search result answer.
  5014  type BasicSearchResultsAnswer interface {
  5015  	AsPlaces() (*Places, bool)
  5016  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  5017  }
  5018  
  5019  // SearchResultsAnswer defines a search result answer.
  5020  type SearchResultsAnswer struct {
  5021  	// QueryContext - READ-ONLY
  5022  	QueryContext BasicQueryContext `json:"queryContext,omitempty"`
  5023  	// 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.
  5024  	TotalEstimatedMatches *int64 `json:"totalEstimatedMatches,omitempty"`
  5025  	// IsFamilyFriendly - READ-ONLY
  5026  	IsFamilyFriendly *bool `json:"isFamilyFriendly,omitempty"`
  5027  	// ReadLink - READ-ONLY; The URL that returns this resource.
  5028  	ReadLink *string `json:"readLink,omitempty"`
  5029  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  5030  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  5031  	// PotentialAction - READ-ONLY
  5032  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  5033  	// ImmediateAction - READ-ONLY
  5034  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  5035  	// PreferredClickthroughURL - READ-ONLY
  5036  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  5037  	// AdaptiveCard - READ-ONLY
  5038  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  5039  	// ID - READ-ONLY; A String identifier.
  5040  	ID *string `json:"id,omitempty"`
  5041  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  5042  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  5043  }
  5044  
  5045  func unmarshalBasicSearchResultsAnswer(body []byte) (BasicSearchResultsAnswer, error) {
  5046  	var m map[string]interface{}
  5047  	err := json.Unmarshal(body, &m)
  5048  	if err != nil {
  5049  		return nil, err
  5050  	}
  5051  
  5052  	switch m["_type"] {
  5053  	case string(TypePlaces):
  5054  		var p Places
  5055  		err := json.Unmarshal(body, &p)
  5056  		return p, err
  5057  	default:
  5058  		var sra SearchResultsAnswer
  5059  		err := json.Unmarshal(body, &sra)
  5060  		return sra, err
  5061  	}
  5062  }
  5063  func unmarshalBasicSearchResultsAnswerArray(body []byte) ([]BasicSearchResultsAnswer, error) {
  5064  	var rawMessages []*json.RawMessage
  5065  	err := json.Unmarshal(body, &rawMessages)
  5066  	if err != nil {
  5067  		return nil, err
  5068  	}
  5069  
  5070  	sraArray := make([]BasicSearchResultsAnswer, len(rawMessages))
  5071  
  5072  	for index, rawMessage := range rawMessages {
  5073  		sra, err := unmarshalBasicSearchResultsAnswer(*rawMessage)
  5074  		if err != nil {
  5075  			return nil, err
  5076  		}
  5077  		sraArray[index] = sra
  5078  	}
  5079  	return sraArray, nil
  5080  }
  5081  
  5082  // MarshalJSON is the custom marshaler for SearchResultsAnswer.
  5083  func (sra SearchResultsAnswer) MarshalJSON() ([]byte, error) {
  5084  	sra.Type = TypeSearchResultsAnswer
  5085  	objectMap := make(map[string]interface{})
  5086  	if sra.Type != "" {
  5087  		objectMap["_type"] = sra.Type
  5088  	}
  5089  	return json.Marshal(objectMap)
  5090  }
  5091  
  5092  // AsThing is the BasicResponseBase implementation for SearchResultsAnswer.
  5093  func (sra SearchResultsAnswer) AsThing() (*Thing, bool) {
  5094  	return nil, false
  5095  }
  5096  
  5097  // AsBasicThing is the BasicResponseBase implementation for SearchResultsAnswer.
  5098  func (sra SearchResultsAnswer) AsBasicThing() (BasicThing, bool) {
  5099  	return nil, false
  5100  }
  5101  
  5102  // AsPlaces is the BasicResponseBase implementation for SearchResultsAnswer.
  5103  func (sra SearchResultsAnswer) AsPlaces() (*Places, bool) {
  5104  	return nil, false
  5105  }
  5106  
  5107  // AsSearchResultsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  5108  func (sra SearchResultsAnswer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  5109  	return &sra, true
  5110  }
  5111  
  5112  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  5113  func (sra SearchResultsAnswer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  5114  	return &sra, true
  5115  }
  5116  
  5117  // AsSearchResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  5118  func (sra SearchResultsAnswer) AsSearchResponse() (*SearchResponse, bool) {
  5119  	return nil, false
  5120  }
  5121  
  5122  // AsPostalAddress is the BasicResponseBase implementation for SearchResultsAnswer.
  5123  func (sra SearchResultsAnswer) AsPostalAddress() (*PostalAddress, bool) {
  5124  	return nil, false
  5125  }
  5126  
  5127  // AsPlace is the BasicResponseBase implementation for SearchResultsAnswer.
  5128  func (sra SearchResultsAnswer) AsPlace() (*Place, bool) {
  5129  	return nil, false
  5130  }
  5131  
  5132  // AsAction is the BasicResponseBase implementation for SearchResultsAnswer.
  5133  func (sra SearchResultsAnswer) AsAction() (*Action, bool) {
  5134  	return nil, false
  5135  }
  5136  
  5137  // AsBasicAction is the BasicResponseBase implementation for SearchResultsAnswer.
  5138  func (sra SearchResultsAnswer) AsBasicAction() (BasicAction, bool) {
  5139  	return nil, false
  5140  }
  5141  
  5142  // AsResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  5143  func (sra SearchResultsAnswer) AsResponse() (*Response, bool) {
  5144  	return nil, false
  5145  }
  5146  
  5147  // AsBasicResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  5148  func (sra SearchResultsAnswer) AsBasicResponse() (BasicResponse, bool) {
  5149  	return &sra, true
  5150  }
  5151  
  5152  // AsIdentifiable is the BasicResponseBase implementation for SearchResultsAnswer.
  5153  func (sra SearchResultsAnswer) AsIdentifiable() (*Identifiable, bool) {
  5154  	return nil, false
  5155  }
  5156  
  5157  // AsBasicIdentifiable is the BasicResponseBase implementation for SearchResultsAnswer.
  5158  func (sra SearchResultsAnswer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  5159  	return &sra, true
  5160  }
  5161  
  5162  // AsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  5163  func (sra SearchResultsAnswer) AsAnswer() (*Answer, bool) {
  5164  	return nil, false
  5165  }
  5166  
  5167  // AsBasicAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  5168  func (sra SearchResultsAnswer) AsBasicAnswer() (BasicAnswer, bool) {
  5169  	return &sra, true
  5170  }
  5171  
  5172  // AsErrorResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  5173  func (sra SearchResultsAnswer) AsErrorResponse() (*ErrorResponse, bool) {
  5174  	return nil, false
  5175  }
  5176  
  5177  // AsCreativeWork is the BasicResponseBase implementation for SearchResultsAnswer.
  5178  func (sra SearchResultsAnswer) AsCreativeWork() (*CreativeWork, bool) {
  5179  	return nil, false
  5180  }
  5181  
  5182  // AsBasicCreativeWork is the BasicResponseBase implementation for SearchResultsAnswer.
  5183  func (sra SearchResultsAnswer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  5184  	return nil, false
  5185  }
  5186  
  5187  // AsIntangible is the BasicResponseBase implementation for SearchResultsAnswer.
  5188  func (sra SearchResultsAnswer) AsIntangible() (*Intangible, bool) {
  5189  	return nil, false
  5190  }
  5191  
  5192  // AsBasicIntangible is the BasicResponseBase implementation for SearchResultsAnswer.
  5193  func (sra SearchResultsAnswer) AsBasicIntangible() (BasicIntangible, bool) {
  5194  	return nil, false
  5195  }
  5196  
  5197  // AsSearchAction is the BasicResponseBase implementation for SearchResultsAnswer.
  5198  func (sra SearchResultsAnswer) AsSearchAction() (*SearchAction, bool) {
  5199  	return nil, false
  5200  }
  5201  
  5202  // AsStructuredValue is the BasicResponseBase implementation for SearchResultsAnswer.
  5203  func (sra SearchResultsAnswer) AsStructuredValue() (*StructuredValue, bool) {
  5204  	return nil, false
  5205  }
  5206  
  5207  // AsBasicStructuredValue is the BasicResponseBase implementation for SearchResultsAnswer.
  5208  func (sra SearchResultsAnswer) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  5209  	return nil, false
  5210  }
  5211  
  5212  // AsResponseBase is the BasicResponseBase implementation for SearchResultsAnswer.
  5213  func (sra SearchResultsAnswer) AsResponseBase() (*ResponseBase, bool) {
  5214  	return nil, false
  5215  }
  5216  
  5217  // AsBasicResponseBase is the BasicResponseBase implementation for SearchResultsAnswer.
  5218  func (sra SearchResultsAnswer) AsBasicResponseBase() (BasicResponseBase, bool) {
  5219  	return &sra, true
  5220  }
  5221  
  5222  // UnmarshalJSON is the custom unmarshaler for SearchResultsAnswer struct.
  5223  func (sra *SearchResultsAnswer) UnmarshalJSON(body []byte) error {
  5224  	var m map[string]*json.RawMessage
  5225  	err := json.Unmarshal(body, &m)
  5226  	if err != nil {
  5227  		return err
  5228  	}
  5229  	for k, v := range m {
  5230  		switch k {
  5231  		case "queryContext":
  5232  			if v != nil {
  5233  				queryContext, err := unmarshalBasicQueryContext(*v)
  5234  				if err != nil {
  5235  					return err
  5236  				}
  5237  				sra.QueryContext = queryContext
  5238  			}
  5239  		case "totalEstimatedMatches":
  5240  			if v != nil {
  5241  				var totalEstimatedMatches int64
  5242  				err = json.Unmarshal(*v, &totalEstimatedMatches)
  5243  				if err != nil {
  5244  					return err
  5245  				}
  5246  				sra.TotalEstimatedMatches = &totalEstimatedMatches
  5247  			}
  5248  		case "isFamilyFriendly":
  5249  			if v != nil {
  5250  				var isFamilyFriendly bool
  5251  				err = json.Unmarshal(*v, &isFamilyFriendly)
  5252  				if err != nil {
  5253  					return err
  5254  				}
  5255  				sra.IsFamilyFriendly = &isFamilyFriendly
  5256  			}
  5257  		case "readLink":
  5258  			if v != nil {
  5259  				var readLink string
  5260  				err = json.Unmarshal(*v, &readLink)
  5261  				if err != nil {
  5262  					return err
  5263  				}
  5264  				sra.ReadLink = &readLink
  5265  			}
  5266  		case "webSearchUrl":
  5267  			if v != nil {
  5268  				var webSearchURL string
  5269  				err = json.Unmarshal(*v, &webSearchURL)
  5270  				if err != nil {
  5271  					return err
  5272  				}
  5273  				sra.WebSearchURL = &webSearchURL
  5274  			}
  5275  		case "potentialAction":
  5276  			if v != nil {
  5277  				potentialAction, err := unmarshalBasicActionArray(*v)
  5278  				if err != nil {
  5279  					return err
  5280  				}
  5281  				sra.PotentialAction = &potentialAction
  5282  			}
  5283  		case "immediateAction":
  5284  			if v != nil {
  5285  				immediateAction, err := unmarshalBasicActionArray(*v)
  5286  				if err != nil {
  5287  					return err
  5288  				}
  5289  				sra.ImmediateAction = &immediateAction
  5290  			}
  5291  		case "preferredClickthroughUrl":
  5292  			if v != nil {
  5293  				var preferredClickthroughURL string
  5294  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  5295  				if err != nil {
  5296  					return err
  5297  				}
  5298  				sra.PreferredClickthroughURL = &preferredClickthroughURL
  5299  			}
  5300  		case "adaptiveCard":
  5301  			if v != nil {
  5302  				var adaptiveCard string
  5303  				err = json.Unmarshal(*v, &adaptiveCard)
  5304  				if err != nil {
  5305  					return err
  5306  				}
  5307  				sra.AdaptiveCard = &adaptiveCard
  5308  			}
  5309  		case "id":
  5310  			if v != nil {
  5311  				var ID string
  5312  				err = json.Unmarshal(*v, &ID)
  5313  				if err != nil {
  5314  					return err
  5315  				}
  5316  				sra.ID = &ID
  5317  			}
  5318  		case "_type":
  5319  			if v != nil {
  5320  				var typeVar TypeBasicResponseBase
  5321  				err = json.Unmarshal(*v, &typeVar)
  5322  				if err != nil {
  5323  					return err
  5324  				}
  5325  				sra.Type = typeVar
  5326  			}
  5327  		}
  5328  	}
  5329  
  5330  	return nil
  5331  }
  5332  
  5333  // BasicStructuredValue ...
  5334  type BasicStructuredValue interface {
  5335  	AsPostalAddress() (*PostalAddress, bool)
  5336  	AsStructuredValue() (*StructuredValue, bool)
  5337  }
  5338  
  5339  // StructuredValue ...
  5340  type StructuredValue struct {
  5341  	// Name - READ-ONLY; The name of the thing represented by this object.
  5342  	Name *string `json:"name,omitempty"`
  5343  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  5344  	URL *string `json:"url,omitempty"`
  5345  	// EntityPresentationInfo - READ-ONLY; Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields.
  5346  	EntityPresentationInfo BasicEntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
  5347  	// ReadLink - READ-ONLY; The URL that returns this resource.
  5348  	ReadLink *string `json:"readLink,omitempty"`
  5349  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  5350  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  5351  	// PotentialAction - READ-ONLY
  5352  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  5353  	// ImmediateAction - READ-ONLY
  5354  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  5355  	// PreferredClickthroughURL - READ-ONLY
  5356  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  5357  	// AdaptiveCard - READ-ONLY
  5358  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  5359  	// ID - READ-ONLY; A String identifier.
  5360  	ID *string `json:"id,omitempty"`
  5361  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  5362  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  5363  }
  5364  
  5365  func unmarshalBasicStructuredValue(body []byte) (BasicStructuredValue, error) {
  5366  	var m map[string]interface{}
  5367  	err := json.Unmarshal(body, &m)
  5368  	if err != nil {
  5369  		return nil, err
  5370  	}
  5371  
  5372  	switch m["_type"] {
  5373  	case string(TypePostalAddress):
  5374  		var pa PostalAddress
  5375  		err := json.Unmarshal(body, &pa)
  5376  		return pa, err
  5377  	default:
  5378  		var sv StructuredValue
  5379  		err := json.Unmarshal(body, &sv)
  5380  		return sv, err
  5381  	}
  5382  }
  5383  func unmarshalBasicStructuredValueArray(body []byte) ([]BasicStructuredValue, error) {
  5384  	var rawMessages []*json.RawMessage
  5385  	err := json.Unmarshal(body, &rawMessages)
  5386  	if err != nil {
  5387  		return nil, err
  5388  	}
  5389  
  5390  	svArray := make([]BasicStructuredValue, len(rawMessages))
  5391  
  5392  	for index, rawMessage := range rawMessages {
  5393  		sv, err := unmarshalBasicStructuredValue(*rawMessage)
  5394  		if err != nil {
  5395  			return nil, err
  5396  		}
  5397  		svArray[index] = sv
  5398  	}
  5399  	return svArray, nil
  5400  }
  5401  
  5402  // MarshalJSON is the custom marshaler for StructuredValue.
  5403  func (sv StructuredValue) MarshalJSON() ([]byte, error) {
  5404  	sv.Type = TypeStructuredValue
  5405  	objectMap := make(map[string]interface{})
  5406  	if sv.Type != "" {
  5407  		objectMap["_type"] = sv.Type
  5408  	}
  5409  	return json.Marshal(objectMap)
  5410  }
  5411  
  5412  // AsThing is the BasicResponseBase implementation for StructuredValue.
  5413  func (sv StructuredValue) AsThing() (*Thing, bool) {
  5414  	return nil, false
  5415  }
  5416  
  5417  // AsBasicThing is the BasicResponseBase implementation for StructuredValue.
  5418  func (sv StructuredValue) AsBasicThing() (BasicThing, bool) {
  5419  	return &sv, true
  5420  }
  5421  
  5422  // AsPlaces is the BasicResponseBase implementation for StructuredValue.
  5423  func (sv StructuredValue) AsPlaces() (*Places, bool) {
  5424  	return nil, false
  5425  }
  5426  
  5427  // AsSearchResultsAnswer is the BasicResponseBase implementation for StructuredValue.
  5428  func (sv StructuredValue) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  5429  	return nil, false
  5430  }
  5431  
  5432  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for StructuredValue.
  5433  func (sv StructuredValue) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  5434  	return nil, false
  5435  }
  5436  
  5437  // AsSearchResponse is the BasicResponseBase implementation for StructuredValue.
  5438  func (sv StructuredValue) AsSearchResponse() (*SearchResponse, bool) {
  5439  	return nil, false
  5440  }
  5441  
  5442  // AsPostalAddress is the BasicResponseBase implementation for StructuredValue.
  5443  func (sv StructuredValue) AsPostalAddress() (*PostalAddress, bool) {
  5444  	return nil, false
  5445  }
  5446  
  5447  // AsPlace is the BasicResponseBase implementation for StructuredValue.
  5448  func (sv StructuredValue) AsPlace() (*Place, bool) {
  5449  	return nil, false
  5450  }
  5451  
  5452  // AsAction is the BasicResponseBase implementation for StructuredValue.
  5453  func (sv StructuredValue) AsAction() (*Action, bool) {
  5454  	return nil, false
  5455  }
  5456  
  5457  // AsBasicAction is the BasicResponseBase implementation for StructuredValue.
  5458  func (sv StructuredValue) AsBasicAction() (BasicAction, bool) {
  5459  	return nil, false
  5460  }
  5461  
  5462  // AsResponse is the BasicResponseBase implementation for StructuredValue.
  5463  func (sv StructuredValue) AsResponse() (*Response, bool) {
  5464  	return nil, false
  5465  }
  5466  
  5467  // AsBasicResponse is the BasicResponseBase implementation for StructuredValue.
  5468  func (sv StructuredValue) AsBasicResponse() (BasicResponse, bool) {
  5469  	return &sv, true
  5470  }
  5471  
  5472  // AsIdentifiable is the BasicResponseBase implementation for StructuredValue.
  5473  func (sv StructuredValue) AsIdentifiable() (*Identifiable, bool) {
  5474  	return nil, false
  5475  }
  5476  
  5477  // AsBasicIdentifiable is the BasicResponseBase implementation for StructuredValue.
  5478  func (sv StructuredValue) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  5479  	return &sv, true
  5480  }
  5481  
  5482  // AsAnswer is the BasicResponseBase implementation for StructuredValue.
  5483  func (sv StructuredValue) AsAnswer() (*Answer, bool) {
  5484  	return nil, false
  5485  }
  5486  
  5487  // AsBasicAnswer is the BasicResponseBase implementation for StructuredValue.
  5488  func (sv StructuredValue) AsBasicAnswer() (BasicAnswer, bool) {
  5489  	return nil, false
  5490  }
  5491  
  5492  // AsErrorResponse is the BasicResponseBase implementation for StructuredValue.
  5493  func (sv StructuredValue) AsErrorResponse() (*ErrorResponse, bool) {
  5494  	return nil, false
  5495  }
  5496  
  5497  // AsCreativeWork is the BasicResponseBase implementation for StructuredValue.
  5498  func (sv StructuredValue) AsCreativeWork() (*CreativeWork, bool) {
  5499  	return nil, false
  5500  }
  5501  
  5502  // AsBasicCreativeWork is the BasicResponseBase implementation for StructuredValue.
  5503  func (sv StructuredValue) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  5504  	return nil, false
  5505  }
  5506  
  5507  // AsIntangible is the BasicResponseBase implementation for StructuredValue.
  5508  func (sv StructuredValue) AsIntangible() (*Intangible, bool) {
  5509  	return nil, false
  5510  }
  5511  
  5512  // AsBasicIntangible is the BasicResponseBase implementation for StructuredValue.
  5513  func (sv StructuredValue) AsBasicIntangible() (BasicIntangible, bool) {
  5514  	return &sv, true
  5515  }
  5516  
  5517  // AsSearchAction is the BasicResponseBase implementation for StructuredValue.
  5518  func (sv StructuredValue) AsSearchAction() (*SearchAction, bool) {
  5519  	return nil, false
  5520  }
  5521  
  5522  // AsStructuredValue is the BasicResponseBase implementation for StructuredValue.
  5523  func (sv StructuredValue) AsStructuredValue() (*StructuredValue, bool) {
  5524  	return &sv, true
  5525  }
  5526  
  5527  // AsBasicStructuredValue is the BasicResponseBase implementation for StructuredValue.
  5528  func (sv StructuredValue) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  5529  	return &sv, true
  5530  }
  5531  
  5532  // AsResponseBase is the BasicResponseBase implementation for StructuredValue.
  5533  func (sv StructuredValue) AsResponseBase() (*ResponseBase, bool) {
  5534  	return nil, false
  5535  }
  5536  
  5537  // AsBasicResponseBase is the BasicResponseBase implementation for StructuredValue.
  5538  func (sv StructuredValue) AsBasicResponseBase() (BasicResponseBase, bool) {
  5539  	return &sv, true
  5540  }
  5541  
  5542  // UnmarshalJSON is the custom unmarshaler for StructuredValue struct.
  5543  func (sv *StructuredValue) UnmarshalJSON(body []byte) error {
  5544  	var m map[string]*json.RawMessage
  5545  	err := json.Unmarshal(body, &m)
  5546  	if err != nil {
  5547  		return err
  5548  	}
  5549  	for k, v := range m {
  5550  		switch k {
  5551  		case "name":
  5552  			if v != nil {
  5553  				var name string
  5554  				err = json.Unmarshal(*v, &name)
  5555  				if err != nil {
  5556  					return err
  5557  				}
  5558  				sv.Name = &name
  5559  			}
  5560  		case "url":
  5561  			if v != nil {
  5562  				var URL string
  5563  				err = json.Unmarshal(*v, &URL)
  5564  				if err != nil {
  5565  					return err
  5566  				}
  5567  				sv.URL = &URL
  5568  			}
  5569  		case "entityPresentationInfo":
  5570  			if v != nil {
  5571  				entityPresentationInfo, err := unmarshalBasicEntitiesEntityPresentationInfo(*v)
  5572  				if err != nil {
  5573  					return err
  5574  				}
  5575  				sv.EntityPresentationInfo = entityPresentationInfo
  5576  			}
  5577  		case "readLink":
  5578  			if v != nil {
  5579  				var readLink string
  5580  				err = json.Unmarshal(*v, &readLink)
  5581  				if err != nil {
  5582  					return err
  5583  				}
  5584  				sv.ReadLink = &readLink
  5585  			}
  5586  		case "webSearchUrl":
  5587  			if v != nil {
  5588  				var webSearchURL string
  5589  				err = json.Unmarshal(*v, &webSearchURL)
  5590  				if err != nil {
  5591  					return err
  5592  				}
  5593  				sv.WebSearchURL = &webSearchURL
  5594  			}
  5595  		case "potentialAction":
  5596  			if v != nil {
  5597  				potentialAction, err := unmarshalBasicActionArray(*v)
  5598  				if err != nil {
  5599  					return err
  5600  				}
  5601  				sv.PotentialAction = &potentialAction
  5602  			}
  5603  		case "immediateAction":
  5604  			if v != nil {
  5605  				immediateAction, err := unmarshalBasicActionArray(*v)
  5606  				if err != nil {
  5607  					return err
  5608  				}
  5609  				sv.ImmediateAction = &immediateAction
  5610  			}
  5611  		case "preferredClickthroughUrl":
  5612  			if v != nil {
  5613  				var preferredClickthroughURL string
  5614  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  5615  				if err != nil {
  5616  					return err
  5617  				}
  5618  				sv.PreferredClickthroughURL = &preferredClickthroughURL
  5619  			}
  5620  		case "adaptiveCard":
  5621  			if v != nil {
  5622  				var adaptiveCard string
  5623  				err = json.Unmarshal(*v, &adaptiveCard)
  5624  				if err != nil {
  5625  					return err
  5626  				}
  5627  				sv.AdaptiveCard = &adaptiveCard
  5628  			}
  5629  		case "id":
  5630  			if v != nil {
  5631  				var ID string
  5632  				err = json.Unmarshal(*v, &ID)
  5633  				if err != nil {
  5634  					return err
  5635  				}
  5636  				sv.ID = &ID
  5637  			}
  5638  		case "_type":
  5639  			if v != nil {
  5640  				var typeVar TypeBasicResponseBase
  5641  				err = json.Unmarshal(*v, &typeVar)
  5642  				if err != nil {
  5643  					return err
  5644  				}
  5645  				sv.Type = typeVar
  5646  			}
  5647  		}
  5648  	}
  5649  
  5650  	return nil
  5651  }
  5652  
  5653  // BasicThing defines a thing.
  5654  type BasicThing interface {
  5655  	AsPostalAddress() (*PostalAddress, bool)
  5656  	AsPlace() (*Place, bool)
  5657  	AsAction() (*Action, bool)
  5658  	AsBasicAction() (BasicAction, bool)
  5659  	AsCreativeWork() (*CreativeWork, bool)
  5660  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  5661  	AsIntangible() (*Intangible, bool)
  5662  	AsBasicIntangible() (BasicIntangible, bool)
  5663  	AsSearchAction() (*SearchAction, bool)
  5664  	AsStructuredValue() (*StructuredValue, bool)
  5665  	AsBasicStructuredValue() (BasicStructuredValue, bool)
  5666  	AsThing() (*Thing, bool)
  5667  }
  5668  
  5669  // Thing defines a thing.
  5670  type Thing struct {
  5671  	// Name - READ-ONLY; The name of the thing represented by this object.
  5672  	Name *string `json:"name,omitempty"`
  5673  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  5674  	URL *string `json:"url,omitempty"`
  5675  	// EntityPresentationInfo - READ-ONLY; Additional information about the entity such as hints that you can use to determine the entity's type. To determine the entity's type, use the entityScenario and entityTypeHint fields.
  5676  	EntityPresentationInfo BasicEntitiesEntityPresentationInfo `json:"entityPresentationInfo,omitempty"`
  5677  	// ReadLink - READ-ONLY; The URL that returns this resource.
  5678  	ReadLink *string `json:"readLink,omitempty"`
  5679  	// WebSearchURL - READ-ONLY; The URL to Bing's search result for this item.
  5680  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  5681  	// PotentialAction - READ-ONLY
  5682  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  5683  	// ImmediateAction - READ-ONLY
  5684  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  5685  	// PreferredClickthroughURL - READ-ONLY
  5686  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  5687  	// AdaptiveCard - READ-ONLY
  5688  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  5689  	// ID - READ-ONLY; A String identifier.
  5690  	ID *string `json:"id,omitempty"`
  5691  	// Type - Possible values include: 'TypeResponseBase', 'TypeThing', 'TypePlaces', 'TypeSearchResultsAnswer', 'TypeSearchResponse', 'TypePostalAddress', 'TypePlace', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeAnswer', 'TypeErrorResponse', 'TypeCreativeWork', 'TypeIntangible', 'TypeSearchAction', 'TypeStructuredValue'
  5692  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  5693  }
  5694  
  5695  func unmarshalBasicThing(body []byte) (BasicThing, error) {
  5696  	var m map[string]interface{}
  5697  	err := json.Unmarshal(body, &m)
  5698  	if err != nil {
  5699  		return nil, err
  5700  	}
  5701  
  5702  	switch m["_type"] {
  5703  	case string(TypePostalAddress):
  5704  		var pa PostalAddress
  5705  		err := json.Unmarshal(body, &pa)
  5706  		return pa, err
  5707  	case string(TypePlace):
  5708  		var p Place
  5709  		err := json.Unmarshal(body, &p)
  5710  		return p, err
  5711  	case string(TypeAction):
  5712  		var a Action
  5713  		err := json.Unmarshal(body, &a)
  5714  		return a, err
  5715  	case string(TypeCreativeWork):
  5716  		var cw CreativeWork
  5717  		err := json.Unmarshal(body, &cw)
  5718  		return cw, err
  5719  	case string(TypeIntangible):
  5720  		var i Intangible
  5721  		err := json.Unmarshal(body, &i)
  5722  		return i, err
  5723  	case string(TypeSearchAction):
  5724  		var sa SearchAction
  5725  		err := json.Unmarshal(body, &sa)
  5726  		return sa, err
  5727  	case string(TypeStructuredValue):
  5728  		var sv StructuredValue
  5729  		err := json.Unmarshal(body, &sv)
  5730  		return sv, err
  5731  	default:
  5732  		var t Thing
  5733  		err := json.Unmarshal(body, &t)
  5734  		return t, err
  5735  	}
  5736  }
  5737  func unmarshalBasicThingArray(body []byte) ([]BasicThing, error) {
  5738  	var rawMessages []*json.RawMessage
  5739  	err := json.Unmarshal(body, &rawMessages)
  5740  	if err != nil {
  5741  		return nil, err
  5742  	}
  5743  
  5744  	tArray := make([]BasicThing, len(rawMessages))
  5745  
  5746  	for index, rawMessage := range rawMessages {
  5747  		t, err := unmarshalBasicThing(*rawMessage)
  5748  		if err != nil {
  5749  			return nil, err
  5750  		}
  5751  		tArray[index] = t
  5752  	}
  5753  	return tArray, nil
  5754  }
  5755  
  5756  // MarshalJSON is the custom marshaler for Thing.
  5757  func (t Thing) MarshalJSON() ([]byte, error) {
  5758  	t.Type = TypeThing
  5759  	objectMap := make(map[string]interface{})
  5760  	if t.Type != "" {
  5761  		objectMap["_type"] = t.Type
  5762  	}
  5763  	return json.Marshal(objectMap)
  5764  }
  5765  
  5766  // AsThing is the BasicResponseBase implementation for Thing.
  5767  func (t Thing) AsThing() (*Thing, bool) {
  5768  	return &t, true
  5769  }
  5770  
  5771  // AsBasicThing is the BasicResponseBase implementation for Thing.
  5772  func (t Thing) AsBasicThing() (BasicThing, bool) {
  5773  	return &t, true
  5774  }
  5775  
  5776  // AsPlaces is the BasicResponseBase implementation for Thing.
  5777  func (t Thing) AsPlaces() (*Places, bool) {
  5778  	return nil, false
  5779  }
  5780  
  5781  // AsSearchResultsAnswer is the BasicResponseBase implementation for Thing.
  5782  func (t Thing) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  5783  	return nil, false
  5784  }
  5785  
  5786  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Thing.
  5787  func (t Thing) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  5788  	return nil, false
  5789  }
  5790  
  5791  // AsSearchResponse is the BasicResponseBase implementation for Thing.
  5792  func (t Thing) AsSearchResponse() (*SearchResponse, bool) {
  5793  	return nil, false
  5794  }
  5795  
  5796  // AsPostalAddress is the BasicResponseBase implementation for Thing.
  5797  func (t Thing) AsPostalAddress() (*PostalAddress, bool) {
  5798  	return nil, false
  5799  }
  5800  
  5801  // AsPlace is the BasicResponseBase implementation for Thing.
  5802  func (t Thing) AsPlace() (*Place, bool) {
  5803  	return nil, false
  5804  }
  5805  
  5806  // AsAction is the BasicResponseBase implementation for Thing.
  5807  func (t Thing) AsAction() (*Action, bool) {
  5808  	return nil, false
  5809  }
  5810  
  5811  // AsBasicAction is the BasicResponseBase implementation for Thing.
  5812  func (t Thing) AsBasicAction() (BasicAction, bool) {
  5813  	return nil, false
  5814  }
  5815  
  5816  // AsResponse is the BasicResponseBase implementation for Thing.
  5817  func (t Thing) AsResponse() (*Response, bool) {
  5818  	return nil, false
  5819  }
  5820  
  5821  // AsBasicResponse is the BasicResponseBase implementation for Thing.
  5822  func (t Thing) AsBasicResponse() (BasicResponse, bool) {
  5823  	return &t, true
  5824  }
  5825  
  5826  // AsIdentifiable is the BasicResponseBase implementation for Thing.
  5827  func (t Thing) AsIdentifiable() (*Identifiable, bool) {
  5828  	return nil, false
  5829  }
  5830  
  5831  // AsBasicIdentifiable is the BasicResponseBase implementation for Thing.
  5832  func (t Thing) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  5833  	return &t, true
  5834  }
  5835  
  5836  // AsAnswer is the BasicResponseBase implementation for Thing.
  5837  func (t Thing) AsAnswer() (*Answer, bool) {
  5838  	return nil, false
  5839  }
  5840  
  5841  // AsBasicAnswer is the BasicResponseBase implementation for Thing.
  5842  func (t Thing) AsBasicAnswer() (BasicAnswer, bool) {
  5843  	return nil, false
  5844  }
  5845  
  5846  // AsErrorResponse is the BasicResponseBase implementation for Thing.
  5847  func (t Thing) AsErrorResponse() (*ErrorResponse, bool) {
  5848  	return nil, false
  5849  }
  5850  
  5851  // AsCreativeWork is the BasicResponseBase implementation for Thing.
  5852  func (t Thing) AsCreativeWork() (*CreativeWork, bool) {
  5853  	return nil, false
  5854  }
  5855  
  5856  // AsBasicCreativeWork is the BasicResponseBase implementation for Thing.
  5857  func (t Thing) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  5858  	return nil, false
  5859  }
  5860  
  5861  // AsIntangible is the BasicResponseBase implementation for Thing.
  5862  func (t Thing) AsIntangible() (*Intangible, bool) {
  5863  	return nil, false
  5864  }
  5865  
  5866  // AsBasicIntangible is the BasicResponseBase implementation for Thing.
  5867  func (t Thing) AsBasicIntangible() (BasicIntangible, bool) {
  5868  	return nil, false
  5869  }
  5870  
  5871  // AsSearchAction is the BasicResponseBase implementation for Thing.
  5872  func (t Thing) AsSearchAction() (*SearchAction, bool) {
  5873  	return nil, false
  5874  }
  5875  
  5876  // AsStructuredValue is the BasicResponseBase implementation for Thing.
  5877  func (t Thing) AsStructuredValue() (*StructuredValue, bool) {
  5878  	return nil, false
  5879  }
  5880  
  5881  // AsBasicStructuredValue is the BasicResponseBase implementation for Thing.
  5882  func (t Thing) AsBasicStructuredValue() (BasicStructuredValue, bool) {
  5883  	return nil, false
  5884  }
  5885  
  5886  // AsResponseBase is the BasicResponseBase implementation for Thing.
  5887  func (t Thing) AsResponseBase() (*ResponseBase, bool) {
  5888  	return nil, false
  5889  }
  5890  
  5891  // AsBasicResponseBase is the BasicResponseBase implementation for Thing.
  5892  func (t Thing) AsBasicResponseBase() (BasicResponseBase, bool) {
  5893  	return &t, true
  5894  }
  5895  
  5896  // UnmarshalJSON is the custom unmarshaler for Thing struct.
  5897  func (t *Thing) UnmarshalJSON(body []byte) error {
  5898  	var m map[string]*json.RawMessage
  5899  	err := json.Unmarshal(body, &m)
  5900  	if err != nil {
  5901  		return err
  5902  	}
  5903  	for k, v := range m {
  5904  		switch k {
  5905  		case "name":
  5906  			if v != nil {
  5907  				var name string
  5908  				err = json.Unmarshal(*v, &name)
  5909  				if err != nil {
  5910  					return err
  5911  				}
  5912  				t.Name = &name
  5913  			}
  5914  		case "url":
  5915  			if v != nil {
  5916  				var URL string
  5917  				err = json.Unmarshal(*v, &URL)
  5918  				if err != nil {
  5919  					return err
  5920  				}
  5921  				t.URL = &URL
  5922  			}
  5923  		case "entityPresentationInfo":
  5924  			if v != nil {
  5925  				entityPresentationInfo, err := unmarshalBasicEntitiesEntityPresentationInfo(*v)
  5926  				if err != nil {
  5927  					return err
  5928  				}
  5929  				t.EntityPresentationInfo = entityPresentationInfo
  5930  			}
  5931  		case "readLink":
  5932  			if v != nil {
  5933  				var readLink string
  5934  				err = json.Unmarshal(*v, &readLink)
  5935  				if err != nil {
  5936  					return err
  5937  				}
  5938  				t.ReadLink = &readLink
  5939  			}
  5940  		case "webSearchUrl":
  5941  			if v != nil {
  5942  				var webSearchURL string
  5943  				err = json.Unmarshal(*v, &webSearchURL)
  5944  				if err != nil {
  5945  					return err
  5946  				}
  5947  				t.WebSearchURL = &webSearchURL
  5948  			}
  5949  		case "potentialAction":
  5950  			if v != nil {
  5951  				potentialAction, err := unmarshalBasicActionArray(*v)
  5952  				if err != nil {
  5953  					return err
  5954  				}
  5955  				t.PotentialAction = &potentialAction
  5956  			}
  5957  		case "immediateAction":
  5958  			if v != nil {
  5959  				immediateAction, err := unmarshalBasicActionArray(*v)
  5960  				if err != nil {
  5961  					return err
  5962  				}
  5963  				t.ImmediateAction = &immediateAction
  5964  			}
  5965  		case "preferredClickthroughUrl":
  5966  			if v != nil {
  5967  				var preferredClickthroughURL string
  5968  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  5969  				if err != nil {
  5970  					return err
  5971  				}
  5972  				t.PreferredClickthroughURL = &preferredClickthroughURL
  5973  			}
  5974  		case "adaptiveCard":
  5975  			if v != nil {
  5976  				var adaptiveCard string
  5977  				err = json.Unmarshal(*v, &adaptiveCard)
  5978  				if err != nil {
  5979  					return err
  5980  				}
  5981  				t.AdaptiveCard = &adaptiveCard
  5982  			}
  5983  		case "id":
  5984  			if v != nil {
  5985  				var ID string
  5986  				err = json.Unmarshal(*v, &ID)
  5987  				if err != nil {
  5988  					return err
  5989  				}
  5990  				t.ID = &ID
  5991  			}
  5992  		case "_type":
  5993  			if v != nil {
  5994  				var typeVar TypeBasicResponseBase
  5995  				err = json.Unmarshal(*v, &typeVar)
  5996  				if err != nil {
  5997  					return err
  5998  				}
  5999  				t.Type = typeVar
  6000  			}
  6001  		}
  6002  	}
  6003  
  6004  	return nil
  6005  }
  6006  

View as plain text