/**
* 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 { ImageInfo } from './ImageInfo.js';
/**
* The AvatarRelated model module.
* @module model/AvatarRelated
* @version v0
*/
export class AvatarRelated {
/**
* Constructs a new <code>AvatarRelated</code>.
* @alias AvatarRelated
*/
constructor() {
/** uid
* @type {String}
*/
this.uid = undefined;
/** uri
* @type {String}
*/
this.uri = undefined;
/** images
* @type {Array.<ImageInfo>}
*/
this.images = undefined;
AvatarRelated.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>AvatarRelated</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 {AvatarRelated} obj Optional instance to populate.
* @return {AvatarRelated} The populated <code>AvatarRelated</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new AvatarRelated();
if (data.hasOwnProperty('uid')) {
obj['uid'] = ApiClient.convertToType(data['uid'], 'String');
}
if (data.hasOwnProperty('uri')) {
obj['uri'] = ApiClient.convertToType(data['uri'], 'String');
}
if (data.hasOwnProperty('images')) {
obj['images'] = ApiClient.convertToType(data['images'], [ImageInfo]);
}
}
return obj;
}
/**
* Validates the JSON data with respect to <code>AvatarRelated</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>AvatarRelated</code>.
*/
static validateJSON(data) {
// 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['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']);
}
if (data['images']) { // data not null
// ensure the json data is an array
if (!Array.isArray(data['images'])) {
throw new Error("Expected the field `images` to be an array in the JSON data but got " + data['images']);
}
// validate the optional field `images` (array)
for (const item of data['images']) {
ImageInfo.validateJSON(item);
};
}
return true;
}
}
export default AvatarRelated;