/**
* OpenAPI definition
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v0
*
*
* 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.js';
import { InlineArchives } from './InlineArchives.js';
import { ModelCategory } from './ModelCategory.js';
import { ModelLicense } from './ModelLicense.js';
import { ModelTag } from './ModelTag.js';
import { ThumbnailsRelated } from './ThumbnailsRelated.js';
import { UserRelated } from './UserRelated.js';
/**
* The ModelSearchList model module.
* @module model/ModelSearchList
* @version v0
*/
export class ModelSearchList {
/**
* Constructs a new <code>ModelSearchList</code>.
* One model returned in search response.
* @alias ModelSearchList
*/
constructor() {
/** uri
* @type {String}
*/
this.uri = undefined;
/** uid
* @type {String}
*/
this.uid = undefined;
/** name
* @type {String}
*/
this.name = undefined;
/** staffpickedAt
* @type {String}
*/
this.staffpickedAt = undefined;
/** viewCount
* @type {Number}
*/
this.viewCount = undefined;
/** likeCount
* @type {Number}
*/
this.likeCount = undefined;
/** animationCount
* @type {Number}
*/
this.animationCount = undefined;
/** viewerUrl
* @type {String}
*/
this.viewerUrl = undefined;
/** embedUrl
* @type {String}
*/
this.embedUrl = undefined;
/** commentCount
* @type {Number}
*/
this.commentCount = undefined;
/** isDownloadable
* @type {Boolean}
*/
this.isDownloadable = undefined;
/** publishedAt
* @type {String}
*/
this.publishedAt = undefined;
/** tags
* @type {Array.<ModelTag>}
*/
this.tags = undefined;
/** categories
* @type {Array.<ModelCategory>}
*/
this.categories = undefined;
/** thumbnails
* @type {ThumbnailsRelated}
*/
this.thumbnails = undefined;
/** user
* @type {UserRelated}
*/
this.user = undefined;
/** description
* @type {String}
*/
this.description = undefined;
/** faceCount
* @type {Number}
*/
this.faceCount = undefined;
/** createdAt
* @type {String}
*/
this.createdAt = undefined;
/** vertexCount
* @type {Number}
*/
this.vertexCount = undefined;
/** isAgeRestricted
* @type {Boolean}
*/
this.isAgeRestricted = undefined;
/** archives
* @type {InlineArchives}
*/
this.archives = undefined;
/** license
* @type {ModelLicense}
*/
this.license = undefined;
/** isPublished
* @type {Boolean}
*/
this.isPublished = undefined;
ModelSearchList.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>ModelSearchList</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 {ModelSearchList} obj Optional instance to populate.
* @return {ModelSearchList} The populated <code>ModelSearchList</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new ModelSearchList();
if (data.hasOwnProperty('uri')) {
obj['uri'] = ApiClient.convertToType(data['uri'], 'String');
}
if (data.hasOwnProperty('uid')) {
obj['uid'] = ApiClient.convertToType(data['uid'], 'String');
}
if (data.hasOwnProperty('name')) {
obj['name'] = ApiClient.convertToType(data['name'], 'String');
}
if (data.hasOwnProperty('staffpickedAt')) {
obj['staffpickedAt'] = ApiClient.convertToType(data['staffpickedAt'], 'String');
}
if (data.hasOwnProperty('viewCount')) {
obj['viewCount'] = ApiClient.convertToType(data['viewCount'], 'Number');
}
if (data.hasOwnProperty('likeCount')) {
obj['likeCount'] = ApiClient.convertToType(data['likeCount'], 'Number');
}
if (data.hasOwnProperty('animationCount')) {
obj['animationCount'] = ApiClient.convertToType(data['animationCount'], 'Number');
}
if (data.hasOwnProperty('viewerUrl')) {
obj['viewerUrl'] = ApiClient.convertToType(data['viewerUrl'], 'String');
}
if (data.hasOwnProperty('embedUrl')) {
obj['embedUrl'] = ApiClient.convertToType(data['embedUrl'], 'String');
}
if (data.hasOwnProperty('commentCount')) {
obj['commentCount'] = ApiClient.convertToType(data['commentCount'], 'Number');
}
if (data.hasOwnProperty('isDownloadable')) {
obj['isDownloadable'] = ApiClient.convertToType(data['isDownloadable'], 'Boolean');
}
if (data.hasOwnProperty('publishedAt')) {
obj['publishedAt'] = ApiClient.convertToType(data['publishedAt'], 'String');
}
if (data.hasOwnProperty('tags')) {
obj['tags'] = ApiClient.convertToType(data['tags'], [ModelTag]);
}
if (data.hasOwnProperty('categories')) {
obj['categories'] = ApiClient.convertToType(data['categories'], [ModelCategory]);
}
if (data.hasOwnProperty('thumbnails')) {
obj['thumbnails'] = ThumbnailsRelated.constructFromObject(data['thumbnails']);
}
if (data.hasOwnProperty('user')) {
obj['user'] = UserRelated.constructFromObject(data['user']);
}
if (data.hasOwnProperty('description')) {
obj['description'] = ApiClient.convertToType(data['description'], 'String');
}
if (data.hasOwnProperty('faceCount')) {
obj['faceCount'] = ApiClient.convertToType(data['faceCount'], 'Number');
}
if (data.hasOwnProperty('createdAt')) {
obj['createdAt'] = ApiClient.convertToType(data['createdAt'], 'String');
}
if (data.hasOwnProperty('vertexCount')) {
obj['vertexCount'] = ApiClient.convertToType(data['vertexCount'], 'Number');
}
if (data.hasOwnProperty('isAgeRestricted')) {
obj['isAgeRestricted'] = ApiClient.convertToType(data['isAgeRestricted'], 'Boolean');
}
if (data.hasOwnProperty('archives')) {
obj['archives'] = InlineArchives.constructFromObject(data['archives']);
}
if (data.hasOwnProperty('license')) {
obj['license'] = ModelLicense.constructFromObject(data['license']);
}
if (data.hasOwnProperty('isPublished')) {
obj['isPublished'] = ApiClient.convertToType(data['isPublished'], 'Boolean');
}
}
return obj;
}
/**
* Validates the JSON data with respect to <code>ModelSearchList</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>ModelSearchList</code>.
*/
static validateJSON(data) {
// ensure the json data is a string
if (data['uri'] && !(typeof data['uri'] === 'string' || data['uri'] instanceof String)) {
throw new Error("Expected the field `uri` to be a primitive type in the JSON string but got " + data['uri']);
}
// ensure the json data is a string
if (data['uid'] && !(typeof data['uid'] === 'string' || data['uid'] instanceof String)) {
throw new Error("Expected the field `uid` to be a primitive type in the JSON string but got " + data['uid']);
}
// ensure the json data is a string
if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
}
// ensure the json data is a string
if (data['staffpickedAt'] && !(typeof data['staffpickedAt'] === 'string' || data['staffpickedAt'] instanceof String)) {
throw new Error("Expected the field `staffpickedAt` to be a primitive type in the JSON string but got " + data['staffpickedAt']);
}
// ensure the json data is a string
if (data['viewerUrl'] && !(typeof data['viewerUrl'] === 'string' || data['viewerUrl'] instanceof String)) {
throw new Error("Expected the field `viewerUrl` to be a primitive type in the JSON string but got " + data['viewerUrl']);
}
// ensure the json data is a string
if (data['embedUrl'] && !(typeof data['embedUrl'] === 'string' || data['embedUrl'] instanceof String)) {
throw new Error("Expected the field `embedUrl` to be a primitive type in the JSON string but got " + data['embedUrl']);
}
// ensure the json data is a string
if (data['publishedAt'] && !(typeof data['publishedAt'] === 'string' || data['publishedAt'] instanceof String)) {
throw new Error("Expected the field `publishedAt` to be a primitive type in the JSON string but got " + data['publishedAt']);
}
if (data['tags']) { // data not null
// ensure the json data is an array
if (!Array.isArray(data['tags'])) {
throw new Error("Expected the field `tags` to be an array in the JSON data but got " + data['tags']);
}
// validate the optional field `tags` (array)
for (const item of data['tags']) {
ModelTag.validateJSON(item);
};
}
if (data['categories']) { // data not null
// ensure the json data is an array
if (!Array.isArray(data['categories'])) {
throw new Error("Expected the field `categories` to be an array in the JSON data but got " + data['categories']);
}
// validate the optional field `categories` (array)
for (const item of data['categories']) {
ModelCategory.validateJSON(item);
};
}
// validate the optional field `thumbnails`
if (data['thumbnails']) { // data not null
ThumbnailsRelated.validateJSON(data['thumbnails']);
}
// validate the optional field `user`
if (data['user']) { // data not null
UserRelated.validateJSON(data['user']);
}
// ensure the json data is a string
if (data['description'] && !(typeof data['description'] === 'string' || data['description'] instanceof String)) {
throw new Error("Expected the field `description` to be a primitive type in the JSON string but got " + data['description']);
}
// ensure the json data is a string
if (data['createdAt'] && !(typeof data['createdAt'] === 'string' || data['createdAt'] instanceof String)) {
throw new Error("Expected the field `createdAt` to be a primitive type in the JSON string but got " + data['createdAt']);
}
// validate the optional field `archives`
if (data['archives']) { // data not null
InlineArchives.validateJSON(data['archives']);
}
// validate the optional field `license`
if (data['license']) { // data not null
ModelLicense.validateJSON(data['license']);
}
return true;
}
}
export default ModelSearchList;