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