// This file was autogenerated. Please do not change. // All changes will be overwrited on commit. export interface IAddUrlRequest { name?: string; url?: string; whitelist?: boolean; } export default class AddUrlRequest { readonly _name: string | undefined; get name(): string | undefined { return this._name; } readonly _url: string | undefined; /** * Description: URL or an absolute path to the file containing filtering rules. * * Example: https://filters.adtidy.org/windows/filters/15.txt */ get url(): string | undefined { return this._url; } readonly _whitelist: boolean | undefined; get whitelist(): boolean | undefined { return this._whitelist; } constructor(props: IAddUrlRequest) { if (typeof props.name === 'string') { this._name = props.name.trim(); } if (typeof props.url === 'string') { this._url = props.url.trim(); } if (typeof props.whitelist === 'boolean') { this._whitelist = props.whitelist; } } serialize(): IAddUrlRequest { const data: IAddUrlRequest = { }; if (typeof this._name !== 'undefined') { data.name = this._name; } if (typeof this._url !== 'undefined') { data.url = this._url; } if (typeof this._whitelist !== 'undefined') { data.whitelist = this._whitelist; } return data; } validate(): string[] { const validate = { name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name, url: !this._url ? true : typeof this._url === 'string' && !this._url ? true : this._url, whitelist: !this._whitelist ? true : typeof this._whitelist === 'boolean', }; const isError: string[] = []; Object.keys(validate).forEach((key) => { if (!(validate as any)[key]) { isError.push(key); } }); return isError; } update(props: Partial): AddUrlRequest { return new AddUrlRequest({ ...this.serialize(), ...props }); } }