// This file was autogenerated. Please do not change. // All changes will be overwrited on commit. export interface IClientAuto { ip?: string; name?: string; source?: string; } export default class ClientAuto { readonly _ip: string | undefined; /** * Description: IP address * Example: 127.0.0.1 */ get ip(): string | undefined { return this._ip; } readonly _name: string | undefined; /** * Description: Name * Example: localhost */ get name(): string | undefined { return this._name; } readonly _source: string | undefined; /** * Description: The source of this information * Example: etc/hosts */ get source(): string | undefined { return this._source; } constructor(props: IClientAuto) { if (typeof props.ip === 'string') { this._ip = props.ip.trim(); } if (typeof props.name === 'string') { this._name = props.name.trim(); } if (typeof props.source === 'string') { this._source = props.source.trim(); } } serialize(): IClientAuto { const data: IClientAuto = { }; if (typeof this._ip !== 'undefined') { data.ip = this._ip; } if (typeof this._name !== 'undefined') { data.name = this._name; } if (typeof this._source !== 'undefined') { data.source = this._source; } return data; } validate(): string[] { const validate = { ip: !this._ip ? true : typeof this._ip === 'string' && !this._ip ? true : this._ip, name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name, source: !this._source ? true : typeof this._source === 'string' && !this._source ? true : this._source, }; const isError: string[] = []; Object.keys(validate).forEach((key) => { if (!(validate as any)[key]) { isError.push(key); } }); return isError; } update(props: Partial): ClientAuto { return new ClientAuto({ ...this.serialize(), ...props }); } }