/** * OpenAPI Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 * * * 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'; /** * The User model module. * @module model/User * @version 1.0.0 */ class User { /** * Constructs a new User. * @alias module:model/User */ constructor() { User.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 User from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from data to obj if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/User} obj Optional instance to populate. * @return {module:model/User} The populated User instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new User(); if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } if (data.hasOwnProperty('username')) { obj['username'] = ApiClient.convertToType(data['username'], 'String'); } if (data.hasOwnProperty('firstName')) { obj['firstName'] = ApiClient.convertToType(data['firstName'], 'String'); } if (data.hasOwnProperty('lastName')) { obj['lastName'] = ApiClient.convertToType(data['lastName'], 'String'); } if (data.hasOwnProperty('email')) { obj['email'] = ApiClient.convertToType(data['email'], 'String'); } if (data.hasOwnProperty('password')) { obj['password'] = ApiClient.convertToType(data['password'], 'String'); } if (data.hasOwnProperty('phone')) { obj['phone'] = ApiClient.convertToType(data['phone'], 'String'); } if (data.hasOwnProperty('userStatus')) { obj['userStatus'] = ApiClient.convertToType(data['userStatus'], 'Number'); } } return obj; } /** * Validates the JSON data with respect to User. * @param {Object} data The plain JavaScript object bearing properties of interest. * @return {boolean} to indicate whether the JSON data is valid with respect to User. */ static validateJSON(data) { // 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['firstName'] && !(typeof data['firstName'] === 'string' || data['firstName'] instanceof String)) { throw new Error("Expected the field `firstName` to be a primitive type in the JSON string but got " + data['firstName']); } // ensure the json data is a string if (data['lastName'] && !(typeof data['lastName'] === 'string' || data['lastName'] instanceof String)) { throw new Error("Expected the field `lastName` to be a primitive type in the JSON string but got " + data['lastName']); } // ensure the json data is a string if (data['email'] && !(typeof data['email'] === 'string' || data['email'] instanceof String)) { throw new Error("Expected the field `email` to be a primitive type in the JSON string but got " + data['email']); } // ensure the json data is a string if (data['password'] && !(typeof data['password'] === 'string' || data['password'] instanceof String)) { throw new Error("Expected the field `password` to be a primitive type in the JSON string but got " + data['password']); } // ensure the json data is a string if (data['phone'] && !(typeof data['phone'] === 'string' || data['phone'] instanceof String)) { throw new Error("Expected the field `phone` to be a primitive type in the JSON string but got " + data['phone']); } return true; } } /** * @member {Number} id */ User.prototype['id'] = undefined; /** * @member {String} username */ User.prototype['username'] = undefined; /** * @member {String} firstName */ User.prototype['firstName'] = undefined; /** * @member {String} lastName */ User.prototype['lastName'] = undefined; /** * @member {String} email */ User.prototype['email'] = undefined; /** * @member {String} password */ User.prototype['password'] = undefined; /** * @member {String} phone */ User.prototype['phone'] = undefined; /** * User Status * @member {Number} userStatus */ User.prototype['userStatus'] = undefined; export default User;