Pull request: beta client squashed
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
This commit is contained in:
100
client2/src/lib/entities/VersionInfo.ts
Normal file
100
client2/src/lib/entities/VersionInfo.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IVersionInfo {
|
||||
announcement?: string;
|
||||
announcement_url?: string;
|
||||
can_autoupdate?: boolean;
|
||||
new_version?: string;
|
||||
}
|
||||
|
||||
export default class VersionInfo {
|
||||
readonly _announcement: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: AdGuard Home v0.9 is now available!
|
||||
*/
|
||||
get announcement(): string | undefined {
|
||||
return this._announcement;
|
||||
}
|
||||
|
||||
readonly _announcement_url: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: https://github.com/AdguardTeam/AdGuardHome/releases/tag/v0.9
|
||||
*
|
||||
*/
|
||||
get announcementUrl(): string | undefined {
|
||||
return this._announcement_url;
|
||||
}
|
||||
|
||||
readonly _can_autoupdate: boolean | undefined;
|
||||
|
||||
get canAutoupdate(): boolean | undefined {
|
||||
return this._can_autoupdate;
|
||||
}
|
||||
|
||||
readonly _new_version: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: v0.9
|
||||
*/
|
||||
get newVersion(): string | undefined {
|
||||
return this._new_version;
|
||||
}
|
||||
|
||||
constructor(props: IVersionInfo) {
|
||||
if (typeof props.announcement === 'string') {
|
||||
this._announcement = props.announcement.trim();
|
||||
}
|
||||
if (typeof props.announcement_url === 'string') {
|
||||
this._announcement_url = props.announcement_url.trim();
|
||||
}
|
||||
if (typeof props.can_autoupdate === 'boolean') {
|
||||
this._can_autoupdate = props.can_autoupdate;
|
||||
}
|
||||
if (typeof props.new_version === 'string') {
|
||||
this._new_version = props.new_version.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IVersionInfo {
|
||||
const data: IVersionInfo = {
|
||||
};
|
||||
if (typeof this._announcement !== 'undefined') {
|
||||
data.announcement = this._announcement;
|
||||
}
|
||||
if (typeof this._announcement_url !== 'undefined') {
|
||||
data.announcement_url = this._announcement_url;
|
||||
}
|
||||
if (typeof this._can_autoupdate !== 'undefined') {
|
||||
data.can_autoupdate = this._can_autoupdate;
|
||||
}
|
||||
if (typeof this._new_version !== 'undefined') {
|
||||
data.new_version = this._new_version;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
new_version: !this._new_version ? true : typeof this._new_version === 'string' && !this._new_version ? true : this._new_version,
|
||||
announcement: !this._announcement ? true : typeof this._announcement === 'string' && !this._announcement ? true : this._announcement,
|
||||
announcement_url: !this._announcement_url ? true : typeof this._announcement_url === 'string' && !this._announcement_url ? true : this._announcement_url,
|
||||
can_autoupdate: !this._can_autoupdate ? true : typeof this._can_autoupdate === 'boolean',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IVersionInfo>): VersionInfo {
|
||||
return new VersionInfo({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user