...

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

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

     1  package autosuggest
     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/autosuggest"
    16  
    17  // BasicAction ...
    18  type BasicAction interface {
    19  	AsSearchAction() (*SearchAction, bool)
    20  	AsAction() (*Action, bool)
    21  }
    22  
    23  // Action ...
    24  type Action struct {
    25  	// Result - READ-ONLY
    26  	Result *[]BasicThing `json:"result,omitempty"`
    27  	// DisplayName - READ-ONLY
    28  	DisplayName *string `json:"displayName,omitempty"`
    29  	// IsTopAction - READ-ONLY
    30  	IsTopAction *bool `json:"isTopAction,omitempty"`
    31  	// ServiceURL - READ-ONLY
    32  	ServiceURL *string `json:"serviceUrl,omitempty"`
    33  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
    34  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
    35  	// About - READ-ONLY; For internal use only.
    36  	About *[]BasicThing `json:"about,omitempty"`
    37  	// Mentions - READ-ONLY; For internal use only.
    38  	Mentions *[]BasicThing `json:"mentions,omitempty"`
    39  	// Provider - READ-ONLY; The source of the creative work.
    40  	Provider *[]BasicThing `json:"provider,omitempty"`
    41  	// Creator - READ-ONLY
    42  	Creator BasicThing `json:"creator,omitempty"`
    43  	// Text - READ-ONLY; Text content of this creative work
    44  	Text *string `json:"text,omitempty"`
    45  	// DiscussionURL - READ-ONLY
    46  	DiscussionURL *string `json:"discussionUrl,omitempty"`
    47  	// CommentCount - READ-ONLY
    48  	CommentCount *int32 `json:"commentCount,omitempty"`
    49  	// MainEntity - READ-ONLY
    50  	MainEntity BasicThing `json:"mainEntity,omitempty"`
    51  	// HeadLine - READ-ONLY
    52  	HeadLine *string `json:"headLine,omitempty"`
    53  	// CopyrightHolder - READ-ONLY
    54  	CopyrightHolder BasicThing `json:"copyrightHolder,omitempty"`
    55  	// CopyrightYear - READ-ONLY
    56  	CopyrightYear *int32 `json:"copyrightYear,omitempty"`
    57  	// Disclaimer - READ-ONLY
    58  	Disclaimer *string `json:"disclaimer,omitempty"`
    59  	// IsAccessibleForFree - READ-ONLY
    60  	IsAccessibleForFree *bool `json:"isAccessibleForFree,omitempty"`
    61  	// Genre - READ-ONLY
    62  	Genre *[]string `json:"genre,omitempty"`
    63  	// IsFamilyFriendly - READ-ONLY
    64  	IsFamilyFriendly *bool `json:"isFamilyFriendly,omitempty"`
    65  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
    66  	URL *string `json:"url,omitempty"`
    67  	// ReadLink - READ-ONLY; The URL that returns this resource.
    68  	ReadLink *string `json:"readLink,omitempty"`
    69  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
    70  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
    71  	// PotentialAction - READ-ONLY
    72  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
    73  	// ImmediateAction - READ-ONLY
    74  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
    75  	// PreferredClickthroughURL - READ-ONLY
    76  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
    77  	// AdaptiveCard - READ-ONLY
    78  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
    79  	// ID - READ-ONLY; A String identifier.
    80  	ID *string `json:"id,omitempty"`
    81  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
    82  	Type TypeBasicResponseBase `json:"_type,omitempty"`
    83  }
    84  
    85  func unmarshalBasicAction(body []byte) (BasicAction, error) {
    86  	var m map[string]interface{}
    87  	err := json.Unmarshal(body, &m)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  
    92  	switch m["_type"] {
    93  	case string(TypeSearchAction):
    94  		var sa SearchAction
    95  		err := json.Unmarshal(body, &sa)
    96  		return sa, err
    97  	default:
    98  		var a Action
    99  		err := json.Unmarshal(body, &a)
   100  		return a, err
   101  	}
   102  }
   103  func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) {
   104  	var rawMessages []*json.RawMessage
   105  	err := json.Unmarshal(body, &rawMessages)
   106  	if err != nil {
   107  		return nil, err
   108  	}
   109  
   110  	aArray := make([]BasicAction, len(rawMessages))
   111  
   112  	for index, rawMessage := range rawMessages {
   113  		a, err := unmarshalBasicAction(*rawMessage)
   114  		if err != nil {
   115  			return nil, err
   116  		}
   117  		aArray[index] = a
   118  	}
   119  	return aArray, nil
   120  }
   121  
   122  // MarshalJSON is the custom marshaler for Action.
   123  func (a Action) MarshalJSON() ([]byte, error) {
   124  	a.Type = TypeAction
   125  	objectMap := make(map[string]interface{})
   126  	if a.Type != "" {
   127  		objectMap["_type"] = a.Type
   128  	}
   129  	return json.Marshal(objectMap)
   130  }
   131  
   132  // AsSearchAction is the BasicResponseBase implementation for Action.
   133  func (a Action) AsSearchAction() (*SearchAction, bool) {
   134  	return nil, false
   135  }
   136  
   137  // AsSuggestions is the BasicResponseBase implementation for Action.
   138  func (a Action) AsSuggestions() (*Suggestions, bool) {
   139  	return nil, false
   140  }
   141  
   142  // AsSearchResultsAnswer is the BasicResponseBase implementation for Action.
   143  func (a Action) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   144  	return nil, false
   145  }
   146  
   147  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Action.
   148  func (a Action) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   149  	return nil, false
   150  }
   151  
   152  // AsAnswer is the BasicResponseBase implementation for Action.
   153  func (a Action) AsAnswer() (*Answer, bool) {
   154  	return nil, false
   155  }
   156  
   157  // AsBasicAnswer is the BasicResponseBase implementation for Action.
   158  func (a Action) AsBasicAnswer() (BasicAnswer, bool) {
   159  	return nil, false
   160  }
   161  
   162  // AsThing is the BasicResponseBase implementation for Action.
   163  func (a Action) AsThing() (*Thing, bool) {
   164  	return nil, false
   165  }
   166  
   167  // AsBasicThing is the BasicResponseBase implementation for Action.
   168  func (a Action) AsBasicThing() (BasicThing, bool) {
   169  	return &a, true
   170  }
   171  
   172  // AsAction is the BasicResponseBase implementation for Action.
   173  func (a Action) AsAction() (*Action, bool) {
   174  	return &a, true
   175  }
   176  
   177  // AsBasicAction is the BasicResponseBase implementation for Action.
   178  func (a Action) AsBasicAction() (BasicAction, bool) {
   179  	return &a, true
   180  }
   181  
   182  // AsResponse is the BasicResponseBase implementation for Action.
   183  func (a Action) AsResponse() (*Response, bool) {
   184  	return nil, false
   185  }
   186  
   187  // AsBasicResponse is the BasicResponseBase implementation for Action.
   188  func (a Action) AsBasicResponse() (BasicResponse, bool) {
   189  	return &a, true
   190  }
   191  
   192  // AsIdentifiable is the BasicResponseBase implementation for Action.
   193  func (a Action) AsIdentifiable() (*Identifiable, bool) {
   194  	return nil, false
   195  }
   196  
   197  // AsBasicIdentifiable is the BasicResponseBase implementation for Action.
   198  func (a Action) AsBasicIdentifiable() (BasicIdentifiable, bool) {
   199  	return &a, true
   200  }
   201  
   202  // AsErrorResponse is the BasicResponseBase implementation for Action.
   203  func (a Action) AsErrorResponse() (*ErrorResponse, bool) {
   204  	return nil, false
   205  }
   206  
   207  // AsCreativeWork is the BasicResponseBase implementation for Action.
   208  func (a Action) AsCreativeWork() (*CreativeWork, bool) {
   209  	return nil, false
   210  }
   211  
   212  // AsBasicCreativeWork is the BasicResponseBase implementation for Action.
   213  func (a Action) AsBasicCreativeWork() (BasicCreativeWork, bool) {
   214  	return &a, true
   215  }
   216  
   217  // AsResponseBase is the BasicResponseBase implementation for Action.
   218  func (a Action) AsResponseBase() (*ResponseBase, bool) {
   219  	return nil, false
   220  }
   221  
   222  // AsBasicResponseBase is the BasicResponseBase implementation for Action.
   223  func (a Action) AsBasicResponseBase() (BasicResponseBase, bool) {
   224  	return &a, true
   225  }
   226  
   227  // UnmarshalJSON is the custom unmarshaler for Action struct.
   228  func (a *Action) UnmarshalJSON(body []byte) error {
   229  	var m map[string]*json.RawMessage
   230  	err := json.Unmarshal(body, &m)
   231  	if err != nil {
   232  		return err
   233  	}
   234  	for k, v := range m {
   235  		switch k {
   236  		case "result":
   237  			if v != nil {
   238  				resultVar, err := unmarshalBasicThingArray(*v)
   239  				if err != nil {
   240  					return err
   241  				}
   242  				a.Result = &resultVar
   243  			}
   244  		case "displayName":
   245  			if v != nil {
   246  				var displayName string
   247  				err = json.Unmarshal(*v, &displayName)
   248  				if err != nil {
   249  					return err
   250  				}
   251  				a.DisplayName = &displayName
   252  			}
   253  		case "isTopAction":
   254  			if v != nil {
   255  				var isTopAction bool
   256  				err = json.Unmarshal(*v, &isTopAction)
   257  				if err != nil {
   258  					return err
   259  				}
   260  				a.IsTopAction = &isTopAction
   261  			}
   262  		case "serviceUrl":
   263  			if v != nil {
   264  				var serviceURL string
   265  				err = json.Unmarshal(*v, &serviceURL)
   266  				if err != nil {
   267  					return err
   268  				}
   269  				a.ServiceURL = &serviceURL
   270  			}
   271  		case "thumbnailUrl":
   272  			if v != nil {
   273  				var thumbnailURL string
   274  				err = json.Unmarshal(*v, &thumbnailURL)
   275  				if err != nil {
   276  					return err
   277  				}
   278  				a.ThumbnailURL = &thumbnailURL
   279  			}
   280  		case "about":
   281  			if v != nil {
   282  				about, err := unmarshalBasicThingArray(*v)
   283  				if err != nil {
   284  					return err
   285  				}
   286  				a.About = &about
   287  			}
   288  		case "mentions":
   289  			if v != nil {
   290  				mentions, err := unmarshalBasicThingArray(*v)
   291  				if err != nil {
   292  					return err
   293  				}
   294  				a.Mentions = &mentions
   295  			}
   296  		case "provider":
   297  			if v != nil {
   298  				provider, err := unmarshalBasicThingArray(*v)
   299  				if err != nil {
   300  					return err
   301  				}
   302  				a.Provider = &provider
   303  			}
   304  		case "creator":
   305  			if v != nil {
   306  				creator, err := unmarshalBasicThing(*v)
   307  				if err != nil {
   308  					return err
   309  				}
   310  				a.Creator = creator
   311  			}
   312  		case "text":
   313  			if v != nil {
   314  				var textVar string
   315  				err = json.Unmarshal(*v, &textVar)
   316  				if err != nil {
   317  					return err
   318  				}
   319  				a.Text = &textVar
   320  			}
   321  		case "discussionUrl":
   322  			if v != nil {
   323  				var discussionURL string
   324  				err = json.Unmarshal(*v, &discussionURL)
   325  				if err != nil {
   326  					return err
   327  				}
   328  				a.DiscussionURL = &discussionURL
   329  			}
   330  		case "commentCount":
   331  			if v != nil {
   332  				var commentCount int32
   333  				err = json.Unmarshal(*v, &commentCount)
   334  				if err != nil {
   335  					return err
   336  				}
   337  				a.CommentCount = &commentCount
   338  			}
   339  		case "mainEntity":
   340  			if v != nil {
   341  				mainEntity, err := unmarshalBasicThing(*v)
   342  				if err != nil {
   343  					return err
   344  				}
   345  				a.MainEntity = mainEntity
   346  			}
   347  		case "headLine":
   348  			if v != nil {
   349  				var headLine string
   350  				err = json.Unmarshal(*v, &headLine)
   351  				if err != nil {
   352  					return err
   353  				}
   354  				a.HeadLine = &headLine
   355  			}
   356  		case "copyrightHolder":
   357  			if v != nil {
   358  				copyrightHolder, err := unmarshalBasicThing(*v)
   359  				if err != nil {
   360  					return err
   361  				}
   362  				a.CopyrightHolder = copyrightHolder
   363  			}
   364  		case "copyrightYear":
   365  			if v != nil {
   366  				var copyrightYear int32
   367  				err = json.Unmarshal(*v, &copyrightYear)
   368  				if err != nil {
   369  					return err
   370  				}
   371  				a.CopyrightYear = &copyrightYear
   372  			}
   373  		case "disclaimer":
   374  			if v != nil {
   375  				var disclaimer string
   376  				err = json.Unmarshal(*v, &disclaimer)
   377  				if err != nil {
   378  					return err
   379  				}
   380  				a.Disclaimer = &disclaimer
   381  			}
   382  		case "isAccessibleForFree":
   383  			if v != nil {
   384  				var isAccessibleForFree bool
   385  				err = json.Unmarshal(*v, &isAccessibleForFree)
   386  				if err != nil {
   387  					return err
   388  				}
   389  				a.IsAccessibleForFree = &isAccessibleForFree
   390  			}
   391  		case "genre":
   392  			if v != nil {
   393  				var genre []string
   394  				err = json.Unmarshal(*v, &genre)
   395  				if err != nil {
   396  					return err
   397  				}
   398  				a.Genre = &genre
   399  			}
   400  		case "isFamilyFriendly":
   401  			if v != nil {
   402  				var isFamilyFriendly bool
   403  				err = json.Unmarshal(*v, &isFamilyFriendly)
   404  				if err != nil {
   405  					return err
   406  				}
   407  				a.IsFamilyFriendly = &isFamilyFriendly
   408  			}
   409  		case "url":
   410  			if v != nil {
   411  				var URL string
   412  				err = json.Unmarshal(*v, &URL)
   413  				if err != nil {
   414  					return err
   415  				}
   416  				a.URL = &URL
   417  			}
   418  		case "readLink":
   419  			if v != nil {
   420  				var readLink string
   421  				err = json.Unmarshal(*v, &readLink)
   422  				if err != nil {
   423  					return err
   424  				}
   425  				a.ReadLink = &readLink
   426  			}
   427  		case "webSearchUrl":
   428  			if v != nil {
   429  				var webSearchURL string
   430  				err = json.Unmarshal(*v, &webSearchURL)
   431  				if err != nil {
   432  					return err
   433  				}
   434  				a.WebSearchURL = &webSearchURL
   435  			}
   436  		case "potentialAction":
   437  			if v != nil {
   438  				potentialAction, err := unmarshalBasicActionArray(*v)
   439  				if err != nil {
   440  					return err
   441  				}
   442  				a.PotentialAction = &potentialAction
   443  			}
   444  		case "immediateAction":
   445  			if v != nil {
   446  				immediateAction, err := unmarshalBasicActionArray(*v)
   447  				if err != nil {
   448  					return err
   449  				}
   450  				a.ImmediateAction = &immediateAction
   451  			}
   452  		case "preferredClickthroughUrl":
   453  			if v != nil {
   454  				var preferredClickthroughURL string
   455  				err = json.Unmarshal(*v, &preferredClickthroughURL)
   456  				if err != nil {
   457  					return err
   458  				}
   459  				a.PreferredClickthroughURL = &preferredClickthroughURL
   460  			}
   461  		case "adaptiveCard":
   462  			if v != nil {
   463  				var adaptiveCard string
   464  				err = json.Unmarshal(*v, &adaptiveCard)
   465  				if err != nil {
   466  					return err
   467  				}
   468  				a.AdaptiveCard = &adaptiveCard
   469  			}
   470  		case "id":
   471  			if v != nil {
   472  				var ID string
   473  				err = json.Unmarshal(*v, &ID)
   474  				if err != nil {
   475  					return err
   476  				}
   477  				a.ID = &ID
   478  			}
   479  		case "_type":
   480  			if v != nil {
   481  				var typeVar TypeBasicResponseBase
   482  				err = json.Unmarshal(*v, &typeVar)
   483  				if err != nil {
   484  					return err
   485  				}
   486  				a.Type = typeVar
   487  			}
   488  		}
   489  	}
   490  
   491  	return nil
   492  }
   493  
   494  // BasicAnswer defines an answer.
   495  type BasicAnswer interface {
   496  	AsSuggestions() (*Suggestions, bool)
   497  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
   498  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
   499  	AsAnswer() (*Answer, bool)
   500  }
   501  
   502  // Answer defines an answer.
   503  type Answer struct {
   504  	// ReadLink - READ-ONLY; The URL that returns this resource.
   505  	ReadLink *string `json:"readLink,omitempty"`
   506  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
   507  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
   508  	// PotentialAction - READ-ONLY
   509  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
   510  	// ImmediateAction - READ-ONLY
   511  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
   512  	// PreferredClickthroughURL - READ-ONLY
   513  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
   514  	// AdaptiveCard - READ-ONLY
   515  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
   516  	// ID - READ-ONLY; A String identifier.
   517  	ID *string `json:"id,omitempty"`
   518  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
   519  	Type TypeBasicResponseBase `json:"_type,omitempty"`
   520  }
   521  
   522  func unmarshalBasicAnswer(body []byte) (BasicAnswer, error) {
   523  	var m map[string]interface{}
   524  	err := json.Unmarshal(body, &m)
   525  	if err != nil {
   526  		return nil, err
   527  	}
   528  
   529  	switch m["_type"] {
   530  	case string(TypeSuggestions):
   531  		var s Suggestions
   532  		err := json.Unmarshal(body, &s)
   533  		return s, err
   534  	case string(TypeSearchResultsAnswer):
   535  		var sra SearchResultsAnswer
   536  		err := json.Unmarshal(body, &sra)
   537  		return sra, err
   538  	default:
   539  		var a Answer
   540  		err := json.Unmarshal(body, &a)
   541  		return a, err
   542  	}
   543  }
   544  func unmarshalBasicAnswerArray(body []byte) ([]BasicAnswer, error) {
   545  	var rawMessages []*json.RawMessage
   546  	err := json.Unmarshal(body, &rawMessages)
   547  	if err != nil {
   548  		return nil, err
   549  	}
   550  
   551  	aArray := make([]BasicAnswer, len(rawMessages))
   552  
   553  	for index, rawMessage := range rawMessages {
   554  		a, err := unmarshalBasicAnswer(*rawMessage)
   555  		if err != nil {
   556  			return nil, err
   557  		}
   558  		aArray[index] = a
   559  	}
   560  	return aArray, nil
   561  }
   562  
   563  // MarshalJSON is the custom marshaler for Answer.
   564  func (a Answer) MarshalJSON() ([]byte, error) {
   565  	a.Type = TypeAnswer
   566  	objectMap := make(map[string]interface{})
   567  	if a.Type != "" {
   568  		objectMap["_type"] = a.Type
   569  	}
   570  	return json.Marshal(objectMap)
   571  }
   572  
   573  // AsSearchAction is the BasicResponseBase implementation for Answer.
   574  func (a Answer) AsSearchAction() (*SearchAction, bool) {
   575  	return nil, false
   576  }
   577  
   578  // AsSuggestions is the BasicResponseBase implementation for Answer.
   579  func (a Answer) AsSuggestions() (*Suggestions, bool) {
   580  	return nil, false
   581  }
   582  
   583  // AsSearchResultsAnswer is the BasicResponseBase implementation for Answer.
   584  func (a Answer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   585  	return nil, false
   586  }
   587  
   588  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Answer.
   589  func (a Answer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   590  	return nil, false
   591  }
   592  
   593  // AsAnswer is the BasicResponseBase implementation for Answer.
   594  func (a Answer) AsAnswer() (*Answer, bool) {
   595  	return &a, true
   596  }
   597  
   598  // AsBasicAnswer is the BasicResponseBase implementation for Answer.
   599  func (a Answer) AsBasicAnswer() (BasicAnswer, bool) {
   600  	return &a, true
   601  }
   602  
   603  // AsThing is the BasicResponseBase implementation for Answer.
   604  func (a Answer) AsThing() (*Thing, bool) {
   605  	return nil, false
   606  }
   607  
   608  // AsBasicThing is the BasicResponseBase implementation for Answer.
   609  func (a Answer) AsBasicThing() (BasicThing, bool) {
   610  	return nil, false
   611  }
   612  
   613  // AsAction is the BasicResponseBase implementation for Answer.
   614  func (a Answer) AsAction() (*Action, bool) {
   615  	return nil, false
   616  }
   617  
   618  // AsBasicAction is the BasicResponseBase implementation for Answer.
   619  func (a Answer) AsBasicAction() (BasicAction, bool) {
   620  	return nil, false
   621  }
   622  
   623  // AsResponse is the BasicResponseBase implementation for Answer.
   624  func (a Answer) AsResponse() (*Response, bool) {
   625  	return nil, false
   626  }
   627  
   628  // AsBasicResponse is the BasicResponseBase implementation for Answer.
   629  func (a Answer) AsBasicResponse() (BasicResponse, bool) {
   630  	return &a, true
   631  }
   632  
   633  // AsIdentifiable is the BasicResponseBase implementation for Answer.
   634  func (a Answer) AsIdentifiable() (*Identifiable, bool) {
   635  	return nil, false
   636  }
   637  
   638  // AsBasicIdentifiable is the BasicResponseBase implementation for Answer.
   639  func (a Answer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
   640  	return &a, true
   641  }
   642  
   643  // AsErrorResponse is the BasicResponseBase implementation for Answer.
   644  func (a Answer) AsErrorResponse() (*ErrorResponse, bool) {
   645  	return nil, false
   646  }
   647  
   648  // AsCreativeWork is the BasicResponseBase implementation for Answer.
   649  func (a Answer) AsCreativeWork() (*CreativeWork, bool) {
   650  	return nil, false
   651  }
   652  
   653  // AsBasicCreativeWork is the BasicResponseBase implementation for Answer.
   654  func (a Answer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
   655  	return nil, false
   656  }
   657  
   658  // AsResponseBase is the BasicResponseBase implementation for Answer.
   659  func (a Answer) AsResponseBase() (*ResponseBase, bool) {
   660  	return nil, false
   661  }
   662  
   663  // AsBasicResponseBase is the BasicResponseBase implementation for Answer.
   664  func (a Answer) AsBasicResponseBase() (BasicResponseBase, bool) {
   665  	return &a, true
   666  }
   667  
   668  // UnmarshalJSON is the custom unmarshaler for Answer struct.
   669  func (a *Answer) UnmarshalJSON(body []byte) error {
   670  	var m map[string]*json.RawMessage
   671  	err := json.Unmarshal(body, &m)
   672  	if err != nil {
   673  		return err
   674  	}
   675  	for k, v := range m {
   676  		switch k {
   677  		case "readLink":
   678  			if v != nil {
   679  				var readLink string
   680  				err = json.Unmarshal(*v, &readLink)
   681  				if err != nil {
   682  					return err
   683  				}
   684  				a.ReadLink = &readLink
   685  			}
   686  		case "webSearchUrl":
   687  			if v != nil {
   688  				var webSearchURL string
   689  				err = json.Unmarshal(*v, &webSearchURL)
   690  				if err != nil {
   691  					return err
   692  				}
   693  				a.WebSearchURL = &webSearchURL
   694  			}
   695  		case "potentialAction":
   696  			if v != nil {
   697  				potentialAction, err := unmarshalBasicActionArray(*v)
   698  				if err != nil {
   699  					return err
   700  				}
   701  				a.PotentialAction = &potentialAction
   702  			}
   703  		case "immediateAction":
   704  			if v != nil {
   705  				immediateAction, err := unmarshalBasicActionArray(*v)
   706  				if err != nil {
   707  					return err
   708  				}
   709  				a.ImmediateAction = &immediateAction
   710  			}
   711  		case "preferredClickthroughUrl":
   712  			if v != nil {
   713  				var preferredClickthroughURL string
   714  				err = json.Unmarshal(*v, &preferredClickthroughURL)
   715  				if err != nil {
   716  					return err
   717  				}
   718  				a.PreferredClickthroughURL = &preferredClickthroughURL
   719  			}
   720  		case "adaptiveCard":
   721  			if v != nil {
   722  				var adaptiveCard string
   723  				err = json.Unmarshal(*v, &adaptiveCard)
   724  				if err != nil {
   725  					return err
   726  				}
   727  				a.AdaptiveCard = &adaptiveCard
   728  			}
   729  		case "id":
   730  			if v != nil {
   731  				var ID string
   732  				err = json.Unmarshal(*v, &ID)
   733  				if err != nil {
   734  					return err
   735  				}
   736  				a.ID = &ID
   737  			}
   738  		case "_type":
   739  			if v != nil {
   740  				var typeVar TypeBasicResponseBase
   741  				err = json.Unmarshal(*v, &typeVar)
   742  				if err != nil {
   743  					return err
   744  				}
   745  				a.Type = typeVar
   746  			}
   747  		}
   748  	}
   749  
   750  	return nil
   751  }
   752  
   753  // BasicCreativeWork the most generic kind of creative work, including books, movies, photographs, software programs,
   754  // etc.
   755  type BasicCreativeWork interface {
   756  	AsSearchAction() (*SearchAction, bool)
   757  	AsAction() (*Action, bool)
   758  	AsBasicAction() (BasicAction, bool)
   759  	AsCreativeWork() (*CreativeWork, bool)
   760  }
   761  
   762  // CreativeWork the most generic kind of creative work, including books, movies, photographs, software
   763  // programs, etc.
   764  type CreativeWork struct {
   765  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
   766  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
   767  	// About - READ-ONLY; For internal use only.
   768  	About *[]BasicThing `json:"about,omitempty"`
   769  	// Mentions - READ-ONLY; For internal use only.
   770  	Mentions *[]BasicThing `json:"mentions,omitempty"`
   771  	// Provider - READ-ONLY; The source of the creative work.
   772  	Provider *[]BasicThing `json:"provider,omitempty"`
   773  	// Creator - READ-ONLY
   774  	Creator BasicThing `json:"creator,omitempty"`
   775  	// Text - READ-ONLY; Text content of this creative work
   776  	Text *string `json:"text,omitempty"`
   777  	// DiscussionURL - READ-ONLY
   778  	DiscussionURL *string `json:"discussionUrl,omitempty"`
   779  	// CommentCount - READ-ONLY
   780  	CommentCount *int32 `json:"commentCount,omitempty"`
   781  	// MainEntity - READ-ONLY
   782  	MainEntity BasicThing `json:"mainEntity,omitempty"`
   783  	// HeadLine - READ-ONLY
   784  	HeadLine *string `json:"headLine,omitempty"`
   785  	// CopyrightHolder - READ-ONLY
   786  	CopyrightHolder BasicThing `json:"copyrightHolder,omitempty"`
   787  	// CopyrightYear - READ-ONLY
   788  	CopyrightYear *int32 `json:"copyrightYear,omitempty"`
   789  	// Disclaimer - READ-ONLY
   790  	Disclaimer *string `json:"disclaimer,omitempty"`
   791  	// IsAccessibleForFree - READ-ONLY
   792  	IsAccessibleForFree *bool `json:"isAccessibleForFree,omitempty"`
   793  	// Genre - READ-ONLY
   794  	Genre *[]string `json:"genre,omitempty"`
   795  	// IsFamilyFriendly - READ-ONLY
   796  	IsFamilyFriendly *bool `json:"isFamilyFriendly,omitempty"`
   797  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
   798  	URL *string `json:"url,omitempty"`
   799  	// ReadLink - READ-ONLY; The URL that returns this resource.
   800  	ReadLink *string `json:"readLink,omitempty"`
   801  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
   802  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
   803  	// PotentialAction - READ-ONLY
   804  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
   805  	// ImmediateAction - READ-ONLY
   806  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
   807  	// PreferredClickthroughURL - READ-ONLY
   808  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
   809  	// AdaptiveCard - READ-ONLY
   810  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
   811  	// ID - READ-ONLY; A String identifier.
   812  	ID *string `json:"id,omitempty"`
   813  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
   814  	Type TypeBasicResponseBase `json:"_type,omitempty"`
   815  }
   816  
   817  func unmarshalBasicCreativeWork(body []byte) (BasicCreativeWork, error) {
   818  	var m map[string]interface{}
   819  	err := json.Unmarshal(body, &m)
   820  	if err != nil {
   821  		return nil, err
   822  	}
   823  
   824  	switch m["_type"] {
   825  	case string(TypeSearchAction):
   826  		var sa SearchAction
   827  		err := json.Unmarshal(body, &sa)
   828  		return sa, err
   829  	case string(TypeAction):
   830  		var a Action
   831  		err := json.Unmarshal(body, &a)
   832  		return a, err
   833  	default:
   834  		var cw CreativeWork
   835  		err := json.Unmarshal(body, &cw)
   836  		return cw, err
   837  	}
   838  }
   839  func unmarshalBasicCreativeWorkArray(body []byte) ([]BasicCreativeWork, error) {
   840  	var rawMessages []*json.RawMessage
   841  	err := json.Unmarshal(body, &rawMessages)
   842  	if err != nil {
   843  		return nil, err
   844  	}
   845  
   846  	cwArray := make([]BasicCreativeWork, len(rawMessages))
   847  
   848  	for index, rawMessage := range rawMessages {
   849  		cw, err := unmarshalBasicCreativeWork(*rawMessage)
   850  		if err != nil {
   851  			return nil, err
   852  		}
   853  		cwArray[index] = cw
   854  	}
   855  	return cwArray, nil
   856  }
   857  
   858  // MarshalJSON is the custom marshaler for CreativeWork.
   859  func (cw CreativeWork) MarshalJSON() ([]byte, error) {
   860  	cw.Type = TypeCreativeWork
   861  	objectMap := make(map[string]interface{})
   862  	if cw.Type != "" {
   863  		objectMap["_type"] = cw.Type
   864  	}
   865  	return json.Marshal(objectMap)
   866  }
   867  
   868  // AsSearchAction is the BasicResponseBase implementation for CreativeWork.
   869  func (cw CreativeWork) AsSearchAction() (*SearchAction, bool) {
   870  	return nil, false
   871  }
   872  
   873  // AsSuggestions is the BasicResponseBase implementation for CreativeWork.
   874  func (cw CreativeWork) AsSuggestions() (*Suggestions, bool) {
   875  	return nil, false
   876  }
   877  
   878  // AsSearchResultsAnswer is the BasicResponseBase implementation for CreativeWork.
   879  func (cw CreativeWork) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
   880  	return nil, false
   881  }
   882  
   883  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for CreativeWork.
   884  func (cw CreativeWork) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
   885  	return nil, false
   886  }
   887  
   888  // AsAnswer is the BasicResponseBase implementation for CreativeWork.
   889  func (cw CreativeWork) AsAnswer() (*Answer, bool) {
   890  	return nil, false
   891  }
   892  
   893  // AsBasicAnswer is the BasicResponseBase implementation for CreativeWork.
   894  func (cw CreativeWork) AsBasicAnswer() (BasicAnswer, bool) {
   895  	return nil, false
   896  }
   897  
   898  // AsThing is the BasicResponseBase implementation for CreativeWork.
   899  func (cw CreativeWork) AsThing() (*Thing, bool) {
   900  	return nil, false
   901  }
   902  
   903  // AsBasicThing is the BasicResponseBase implementation for CreativeWork.
   904  func (cw CreativeWork) AsBasicThing() (BasicThing, bool) {
   905  	return &cw, true
   906  }
   907  
   908  // AsAction is the BasicResponseBase implementation for CreativeWork.
   909  func (cw CreativeWork) AsAction() (*Action, bool) {
   910  	return nil, false
   911  }
   912  
   913  // AsBasicAction is the BasicResponseBase implementation for CreativeWork.
   914  func (cw CreativeWork) AsBasicAction() (BasicAction, bool) {
   915  	return nil, false
   916  }
   917  
   918  // AsResponse is the BasicResponseBase implementation for CreativeWork.
   919  func (cw CreativeWork) AsResponse() (*Response, bool) {
   920  	return nil, false
   921  }
   922  
   923  // AsBasicResponse is the BasicResponseBase implementation for CreativeWork.
   924  func (cw CreativeWork) AsBasicResponse() (BasicResponse, bool) {
   925  	return &cw, true
   926  }
   927  
   928  // AsIdentifiable is the BasicResponseBase implementation for CreativeWork.
   929  func (cw CreativeWork) AsIdentifiable() (*Identifiable, bool) {
   930  	return nil, false
   931  }
   932  
   933  // AsBasicIdentifiable is the BasicResponseBase implementation for CreativeWork.
   934  func (cw CreativeWork) AsBasicIdentifiable() (BasicIdentifiable, bool) {
   935  	return &cw, true
   936  }
   937  
   938  // AsErrorResponse is the BasicResponseBase implementation for CreativeWork.
   939  func (cw CreativeWork) AsErrorResponse() (*ErrorResponse, bool) {
   940  	return nil, false
   941  }
   942  
   943  // AsCreativeWork is the BasicResponseBase implementation for CreativeWork.
   944  func (cw CreativeWork) AsCreativeWork() (*CreativeWork, bool) {
   945  	return &cw, true
   946  }
   947  
   948  // AsBasicCreativeWork is the BasicResponseBase implementation for CreativeWork.
   949  func (cw CreativeWork) AsBasicCreativeWork() (BasicCreativeWork, bool) {
   950  	return &cw, true
   951  }
   952  
   953  // AsResponseBase is the BasicResponseBase implementation for CreativeWork.
   954  func (cw CreativeWork) AsResponseBase() (*ResponseBase, bool) {
   955  	return nil, false
   956  }
   957  
   958  // AsBasicResponseBase is the BasicResponseBase implementation for CreativeWork.
   959  func (cw CreativeWork) AsBasicResponseBase() (BasicResponseBase, bool) {
   960  	return &cw, true
   961  }
   962  
   963  // UnmarshalJSON is the custom unmarshaler for CreativeWork struct.
   964  func (cw *CreativeWork) UnmarshalJSON(body []byte) error {
   965  	var m map[string]*json.RawMessage
   966  	err := json.Unmarshal(body, &m)
   967  	if err != nil {
   968  		return err
   969  	}
   970  	for k, v := range m {
   971  		switch k {
   972  		case "thumbnailUrl":
   973  			if v != nil {
   974  				var thumbnailURL string
   975  				err = json.Unmarshal(*v, &thumbnailURL)
   976  				if err != nil {
   977  					return err
   978  				}
   979  				cw.ThumbnailURL = &thumbnailURL
   980  			}
   981  		case "about":
   982  			if v != nil {
   983  				about, err := unmarshalBasicThingArray(*v)
   984  				if err != nil {
   985  					return err
   986  				}
   987  				cw.About = &about
   988  			}
   989  		case "mentions":
   990  			if v != nil {
   991  				mentions, err := unmarshalBasicThingArray(*v)
   992  				if err != nil {
   993  					return err
   994  				}
   995  				cw.Mentions = &mentions
   996  			}
   997  		case "provider":
   998  			if v != nil {
   999  				provider, err := unmarshalBasicThingArray(*v)
  1000  				if err != nil {
  1001  					return err
  1002  				}
  1003  				cw.Provider = &provider
  1004  			}
  1005  		case "creator":
  1006  			if v != nil {
  1007  				creator, err := unmarshalBasicThing(*v)
  1008  				if err != nil {
  1009  					return err
  1010  				}
  1011  				cw.Creator = creator
  1012  			}
  1013  		case "text":
  1014  			if v != nil {
  1015  				var textVar string
  1016  				err = json.Unmarshal(*v, &textVar)
  1017  				if err != nil {
  1018  					return err
  1019  				}
  1020  				cw.Text = &textVar
  1021  			}
  1022  		case "discussionUrl":
  1023  			if v != nil {
  1024  				var discussionURL string
  1025  				err = json.Unmarshal(*v, &discussionURL)
  1026  				if err != nil {
  1027  					return err
  1028  				}
  1029  				cw.DiscussionURL = &discussionURL
  1030  			}
  1031  		case "commentCount":
  1032  			if v != nil {
  1033  				var commentCount int32
  1034  				err = json.Unmarshal(*v, &commentCount)
  1035  				if err != nil {
  1036  					return err
  1037  				}
  1038  				cw.CommentCount = &commentCount
  1039  			}
  1040  		case "mainEntity":
  1041  			if v != nil {
  1042  				mainEntity, err := unmarshalBasicThing(*v)
  1043  				if err != nil {
  1044  					return err
  1045  				}
  1046  				cw.MainEntity = mainEntity
  1047  			}
  1048  		case "headLine":
  1049  			if v != nil {
  1050  				var headLine string
  1051  				err = json.Unmarshal(*v, &headLine)
  1052  				if err != nil {
  1053  					return err
  1054  				}
  1055  				cw.HeadLine = &headLine
  1056  			}
  1057  		case "copyrightHolder":
  1058  			if v != nil {
  1059  				copyrightHolder, err := unmarshalBasicThing(*v)
  1060  				if err != nil {
  1061  					return err
  1062  				}
  1063  				cw.CopyrightHolder = copyrightHolder
  1064  			}
  1065  		case "copyrightYear":
  1066  			if v != nil {
  1067  				var copyrightYear int32
  1068  				err = json.Unmarshal(*v, &copyrightYear)
  1069  				if err != nil {
  1070  					return err
  1071  				}
  1072  				cw.CopyrightYear = &copyrightYear
  1073  			}
  1074  		case "disclaimer":
  1075  			if v != nil {
  1076  				var disclaimer string
  1077  				err = json.Unmarshal(*v, &disclaimer)
  1078  				if err != nil {
  1079  					return err
  1080  				}
  1081  				cw.Disclaimer = &disclaimer
  1082  			}
  1083  		case "isAccessibleForFree":
  1084  			if v != nil {
  1085  				var isAccessibleForFree bool
  1086  				err = json.Unmarshal(*v, &isAccessibleForFree)
  1087  				if err != nil {
  1088  					return err
  1089  				}
  1090  				cw.IsAccessibleForFree = &isAccessibleForFree
  1091  			}
  1092  		case "genre":
  1093  			if v != nil {
  1094  				var genre []string
  1095  				err = json.Unmarshal(*v, &genre)
  1096  				if err != nil {
  1097  					return err
  1098  				}
  1099  				cw.Genre = &genre
  1100  			}
  1101  		case "isFamilyFriendly":
  1102  			if v != nil {
  1103  				var isFamilyFriendly bool
  1104  				err = json.Unmarshal(*v, &isFamilyFriendly)
  1105  				if err != nil {
  1106  					return err
  1107  				}
  1108  				cw.IsFamilyFriendly = &isFamilyFriendly
  1109  			}
  1110  		case "url":
  1111  			if v != nil {
  1112  				var URL string
  1113  				err = json.Unmarshal(*v, &URL)
  1114  				if err != nil {
  1115  					return err
  1116  				}
  1117  				cw.URL = &URL
  1118  			}
  1119  		case "readLink":
  1120  			if v != nil {
  1121  				var readLink string
  1122  				err = json.Unmarshal(*v, &readLink)
  1123  				if err != nil {
  1124  					return err
  1125  				}
  1126  				cw.ReadLink = &readLink
  1127  			}
  1128  		case "webSearchUrl":
  1129  			if v != nil {
  1130  				var webSearchURL string
  1131  				err = json.Unmarshal(*v, &webSearchURL)
  1132  				if err != nil {
  1133  					return err
  1134  				}
  1135  				cw.WebSearchURL = &webSearchURL
  1136  			}
  1137  		case "potentialAction":
  1138  			if v != nil {
  1139  				potentialAction, err := unmarshalBasicActionArray(*v)
  1140  				if err != nil {
  1141  					return err
  1142  				}
  1143  				cw.PotentialAction = &potentialAction
  1144  			}
  1145  		case "immediateAction":
  1146  			if v != nil {
  1147  				immediateAction, err := unmarshalBasicActionArray(*v)
  1148  				if err != nil {
  1149  					return err
  1150  				}
  1151  				cw.ImmediateAction = &immediateAction
  1152  			}
  1153  		case "preferredClickthroughUrl":
  1154  			if v != nil {
  1155  				var preferredClickthroughURL string
  1156  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  1157  				if err != nil {
  1158  					return err
  1159  				}
  1160  				cw.PreferredClickthroughURL = &preferredClickthroughURL
  1161  			}
  1162  		case "adaptiveCard":
  1163  			if v != nil {
  1164  				var adaptiveCard string
  1165  				err = json.Unmarshal(*v, &adaptiveCard)
  1166  				if err != nil {
  1167  					return err
  1168  				}
  1169  				cw.AdaptiveCard = &adaptiveCard
  1170  			}
  1171  		case "id":
  1172  			if v != nil {
  1173  				var ID string
  1174  				err = json.Unmarshal(*v, &ID)
  1175  				if err != nil {
  1176  					return err
  1177  				}
  1178  				cw.ID = &ID
  1179  			}
  1180  		case "_type":
  1181  			if v != nil {
  1182  				var typeVar TypeBasicResponseBase
  1183  				err = json.Unmarshal(*v, &typeVar)
  1184  				if err != nil {
  1185  					return err
  1186  				}
  1187  				cw.Type = typeVar
  1188  			}
  1189  		}
  1190  	}
  1191  
  1192  	return nil
  1193  }
  1194  
  1195  // BasicError defines the error that occurred.
  1196  type BasicError interface {
  1197  	AsError() (*Error, bool)
  1198  }
  1199  
  1200  // Error defines the error that occurred.
  1201  type Error struct {
  1202  	// Code - The error code that identifies the category of error. Possible values include: 'None', 'ServerError', 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'
  1203  	Code ErrorCode `json:"code,omitempty"`
  1204  	// Message - A description of the error.
  1205  	Message *string `json:"message,omitempty"`
  1206  	// MoreDetails - READ-ONLY; A description that provides additional information about the error.
  1207  	MoreDetails *string `json:"moreDetails,omitempty"`
  1208  	// Parameter - READ-ONLY; The parameter in the request that caused the error.
  1209  	Parameter *string `json:"parameter,omitempty"`
  1210  	// Value - READ-ONLY; The parameter's value in the request that was not valid.
  1211  	Value *string `json:"value,omitempty"`
  1212  	// Type - Possible values include: 'TypeError'
  1213  	Type TypeBasicError `json:"_type,omitempty"`
  1214  }
  1215  
  1216  func unmarshalBasicError(body []byte) (BasicError, error) {
  1217  	var m map[string]interface{}
  1218  	err := json.Unmarshal(body, &m)
  1219  	if err != nil {
  1220  		return nil, err
  1221  	}
  1222  
  1223  	switch m["_type"] {
  1224  	default:
  1225  		var e Error
  1226  		err := json.Unmarshal(body, &e)
  1227  		return e, err
  1228  	}
  1229  }
  1230  func unmarshalBasicErrorArray(body []byte) ([]BasicError, error) {
  1231  	var rawMessages []*json.RawMessage
  1232  	err := json.Unmarshal(body, &rawMessages)
  1233  	if err != nil {
  1234  		return nil, err
  1235  	}
  1236  
  1237  	eArray := make([]BasicError, len(rawMessages))
  1238  
  1239  	for index, rawMessage := range rawMessages {
  1240  		e, err := unmarshalBasicError(*rawMessage)
  1241  		if err != nil {
  1242  			return nil, err
  1243  		}
  1244  		eArray[index] = e
  1245  	}
  1246  	return eArray, nil
  1247  }
  1248  
  1249  // MarshalJSON is the custom marshaler for Error.
  1250  func (e Error) MarshalJSON() ([]byte, error) {
  1251  	e.Type = TypeError
  1252  	objectMap := make(map[string]interface{})
  1253  	if e.Code != "" {
  1254  		objectMap["code"] = e.Code
  1255  	}
  1256  	if e.Message != nil {
  1257  		objectMap["message"] = e.Message
  1258  	}
  1259  	if e.Type != "" {
  1260  		objectMap["_type"] = e.Type
  1261  	}
  1262  	return json.Marshal(objectMap)
  1263  }
  1264  
  1265  // AsError is the BasicError implementation for Error.
  1266  func (e Error) AsError() (*Error, bool) {
  1267  	return &e, true
  1268  }
  1269  
  1270  // AsBasicError is the BasicError implementation for Error.
  1271  func (e Error) AsBasicError() (BasicError, bool) {
  1272  	return &e, true
  1273  }
  1274  
  1275  // ErrorResponse the top-level response that represents a failed request.
  1276  type ErrorResponse struct {
  1277  	// Errors - A list of errors that describe the reasons why the request failed.
  1278  	Errors *[]BasicError `json:"errors,omitempty"`
  1279  	// ReadLink - READ-ONLY; The URL that returns this resource.
  1280  	ReadLink *string `json:"readLink,omitempty"`
  1281  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  1282  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  1283  	// PotentialAction - READ-ONLY
  1284  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  1285  	// ImmediateAction - READ-ONLY
  1286  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  1287  	// PreferredClickthroughURL - READ-ONLY
  1288  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  1289  	// AdaptiveCard - READ-ONLY
  1290  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  1291  	// ID - READ-ONLY; A String identifier.
  1292  	ID *string `json:"id,omitempty"`
  1293  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
  1294  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  1295  }
  1296  
  1297  // MarshalJSON is the custom marshaler for ErrorResponse.
  1298  func (er ErrorResponse) MarshalJSON() ([]byte, error) {
  1299  	er.Type = TypeErrorResponse
  1300  	objectMap := make(map[string]interface{})
  1301  	if er.Errors != nil {
  1302  		objectMap["errors"] = er.Errors
  1303  	}
  1304  	if er.Type != "" {
  1305  		objectMap["_type"] = er.Type
  1306  	}
  1307  	return json.Marshal(objectMap)
  1308  }
  1309  
  1310  // AsSearchAction is the BasicResponseBase implementation for ErrorResponse.
  1311  func (er ErrorResponse) AsSearchAction() (*SearchAction, bool) {
  1312  	return nil, false
  1313  }
  1314  
  1315  // AsSuggestions is the BasicResponseBase implementation for ErrorResponse.
  1316  func (er ErrorResponse) AsSuggestions() (*Suggestions, bool) {
  1317  	return nil, false
  1318  }
  1319  
  1320  // AsSearchResultsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1321  func (er ErrorResponse) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1322  	return nil, false
  1323  }
  1324  
  1325  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1326  func (er ErrorResponse) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  1327  	return nil, false
  1328  }
  1329  
  1330  // AsAnswer is the BasicResponseBase implementation for ErrorResponse.
  1331  func (er ErrorResponse) AsAnswer() (*Answer, bool) {
  1332  	return nil, false
  1333  }
  1334  
  1335  // AsBasicAnswer is the BasicResponseBase implementation for ErrorResponse.
  1336  func (er ErrorResponse) AsBasicAnswer() (BasicAnswer, bool) {
  1337  	return nil, false
  1338  }
  1339  
  1340  // AsThing is the BasicResponseBase implementation for ErrorResponse.
  1341  func (er ErrorResponse) AsThing() (*Thing, bool) {
  1342  	return nil, false
  1343  }
  1344  
  1345  // AsBasicThing is the BasicResponseBase implementation for ErrorResponse.
  1346  func (er ErrorResponse) AsBasicThing() (BasicThing, bool) {
  1347  	return nil, false
  1348  }
  1349  
  1350  // AsAction is the BasicResponseBase implementation for ErrorResponse.
  1351  func (er ErrorResponse) AsAction() (*Action, bool) {
  1352  	return nil, false
  1353  }
  1354  
  1355  // AsBasicAction is the BasicResponseBase implementation for ErrorResponse.
  1356  func (er ErrorResponse) AsBasicAction() (BasicAction, bool) {
  1357  	return nil, false
  1358  }
  1359  
  1360  // AsResponse is the BasicResponseBase implementation for ErrorResponse.
  1361  func (er ErrorResponse) AsResponse() (*Response, bool) {
  1362  	return nil, false
  1363  }
  1364  
  1365  // AsBasicResponse is the BasicResponseBase implementation for ErrorResponse.
  1366  func (er ErrorResponse) AsBasicResponse() (BasicResponse, bool) {
  1367  	return &er, true
  1368  }
  1369  
  1370  // AsIdentifiable is the BasicResponseBase implementation for ErrorResponse.
  1371  func (er ErrorResponse) AsIdentifiable() (*Identifiable, bool) {
  1372  	return nil, false
  1373  }
  1374  
  1375  // AsBasicIdentifiable is the BasicResponseBase implementation for ErrorResponse.
  1376  func (er ErrorResponse) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1377  	return &er, true
  1378  }
  1379  
  1380  // AsErrorResponse is the BasicResponseBase implementation for ErrorResponse.
  1381  func (er ErrorResponse) AsErrorResponse() (*ErrorResponse, bool) {
  1382  	return &er, true
  1383  }
  1384  
  1385  // AsCreativeWork is the BasicResponseBase implementation for ErrorResponse.
  1386  func (er ErrorResponse) AsCreativeWork() (*CreativeWork, bool) {
  1387  	return nil, false
  1388  }
  1389  
  1390  // AsBasicCreativeWork is the BasicResponseBase implementation for ErrorResponse.
  1391  func (er ErrorResponse) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1392  	return nil, false
  1393  }
  1394  
  1395  // AsResponseBase is the BasicResponseBase implementation for ErrorResponse.
  1396  func (er ErrorResponse) AsResponseBase() (*ResponseBase, bool) {
  1397  	return nil, false
  1398  }
  1399  
  1400  // AsBasicResponseBase is the BasicResponseBase implementation for ErrorResponse.
  1401  func (er ErrorResponse) AsBasicResponseBase() (BasicResponseBase, bool) {
  1402  	return &er, true
  1403  }
  1404  
  1405  // UnmarshalJSON is the custom unmarshaler for ErrorResponse struct.
  1406  func (er *ErrorResponse) UnmarshalJSON(body []byte) error {
  1407  	var m map[string]*json.RawMessage
  1408  	err := json.Unmarshal(body, &m)
  1409  	if err != nil {
  1410  		return err
  1411  	}
  1412  	for k, v := range m {
  1413  		switch k {
  1414  		case "errors":
  1415  			if v != nil {
  1416  				errorsVar, err := unmarshalBasicErrorArray(*v)
  1417  				if err != nil {
  1418  					return err
  1419  				}
  1420  				er.Errors = &errorsVar
  1421  			}
  1422  		case "readLink":
  1423  			if v != nil {
  1424  				var readLink string
  1425  				err = json.Unmarshal(*v, &readLink)
  1426  				if err != nil {
  1427  					return err
  1428  				}
  1429  				er.ReadLink = &readLink
  1430  			}
  1431  		case "webSearchUrl":
  1432  			if v != nil {
  1433  				var webSearchURL string
  1434  				err = json.Unmarshal(*v, &webSearchURL)
  1435  				if err != nil {
  1436  					return err
  1437  				}
  1438  				er.WebSearchURL = &webSearchURL
  1439  			}
  1440  		case "potentialAction":
  1441  			if v != nil {
  1442  				potentialAction, err := unmarshalBasicActionArray(*v)
  1443  				if err != nil {
  1444  					return err
  1445  				}
  1446  				er.PotentialAction = &potentialAction
  1447  			}
  1448  		case "immediateAction":
  1449  			if v != nil {
  1450  				immediateAction, err := unmarshalBasicActionArray(*v)
  1451  				if err != nil {
  1452  					return err
  1453  				}
  1454  				er.ImmediateAction = &immediateAction
  1455  			}
  1456  		case "preferredClickthroughUrl":
  1457  			if v != nil {
  1458  				var preferredClickthroughURL string
  1459  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  1460  				if err != nil {
  1461  					return err
  1462  				}
  1463  				er.PreferredClickthroughURL = &preferredClickthroughURL
  1464  			}
  1465  		case "adaptiveCard":
  1466  			if v != nil {
  1467  				var adaptiveCard string
  1468  				err = json.Unmarshal(*v, &adaptiveCard)
  1469  				if err != nil {
  1470  					return err
  1471  				}
  1472  				er.AdaptiveCard = &adaptiveCard
  1473  			}
  1474  		case "id":
  1475  			if v != nil {
  1476  				var ID string
  1477  				err = json.Unmarshal(*v, &ID)
  1478  				if err != nil {
  1479  					return err
  1480  				}
  1481  				er.ID = &ID
  1482  			}
  1483  		case "_type":
  1484  			if v != nil {
  1485  				var typeVar TypeBasicResponseBase
  1486  				err = json.Unmarshal(*v, &typeVar)
  1487  				if err != nil {
  1488  					return err
  1489  				}
  1490  				er.Type = typeVar
  1491  			}
  1492  		}
  1493  	}
  1494  
  1495  	return nil
  1496  }
  1497  
  1498  // BasicIdentifiable defines the identity of a resource.
  1499  type BasicIdentifiable interface {
  1500  	AsSearchAction() (*SearchAction, bool)
  1501  	AsSuggestions() (*Suggestions, bool)
  1502  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  1503  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  1504  	AsAnswer() (*Answer, bool)
  1505  	AsBasicAnswer() (BasicAnswer, bool)
  1506  	AsThing() (*Thing, bool)
  1507  	AsBasicThing() (BasicThing, bool)
  1508  	AsAction() (*Action, bool)
  1509  	AsBasicAction() (BasicAction, bool)
  1510  	AsResponse() (*Response, bool)
  1511  	AsBasicResponse() (BasicResponse, bool)
  1512  	AsErrorResponse() (*ErrorResponse, bool)
  1513  	AsCreativeWork() (*CreativeWork, bool)
  1514  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  1515  	AsIdentifiable() (*Identifiable, bool)
  1516  }
  1517  
  1518  // Identifiable defines the identity of a resource.
  1519  type Identifiable struct {
  1520  	// ID - READ-ONLY; A String identifier.
  1521  	ID *string `json:"id,omitempty"`
  1522  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
  1523  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  1524  }
  1525  
  1526  func unmarshalBasicIdentifiable(body []byte) (BasicIdentifiable, error) {
  1527  	var m map[string]interface{}
  1528  	err := json.Unmarshal(body, &m)
  1529  	if err != nil {
  1530  		return nil, err
  1531  	}
  1532  
  1533  	switch m["_type"] {
  1534  	case string(TypeSearchAction):
  1535  		var sa SearchAction
  1536  		err := json.Unmarshal(body, &sa)
  1537  		return sa, err
  1538  	case string(TypeSuggestions):
  1539  		var s Suggestions
  1540  		err := json.Unmarshal(body, &s)
  1541  		return s, err
  1542  	case string(TypeSearchResultsAnswer):
  1543  		var sra SearchResultsAnswer
  1544  		err := json.Unmarshal(body, &sra)
  1545  		return sra, err
  1546  	case string(TypeAnswer):
  1547  		var a Answer
  1548  		err := json.Unmarshal(body, &a)
  1549  		return a, err
  1550  	case string(TypeThing):
  1551  		var t Thing
  1552  		err := json.Unmarshal(body, &t)
  1553  		return t, err
  1554  	case string(TypeAction):
  1555  		var a Action
  1556  		err := json.Unmarshal(body, &a)
  1557  		return a, err
  1558  	case string(TypeResponse):
  1559  		var r Response
  1560  		err := json.Unmarshal(body, &r)
  1561  		return r, err
  1562  	case string(TypeErrorResponse):
  1563  		var er ErrorResponse
  1564  		err := json.Unmarshal(body, &er)
  1565  		return er, err
  1566  	case string(TypeCreativeWork):
  1567  		var cw CreativeWork
  1568  		err := json.Unmarshal(body, &cw)
  1569  		return cw, err
  1570  	default:
  1571  		var i Identifiable
  1572  		err := json.Unmarshal(body, &i)
  1573  		return i, err
  1574  	}
  1575  }
  1576  func unmarshalBasicIdentifiableArray(body []byte) ([]BasicIdentifiable, error) {
  1577  	var rawMessages []*json.RawMessage
  1578  	err := json.Unmarshal(body, &rawMessages)
  1579  	if err != nil {
  1580  		return nil, err
  1581  	}
  1582  
  1583  	iArray := make([]BasicIdentifiable, len(rawMessages))
  1584  
  1585  	for index, rawMessage := range rawMessages {
  1586  		i, err := unmarshalBasicIdentifiable(*rawMessage)
  1587  		if err != nil {
  1588  			return nil, err
  1589  		}
  1590  		iArray[index] = i
  1591  	}
  1592  	return iArray, nil
  1593  }
  1594  
  1595  // MarshalJSON is the custom marshaler for Identifiable.
  1596  func (i Identifiable) MarshalJSON() ([]byte, error) {
  1597  	i.Type = TypeIdentifiable
  1598  	objectMap := make(map[string]interface{})
  1599  	if i.Type != "" {
  1600  		objectMap["_type"] = i.Type
  1601  	}
  1602  	return json.Marshal(objectMap)
  1603  }
  1604  
  1605  // AsSearchAction is the BasicResponseBase implementation for Identifiable.
  1606  func (i Identifiable) AsSearchAction() (*SearchAction, bool) {
  1607  	return nil, false
  1608  }
  1609  
  1610  // AsSuggestions is the BasicResponseBase implementation for Identifiable.
  1611  func (i Identifiable) AsSuggestions() (*Suggestions, bool) {
  1612  	return nil, false
  1613  }
  1614  
  1615  // AsSearchResultsAnswer is the BasicResponseBase implementation for Identifiable.
  1616  func (i Identifiable) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1617  	return nil, false
  1618  }
  1619  
  1620  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Identifiable.
  1621  func (i Identifiable) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  1622  	return nil, false
  1623  }
  1624  
  1625  // AsAnswer is the BasicResponseBase implementation for Identifiable.
  1626  func (i Identifiable) AsAnswer() (*Answer, bool) {
  1627  	return nil, false
  1628  }
  1629  
  1630  // AsBasicAnswer is the BasicResponseBase implementation for Identifiable.
  1631  func (i Identifiable) AsBasicAnswer() (BasicAnswer, bool) {
  1632  	return nil, false
  1633  }
  1634  
  1635  // AsThing is the BasicResponseBase implementation for Identifiable.
  1636  func (i Identifiable) AsThing() (*Thing, bool) {
  1637  	return nil, false
  1638  }
  1639  
  1640  // AsBasicThing is the BasicResponseBase implementation for Identifiable.
  1641  func (i Identifiable) AsBasicThing() (BasicThing, bool) {
  1642  	return nil, false
  1643  }
  1644  
  1645  // AsAction is the BasicResponseBase implementation for Identifiable.
  1646  func (i Identifiable) AsAction() (*Action, bool) {
  1647  	return nil, false
  1648  }
  1649  
  1650  // AsBasicAction is the BasicResponseBase implementation for Identifiable.
  1651  func (i Identifiable) AsBasicAction() (BasicAction, bool) {
  1652  	return nil, false
  1653  }
  1654  
  1655  // AsResponse is the BasicResponseBase implementation for Identifiable.
  1656  func (i Identifiable) AsResponse() (*Response, bool) {
  1657  	return nil, false
  1658  }
  1659  
  1660  // AsBasicResponse is the BasicResponseBase implementation for Identifiable.
  1661  func (i Identifiable) AsBasicResponse() (BasicResponse, bool) {
  1662  	return nil, false
  1663  }
  1664  
  1665  // AsIdentifiable is the BasicResponseBase implementation for Identifiable.
  1666  func (i Identifiable) AsIdentifiable() (*Identifiable, bool) {
  1667  	return &i, true
  1668  }
  1669  
  1670  // AsBasicIdentifiable is the BasicResponseBase implementation for Identifiable.
  1671  func (i Identifiable) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1672  	return &i, true
  1673  }
  1674  
  1675  // AsErrorResponse is the BasicResponseBase implementation for Identifiable.
  1676  func (i Identifiable) AsErrorResponse() (*ErrorResponse, bool) {
  1677  	return nil, false
  1678  }
  1679  
  1680  // AsCreativeWork is the BasicResponseBase implementation for Identifiable.
  1681  func (i Identifiable) AsCreativeWork() (*CreativeWork, bool) {
  1682  	return nil, false
  1683  }
  1684  
  1685  // AsBasicCreativeWork is the BasicResponseBase implementation for Identifiable.
  1686  func (i Identifiable) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1687  	return nil, false
  1688  }
  1689  
  1690  // AsResponseBase is the BasicResponseBase implementation for Identifiable.
  1691  func (i Identifiable) AsResponseBase() (*ResponseBase, bool) {
  1692  	return nil, false
  1693  }
  1694  
  1695  // AsBasicResponseBase is the BasicResponseBase implementation for Identifiable.
  1696  func (i Identifiable) AsBasicResponseBase() (BasicResponseBase, bool) {
  1697  	return &i, true
  1698  }
  1699  
  1700  // BasicQueryContext defines the query context that Bing used for the request.
  1701  type BasicQueryContext interface {
  1702  	AsQueryContext() (*QueryContext, bool)
  1703  }
  1704  
  1705  // QueryContext defines the query context that Bing used for the request.
  1706  type QueryContext struct {
  1707  	// OriginalQuery - The query string as specified in the request.
  1708  	OriginalQuery *string `json:"originalQuery,omitempty"`
  1709  	// 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.
  1710  	AlteredQuery *string `json:"alteredQuery,omitempty"`
  1711  	// 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.
  1712  	AlterationOverrideQuery *string `json:"alterationOverrideQuery,omitempty"`
  1713  	// 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.
  1714  	AdultIntent *bool `json:"adultIntent,omitempty"`
  1715  	// 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".
  1716  	AskUserForLocation *bool `json:"askUserForLocation,omitempty"`
  1717  	// IsTransactional - READ-ONLY
  1718  	IsTransactional *bool `json:"isTransactional,omitempty"`
  1719  	// Type - Possible values include: 'TypeQueryContext'
  1720  	Type TypeBasicQueryContext `json:"_type,omitempty"`
  1721  }
  1722  
  1723  func unmarshalBasicQueryContext(body []byte) (BasicQueryContext, error) {
  1724  	var m map[string]interface{}
  1725  	err := json.Unmarshal(body, &m)
  1726  	if err != nil {
  1727  		return nil, err
  1728  	}
  1729  
  1730  	switch m["_type"] {
  1731  	default:
  1732  		var qc QueryContext
  1733  		err := json.Unmarshal(body, &qc)
  1734  		return qc, err
  1735  	}
  1736  }
  1737  func unmarshalBasicQueryContextArray(body []byte) ([]BasicQueryContext, error) {
  1738  	var rawMessages []*json.RawMessage
  1739  	err := json.Unmarshal(body, &rawMessages)
  1740  	if err != nil {
  1741  		return nil, err
  1742  	}
  1743  
  1744  	qcArray := make([]BasicQueryContext, len(rawMessages))
  1745  
  1746  	for index, rawMessage := range rawMessages {
  1747  		qc, err := unmarshalBasicQueryContext(*rawMessage)
  1748  		if err != nil {
  1749  			return nil, err
  1750  		}
  1751  		qcArray[index] = qc
  1752  	}
  1753  	return qcArray, nil
  1754  }
  1755  
  1756  // MarshalJSON is the custom marshaler for QueryContext.
  1757  func (qc QueryContext) MarshalJSON() ([]byte, error) {
  1758  	qc.Type = TypeQueryContext
  1759  	objectMap := make(map[string]interface{})
  1760  	if qc.OriginalQuery != nil {
  1761  		objectMap["originalQuery"] = qc.OriginalQuery
  1762  	}
  1763  	if qc.Type != "" {
  1764  		objectMap["_type"] = qc.Type
  1765  	}
  1766  	return json.Marshal(objectMap)
  1767  }
  1768  
  1769  // AsQueryContext is the BasicQueryContext implementation for QueryContext.
  1770  func (qc QueryContext) AsQueryContext() (*QueryContext, bool) {
  1771  	return &qc, true
  1772  }
  1773  
  1774  // AsBasicQueryContext is the BasicQueryContext implementation for QueryContext.
  1775  func (qc QueryContext) AsBasicQueryContext() (BasicQueryContext, bool) {
  1776  	return &qc, true
  1777  }
  1778  
  1779  // BasicResponse defines a response. All schemas that could be returned at the root of a response should inherit from
  1780  // this
  1781  type BasicResponse interface {
  1782  	AsSearchAction() (*SearchAction, bool)
  1783  	AsSuggestions() (*Suggestions, bool)
  1784  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  1785  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  1786  	AsAnswer() (*Answer, bool)
  1787  	AsBasicAnswer() (BasicAnswer, bool)
  1788  	AsThing() (*Thing, bool)
  1789  	AsBasicThing() (BasicThing, bool)
  1790  	AsAction() (*Action, bool)
  1791  	AsBasicAction() (BasicAction, bool)
  1792  	AsErrorResponse() (*ErrorResponse, bool)
  1793  	AsCreativeWork() (*CreativeWork, bool)
  1794  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  1795  	AsResponse() (*Response, bool)
  1796  }
  1797  
  1798  // Response defines a response. All schemas that could be returned at the root of a response should inherit
  1799  // from this
  1800  type Response struct {
  1801  	// ReadLink - READ-ONLY; The URL that returns this resource.
  1802  	ReadLink *string `json:"readLink,omitempty"`
  1803  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  1804  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  1805  	// PotentialAction - READ-ONLY
  1806  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  1807  	// ImmediateAction - READ-ONLY
  1808  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  1809  	// PreferredClickthroughURL - READ-ONLY
  1810  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  1811  	// AdaptiveCard - READ-ONLY
  1812  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  1813  	// ID - READ-ONLY; A String identifier.
  1814  	ID *string `json:"id,omitempty"`
  1815  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
  1816  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  1817  }
  1818  
  1819  func unmarshalBasicResponse(body []byte) (BasicResponse, error) {
  1820  	var m map[string]interface{}
  1821  	err := json.Unmarshal(body, &m)
  1822  	if err != nil {
  1823  		return nil, err
  1824  	}
  1825  
  1826  	switch m["_type"] {
  1827  	case string(TypeSearchAction):
  1828  		var sa SearchAction
  1829  		err := json.Unmarshal(body, &sa)
  1830  		return sa, err
  1831  	case string(TypeSuggestions):
  1832  		var s Suggestions
  1833  		err := json.Unmarshal(body, &s)
  1834  		return s, err
  1835  	case string(TypeSearchResultsAnswer):
  1836  		var sra SearchResultsAnswer
  1837  		err := json.Unmarshal(body, &sra)
  1838  		return sra, err
  1839  	case string(TypeAnswer):
  1840  		var a Answer
  1841  		err := json.Unmarshal(body, &a)
  1842  		return a, err
  1843  	case string(TypeThing):
  1844  		var t Thing
  1845  		err := json.Unmarshal(body, &t)
  1846  		return t, err
  1847  	case string(TypeAction):
  1848  		var a Action
  1849  		err := json.Unmarshal(body, &a)
  1850  		return a, err
  1851  	case string(TypeErrorResponse):
  1852  		var er ErrorResponse
  1853  		err := json.Unmarshal(body, &er)
  1854  		return er, err
  1855  	case string(TypeCreativeWork):
  1856  		var cw CreativeWork
  1857  		err := json.Unmarshal(body, &cw)
  1858  		return cw, err
  1859  	default:
  1860  		var r Response
  1861  		err := json.Unmarshal(body, &r)
  1862  		return r, err
  1863  	}
  1864  }
  1865  func unmarshalBasicResponseArray(body []byte) ([]BasicResponse, error) {
  1866  	var rawMessages []*json.RawMessage
  1867  	err := json.Unmarshal(body, &rawMessages)
  1868  	if err != nil {
  1869  		return nil, err
  1870  	}
  1871  
  1872  	rArray := make([]BasicResponse, len(rawMessages))
  1873  
  1874  	for index, rawMessage := range rawMessages {
  1875  		r, err := unmarshalBasicResponse(*rawMessage)
  1876  		if err != nil {
  1877  			return nil, err
  1878  		}
  1879  		rArray[index] = r
  1880  	}
  1881  	return rArray, nil
  1882  }
  1883  
  1884  // MarshalJSON is the custom marshaler for Response.
  1885  func (r Response) MarshalJSON() ([]byte, error) {
  1886  	r.Type = TypeResponse
  1887  	objectMap := make(map[string]interface{})
  1888  	if r.Type != "" {
  1889  		objectMap["_type"] = r.Type
  1890  	}
  1891  	return json.Marshal(objectMap)
  1892  }
  1893  
  1894  // AsSearchAction is the BasicResponseBase implementation for Response.
  1895  func (r Response) AsSearchAction() (*SearchAction, bool) {
  1896  	return nil, false
  1897  }
  1898  
  1899  // AsSuggestions is the BasicResponseBase implementation for Response.
  1900  func (r Response) AsSuggestions() (*Suggestions, bool) {
  1901  	return nil, false
  1902  }
  1903  
  1904  // AsSearchResultsAnswer is the BasicResponseBase implementation for Response.
  1905  func (r Response) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  1906  	return nil, false
  1907  }
  1908  
  1909  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Response.
  1910  func (r Response) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  1911  	return nil, false
  1912  }
  1913  
  1914  // AsAnswer is the BasicResponseBase implementation for Response.
  1915  func (r Response) AsAnswer() (*Answer, bool) {
  1916  	return nil, false
  1917  }
  1918  
  1919  // AsBasicAnswer is the BasicResponseBase implementation for Response.
  1920  func (r Response) AsBasicAnswer() (BasicAnswer, bool) {
  1921  	return nil, false
  1922  }
  1923  
  1924  // AsThing is the BasicResponseBase implementation for Response.
  1925  func (r Response) AsThing() (*Thing, bool) {
  1926  	return nil, false
  1927  }
  1928  
  1929  // AsBasicThing is the BasicResponseBase implementation for Response.
  1930  func (r Response) AsBasicThing() (BasicThing, bool) {
  1931  	return nil, false
  1932  }
  1933  
  1934  // AsAction is the BasicResponseBase implementation for Response.
  1935  func (r Response) AsAction() (*Action, bool) {
  1936  	return nil, false
  1937  }
  1938  
  1939  // AsBasicAction is the BasicResponseBase implementation for Response.
  1940  func (r Response) AsBasicAction() (BasicAction, bool) {
  1941  	return nil, false
  1942  }
  1943  
  1944  // AsResponse is the BasicResponseBase implementation for Response.
  1945  func (r Response) AsResponse() (*Response, bool) {
  1946  	return &r, true
  1947  }
  1948  
  1949  // AsBasicResponse is the BasicResponseBase implementation for Response.
  1950  func (r Response) AsBasicResponse() (BasicResponse, bool) {
  1951  	return &r, true
  1952  }
  1953  
  1954  // AsIdentifiable is the BasicResponseBase implementation for Response.
  1955  func (r Response) AsIdentifiable() (*Identifiable, bool) {
  1956  	return nil, false
  1957  }
  1958  
  1959  // AsBasicIdentifiable is the BasicResponseBase implementation for Response.
  1960  func (r Response) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  1961  	return &r, true
  1962  }
  1963  
  1964  // AsErrorResponse is the BasicResponseBase implementation for Response.
  1965  func (r Response) AsErrorResponse() (*ErrorResponse, bool) {
  1966  	return nil, false
  1967  }
  1968  
  1969  // AsCreativeWork is the BasicResponseBase implementation for Response.
  1970  func (r Response) AsCreativeWork() (*CreativeWork, bool) {
  1971  	return nil, false
  1972  }
  1973  
  1974  // AsBasicCreativeWork is the BasicResponseBase implementation for Response.
  1975  func (r Response) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  1976  	return nil, false
  1977  }
  1978  
  1979  // AsResponseBase is the BasicResponseBase implementation for Response.
  1980  func (r Response) AsResponseBase() (*ResponseBase, bool) {
  1981  	return nil, false
  1982  }
  1983  
  1984  // AsBasicResponseBase is the BasicResponseBase implementation for Response.
  1985  func (r Response) AsBasicResponseBase() (BasicResponseBase, bool) {
  1986  	return &r, true
  1987  }
  1988  
  1989  // UnmarshalJSON is the custom unmarshaler for Response struct.
  1990  func (r *Response) UnmarshalJSON(body []byte) error {
  1991  	var m map[string]*json.RawMessage
  1992  	err := json.Unmarshal(body, &m)
  1993  	if err != nil {
  1994  		return err
  1995  	}
  1996  	for k, v := range m {
  1997  		switch k {
  1998  		case "readLink":
  1999  			if v != nil {
  2000  				var readLink string
  2001  				err = json.Unmarshal(*v, &readLink)
  2002  				if err != nil {
  2003  					return err
  2004  				}
  2005  				r.ReadLink = &readLink
  2006  			}
  2007  		case "webSearchUrl":
  2008  			if v != nil {
  2009  				var webSearchURL string
  2010  				err = json.Unmarshal(*v, &webSearchURL)
  2011  				if err != nil {
  2012  					return err
  2013  				}
  2014  				r.WebSearchURL = &webSearchURL
  2015  			}
  2016  		case "potentialAction":
  2017  			if v != nil {
  2018  				potentialAction, err := unmarshalBasicActionArray(*v)
  2019  				if err != nil {
  2020  					return err
  2021  				}
  2022  				r.PotentialAction = &potentialAction
  2023  			}
  2024  		case "immediateAction":
  2025  			if v != nil {
  2026  				immediateAction, err := unmarshalBasicActionArray(*v)
  2027  				if err != nil {
  2028  					return err
  2029  				}
  2030  				r.ImmediateAction = &immediateAction
  2031  			}
  2032  		case "preferredClickthroughUrl":
  2033  			if v != nil {
  2034  				var preferredClickthroughURL string
  2035  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  2036  				if err != nil {
  2037  					return err
  2038  				}
  2039  				r.PreferredClickthroughURL = &preferredClickthroughURL
  2040  			}
  2041  		case "adaptiveCard":
  2042  			if v != nil {
  2043  				var adaptiveCard string
  2044  				err = json.Unmarshal(*v, &adaptiveCard)
  2045  				if err != nil {
  2046  					return err
  2047  				}
  2048  				r.AdaptiveCard = &adaptiveCard
  2049  			}
  2050  		case "id":
  2051  			if v != nil {
  2052  				var ID string
  2053  				err = json.Unmarshal(*v, &ID)
  2054  				if err != nil {
  2055  					return err
  2056  				}
  2057  				r.ID = &ID
  2058  			}
  2059  		case "_type":
  2060  			if v != nil {
  2061  				var typeVar TypeBasicResponseBase
  2062  				err = json.Unmarshal(*v, &typeVar)
  2063  				if err != nil {
  2064  					return err
  2065  				}
  2066  				r.Type = typeVar
  2067  			}
  2068  		}
  2069  	}
  2070  
  2071  	return nil
  2072  }
  2073  
  2074  // BasicResponseBase response base
  2075  type BasicResponseBase interface {
  2076  	AsSearchAction() (*SearchAction, bool)
  2077  	AsSuggestions() (*Suggestions, bool)
  2078  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  2079  	AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool)
  2080  	AsAnswer() (*Answer, bool)
  2081  	AsBasicAnswer() (BasicAnswer, bool)
  2082  	AsThing() (*Thing, bool)
  2083  	AsBasicThing() (BasicThing, bool)
  2084  	AsAction() (*Action, bool)
  2085  	AsBasicAction() (BasicAction, bool)
  2086  	AsResponse() (*Response, bool)
  2087  	AsBasicResponse() (BasicResponse, bool)
  2088  	AsIdentifiable() (*Identifiable, bool)
  2089  	AsBasicIdentifiable() (BasicIdentifiable, bool)
  2090  	AsErrorResponse() (*ErrorResponse, bool)
  2091  	AsCreativeWork() (*CreativeWork, bool)
  2092  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  2093  	AsResponseBase() (*ResponseBase, bool)
  2094  }
  2095  
  2096  // ResponseBase response base
  2097  type ResponseBase struct {
  2098  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
  2099  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  2100  }
  2101  
  2102  func unmarshalBasicResponseBase(body []byte) (BasicResponseBase, error) {
  2103  	var m map[string]interface{}
  2104  	err := json.Unmarshal(body, &m)
  2105  	if err != nil {
  2106  		return nil, err
  2107  	}
  2108  
  2109  	switch m["_type"] {
  2110  	case string(TypeSearchAction):
  2111  		var sa SearchAction
  2112  		err := json.Unmarshal(body, &sa)
  2113  		return sa, err
  2114  	case string(TypeSuggestions):
  2115  		var s Suggestions
  2116  		err := json.Unmarshal(body, &s)
  2117  		return s, err
  2118  	case string(TypeSearchResultsAnswer):
  2119  		var sra SearchResultsAnswer
  2120  		err := json.Unmarshal(body, &sra)
  2121  		return sra, err
  2122  	case string(TypeAnswer):
  2123  		var a Answer
  2124  		err := json.Unmarshal(body, &a)
  2125  		return a, err
  2126  	case string(TypeThing):
  2127  		var t Thing
  2128  		err := json.Unmarshal(body, &t)
  2129  		return t, err
  2130  	case string(TypeAction):
  2131  		var a Action
  2132  		err := json.Unmarshal(body, &a)
  2133  		return a, err
  2134  	case string(TypeResponse):
  2135  		var r Response
  2136  		err := json.Unmarshal(body, &r)
  2137  		return r, err
  2138  	case string(TypeIdentifiable):
  2139  		var i Identifiable
  2140  		err := json.Unmarshal(body, &i)
  2141  		return i, err
  2142  	case string(TypeErrorResponse):
  2143  		var er ErrorResponse
  2144  		err := json.Unmarshal(body, &er)
  2145  		return er, err
  2146  	case string(TypeCreativeWork):
  2147  		var cw CreativeWork
  2148  		err := json.Unmarshal(body, &cw)
  2149  		return cw, err
  2150  	default:
  2151  		var rb ResponseBase
  2152  		err := json.Unmarshal(body, &rb)
  2153  		return rb, err
  2154  	}
  2155  }
  2156  func unmarshalBasicResponseBaseArray(body []byte) ([]BasicResponseBase, error) {
  2157  	var rawMessages []*json.RawMessage
  2158  	err := json.Unmarshal(body, &rawMessages)
  2159  	if err != nil {
  2160  		return nil, err
  2161  	}
  2162  
  2163  	rbArray := make([]BasicResponseBase, len(rawMessages))
  2164  
  2165  	for index, rawMessage := range rawMessages {
  2166  		rb, err := unmarshalBasicResponseBase(*rawMessage)
  2167  		if err != nil {
  2168  			return nil, err
  2169  		}
  2170  		rbArray[index] = rb
  2171  	}
  2172  	return rbArray, nil
  2173  }
  2174  
  2175  // MarshalJSON is the custom marshaler for ResponseBase.
  2176  func (rb ResponseBase) MarshalJSON() ([]byte, error) {
  2177  	rb.Type = TypeResponseBase
  2178  	objectMap := make(map[string]interface{})
  2179  	if rb.Type != "" {
  2180  		objectMap["_type"] = rb.Type
  2181  	}
  2182  	return json.Marshal(objectMap)
  2183  }
  2184  
  2185  // AsSearchAction is the BasicResponseBase implementation for ResponseBase.
  2186  func (rb ResponseBase) AsSearchAction() (*SearchAction, bool) {
  2187  	return nil, false
  2188  }
  2189  
  2190  // AsSuggestions is the BasicResponseBase implementation for ResponseBase.
  2191  func (rb ResponseBase) AsSuggestions() (*Suggestions, bool) {
  2192  	return nil, false
  2193  }
  2194  
  2195  // AsSearchResultsAnswer is the BasicResponseBase implementation for ResponseBase.
  2196  func (rb ResponseBase) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2197  	return nil, false
  2198  }
  2199  
  2200  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for ResponseBase.
  2201  func (rb ResponseBase) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2202  	return nil, false
  2203  }
  2204  
  2205  // AsAnswer is the BasicResponseBase implementation for ResponseBase.
  2206  func (rb ResponseBase) AsAnswer() (*Answer, bool) {
  2207  	return nil, false
  2208  }
  2209  
  2210  // AsBasicAnswer is the BasicResponseBase implementation for ResponseBase.
  2211  func (rb ResponseBase) AsBasicAnswer() (BasicAnswer, bool) {
  2212  	return nil, false
  2213  }
  2214  
  2215  // AsThing is the BasicResponseBase implementation for ResponseBase.
  2216  func (rb ResponseBase) AsThing() (*Thing, bool) {
  2217  	return nil, false
  2218  }
  2219  
  2220  // AsBasicThing is the BasicResponseBase implementation for ResponseBase.
  2221  func (rb ResponseBase) AsBasicThing() (BasicThing, bool) {
  2222  	return nil, false
  2223  }
  2224  
  2225  // AsAction is the BasicResponseBase implementation for ResponseBase.
  2226  func (rb ResponseBase) AsAction() (*Action, bool) {
  2227  	return nil, false
  2228  }
  2229  
  2230  // AsBasicAction is the BasicResponseBase implementation for ResponseBase.
  2231  func (rb ResponseBase) AsBasicAction() (BasicAction, bool) {
  2232  	return nil, false
  2233  }
  2234  
  2235  // AsResponse is the BasicResponseBase implementation for ResponseBase.
  2236  func (rb ResponseBase) AsResponse() (*Response, bool) {
  2237  	return nil, false
  2238  }
  2239  
  2240  // AsBasicResponse is the BasicResponseBase implementation for ResponseBase.
  2241  func (rb ResponseBase) AsBasicResponse() (BasicResponse, bool) {
  2242  	return nil, false
  2243  }
  2244  
  2245  // AsIdentifiable is the BasicResponseBase implementation for ResponseBase.
  2246  func (rb ResponseBase) AsIdentifiable() (*Identifiable, bool) {
  2247  	return nil, false
  2248  }
  2249  
  2250  // AsBasicIdentifiable is the BasicResponseBase implementation for ResponseBase.
  2251  func (rb ResponseBase) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2252  	return nil, false
  2253  }
  2254  
  2255  // AsErrorResponse is the BasicResponseBase implementation for ResponseBase.
  2256  func (rb ResponseBase) AsErrorResponse() (*ErrorResponse, bool) {
  2257  	return nil, false
  2258  }
  2259  
  2260  // AsCreativeWork is the BasicResponseBase implementation for ResponseBase.
  2261  func (rb ResponseBase) AsCreativeWork() (*CreativeWork, bool) {
  2262  	return nil, false
  2263  }
  2264  
  2265  // AsBasicCreativeWork is the BasicResponseBase implementation for ResponseBase.
  2266  func (rb ResponseBase) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2267  	return nil, false
  2268  }
  2269  
  2270  // AsResponseBase is the BasicResponseBase implementation for ResponseBase.
  2271  func (rb ResponseBase) AsResponseBase() (*ResponseBase, bool) {
  2272  	return &rb, true
  2273  }
  2274  
  2275  // AsBasicResponseBase is the BasicResponseBase implementation for ResponseBase.
  2276  func (rb ResponseBase) AsBasicResponseBase() (BasicResponseBase, bool) {
  2277  	return &rb, true
  2278  }
  2279  
  2280  // SearchAction ...
  2281  type SearchAction struct {
  2282  	// DisplayText - READ-ONLY
  2283  	DisplayText *string `json:"displayText,omitempty"`
  2284  	// Query - READ-ONLY
  2285  	Query *string `json:"query,omitempty"`
  2286  	// SearchKind - READ-ONLY; Possible values include: 'WebSearch', 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', 'CustomSearch'
  2287  	SearchKind SearchKind `json:"searchKind,omitempty"`
  2288  	// Result - READ-ONLY
  2289  	Result *[]BasicThing `json:"result,omitempty"`
  2290  	// DisplayName - READ-ONLY
  2291  	DisplayName *string `json:"displayName,omitempty"`
  2292  	// IsTopAction - READ-ONLY
  2293  	IsTopAction *bool `json:"isTopAction,omitempty"`
  2294  	// ServiceURL - READ-ONLY
  2295  	ServiceURL *string `json:"serviceUrl,omitempty"`
  2296  	// ThumbnailURL - READ-ONLY; The URL to a thumbnail of the item.
  2297  	ThumbnailURL *string `json:"thumbnailUrl,omitempty"`
  2298  	// About - READ-ONLY; For internal use only.
  2299  	About *[]BasicThing `json:"about,omitempty"`
  2300  	// Mentions - READ-ONLY; For internal use only.
  2301  	Mentions *[]BasicThing `json:"mentions,omitempty"`
  2302  	// Provider - READ-ONLY; The source of the creative work.
  2303  	Provider *[]BasicThing `json:"provider,omitempty"`
  2304  	// Creator - READ-ONLY
  2305  	Creator BasicThing `json:"creator,omitempty"`
  2306  	// Text - READ-ONLY; Text content of this creative work
  2307  	Text *string `json:"text,omitempty"`
  2308  	// DiscussionURL - READ-ONLY
  2309  	DiscussionURL *string `json:"discussionUrl,omitempty"`
  2310  	// CommentCount - READ-ONLY
  2311  	CommentCount *int32 `json:"commentCount,omitempty"`
  2312  	// MainEntity - READ-ONLY
  2313  	MainEntity BasicThing `json:"mainEntity,omitempty"`
  2314  	// HeadLine - READ-ONLY
  2315  	HeadLine *string `json:"headLine,omitempty"`
  2316  	// CopyrightHolder - READ-ONLY
  2317  	CopyrightHolder BasicThing `json:"copyrightHolder,omitempty"`
  2318  	// CopyrightYear - READ-ONLY
  2319  	CopyrightYear *int32 `json:"copyrightYear,omitempty"`
  2320  	// Disclaimer - READ-ONLY
  2321  	Disclaimer *string `json:"disclaimer,omitempty"`
  2322  	// IsAccessibleForFree - READ-ONLY
  2323  	IsAccessibleForFree *bool `json:"isAccessibleForFree,omitempty"`
  2324  	// Genre - READ-ONLY
  2325  	Genre *[]string `json:"genre,omitempty"`
  2326  	// IsFamilyFriendly - READ-ONLY
  2327  	IsFamilyFriendly *bool `json:"isFamilyFriendly,omitempty"`
  2328  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  2329  	URL *string `json:"url,omitempty"`
  2330  	// ReadLink - READ-ONLY; The URL that returns this resource.
  2331  	ReadLink *string `json:"readLink,omitempty"`
  2332  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  2333  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2334  	// PotentialAction - READ-ONLY
  2335  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  2336  	// ImmediateAction - READ-ONLY
  2337  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  2338  	// PreferredClickthroughURL - READ-ONLY
  2339  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  2340  	// AdaptiveCard - READ-ONLY
  2341  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  2342  	// ID - READ-ONLY; A String identifier.
  2343  	ID *string `json:"id,omitempty"`
  2344  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
  2345  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  2346  }
  2347  
  2348  // MarshalJSON is the custom marshaler for SearchAction.
  2349  func (sa SearchAction) MarshalJSON() ([]byte, error) {
  2350  	sa.Type = TypeSearchAction
  2351  	objectMap := make(map[string]interface{})
  2352  	if sa.Type != "" {
  2353  		objectMap["_type"] = sa.Type
  2354  	}
  2355  	return json.Marshal(objectMap)
  2356  }
  2357  
  2358  // AsSearchAction is the BasicResponseBase implementation for SearchAction.
  2359  func (sa SearchAction) AsSearchAction() (*SearchAction, bool) {
  2360  	return &sa, true
  2361  }
  2362  
  2363  // AsSuggestions is the BasicResponseBase implementation for SearchAction.
  2364  func (sa SearchAction) AsSuggestions() (*Suggestions, bool) {
  2365  	return nil, false
  2366  }
  2367  
  2368  // AsSearchResultsAnswer is the BasicResponseBase implementation for SearchAction.
  2369  func (sa SearchAction) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2370  	return nil, false
  2371  }
  2372  
  2373  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for SearchAction.
  2374  func (sa SearchAction) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2375  	return nil, false
  2376  }
  2377  
  2378  // AsAnswer is the BasicResponseBase implementation for SearchAction.
  2379  func (sa SearchAction) AsAnswer() (*Answer, bool) {
  2380  	return nil, false
  2381  }
  2382  
  2383  // AsBasicAnswer is the BasicResponseBase implementation for SearchAction.
  2384  func (sa SearchAction) AsBasicAnswer() (BasicAnswer, bool) {
  2385  	return nil, false
  2386  }
  2387  
  2388  // AsThing is the BasicResponseBase implementation for SearchAction.
  2389  func (sa SearchAction) AsThing() (*Thing, bool) {
  2390  	return nil, false
  2391  }
  2392  
  2393  // AsBasicThing is the BasicResponseBase implementation for SearchAction.
  2394  func (sa SearchAction) AsBasicThing() (BasicThing, bool) {
  2395  	return &sa, true
  2396  }
  2397  
  2398  // AsAction is the BasicResponseBase implementation for SearchAction.
  2399  func (sa SearchAction) AsAction() (*Action, bool) {
  2400  	return nil, false
  2401  }
  2402  
  2403  // AsBasicAction is the BasicResponseBase implementation for SearchAction.
  2404  func (sa SearchAction) AsBasicAction() (BasicAction, bool) {
  2405  	return &sa, true
  2406  }
  2407  
  2408  // AsResponse is the BasicResponseBase implementation for SearchAction.
  2409  func (sa SearchAction) AsResponse() (*Response, bool) {
  2410  	return nil, false
  2411  }
  2412  
  2413  // AsBasicResponse is the BasicResponseBase implementation for SearchAction.
  2414  func (sa SearchAction) AsBasicResponse() (BasicResponse, bool) {
  2415  	return &sa, true
  2416  }
  2417  
  2418  // AsIdentifiable is the BasicResponseBase implementation for SearchAction.
  2419  func (sa SearchAction) AsIdentifiable() (*Identifiable, bool) {
  2420  	return nil, false
  2421  }
  2422  
  2423  // AsBasicIdentifiable is the BasicResponseBase implementation for SearchAction.
  2424  func (sa SearchAction) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2425  	return &sa, true
  2426  }
  2427  
  2428  // AsErrorResponse is the BasicResponseBase implementation for SearchAction.
  2429  func (sa SearchAction) AsErrorResponse() (*ErrorResponse, bool) {
  2430  	return nil, false
  2431  }
  2432  
  2433  // AsCreativeWork is the BasicResponseBase implementation for SearchAction.
  2434  func (sa SearchAction) AsCreativeWork() (*CreativeWork, bool) {
  2435  	return nil, false
  2436  }
  2437  
  2438  // AsBasicCreativeWork is the BasicResponseBase implementation for SearchAction.
  2439  func (sa SearchAction) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2440  	return &sa, true
  2441  }
  2442  
  2443  // AsResponseBase is the BasicResponseBase implementation for SearchAction.
  2444  func (sa SearchAction) AsResponseBase() (*ResponseBase, bool) {
  2445  	return nil, false
  2446  }
  2447  
  2448  // AsBasicResponseBase is the BasicResponseBase implementation for SearchAction.
  2449  func (sa SearchAction) AsBasicResponseBase() (BasicResponseBase, bool) {
  2450  	return &sa, true
  2451  }
  2452  
  2453  // UnmarshalJSON is the custom unmarshaler for SearchAction struct.
  2454  func (sa *SearchAction) UnmarshalJSON(body []byte) error {
  2455  	var m map[string]*json.RawMessage
  2456  	err := json.Unmarshal(body, &m)
  2457  	if err != nil {
  2458  		return err
  2459  	}
  2460  	for k, v := range m {
  2461  		switch k {
  2462  		case "displayText":
  2463  			if v != nil {
  2464  				var displayText string
  2465  				err = json.Unmarshal(*v, &displayText)
  2466  				if err != nil {
  2467  					return err
  2468  				}
  2469  				sa.DisplayText = &displayText
  2470  			}
  2471  		case "query":
  2472  			if v != nil {
  2473  				var query string
  2474  				err = json.Unmarshal(*v, &query)
  2475  				if err != nil {
  2476  					return err
  2477  				}
  2478  				sa.Query = &query
  2479  			}
  2480  		case "searchKind":
  2481  			if v != nil {
  2482  				var searchKind SearchKind
  2483  				err = json.Unmarshal(*v, &searchKind)
  2484  				if err != nil {
  2485  					return err
  2486  				}
  2487  				sa.SearchKind = searchKind
  2488  			}
  2489  		case "result":
  2490  			if v != nil {
  2491  				resultVar, err := unmarshalBasicThingArray(*v)
  2492  				if err != nil {
  2493  					return err
  2494  				}
  2495  				sa.Result = &resultVar
  2496  			}
  2497  		case "displayName":
  2498  			if v != nil {
  2499  				var displayName string
  2500  				err = json.Unmarshal(*v, &displayName)
  2501  				if err != nil {
  2502  					return err
  2503  				}
  2504  				sa.DisplayName = &displayName
  2505  			}
  2506  		case "isTopAction":
  2507  			if v != nil {
  2508  				var isTopAction bool
  2509  				err = json.Unmarshal(*v, &isTopAction)
  2510  				if err != nil {
  2511  					return err
  2512  				}
  2513  				sa.IsTopAction = &isTopAction
  2514  			}
  2515  		case "serviceUrl":
  2516  			if v != nil {
  2517  				var serviceURL string
  2518  				err = json.Unmarshal(*v, &serviceURL)
  2519  				if err != nil {
  2520  					return err
  2521  				}
  2522  				sa.ServiceURL = &serviceURL
  2523  			}
  2524  		case "thumbnailUrl":
  2525  			if v != nil {
  2526  				var thumbnailURL string
  2527  				err = json.Unmarshal(*v, &thumbnailURL)
  2528  				if err != nil {
  2529  					return err
  2530  				}
  2531  				sa.ThumbnailURL = &thumbnailURL
  2532  			}
  2533  		case "about":
  2534  			if v != nil {
  2535  				about, err := unmarshalBasicThingArray(*v)
  2536  				if err != nil {
  2537  					return err
  2538  				}
  2539  				sa.About = &about
  2540  			}
  2541  		case "mentions":
  2542  			if v != nil {
  2543  				mentions, err := unmarshalBasicThingArray(*v)
  2544  				if err != nil {
  2545  					return err
  2546  				}
  2547  				sa.Mentions = &mentions
  2548  			}
  2549  		case "provider":
  2550  			if v != nil {
  2551  				provider, err := unmarshalBasicThingArray(*v)
  2552  				if err != nil {
  2553  					return err
  2554  				}
  2555  				sa.Provider = &provider
  2556  			}
  2557  		case "creator":
  2558  			if v != nil {
  2559  				creator, err := unmarshalBasicThing(*v)
  2560  				if err != nil {
  2561  					return err
  2562  				}
  2563  				sa.Creator = creator
  2564  			}
  2565  		case "text":
  2566  			if v != nil {
  2567  				var textVar string
  2568  				err = json.Unmarshal(*v, &textVar)
  2569  				if err != nil {
  2570  					return err
  2571  				}
  2572  				sa.Text = &textVar
  2573  			}
  2574  		case "discussionUrl":
  2575  			if v != nil {
  2576  				var discussionURL string
  2577  				err = json.Unmarshal(*v, &discussionURL)
  2578  				if err != nil {
  2579  					return err
  2580  				}
  2581  				sa.DiscussionURL = &discussionURL
  2582  			}
  2583  		case "commentCount":
  2584  			if v != nil {
  2585  				var commentCount int32
  2586  				err = json.Unmarshal(*v, &commentCount)
  2587  				if err != nil {
  2588  					return err
  2589  				}
  2590  				sa.CommentCount = &commentCount
  2591  			}
  2592  		case "mainEntity":
  2593  			if v != nil {
  2594  				mainEntity, err := unmarshalBasicThing(*v)
  2595  				if err != nil {
  2596  					return err
  2597  				}
  2598  				sa.MainEntity = mainEntity
  2599  			}
  2600  		case "headLine":
  2601  			if v != nil {
  2602  				var headLine string
  2603  				err = json.Unmarshal(*v, &headLine)
  2604  				if err != nil {
  2605  					return err
  2606  				}
  2607  				sa.HeadLine = &headLine
  2608  			}
  2609  		case "copyrightHolder":
  2610  			if v != nil {
  2611  				copyrightHolder, err := unmarshalBasicThing(*v)
  2612  				if err != nil {
  2613  					return err
  2614  				}
  2615  				sa.CopyrightHolder = copyrightHolder
  2616  			}
  2617  		case "copyrightYear":
  2618  			if v != nil {
  2619  				var copyrightYear int32
  2620  				err = json.Unmarshal(*v, &copyrightYear)
  2621  				if err != nil {
  2622  					return err
  2623  				}
  2624  				sa.CopyrightYear = &copyrightYear
  2625  			}
  2626  		case "disclaimer":
  2627  			if v != nil {
  2628  				var disclaimer string
  2629  				err = json.Unmarshal(*v, &disclaimer)
  2630  				if err != nil {
  2631  					return err
  2632  				}
  2633  				sa.Disclaimer = &disclaimer
  2634  			}
  2635  		case "isAccessibleForFree":
  2636  			if v != nil {
  2637  				var isAccessibleForFree bool
  2638  				err = json.Unmarshal(*v, &isAccessibleForFree)
  2639  				if err != nil {
  2640  					return err
  2641  				}
  2642  				sa.IsAccessibleForFree = &isAccessibleForFree
  2643  			}
  2644  		case "genre":
  2645  			if v != nil {
  2646  				var genre []string
  2647  				err = json.Unmarshal(*v, &genre)
  2648  				if err != nil {
  2649  					return err
  2650  				}
  2651  				sa.Genre = &genre
  2652  			}
  2653  		case "isFamilyFriendly":
  2654  			if v != nil {
  2655  				var isFamilyFriendly bool
  2656  				err = json.Unmarshal(*v, &isFamilyFriendly)
  2657  				if err != nil {
  2658  					return err
  2659  				}
  2660  				sa.IsFamilyFriendly = &isFamilyFriendly
  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  				sa.URL = &URL
  2670  			}
  2671  		case "readLink":
  2672  			if v != nil {
  2673  				var readLink string
  2674  				err = json.Unmarshal(*v, &readLink)
  2675  				if err != nil {
  2676  					return err
  2677  				}
  2678  				sa.ReadLink = &readLink
  2679  			}
  2680  		case "webSearchUrl":
  2681  			if v != nil {
  2682  				var webSearchURL string
  2683  				err = json.Unmarshal(*v, &webSearchURL)
  2684  				if err != nil {
  2685  					return err
  2686  				}
  2687  				sa.WebSearchURL = &webSearchURL
  2688  			}
  2689  		case "potentialAction":
  2690  			if v != nil {
  2691  				potentialAction, err := unmarshalBasicActionArray(*v)
  2692  				if err != nil {
  2693  					return err
  2694  				}
  2695  				sa.PotentialAction = &potentialAction
  2696  			}
  2697  		case "immediateAction":
  2698  			if v != nil {
  2699  				immediateAction, err := unmarshalBasicActionArray(*v)
  2700  				if err != nil {
  2701  					return err
  2702  				}
  2703  				sa.ImmediateAction = &immediateAction
  2704  			}
  2705  		case "preferredClickthroughUrl":
  2706  			if v != nil {
  2707  				var preferredClickthroughURL string
  2708  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  2709  				if err != nil {
  2710  					return err
  2711  				}
  2712  				sa.PreferredClickthroughURL = &preferredClickthroughURL
  2713  			}
  2714  		case "adaptiveCard":
  2715  			if v != nil {
  2716  				var adaptiveCard string
  2717  				err = json.Unmarshal(*v, &adaptiveCard)
  2718  				if err != nil {
  2719  					return err
  2720  				}
  2721  				sa.AdaptiveCard = &adaptiveCard
  2722  			}
  2723  		case "id":
  2724  			if v != nil {
  2725  				var ID string
  2726  				err = json.Unmarshal(*v, &ID)
  2727  				if err != nil {
  2728  					return err
  2729  				}
  2730  				sa.ID = &ID
  2731  			}
  2732  		case "_type":
  2733  			if v != nil {
  2734  				var typeVar TypeBasicResponseBase
  2735  				err = json.Unmarshal(*v, &typeVar)
  2736  				if err != nil {
  2737  					return err
  2738  				}
  2739  				sa.Type = typeVar
  2740  			}
  2741  		}
  2742  	}
  2743  
  2744  	return nil
  2745  }
  2746  
  2747  // BasicSearchResultsAnswer defines a search result answer.
  2748  type BasicSearchResultsAnswer interface {
  2749  	AsSuggestions() (*Suggestions, bool)
  2750  	AsSearchResultsAnswer() (*SearchResultsAnswer, bool)
  2751  }
  2752  
  2753  // SearchResultsAnswer defines a search result answer.
  2754  type SearchResultsAnswer struct {
  2755  	// QueryContext - READ-ONLY
  2756  	QueryContext BasicQueryContext `json:"queryContext,omitempty"`
  2757  	// ReadLink - READ-ONLY; The URL that returns this resource.
  2758  	ReadLink *string `json:"readLink,omitempty"`
  2759  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  2760  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  2761  	// PotentialAction - READ-ONLY
  2762  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  2763  	// ImmediateAction - READ-ONLY
  2764  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  2765  	// PreferredClickthroughURL - READ-ONLY
  2766  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  2767  	// AdaptiveCard - READ-ONLY
  2768  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  2769  	// ID - READ-ONLY; A String identifier.
  2770  	ID *string `json:"id,omitempty"`
  2771  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
  2772  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  2773  }
  2774  
  2775  func unmarshalBasicSearchResultsAnswer(body []byte) (BasicSearchResultsAnswer, error) {
  2776  	var m map[string]interface{}
  2777  	err := json.Unmarshal(body, &m)
  2778  	if err != nil {
  2779  		return nil, err
  2780  	}
  2781  
  2782  	switch m["_type"] {
  2783  	case string(TypeSuggestions):
  2784  		var s Suggestions
  2785  		err := json.Unmarshal(body, &s)
  2786  		return s, err
  2787  	default:
  2788  		var sra SearchResultsAnswer
  2789  		err := json.Unmarshal(body, &sra)
  2790  		return sra, err
  2791  	}
  2792  }
  2793  func unmarshalBasicSearchResultsAnswerArray(body []byte) ([]BasicSearchResultsAnswer, error) {
  2794  	var rawMessages []*json.RawMessage
  2795  	err := json.Unmarshal(body, &rawMessages)
  2796  	if err != nil {
  2797  		return nil, err
  2798  	}
  2799  
  2800  	sraArray := make([]BasicSearchResultsAnswer, len(rawMessages))
  2801  
  2802  	for index, rawMessage := range rawMessages {
  2803  		sra, err := unmarshalBasicSearchResultsAnswer(*rawMessage)
  2804  		if err != nil {
  2805  			return nil, err
  2806  		}
  2807  		sraArray[index] = sra
  2808  	}
  2809  	return sraArray, nil
  2810  }
  2811  
  2812  // MarshalJSON is the custom marshaler for SearchResultsAnswer.
  2813  func (sra SearchResultsAnswer) MarshalJSON() ([]byte, error) {
  2814  	sra.Type = TypeSearchResultsAnswer
  2815  	objectMap := make(map[string]interface{})
  2816  	if sra.Type != "" {
  2817  		objectMap["_type"] = sra.Type
  2818  	}
  2819  	return json.Marshal(objectMap)
  2820  }
  2821  
  2822  // AsSearchAction is the BasicResponseBase implementation for SearchResultsAnswer.
  2823  func (sra SearchResultsAnswer) AsSearchAction() (*SearchAction, bool) {
  2824  	return nil, false
  2825  }
  2826  
  2827  // AsSuggestions is the BasicResponseBase implementation for SearchResultsAnswer.
  2828  func (sra SearchResultsAnswer) AsSuggestions() (*Suggestions, bool) {
  2829  	return nil, false
  2830  }
  2831  
  2832  // AsSearchResultsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  2833  func (sra SearchResultsAnswer) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  2834  	return &sra, true
  2835  }
  2836  
  2837  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  2838  func (sra SearchResultsAnswer) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  2839  	return &sra, true
  2840  }
  2841  
  2842  // AsAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  2843  func (sra SearchResultsAnswer) AsAnswer() (*Answer, bool) {
  2844  	return nil, false
  2845  }
  2846  
  2847  // AsBasicAnswer is the BasicResponseBase implementation for SearchResultsAnswer.
  2848  func (sra SearchResultsAnswer) AsBasicAnswer() (BasicAnswer, bool) {
  2849  	return &sra, true
  2850  }
  2851  
  2852  // AsThing is the BasicResponseBase implementation for SearchResultsAnswer.
  2853  func (sra SearchResultsAnswer) AsThing() (*Thing, bool) {
  2854  	return nil, false
  2855  }
  2856  
  2857  // AsBasicThing is the BasicResponseBase implementation for SearchResultsAnswer.
  2858  func (sra SearchResultsAnswer) AsBasicThing() (BasicThing, bool) {
  2859  	return nil, false
  2860  }
  2861  
  2862  // AsAction is the BasicResponseBase implementation for SearchResultsAnswer.
  2863  func (sra SearchResultsAnswer) AsAction() (*Action, bool) {
  2864  	return nil, false
  2865  }
  2866  
  2867  // AsBasicAction is the BasicResponseBase implementation for SearchResultsAnswer.
  2868  func (sra SearchResultsAnswer) AsBasicAction() (BasicAction, bool) {
  2869  	return nil, false
  2870  }
  2871  
  2872  // AsResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  2873  func (sra SearchResultsAnswer) AsResponse() (*Response, bool) {
  2874  	return nil, false
  2875  }
  2876  
  2877  // AsBasicResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  2878  func (sra SearchResultsAnswer) AsBasicResponse() (BasicResponse, bool) {
  2879  	return &sra, true
  2880  }
  2881  
  2882  // AsIdentifiable is the BasicResponseBase implementation for SearchResultsAnswer.
  2883  func (sra SearchResultsAnswer) AsIdentifiable() (*Identifiable, bool) {
  2884  	return nil, false
  2885  }
  2886  
  2887  // AsBasicIdentifiable is the BasicResponseBase implementation for SearchResultsAnswer.
  2888  func (sra SearchResultsAnswer) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  2889  	return &sra, true
  2890  }
  2891  
  2892  // AsErrorResponse is the BasicResponseBase implementation for SearchResultsAnswer.
  2893  func (sra SearchResultsAnswer) AsErrorResponse() (*ErrorResponse, bool) {
  2894  	return nil, false
  2895  }
  2896  
  2897  // AsCreativeWork is the BasicResponseBase implementation for SearchResultsAnswer.
  2898  func (sra SearchResultsAnswer) AsCreativeWork() (*CreativeWork, bool) {
  2899  	return nil, false
  2900  }
  2901  
  2902  // AsBasicCreativeWork is the BasicResponseBase implementation for SearchResultsAnswer.
  2903  func (sra SearchResultsAnswer) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  2904  	return nil, false
  2905  }
  2906  
  2907  // AsResponseBase is the BasicResponseBase implementation for SearchResultsAnswer.
  2908  func (sra SearchResultsAnswer) AsResponseBase() (*ResponseBase, bool) {
  2909  	return nil, false
  2910  }
  2911  
  2912  // AsBasicResponseBase is the BasicResponseBase implementation for SearchResultsAnswer.
  2913  func (sra SearchResultsAnswer) AsBasicResponseBase() (BasicResponseBase, bool) {
  2914  	return &sra, true
  2915  }
  2916  
  2917  // UnmarshalJSON is the custom unmarshaler for SearchResultsAnswer struct.
  2918  func (sra *SearchResultsAnswer) UnmarshalJSON(body []byte) error {
  2919  	var m map[string]*json.RawMessage
  2920  	err := json.Unmarshal(body, &m)
  2921  	if err != nil {
  2922  		return err
  2923  	}
  2924  	for k, v := range m {
  2925  		switch k {
  2926  		case "queryContext":
  2927  			if v != nil {
  2928  				queryContext, err := unmarshalBasicQueryContext(*v)
  2929  				if err != nil {
  2930  					return err
  2931  				}
  2932  				sra.QueryContext = queryContext
  2933  			}
  2934  		case "readLink":
  2935  			if v != nil {
  2936  				var readLink string
  2937  				err = json.Unmarshal(*v, &readLink)
  2938  				if err != nil {
  2939  					return err
  2940  				}
  2941  				sra.ReadLink = &readLink
  2942  			}
  2943  		case "webSearchUrl":
  2944  			if v != nil {
  2945  				var webSearchURL string
  2946  				err = json.Unmarshal(*v, &webSearchURL)
  2947  				if err != nil {
  2948  					return err
  2949  				}
  2950  				sra.WebSearchURL = &webSearchURL
  2951  			}
  2952  		case "potentialAction":
  2953  			if v != nil {
  2954  				potentialAction, err := unmarshalBasicActionArray(*v)
  2955  				if err != nil {
  2956  					return err
  2957  				}
  2958  				sra.PotentialAction = &potentialAction
  2959  			}
  2960  		case "immediateAction":
  2961  			if v != nil {
  2962  				immediateAction, err := unmarshalBasicActionArray(*v)
  2963  				if err != nil {
  2964  					return err
  2965  				}
  2966  				sra.ImmediateAction = &immediateAction
  2967  			}
  2968  		case "preferredClickthroughUrl":
  2969  			if v != nil {
  2970  				var preferredClickthroughURL string
  2971  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  2972  				if err != nil {
  2973  					return err
  2974  				}
  2975  				sra.PreferredClickthroughURL = &preferredClickthroughURL
  2976  			}
  2977  		case "adaptiveCard":
  2978  			if v != nil {
  2979  				var adaptiveCard string
  2980  				err = json.Unmarshal(*v, &adaptiveCard)
  2981  				if err != nil {
  2982  					return err
  2983  				}
  2984  				sra.AdaptiveCard = &adaptiveCard
  2985  			}
  2986  		case "id":
  2987  			if v != nil {
  2988  				var ID string
  2989  				err = json.Unmarshal(*v, &ID)
  2990  				if err != nil {
  2991  					return err
  2992  				}
  2993  				sra.ID = &ID
  2994  			}
  2995  		case "_type":
  2996  			if v != nil {
  2997  				var typeVar TypeBasicResponseBase
  2998  				err = json.Unmarshal(*v, &typeVar)
  2999  				if err != nil {
  3000  					return err
  3001  				}
  3002  				sra.Type = typeVar
  3003  			}
  3004  		}
  3005  	}
  3006  
  3007  	return nil
  3008  }
  3009  
  3010  // Suggestions ...
  3011  type Suggestions struct {
  3012  	autorest.Response `json:"-"`
  3013  	SuggestionGroups  *[]BasicSuggestionsSuggestionGroup `json:"suggestionGroups,omitempty"`
  3014  	// QueryContext - READ-ONLY
  3015  	QueryContext BasicQueryContext `json:"queryContext,omitempty"`
  3016  	// ReadLink - READ-ONLY; The URL that returns this resource.
  3017  	ReadLink *string `json:"readLink,omitempty"`
  3018  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  3019  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  3020  	// PotentialAction - READ-ONLY
  3021  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  3022  	// ImmediateAction - READ-ONLY
  3023  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  3024  	// PreferredClickthroughURL - READ-ONLY
  3025  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  3026  	// AdaptiveCard - READ-ONLY
  3027  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  3028  	// ID - READ-ONLY; A String identifier.
  3029  	ID *string `json:"id,omitempty"`
  3030  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
  3031  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  3032  }
  3033  
  3034  // MarshalJSON is the custom marshaler for Suggestions.
  3035  func (s Suggestions) MarshalJSON() ([]byte, error) {
  3036  	s.Type = TypeSuggestions
  3037  	objectMap := make(map[string]interface{})
  3038  	if s.SuggestionGroups != nil {
  3039  		objectMap["suggestionGroups"] = s.SuggestionGroups
  3040  	}
  3041  	if s.Type != "" {
  3042  		objectMap["_type"] = s.Type
  3043  	}
  3044  	return json.Marshal(objectMap)
  3045  }
  3046  
  3047  // AsSearchAction is the BasicResponseBase implementation for Suggestions.
  3048  func (s Suggestions) AsSearchAction() (*SearchAction, bool) {
  3049  	return nil, false
  3050  }
  3051  
  3052  // AsSuggestions is the BasicResponseBase implementation for Suggestions.
  3053  func (s Suggestions) AsSuggestions() (*Suggestions, bool) {
  3054  	return &s, true
  3055  }
  3056  
  3057  // AsSearchResultsAnswer is the BasicResponseBase implementation for Suggestions.
  3058  func (s Suggestions) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  3059  	return nil, false
  3060  }
  3061  
  3062  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Suggestions.
  3063  func (s Suggestions) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  3064  	return &s, true
  3065  }
  3066  
  3067  // AsAnswer is the BasicResponseBase implementation for Suggestions.
  3068  func (s Suggestions) AsAnswer() (*Answer, bool) {
  3069  	return nil, false
  3070  }
  3071  
  3072  // AsBasicAnswer is the BasicResponseBase implementation for Suggestions.
  3073  func (s Suggestions) AsBasicAnswer() (BasicAnswer, bool) {
  3074  	return &s, true
  3075  }
  3076  
  3077  // AsThing is the BasicResponseBase implementation for Suggestions.
  3078  func (s Suggestions) AsThing() (*Thing, bool) {
  3079  	return nil, false
  3080  }
  3081  
  3082  // AsBasicThing is the BasicResponseBase implementation for Suggestions.
  3083  func (s Suggestions) AsBasicThing() (BasicThing, bool) {
  3084  	return nil, false
  3085  }
  3086  
  3087  // AsAction is the BasicResponseBase implementation for Suggestions.
  3088  func (s Suggestions) AsAction() (*Action, bool) {
  3089  	return nil, false
  3090  }
  3091  
  3092  // AsBasicAction is the BasicResponseBase implementation for Suggestions.
  3093  func (s Suggestions) AsBasicAction() (BasicAction, bool) {
  3094  	return nil, false
  3095  }
  3096  
  3097  // AsResponse is the BasicResponseBase implementation for Suggestions.
  3098  func (s Suggestions) AsResponse() (*Response, bool) {
  3099  	return nil, false
  3100  }
  3101  
  3102  // AsBasicResponse is the BasicResponseBase implementation for Suggestions.
  3103  func (s Suggestions) AsBasicResponse() (BasicResponse, bool) {
  3104  	return &s, true
  3105  }
  3106  
  3107  // AsIdentifiable is the BasicResponseBase implementation for Suggestions.
  3108  func (s Suggestions) AsIdentifiable() (*Identifiable, bool) {
  3109  	return nil, false
  3110  }
  3111  
  3112  // AsBasicIdentifiable is the BasicResponseBase implementation for Suggestions.
  3113  func (s Suggestions) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  3114  	return &s, true
  3115  }
  3116  
  3117  // AsErrorResponse is the BasicResponseBase implementation for Suggestions.
  3118  func (s Suggestions) AsErrorResponse() (*ErrorResponse, bool) {
  3119  	return nil, false
  3120  }
  3121  
  3122  // AsCreativeWork is the BasicResponseBase implementation for Suggestions.
  3123  func (s Suggestions) AsCreativeWork() (*CreativeWork, bool) {
  3124  	return nil, false
  3125  }
  3126  
  3127  // AsBasicCreativeWork is the BasicResponseBase implementation for Suggestions.
  3128  func (s Suggestions) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  3129  	return nil, false
  3130  }
  3131  
  3132  // AsResponseBase is the BasicResponseBase implementation for Suggestions.
  3133  func (s Suggestions) AsResponseBase() (*ResponseBase, bool) {
  3134  	return nil, false
  3135  }
  3136  
  3137  // AsBasicResponseBase is the BasicResponseBase implementation for Suggestions.
  3138  func (s Suggestions) AsBasicResponseBase() (BasicResponseBase, bool) {
  3139  	return &s, true
  3140  }
  3141  
  3142  // UnmarshalJSON is the custom unmarshaler for Suggestions struct.
  3143  func (s *Suggestions) UnmarshalJSON(body []byte) error {
  3144  	var m map[string]*json.RawMessage
  3145  	err := json.Unmarshal(body, &m)
  3146  	if err != nil {
  3147  		return err
  3148  	}
  3149  	for k, v := range m {
  3150  		switch k {
  3151  		case "suggestionGroups":
  3152  			if v != nil {
  3153  				suggestionGroups, err := unmarshalBasicSuggestionsSuggestionGroupArray(*v)
  3154  				if err != nil {
  3155  					return err
  3156  				}
  3157  				s.SuggestionGroups = &suggestionGroups
  3158  			}
  3159  		case "queryContext":
  3160  			if v != nil {
  3161  				queryContext, err := unmarshalBasicQueryContext(*v)
  3162  				if err != nil {
  3163  					return err
  3164  				}
  3165  				s.QueryContext = queryContext
  3166  			}
  3167  		case "readLink":
  3168  			if v != nil {
  3169  				var readLink string
  3170  				err = json.Unmarshal(*v, &readLink)
  3171  				if err != nil {
  3172  					return err
  3173  				}
  3174  				s.ReadLink = &readLink
  3175  			}
  3176  		case "webSearchUrl":
  3177  			if v != nil {
  3178  				var webSearchURL string
  3179  				err = json.Unmarshal(*v, &webSearchURL)
  3180  				if err != nil {
  3181  					return err
  3182  				}
  3183  				s.WebSearchURL = &webSearchURL
  3184  			}
  3185  		case "potentialAction":
  3186  			if v != nil {
  3187  				potentialAction, err := unmarshalBasicActionArray(*v)
  3188  				if err != nil {
  3189  					return err
  3190  				}
  3191  				s.PotentialAction = &potentialAction
  3192  			}
  3193  		case "immediateAction":
  3194  			if v != nil {
  3195  				immediateAction, err := unmarshalBasicActionArray(*v)
  3196  				if err != nil {
  3197  					return err
  3198  				}
  3199  				s.ImmediateAction = &immediateAction
  3200  			}
  3201  		case "preferredClickthroughUrl":
  3202  			if v != nil {
  3203  				var preferredClickthroughURL string
  3204  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  3205  				if err != nil {
  3206  					return err
  3207  				}
  3208  				s.PreferredClickthroughURL = &preferredClickthroughURL
  3209  			}
  3210  		case "adaptiveCard":
  3211  			if v != nil {
  3212  				var adaptiveCard string
  3213  				err = json.Unmarshal(*v, &adaptiveCard)
  3214  				if err != nil {
  3215  					return err
  3216  				}
  3217  				s.AdaptiveCard = &adaptiveCard
  3218  			}
  3219  		case "id":
  3220  			if v != nil {
  3221  				var ID string
  3222  				err = json.Unmarshal(*v, &ID)
  3223  				if err != nil {
  3224  					return err
  3225  				}
  3226  				s.ID = &ID
  3227  			}
  3228  		case "_type":
  3229  			if v != nil {
  3230  				var typeVar TypeBasicResponseBase
  3231  				err = json.Unmarshal(*v, &typeVar)
  3232  				if err != nil {
  3233  					return err
  3234  				}
  3235  				s.Type = typeVar
  3236  			}
  3237  		}
  3238  	}
  3239  
  3240  	return nil
  3241  }
  3242  
  3243  // BasicSuggestionsSuggestionGroup ...
  3244  type BasicSuggestionsSuggestionGroup interface {
  3245  	AsSuggestionsSuggestionGroup() (*SuggestionsSuggestionGroup, bool)
  3246  }
  3247  
  3248  // SuggestionsSuggestionGroup ...
  3249  type SuggestionsSuggestionGroup struct {
  3250  	// Name - Possible values include: 'Unknown', 'Web', 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', 'PersonalSearchTags', 'Custom'
  3251  	Name              ScenarioType    `json:"name,omitempty"`
  3252  	SearchSuggestions *[]SearchAction `json:"searchSuggestions,omitempty"`
  3253  	// Type - Possible values include: 'TypeSuggestionsSuggestionGroup'
  3254  	Type Type `json:"_type,omitempty"`
  3255  }
  3256  
  3257  func unmarshalBasicSuggestionsSuggestionGroup(body []byte) (BasicSuggestionsSuggestionGroup, error) {
  3258  	var m map[string]interface{}
  3259  	err := json.Unmarshal(body, &m)
  3260  	if err != nil {
  3261  		return nil, err
  3262  	}
  3263  
  3264  	switch m["_type"] {
  3265  	default:
  3266  		var ssg SuggestionsSuggestionGroup
  3267  		err := json.Unmarshal(body, &ssg)
  3268  		return ssg, err
  3269  	}
  3270  }
  3271  func unmarshalBasicSuggestionsSuggestionGroupArray(body []byte) ([]BasicSuggestionsSuggestionGroup, error) {
  3272  	var rawMessages []*json.RawMessage
  3273  	err := json.Unmarshal(body, &rawMessages)
  3274  	if err != nil {
  3275  		return nil, err
  3276  	}
  3277  
  3278  	ssgArray := make([]BasicSuggestionsSuggestionGroup, len(rawMessages))
  3279  
  3280  	for index, rawMessage := range rawMessages {
  3281  		ssg, err := unmarshalBasicSuggestionsSuggestionGroup(*rawMessage)
  3282  		if err != nil {
  3283  			return nil, err
  3284  		}
  3285  		ssgArray[index] = ssg
  3286  	}
  3287  	return ssgArray, nil
  3288  }
  3289  
  3290  // MarshalJSON is the custom marshaler for SuggestionsSuggestionGroup.
  3291  func (ssg SuggestionsSuggestionGroup) MarshalJSON() ([]byte, error) {
  3292  	ssg.Type = TypeSuggestionsSuggestionGroup
  3293  	objectMap := make(map[string]interface{})
  3294  	if ssg.Name != "" {
  3295  		objectMap["name"] = ssg.Name
  3296  	}
  3297  	if ssg.SearchSuggestions != nil {
  3298  		objectMap["searchSuggestions"] = ssg.SearchSuggestions
  3299  	}
  3300  	if ssg.Type != "" {
  3301  		objectMap["_type"] = ssg.Type
  3302  	}
  3303  	return json.Marshal(objectMap)
  3304  }
  3305  
  3306  // AsSuggestionsSuggestionGroup is the BasicSuggestionsSuggestionGroup implementation for SuggestionsSuggestionGroup.
  3307  func (ssg SuggestionsSuggestionGroup) AsSuggestionsSuggestionGroup() (*SuggestionsSuggestionGroup, bool) {
  3308  	return &ssg, true
  3309  }
  3310  
  3311  // AsBasicSuggestionsSuggestionGroup is the BasicSuggestionsSuggestionGroup implementation for SuggestionsSuggestionGroup.
  3312  func (ssg SuggestionsSuggestionGroup) AsBasicSuggestionsSuggestionGroup() (BasicSuggestionsSuggestionGroup, bool) {
  3313  	return &ssg, true
  3314  }
  3315  
  3316  // BasicThing defines a thing.
  3317  type BasicThing interface {
  3318  	AsSearchAction() (*SearchAction, bool)
  3319  	AsAction() (*Action, bool)
  3320  	AsBasicAction() (BasicAction, bool)
  3321  	AsCreativeWork() (*CreativeWork, bool)
  3322  	AsBasicCreativeWork() (BasicCreativeWork, bool)
  3323  	AsThing() (*Thing, bool)
  3324  }
  3325  
  3326  // Thing defines a thing.
  3327  type Thing struct {
  3328  	// URL - READ-ONLY; The URL to get more information about the thing represented by this object.
  3329  	URL *string `json:"url,omitempty"`
  3330  	// ReadLink - READ-ONLY; The URL that returns this resource.
  3331  	ReadLink *string `json:"readLink,omitempty"`
  3332  	// WebSearchURL - READ-ONLY; The URL To Bing's search result for this item.
  3333  	WebSearchURL *string `json:"webSearchUrl,omitempty"`
  3334  	// PotentialAction - READ-ONLY
  3335  	PotentialAction *[]BasicAction `json:"potentialAction,omitempty"`
  3336  	// ImmediateAction - READ-ONLY
  3337  	ImmediateAction *[]BasicAction `json:"immediateAction,omitempty"`
  3338  	// PreferredClickthroughURL - READ-ONLY
  3339  	PreferredClickthroughURL *string `json:"preferredClickthroughUrl,omitempty"`
  3340  	// AdaptiveCard - READ-ONLY
  3341  	AdaptiveCard *string `json:"adaptiveCard,omitempty"`
  3342  	// ID - READ-ONLY; A String identifier.
  3343  	ID *string `json:"id,omitempty"`
  3344  	// Type - Possible values include: 'TypeResponseBase', 'TypeSearchAction', 'TypeSuggestions', 'TypeSearchResultsAnswer', 'TypeAnswer', 'TypeThing', 'TypeAction', 'TypeResponse', 'TypeIdentifiable', 'TypeErrorResponse', 'TypeCreativeWork'
  3345  	Type TypeBasicResponseBase `json:"_type,omitempty"`
  3346  }
  3347  
  3348  func unmarshalBasicThing(body []byte) (BasicThing, error) {
  3349  	var m map[string]interface{}
  3350  	err := json.Unmarshal(body, &m)
  3351  	if err != nil {
  3352  		return nil, err
  3353  	}
  3354  
  3355  	switch m["_type"] {
  3356  	case string(TypeSearchAction):
  3357  		var sa SearchAction
  3358  		err := json.Unmarshal(body, &sa)
  3359  		return sa, err
  3360  	case string(TypeAction):
  3361  		var a Action
  3362  		err := json.Unmarshal(body, &a)
  3363  		return a, err
  3364  	case string(TypeCreativeWork):
  3365  		var cw CreativeWork
  3366  		err := json.Unmarshal(body, &cw)
  3367  		return cw, err
  3368  	default:
  3369  		var t Thing
  3370  		err := json.Unmarshal(body, &t)
  3371  		return t, err
  3372  	}
  3373  }
  3374  func unmarshalBasicThingArray(body []byte) ([]BasicThing, error) {
  3375  	var rawMessages []*json.RawMessage
  3376  	err := json.Unmarshal(body, &rawMessages)
  3377  	if err != nil {
  3378  		return nil, err
  3379  	}
  3380  
  3381  	tArray := make([]BasicThing, len(rawMessages))
  3382  
  3383  	for index, rawMessage := range rawMessages {
  3384  		t, err := unmarshalBasicThing(*rawMessage)
  3385  		if err != nil {
  3386  			return nil, err
  3387  		}
  3388  		tArray[index] = t
  3389  	}
  3390  	return tArray, nil
  3391  }
  3392  
  3393  // MarshalJSON is the custom marshaler for Thing.
  3394  func (t Thing) MarshalJSON() ([]byte, error) {
  3395  	t.Type = TypeThing
  3396  	objectMap := make(map[string]interface{})
  3397  	if t.Type != "" {
  3398  		objectMap["_type"] = t.Type
  3399  	}
  3400  	return json.Marshal(objectMap)
  3401  }
  3402  
  3403  // AsSearchAction is the BasicResponseBase implementation for Thing.
  3404  func (t Thing) AsSearchAction() (*SearchAction, bool) {
  3405  	return nil, false
  3406  }
  3407  
  3408  // AsSuggestions is the BasicResponseBase implementation for Thing.
  3409  func (t Thing) AsSuggestions() (*Suggestions, bool) {
  3410  	return nil, false
  3411  }
  3412  
  3413  // AsSearchResultsAnswer is the BasicResponseBase implementation for Thing.
  3414  func (t Thing) AsSearchResultsAnswer() (*SearchResultsAnswer, bool) {
  3415  	return nil, false
  3416  }
  3417  
  3418  // AsBasicSearchResultsAnswer is the BasicResponseBase implementation for Thing.
  3419  func (t Thing) AsBasicSearchResultsAnswer() (BasicSearchResultsAnswer, bool) {
  3420  	return nil, false
  3421  }
  3422  
  3423  // AsAnswer is the BasicResponseBase implementation for Thing.
  3424  func (t Thing) AsAnswer() (*Answer, bool) {
  3425  	return nil, false
  3426  }
  3427  
  3428  // AsBasicAnswer is the BasicResponseBase implementation for Thing.
  3429  func (t Thing) AsBasicAnswer() (BasicAnswer, bool) {
  3430  	return nil, false
  3431  }
  3432  
  3433  // AsThing is the BasicResponseBase implementation for Thing.
  3434  func (t Thing) AsThing() (*Thing, bool) {
  3435  	return &t, true
  3436  }
  3437  
  3438  // AsBasicThing is the BasicResponseBase implementation for Thing.
  3439  func (t Thing) AsBasicThing() (BasicThing, bool) {
  3440  	return &t, true
  3441  }
  3442  
  3443  // AsAction is the BasicResponseBase implementation for Thing.
  3444  func (t Thing) AsAction() (*Action, bool) {
  3445  	return nil, false
  3446  }
  3447  
  3448  // AsBasicAction is the BasicResponseBase implementation for Thing.
  3449  func (t Thing) AsBasicAction() (BasicAction, bool) {
  3450  	return nil, false
  3451  }
  3452  
  3453  // AsResponse is the BasicResponseBase implementation for Thing.
  3454  func (t Thing) AsResponse() (*Response, bool) {
  3455  	return nil, false
  3456  }
  3457  
  3458  // AsBasicResponse is the BasicResponseBase implementation for Thing.
  3459  func (t Thing) AsBasicResponse() (BasicResponse, bool) {
  3460  	return &t, true
  3461  }
  3462  
  3463  // AsIdentifiable is the BasicResponseBase implementation for Thing.
  3464  func (t Thing) AsIdentifiable() (*Identifiable, bool) {
  3465  	return nil, false
  3466  }
  3467  
  3468  // AsBasicIdentifiable is the BasicResponseBase implementation for Thing.
  3469  func (t Thing) AsBasicIdentifiable() (BasicIdentifiable, bool) {
  3470  	return &t, true
  3471  }
  3472  
  3473  // AsErrorResponse is the BasicResponseBase implementation for Thing.
  3474  func (t Thing) AsErrorResponse() (*ErrorResponse, bool) {
  3475  	return nil, false
  3476  }
  3477  
  3478  // AsCreativeWork is the BasicResponseBase implementation for Thing.
  3479  func (t Thing) AsCreativeWork() (*CreativeWork, bool) {
  3480  	return nil, false
  3481  }
  3482  
  3483  // AsBasicCreativeWork is the BasicResponseBase implementation for Thing.
  3484  func (t Thing) AsBasicCreativeWork() (BasicCreativeWork, bool) {
  3485  	return nil, false
  3486  }
  3487  
  3488  // AsResponseBase is the BasicResponseBase implementation for Thing.
  3489  func (t Thing) AsResponseBase() (*ResponseBase, bool) {
  3490  	return nil, false
  3491  }
  3492  
  3493  // AsBasicResponseBase is the BasicResponseBase implementation for Thing.
  3494  func (t Thing) AsBasicResponseBase() (BasicResponseBase, bool) {
  3495  	return &t, true
  3496  }
  3497  
  3498  // UnmarshalJSON is the custom unmarshaler for Thing struct.
  3499  func (t *Thing) UnmarshalJSON(body []byte) error {
  3500  	var m map[string]*json.RawMessage
  3501  	err := json.Unmarshal(body, &m)
  3502  	if err != nil {
  3503  		return err
  3504  	}
  3505  	for k, v := range m {
  3506  		switch k {
  3507  		case "url":
  3508  			if v != nil {
  3509  				var URL string
  3510  				err = json.Unmarshal(*v, &URL)
  3511  				if err != nil {
  3512  					return err
  3513  				}
  3514  				t.URL = &URL
  3515  			}
  3516  		case "readLink":
  3517  			if v != nil {
  3518  				var readLink string
  3519  				err = json.Unmarshal(*v, &readLink)
  3520  				if err != nil {
  3521  					return err
  3522  				}
  3523  				t.ReadLink = &readLink
  3524  			}
  3525  		case "webSearchUrl":
  3526  			if v != nil {
  3527  				var webSearchURL string
  3528  				err = json.Unmarshal(*v, &webSearchURL)
  3529  				if err != nil {
  3530  					return err
  3531  				}
  3532  				t.WebSearchURL = &webSearchURL
  3533  			}
  3534  		case "potentialAction":
  3535  			if v != nil {
  3536  				potentialAction, err := unmarshalBasicActionArray(*v)
  3537  				if err != nil {
  3538  					return err
  3539  				}
  3540  				t.PotentialAction = &potentialAction
  3541  			}
  3542  		case "immediateAction":
  3543  			if v != nil {
  3544  				immediateAction, err := unmarshalBasicActionArray(*v)
  3545  				if err != nil {
  3546  					return err
  3547  				}
  3548  				t.ImmediateAction = &immediateAction
  3549  			}
  3550  		case "preferredClickthroughUrl":
  3551  			if v != nil {
  3552  				var preferredClickthroughURL string
  3553  				err = json.Unmarshal(*v, &preferredClickthroughURL)
  3554  				if err != nil {
  3555  					return err
  3556  				}
  3557  				t.PreferredClickthroughURL = &preferredClickthroughURL
  3558  			}
  3559  		case "adaptiveCard":
  3560  			if v != nil {
  3561  				var adaptiveCard string
  3562  				err = json.Unmarshal(*v, &adaptiveCard)
  3563  				if err != nil {
  3564  					return err
  3565  				}
  3566  				t.AdaptiveCard = &adaptiveCard
  3567  			}
  3568  		case "id":
  3569  			if v != nil {
  3570  				var ID string
  3571  				err = json.Unmarshal(*v, &ID)
  3572  				if err != nil {
  3573  					return err
  3574  				}
  3575  				t.ID = &ID
  3576  			}
  3577  		case "_type":
  3578  			if v != nil {
  3579  				var typeVar TypeBasicResponseBase
  3580  				err = json.Unmarshal(*v, &typeVar)
  3581  				if err != nil {
  3582  					return err
  3583  				}
  3584  				t.Type = typeVar
  3585  			}
  3586  		}
  3587  	}
  3588  
  3589  	return nil
  3590  }
  3591  

View as plain text