/**
* GameBrain API
* GameBrain API
*
* The version of the OpenAPI document: 1.0.1
* Contact: mail@gamebrain.co
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
import ApiClient from '../ApiClient';
import SearchSuggestionResponseResultsInner from './SearchSuggestionResponseResultsInner';
/**
* The SearchSuggestionResponse model module.
* @module model/SearchSuggestionResponse
* @version 1.0.2
*/
class SearchSuggestionResponse {
/**
* Constructs a new <code>SearchSuggestionResponse</code>.
* @alias module:model/SearchSuggestionResponse
*/
constructor() {
SearchSuggestionResponse.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj) {
}
/**
* Constructs a <code>SearchSuggestionResponse</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/SearchSuggestionResponse} obj Optional instance to populate.
* @return {module:model/SearchSuggestionResponse} The populated <code>SearchSuggestionResponse</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new SearchSuggestionResponse();
if (data.hasOwnProperty('results')) {
obj['results'] = ApiClient.convertToType(data['results'], [SearchSuggestionResponseResultsInner]);
}
}
return obj;
}
/**
* Validates the JSON data with respect to <code>SearchSuggestionResponse</code>.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>SearchSuggestionResponse</code>.
*/
static validateJSON(data) {
if (data['results']) { // data not null
// ensure the json data is an array
if (!Array.isArray(data['results'])) {
throw new Error("Expected the field `results` to be an array in the JSON data but got " + data['results']);
}
// validate the optional field `results` (array)
for (const item of data['results']) {
SearchSuggestionResponseResultsInner.validateJSON(item);
};
}
return true;
}
}
/**
* @member {Array.<module:model/SearchSuggestionResponseResultsInner>} results
*/
SearchSuggestionResponse.prototype['results'] = undefined;
export default SearchSuggestionResponse;