mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2026-12-03 21:53:56 +09:00
Merge in DNS/adguard-home from beta-client-2 to master
Squashed commit of the following:
commit b2640cc49a6c5484d730b534dcf5a8013d7fa478
Merge: 659def862 aef4659e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Dec 29 19:23:09 2020 +0300
Merge branch 'master' into beta-client-2
commit 659def8626467949c35b7a6a0c99ffafb07b4385
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Dec 29 17:25:14 2020 +0300
all: upgrade github actions node version
commit b4b8cf8dd75672e9155da5d111ac66e8f5ba1535
Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com>
Date: Tue Dec 29 16:57:14 2020 +0300
all: beta client squashed
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import Client, { IClient } from './Client';
|
|
|
|
// This file was autogenerated. Please do not change.
|
|
// All changes will be overwrited on commit.
|
|
export interface IClientUpdate {
|
|
data?: IClient;
|
|
name?: string;
|
|
}
|
|
|
|
export default class ClientUpdate {
|
|
readonly _data: Client | undefined;
|
|
|
|
get data(): Client | undefined {
|
|
return this._data;
|
|
}
|
|
|
|
readonly _name: string | undefined;
|
|
|
|
get name(): string | undefined {
|
|
return this._name;
|
|
}
|
|
|
|
constructor(props: IClientUpdate) {
|
|
if (props.data) {
|
|
this._data = new Client(props.data);
|
|
}
|
|
if (typeof props.name === 'string') {
|
|
this._name = props.name.trim();
|
|
}
|
|
}
|
|
|
|
serialize(): IClientUpdate {
|
|
const data: IClientUpdate = {
|
|
};
|
|
if (typeof this._data !== 'undefined') {
|
|
data.data = this._data.serialize();
|
|
}
|
|
if (typeof this._name !== 'undefined') {
|
|
data.name = this._name;
|
|
}
|
|
return data;
|
|
}
|
|
|
|
validate(): string[] {
|
|
const validate = {
|
|
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
|
|
data: !this._data ? true : this._data.validate().length === 0,
|
|
};
|
|
const isError: string[] = [];
|
|
Object.keys(validate).forEach((key) => {
|
|
if (!(validate as any)[key]) {
|
|
isError.push(key);
|
|
}
|
|
});
|
|
return isError;
|
|
}
|
|
|
|
update(props: Partial<IClientUpdate>): ClientUpdate {
|
|
return new ClientUpdate({ ...this.serialize(), ...props });
|
|
}
|
|
}
|