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:
Eugene Burkov
2020-12-29 19:53:56 +03:00
parent aef4659e93
commit 5e20ac7ed5
200 changed files with 20843 additions and 55 deletions

View File

@@ -0,0 +1,78 @@
// 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<IAddUrlRequest>): AddUrlRequest {
return new AddUrlRequest({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,67 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IAddressInfo {
ip: string;
port: number;
}
export default class AddressInfo {
readonly _ip: string;
/**
* Description: undefined
* Example: 127.0.0.1
*/
get ip(): string {
return this._ip;
}
static ipValidate(ip: string): boolean {
return typeof ip === 'string' && !!ip.trim();
}
readonly _port: number;
/**
* Description: undefined
* Example: 53
*/
get port(): number {
return this._port;
}
static portValidate(port: number): boolean {
return typeof port === 'number';
}
constructor(props: IAddressInfo) {
this._ip = props.ip.trim();
this._port = props.port;
}
serialize(): IAddressInfo {
const data: IAddressInfo = {
ip: this._ip,
port: this._port,
};
return data;
}
validate(): string[] {
const validate = {
ip: typeof this._ip === 'string' && !this._ip ? true : this._ip,
port: typeof this._port === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IAddressInfo>): AddressInfo {
return new AddressInfo({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,71 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IAddressInfoBeta {
ip: string[];
port: number;
}
export default class AddressInfoBeta {
readonly _ip: string[];
/**
* Description: undefined
* Example: 127.0.0.1
*/
get ip(): string[] {
return this._ip;
}
static get ipMinItems() {
return 1;
}
static ipValidate(ip: string[]): boolean {
return ip.reduce<boolean>((result, p) => result && (typeof p === 'string' && !!p.trim()), true);
}
readonly _port: number;
/**
* Description: undefined
* Example: 53
*/
get port(): number {
return this._port;
}
static portValidate(port: number): boolean {
return typeof port === 'number';
}
constructor(props: IAddressInfoBeta) {
this._ip = props.ip;
this._port = props.port;
}
serialize(): IAddressInfoBeta {
const data: IAddressInfoBeta = {
ip: this._ip,
port: this._port,
};
return data;
}
validate(): string[] {
const validate = {
ip: this._ip.reduce((result, p) => result && typeof p === 'string', true),
port: typeof this._port === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IAddressInfoBeta>): AddressInfoBeta {
return new AddressInfoBeta({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,81 @@
import NetInterface, { INetInterface } from './NetInterface';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IAddressesInfo {
dns_port: number;
interfaces: { [key: string]: INetInterface };
web_port: number;
}
export default class AddressesInfo {
readonly _dns_port: number;
/**
* Description: undefined
* Example: 53
*/
get dnsPort(): number {
return this._dns_port;
}
static dnsPortValidate(dnsPort: number): boolean {
return typeof dnsPort === 'number';
}
readonly _interfaces: { [key: string]: NetInterface };
/** */
get interfaces(): { [key: string]: NetInterface } {
return this._interfaces;
}
readonly _web_port: number;
/**
* Description: undefined
* Example: 80
*/
get webPort(): number {
return this._web_port;
}
static webPortValidate(webPort: number): boolean {
return typeof webPort === 'number';
}
constructor(props: IAddressesInfo) {
this._dns_port = props.dns_port;
this._interfaces = Object.keys(props.interfaces).reduce((prev, key) => {
return { ...prev, [key]: new NetInterface(props.interfaces[key])};
},{})
this._web_port = props.web_port;
}
serialize(): IAddressesInfo {
const data: IAddressesInfo = {
dns_port: this._dns_port,
interfaces: Object.keys(this._interfaces).reduce<Record<string, any>>((prev, key) => ({ ...prev, [key]: this._interfaces[key].serialize() }), {}),
web_port: this._web_port,
};
return data;
}
validate(): string[] {
const validate = {
dns_port: typeof this._dns_port === 'number',
web_port: typeof this._web_port === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IAddressesInfo>): AddressesInfo {
return new AddressesInfo({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,80 @@
import NetInterface, { INetInterface } from './NetInterface';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IAddressesInfoBeta {
dns_port: number;
interfaces: INetInterface[];
web_port: number;
}
export default class AddressesInfoBeta {
readonly _dns_port: number;
/**
* Description: undefined
* Example: 53
*/
get dnsPort(): number {
return this._dns_port;
}
static dnsPortValidate(dnsPort: number): boolean {
return typeof dnsPort === 'number';
}
readonly _interfaces: NetInterface[];
/** */
get interfaces(): NetInterface[] {
return this._interfaces;
}
readonly _web_port: number;
/**
* Description: undefined
* Example: 80
*/
get webPort(): number {
return this._web_port;
}
static webPortValidate(webPort: number): boolean {
return typeof webPort === 'number';
}
constructor(props: IAddressesInfoBeta) {
this._dns_port = props.dns_port;
this._interfaces = props.interfaces.map((p) => new NetInterface(p));
this._web_port = props.web_port;
}
serialize(): IAddressesInfoBeta {
const data: IAddressesInfoBeta = {
dns_port: this._dns_port,
interfaces: this._interfaces.map((p) => p.serialize()),
web_port: this._web_port,
};
return data;
}
validate(): string[] {
const validate = {
dns_port: typeof this._dns_port === 'number',
web_port: typeof this._web_port === 'number',
interfaces: this._interfaces.reduce((result, p) => result && p.validate().length === 0, true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IAddressesInfoBeta>): AddressesInfoBeta {
return new AddressesInfoBeta({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,31 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IBlockedServicesArray {
}
export default class BlockedServicesArray {
constructor(props: IBlockedServicesArray) {
}
serialize(): IBlockedServicesArray {
const data: IBlockedServicesArray = {
};
return data;
}
validate(): string[] {
const validate = {
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IBlockedServicesArray>): BlockedServicesArray {
return new BlockedServicesArray({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,75 @@
import CheckConfigRequestInfo, { ICheckConfigRequestInfo } from './CheckConfigRequestInfo';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ICheckConfigRequest {
dns?: ICheckConfigRequestInfo;
set_static_ip?: boolean;
web?: ICheckConfigRequestInfo;
}
export default class CheckConfigRequest {
readonly _dns: CheckConfigRequestInfo | undefined;
get dns(): CheckConfigRequestInfo | undefined {
return this._dns;
}
readonly _set_static_ip: boolean | undefined;
get setStaticIp(): boolean | undefined {
return this._set_static_ip;
}
readonly _web: CheckConfigRequestInfo | undefined;
get web(): CheckConfigRequestInfo | undefined {
return this._web;
}
constructor(props: ICheckConfigRequest) {
if (props.dns) {
this._dns = new CheckConfigRequestInfo(props.dns);
}
if (typeof props.set_static_ip === 'boolean') {
this._set_static_ip = props.set_static_ip;
}
if (props.web) {
this._web = new CheckConfigRequestInfo(props.web);
}
}
serialize(): ICheckConfigRequest {
const data: ICheckConfigRequest = {
};
if (typeof this._dns !== 'undefined') {
data.dns = this._dns.serialize();
}
if (typeof this._set_static_ip !== 'undefined') {
data.set_static_ip = this._set_static_ip;
}
if (typeof this._web !== 'undefined') {
data.web = this._web.serialize();
}
return data;
}
validate(): string[] {
const validate = {
dns: !this._dns ? true : this._dns.validate().length === 0,
web: !this._web ? true : this._web.validate().length === 0,
set_static_ip: !this._set_static_ip ? true : typeof this._set_static_ip === 'boolean',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ICheckConfigRequest>): CheckConfigRequest {
return new CheckConfigRequest({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,75 @@
import CheckConfigRequestInfoBeta, { ICheckConfigRequestInfoBeta } from './CheckConfigRequestInfoBeta';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ICheckConfigRequestBeta {
dns?: ICheckConfigRequestInfoBeta;
set_static_ip?: boolean;
web?: ICheckConfigRequestInfoBeta;
}
export default class CheckConfigRequestBeta {
readonly _dns: CheckConfigRequestInfoBeta | undefined;
get dns(): CheckConfigRequestInfoBeta | undefined {
return this._dns;
}
readonly _set_static_ip: boolean | undefined;
get setStaticIp(): boolean | undefined {
return this._set_static_ip;
}
readonly _web: CheckConfigRequestInfoBeta | undefined;
get web(): CheckConfigRequestInfoBeta | undefined {
return this._web;
}
constructor(props: ICheckConfigRequestBeta) {
if (props.dns) {
this._dns = new CheckConfigRequestInfoBeta(props.dns);
}
if (typeof props.set_static_ip === 'boolean') {
this._set_static_ip = props.set_static_ip;
}
if (props.web) {
this._web = new CheckConfigRequestInfoBeta(props.web);
}
}
serialize(): ICheckConfigRequestBeta {
const data: ICheckConfigRequestBeta = {
};
if (typeof this._dns !== 'undefined') {
data.dns = this._dns.serialize();
}
if (typeof this._set_static_ip !== 'undefined') {
data.set_static_ip = this._set_static_ip;
}
if (typeof this._web !== 'undefined') {
data.web = this._web.serialize();
}
return data;
}
validate(): string[] {
const validate = {
dns: !this._dns ? true : this._dns.validate().length === 0,
web: !this._web ? true : this._web.validate().length === 0,
set_static_ip: !this._set_static_ip ? true : typeof this._set_static_ip === 'boolean',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ICheckConfigRequestBeta>): CheckConfigRequestBeta {
return new CheckConfigRequestBeta({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,81 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ICheckConfigRequestInfo {
autofix?: boolean;
ip?: string;
port?: number;
}
export default class CheckConfigRequestInfo {
readonly _autofix: boolean | undefined;
get autofix(): boolean | undefined {
return this._autofix;
}
readonly _ip: string | undefined;
/**
* Description: undefined
* Example: 127.0.0.1
*/
get ip(): string | undefined {
return this._ip;
}
readonly _port: number | undefined;
/**
* Description: undefined
* Example: 53
*/
get port(): number | undefined {
return this._port;
}
constructor(props: ICheckConfigRequestInfo) {
if (typeof props.autofix === 'boolean') {
this._autofix = props.autofix;
}
if (typeof props.ip === 'string') {
this._ip = props.ip.trim();
}
if (typeof props.port === 'number') {
this._port = props.port;
}
}
serialize(): ICheckConfigRequestInfo {
const data: ICheckConfigRequestInfo = {
};
if (typeof this._autofix !== 'undefined') {
data.autofix = this._autofix;
}
if (typeof this._ip !== 'undefined') {
data.ip = this._ip;
}
if (typeof this._port !== 'undefined') {
data.port = this._port;
}
return data;
}
validate(): string[] {
const validate = {
ip: !this._ip ? true : typeof this._ip === 'string' && !this._ip ? true : this._ip,
port: !this._port ? true : typeof this._port === 'number',
autofix: !this._autofix ? true : typeof this._autofix === 'boolean',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ICheckConfigRequestInfo>): CheckConfigRequestInfo {
return new CheckConfigRequestInfo({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,85 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ICheckConfigRequestInfoBeta {
autofix?: boolean;
ip?: string[];
port?: number;
}
export default class CheckConfigRequestInfoBeta {
readonly _autofix: boolean | undefined;
get autofix(): boolean | undefined {
return this._autofix;
}
readonly _ip: string[] | undefined;
/**
* Description: undefined
* Example: 127.0.0.1
*/
get ip(): string[] | undefined {
return this._ip;
}
static get ipMinItems() {
return 1;
}
readonly _port: number | undefined;
/**
* Description: undefined
* Example: 53
*/
get port(): number | undefined {
return this._port;
}
constructor(props: ICheckConfigRequestInfoBeta) {
if (typeof props.autofix === 'boolean') {
this._autofix = props.autofix;
}
if (props.ip) {
this._ip = props.ip;
}
if (typeof props.port === 'number') {
this._port = props.port;
}
}
serialize(): ICheckConfigRequestInfoBeta {
const data: ICheckConfigRequestInfoBeta = {
};
if (typeof this._autofix !== 'undefined') {
data.autofix = this._autofix;
}
if (typeof this._ip !== 'undefined') {
data.ip = this._ip;
}
if (typeof this._port !== 'undefined') {
data.port = this._port;
}
return data;
}
validate(): string[] {
const validate = {
ip: !this._ip ? true : this._ip.reduce((result, p) => result && typeof p === 'string', true),
port: !this._port ? true : typeof this._port === 'number',
autofix: !this._autofix ? true : typeof this._autofix === 'boolean',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ICheckConfigRequestInfoBeta>): CheckConfigRequestInfoBeta {
return new CheckConfigRequestInfoBeta({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,64 @@
import CheckConfigResponseInfo, { ICheckConfigResponseInfo } from './CheckConfigResponseInfo';
import CheckConfigStaticIpInfo, { ICheckConfigStaticIpInfo } from './CheckConfigStaticIpInfo';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ICheckConfigResponse {
dns: ICheckConfigResponseInfo;
static_ip: ICheckConfigStaticIpInfo;
web: ICheckConfigResponseInfo;
}
export default class CheckConfigResponse {
readonly _dns: CheckConfigResponseInfo;
get dns(): CheckConfigResponseInfo {
return this._dns;
}
readonly _static_ip: CheckConfigStaticIpInfo;
get staticIp(): CheckConfigStaticIpInfo {
return this._static_ip;
}
readonly _web: CheckConfigResponseInfo;
get web(): CheckConfigResponseInfo {
return this._web;
}
constructor(props: ICheckConfigResponse) {
this._dns = new CheckConfigResponseInfo(props.dns);
this._static_ip = new CheckConfigStaticIpInfo(props.static_ip);
this._web = new CheckConfigResponseInfo(props.web);
}
serialize(): ICheckConfigResponse {
const data: ICheckConfigResponse = {
dns: this._dns.serialize(),
static_ip: this._static_ip.serialize(),
web: this._web.serialize(),
};
return data;
}
validate(): string[] {
const validate = {
dns: this._dns.validate().length === 0,
web: this._web.validate().length === 0,
static_ip: this._static_ip.validate().length === 0,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ICheckConfigResponse>): CheckConfigResponse {
return new CheckConfigResponse({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,59 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ICheckConfigResponseInfo {
can_autofix: boolean;
status: string;
}
export default class CheckConfigResponseInfo {
readonly _can_autofix: boolean;
get canAutofix(): boolean {
return this._can_autofix;
}
static canAutofixValidate(canAutofix: boolean): boolean {
return typeof canAutofix === 'boolean';
}
readonly _status: string;
get status(): string {
return this._status;
}
static statusValidate(status: string): boolean {
return typeof status === 'string' && !!status.trim();
}
constructor(props: ICheckConfigResponseInfo) {
this._can_autofix = props.can_autofix;
this._status = props.status.trim();
}
serialize(): ICheckConfigResponseInfo {
const data: ICheckConfigResponseInfo = {
can_autofix: this._can_autofix,
status: this._status,
};
return data;
}
validate(): string[] {
const validate = {
status: typeof this._status === 'string' && !this._status ? true : this._status,
can_autofix: typeof this._can_autofix === 'boolean',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ICheckConfigResponseInfo>): CheckConfigResponseInfo {
return new CheckConfigResponseInfo({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,79 @@
import { CheckConfigStaticIpInfoStatic } from './CheckConfigStaticIpInfoStatic';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ICheckConfigStaticIpInfo {
error?: string;
ip?: string;
static?: CheckConfigStaticIpInfoStatic;
}
export default class CheckConfigStaticIpInfo {
readonly _error: string | undefined;
/** */
get error(): string | undefined {
return this._error;
}
readonly _ip: string | undefined;
/**
* Description: Current dynamic IP address. Set if static=no
* Example: 192.168.1.1
*/
get ip(): string | undefined {
return this._ip;
}
readonly _static: CheckConfigStaticIpInfoStatic | undefined;
get static(): CheckConfigStaticIpInfoStatic | undefined {
return this._static;
}
constructor(props: ICheckConfigStaticIpInfo) {
if (typeof props.error === 'string') {
this._error = props.error.trim();
}
if (typeof props.ip === 'string') {
this._ip = props.ip.trim();
}
if (props.static) {
this._static = props.static;
}
}
serialize(): ICheckConfigStaticIpInfo {
const data: ICheckConfigStaticIpInfo = {
};
if (typeof this._error !== 'undefined') {
data.error = this._error;
}
if (typeof this._ip !== 'undefined') {
data.ip = this._ip;
}
if (typeof this._static !== 'undefined') {
data.static = this._static;
}
return data;
}
validate(): string[] {
const validate = {
ip: !this._ip ? true : typeof this._ip === 'string' && !this._ip ? true : this._ip,
error: !this._error ? true : typeof this._error === 'string' && !this._error ? true : this._error,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ICheckConfigStaticIpInfo>): CheckConfigStaticIpInfo {
return new CheckConfigStaticIpInfo({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,7 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export enum CheckConfigStaticIpInfoStatic {
YES = 'yes',
NO = 'no',
ERROR = 'error'
}

View File

@@ -0,0 +1,176 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClient {
blocked_services?: string[];
filtering_enabled?: boolean;
ids?: string[];
name?: string;
parental_enabled?: boolean;
safebrowsing_enabled?: boolean;
safesearch_enabled?: boolean;
upstreams?: string[];
use_global_blocked_services?: boolean;
use_global_settings?: boolean;
}
export default class Client {
readonly _blocked_services: string[] | undefined;
get blockedServices(): string[] | undefined {
return this._blocked_services;
}
readonly _filtering_enabled: boolean | undefined;
get filteringEnabled(): boolean | undefined {
return this._filtering_enabled;
}
readonly _ids: string[] | undefined;
/** */
get ids(): string[] | undefined {
return this._ids;
}
readonly _name: string | undefined;
/**
* Description: Name
* Example: localhost
*/
get name(): string | undefined {
return this._name;
}
readonly _parental_enabled: boolean | undefined;
get parentalEnabled(): boolean | undefined {
return this._parental_enabled;
}
readonly _safebrowsing_enabled: boolean | undefined;
get safebrowsingEnabled(): boolean | undefined {
return this._safebrowsing_enabled;
}
readonly _safesearch_enabled: boolean | undefined;
get safesearchEnabled(): boolean | undefined {
return this._safesearch_enabled;
}
readonly _upstreams: string[] | undefined;
get upstreams(): string[] | undefined {
return this._upstreams;
}
readonly _use_global_blocked_services: boolean | undefined;
get useGlobalBlockedServices(): boolean | undefined {
return this._use_global_blocked_services;
}
readonly _use_global_settings: boolean | undefined;
get useGlobalSettings(): boolean | undefined {
return this._use_global_settings;
}
constructor(props: IClient) {
if (props.blocked_services) {
this._blocked_services = props.blocked_services;
}
if (typeof props.filtering_enabled === 'boolean') {
this._filtering_enabled = props.filtering_enabled;
}
if (props.ids) {
this._ids = props.ids;
}
if (typeof props.name === 'string') {
this._name = props.name.trim();
}
if (typeof props.parental_enabled === 'boolean') {
this._parental_enabled = props.parental_enabled;
}
if (typeof props.safebrowsing_enabled === 'boolean') {
this._safebrowsing_enabled = props.safebrowsing_enabled;
}
if (typeof props.safesearch_enabled === 'boolean') {
this._safesearch_enabled = props.safesearch_enabled;
}
if (props.upstreams) {
this._upstreams = props.upstreams;
}
if (typeof props.use_global_blocked_services === 'boolean') {
this._use_global_blocked_services = props.use_global_blocked_services;
}
if (typeof props.use_global_settings === 'boolean') {
this._use_global_settings = props.use_global_settings;
}
}
serialize(): IClient {
const data: IClient = {
};
if (typeof this._blocked_services !== 'undefined') {
data.blocked_services = this._blocked_services;
}
if (typeof this._filtering_enabled !== 'undefined') {
data.filtering_enabled = this._filtering_enabled;
}
if (typeof this._ids !== 'undefined') {
data.ids = this._ids;
}
if (typeof this._name !== 'undefined') {
data.name = this._name;
}
if (typeof this._parental_enabled !== 'undefined') {
data.parental_enabled = this._parental_enabled;
}
if (typeof this._safebrowsing_enabled !== 'undefined') {
data.safebrowsing_enabled = this._safebrowsing_enabled;
}
if (typeof this._safesearch_enabled !== 'undefined') {
data.safesearch_enabled = this._safesearch_enabled;
}
if (typeof this._upstreams !== 'undefined') {
data.upstreams = this._upstreams;
}
if (typeof this._use_global_blocked_services !== 'undefined') {
data.use_global_blocked_services = this._use_global_blocked_services;
}
if (typeof this._use_global_settings !== 'undefined') {
data.use_global_settings = this._use_global_settings;
}
return data;
}
validate(): string[] {
const validate = {
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
ids: !this._ids ? true : this._ids.reduce((result, p) => result && typeof p === 'string', true),
use_global_settings: !this._use_global_settings ? true : typeof this._use_global_settings === 'boolean',
filtering_enabled: !this._filtering_enabled ? true : typeof this._filtering_enabled === 'boolean',
parental_enabled: !this._parental_enabled ? true : typeof this._parental_enabled === 'boolean',
safebrowsing_enabled: !this._safebrowsing_enabled ? true : typeof this._safebrowsing_enabled === 'boolean',
safesearch_enabled: !this._safesearch_enabled ? true : typeof this._safesearch_enabled === 'boolean',
use_global_blocked_services: !this._use_global_blocked_services ? true : typeof this._use_global_blocked_services === 'boolean',
blocked_services: !this._blocked_services ? true : this._blocked_services.reduce((result, p) => result && typeof p === 'string', true),
upstreams: !this._upstreams ? true : this._upstreams.reduce((result, p) => result && typeof p === 'string', true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClient>): Client {
return new Client({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,85 @@
// 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<IClientAuto>): ClientAuto {
return new ClientAuto({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,45 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClientDelete {
name?: string;
}
export default class ClientDelete {
readonly _name: string | undefined;
get name(): string | undefined {
return this._name;
}
constructor(props: IClientDelete) {
if (typeof props.name === 'string') {
this._name = props.name.trim();
}
}
serialize(): IClientDelete {
const data: IClientDelete = {
};
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,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClientDelete>): ClientDelete {
return new ClientDelete({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,222 @@
import WhoisInfo, { IWhoisInfo } from './WhoisInfo';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClientFindSubEntry {
blocked_services?: string[];
disallowed?: boolean;
disallowed_rule?: string;
filtering_enabled?: boolean;
ids?: string[];
name?: string;
parental_enabled?: boolean;
safebrowsing_enabled?: boolean;
safesearch_enabled?: boolean;
upstreams?: string[];
use_global_blocked_services?: boolean;
use_global_settings?: boolean;
whois_info?: IWhoisInfo[];
}
export default class ClientFindSubEntry {
readonly _blocked_services: string[] | undefined;
get blockedServices(): string[] | undefined {
return this._blocked_services;
}
readonly _disallowed: boolean | undefined;
/** */
get disallowed(): boolean | undefined {
return this._disallowed;
}
readonly _disallowed_rule: string | undefined;
/** */
get disallowedRule(): string | undefined {
return this._disallowed_rule;
}
readonly _filtering_enabled: boolean | undefined;
get filteringEnabled(): boolean | undefined {
return this._filtering_enabled;
}
readonly _ids: string[] | undefined;
/** */
get ids(): string[] | undefined {
return this._ids;
}
readonly _name: string | undefined;
/**
* Description: Name
* Example: localhost
*/
get name(): string | undefined {
return this._name;
}
readonly _parental_enabled: boolean | undefined;
get parentalEnabled(): boolean | undefined {
return this._parental_enabled;
}
readonly _safebrowsing_enabled: boolean | undefined;
get safebrowsingEnabled(): boolean | undefined {
return this._safebrowsing_enabled;
}
readonly _safesearch_enabled: boolean | undefined;
get safesearchEnabled(): boolean | undefined {
return this._safesearch_enabled;
}
readonly _upstreams: string[] | undefined;
get upstreams(): string[] | undefined {
return this._upstreams;
}
readonly _use_global_blocked_services: boolean | undefined;
get useGlobalBlockedServices(): boolean | undefined {
return this._use_global_blocked_services;
}
readonly _use_global_settings: boolean | undefined;
get useGlobalSettings(): boolean | undefined {
return this._use_global_settings;
}
readonly _whois_info: WhoisInfo[] | undefined;
get whoisInfo(): WhoisInfo[] | undefined {
return this._whois_info;
}
constructor(props: IClientFindSubEntry) {
if (props.blocked_services) {
this._blocked_services = props.blocked_services;
}
if (typeof props.disallowed === 'boolean') {
this._disallowed = props.disallowed;
}
if (typeof props.disallowed_rule === 'string') {
this._disallowed_rule = props.disallowed_rule.trim();
}
if (typeof props.filtering_enabled === 'boolean') {
this._filtering_enabled = props.filtering_enabled;
}
if (props.ids) {
this._ids = props.ids;
}
if (typeof props.name === 'string') {
this._name = props.name.trim();
}
if (typeof props.parental_enabled === 'boolean') {
this._parental_enabled = props.parental_enabled;
}
if (typeof props.safebrowsing_enabled === 'boolean') {
this._safebrowsing_enabled = props.safebrowsing_enabled;
}
if (typeof props.safesearch_enabled === 'boolean') {
this._safesearch_enabled = props.safesearch_enabled;
}
if (props.upstreams) {
this._upstreams = props.upstreams;
}
if (typeof props.use_global_blocked_services === 'boolean') {
this._use_global_blocked_services = props.use_global_blocked_services;
}
if (typeof props.use_global_settings === 'boolean') {
this._use_global_settings = props.use_global_settings;
}
if (props.whois_info) {
this._whois_info = props.whois_info.map((p) => new WhoisInfo(p));
}
}
serialize(): IClientFindSubEntry {
const data: IClientFindSubEntry = {
};
if (typeof this._blocked_services !== 'undefined') {
data.blocked_services = this._blocked_services;
}
if (typeof this._disallowed !== 'undefined') {
data.disallowed = this._disallowed;
}
if (typeof this._disallowed_rule !== 'undefined') {
data.disallowed_rule = this._disallowed_rule;
}
if (typeof this._filtering_enabled !== 'undefined') {
data.filtering_enabled = this._filtering_enabled;
}
if (typeof this._ids !== 'undefined') {
data.ids = this._ids;
}
if (typeof this._name !== 'undefined') {
data.name = this._name;
}
if (typeof this._parental_enabled !== 'undefined') {
data.parental_enabled = this._parental_enabled;
}
if (typeof this._safebrowsing_enabled !== 'undefined') {
data.safebrowsing_enabled = this._safebrowsing_enabled;
}
if (typeof this._safesearch_enabled !== 'undefined') {
data.safesearch_enabled = this._safesearch_enabled;
}
if (typeof this._upstreams !== 'undefined') {
data.upstreams = this._upstreams;
}
if (typeof this._use_global_blocked_services !== 'undefined') {
data.use_global_blocked_services = this._use_global_blocked_services;
}
if (typeof this._use_global_settings !== 'undefined') {
data.use_global_settings = this._use_global_settings;
}
if (typeof this._whois_info !== 'undefined') {
data.whois_info = this._whois_info.map((p) => p.serialize());
}
return data;
}
validate(): string[] {
const validate = {
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
ids: !this._ids ? true : this._ids.reduce((result, p) => result && typeof p === 'string', true),
use_global_settings: !this._use_global_settings ? true : typeof this._use_global_settings === 'boolean',
filtering_enabled: !this._filtering_enabled ? true : typeof this._filtering_enabled === 'boolean',
parental_enabled: !this._parental_enabled ? true : typeof this._parental_enabled === 'boolean',
safebrowsing_enabled: !this._safebrowsing_enabled ? true : typeof this._safebrowsing_enabled === 'boolean',
safesearch_enabled: !this._safesearch_enabled ? true : typeof this._safesearch_enabled === 'boolean',
use_global_blocked_services: !this._use_global_blocked_services ? true : typeof this._use_global_blocked_services === 'boolean',
blocked_services: !this._blocked_services ? true : this._blocked_services.reduce((result, p) => result && typeof p === 'string', true),
upstreams: !this._upstreams ? true : this._upstreams.reduce((result, p) => result && typeof p === 'string', true),
whois_info: !this._whois_info ? true : this._whois_info.reduce((result, p) => result && p.validate().length === 0, true),
disallowed: !this._disallowed ? true : typeof this._disallowed === 'boolean',
disallowed_rule: !this._disallowed_rule ? true : typeof this._disallowed_rule === 'string' && !this._disallowed_rule ? true : this._disallowed_rule,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClientFindSubEntry>): ClientFindSubEntry {
return new ClientFindSubEntry({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,61 @@
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 });
}
}

View File

@@ -0,0 +1,62 @@
import Client, { IClient } from './Client';
import ClientAuto, { IClientAuto } from './ClientAuto';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClients {
auto_clients?: IClientAuto[];
clients?: IClient[];
}
export default class Clients {
readonly _auto_clients: ClientAuto[] | undefined;
get autoClients(): ClientAuto[] | undefined {
return this._auto_clients;
}
readonly _clients: Client[] | undefined;
get clients(): Client[] | undefined {
return this._clients;
}
constructor(props: IClients) {
if (props.auto_clients) {
this._auto_clients = props.auto_clients.map((p) => new ClientAuto(p));
}
if (props.clients) {
this._clients = props.clients.map((p) => new Client(p));
}
}
serialize(): IClients {
const data: IClients = {
};
if (typeof this._auto_clients !== 'undefined') {
data.auto_clients = this._auto_clients.map((p) => p.serialize());
}
if (typeof this._clients !== 'undefined') {
data.clients = this._clients.map((p) => p.serialize());
}
return data;
}
validate(): string[] {
const validate = {
clients: !this._clients ? true : this._clients.reduce((result, p) => result && p.validate().length === 0, true),
auto_clients: !this._auto_clients ? true : this._auto_clients.reduce((result, p) => result && p.validate().length === 0, true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClients>): Clients {
return new Clients({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,31 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClientsArray {
}
export default class ClientsArray {
constructor(props: IClientsArray) {
}
serialize(): IClientsArray {
const data: IClientsArray = {
};
return data;
}
validate(): string[] {
const validate = {
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClientsArray>): ClientsArray {
return new ClientsArray({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,31 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClientsAutoArray {
}
export default class ClientsAutoArray {
constructor(props: IClientsAutoArray) {
}
serialize(): IClientsAutoArray {
const data: IClientsAutoArray = {
};
return data;
}
validate(): string[] {
const validate = {
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClientsAutoArray>): ClientsAutoArray {
return new ClientsAutoArray({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,31 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClientsFindEntry {
}
export default class ClientsFindEntry {
constructor(props: IClientsFindEntry) {
}
serialize(): IClientsFindEntry {
const data: IClientsFindEntry = {
};
return data;
}
validate(): string[] {
const validate = {
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClientsFindEntry>): ClientsFindEntry {
return new ClientsFindEntry({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,31 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClientsFindResponse {
}
export default class ClientsFindResponse {
constructor(props: IClientsFindResponse) {
}
serialize(): IClientsFindResponse {
const data: IClientsFindResponse = {
};
return data;
}
validate(): string[] {
const validate = {
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClientsFindResponse>): ClientsFindResponse {
return new ClientsFindResponse({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,250 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDNSConfig {
blocking_ipv4?: string;
blocking_ipv6?: string;
blocking_mode?: string;
bootstrap_dns?: string[];
cache_size?: number;
cache_ttl_max?: number;
cache_ttl_min?: number;
dhcp_available?: boolean;
dnssec_enabled?: boolean;
edns_cs_enabled?: boolean;
protection_enabled?: boolean;
ratelimit?: number;
upstream_dns?: string[];
upstream_dns_file?: string;
upstream_mode?: any;
}
export default class DNSConfig {
readonly _blocking_ipv4: string | undefined;
get blockingIpv4(): string | undefined {
return this._blocking_ipv4;
}
readonly _blocking_ipv6: string | undefined;
get blockingIpv6(): string | undefined {
return this._blocking_ipv6;
}
readonly _blocking_mode: string | undefined;
get blockingMode(): string | undefined {
return this._blocking_mode;
}
readonly _bootstrap_dns: string[] | undefined;
/**
* Description: Bootstrap servers, port is optional after colon. Empty value will reset it to default values.
*
* Example: 8.8.8.8:53,1.1.1.1:53
*/
get bootstrapDns(): string[] | undefined {
return this._bootstrap_dns;
}
readonly _cache_size: number | undefined;
get cacheSize(): number | undefined {
return this._cache_size;
}
readonly _cache_ttl_max: number | undefined;
get cacheTtlMax(): number | undefined {
return this._cache_ttl_max;
}
readonly _cache_ttl_min: number | undefined;
get cacheTtlMin(): number | undefined {
return this._cache_ttl_min;
}
readonly _dhcp_available: boolean | undefined;
get dhcpAvailable(): boolean | undefined {
return this._dhcp_available;
}
readonly _dnssec_enabled: boolean | undefined;
get dnssecEnabled(): boolean | undefined {
return this._dnssec_enabled;
}
readonly _edns_cs_enabled: boolean | undefined;
get ednsCsEnabled(): boolean | undefined {
return this._edns_cs_enabled;
}
readonly _protection_enabled: boolean | undefined;
get protectionEnabled(): boolean | undefined {
return this._protection_enabled;
}
readonly _ratelimit: number | undefined;
get ratelimit(): number | undefined {
return this._ratelimit;
}
readonly _upstream_dns: string[] | undefined;
/**
* Description: Upstream servers, port is optional after colon. Empty value will reset it to default values.
*
* Example: tls://1.1.1.1,tls://1.0.0.1
*/
get upstreamDns(): string[] | undefined {
return this._upstream_dns;
}
readonly _upstream_dns_file: string | undefined;
get upstreamDnsFile(): string | undefined {
return this._upstream_dns_file;
}
readonly _upstream_mode: any | undefined;
get upstreamMode(): any | undefined {
return this._upstream_mode;
}
constructor(props: IDNSConfig) {
if (typeof props.blocking_ipv4 === 'string') {
this._blocking_ipv4 = props.blocking_ipv4.trim();
}
if (typeof props.blocking_ipv6 === 'string') {
this._blocking_ipv6 = props.blocking_ipv6.trim();
}
if (typeof props.blocking_mode === 'string') {
this._blocking_mode = props.blocking_mode.trim();
}
if (props.bootstrap_dns) {
this._bootstrap_dns = props.bootstrap_dns;
}
if (typeof props.cache_size === 'number') {
this._cache_size = props.cache_size;
}
if (typeof props.cache_ttl_max === 'number') {
this._cache_ttl_max = props.cache_ttl_max;
}
if (typeof props.cache_ttl_min === 'number') {
this._cache_ttl_min = props.cache_ttl_min;
}
if (typeof props.dhcp_available === 'boolean') {
this._dhcp_available = props.dhcp_available;
}
if (typeof props.dnssec_enabled === 'boolean') {
this._dnssec_enabled = props.dnssec_enabled;
}
if (typeof props.edns_cs_enabled === 'boolean') {
this._edns_cs_enabled = props.edns_cs_enabled;
}
if (typeof props.protection_enabled === 'boolean') {
this._protection_enabled = props.protection_enabled;
}
if (typeof props.ratelimit === 'number') {
this._ratelimit = props.ratelimit;
}
if (props.upstream_dns) {
this._upstream_dns = props.upstream_dns;
}
if (typeof props.upstream_dns_file === 'string') {
this._upstream_dns_file = props.upstream_dns_file.trim();
}
if (props.upstream_mode) {
this._upstream_mode = props.upstream_mode;
}
}
serialize(): IDNSConfig {
const data: IDNSConfig = {
};
if (typeof this._blocking_ipv4 !== 'undefined') {
data.blocking_ipv4 = this._blocking_ipv4;
}
if (typeof this._blocking_ipv6 !== 'undefined') {
data.blocking_ipv6 = this._blocking_ipv6;
}
if (typeof this._blocking_mode !== 'undefined') {
data.blocking_mode = this._blocking_mode;
}
if (typeof this._bootstrap_dns !== 'undefined') {
data.bootstrap_dns = this._bootstrap_dns;
}
if (typeof this._cache_size !== 'undefined') {
data.cache_size = this._cache_size;
}
if (typeof this._cache_ttl_max !== 'undefined') {
data.cache_ttl_max = this._cache_ttl_max;
}
if (typeof this._cache_ttl_min !== 'undefined') {
data.cache_ttl_min = this._cache_ttl_min;
}
if (typeof this._dhcp_available !== 'undefined') {
data.dhcp_available = this._dhcp_available;
}
if (typeof this._dnssec_enabled !== 'undefined') {
data.dnssec_enabled = this._dnssec_enabled;
}
if (typeof this._edns_cs_enabled !== 'undefined') {
data.edns_cs_enabled = this._edns_cs_enabled;
}
if (typeof this._protection_enabled !== 'undefined') {
data.protection_enabled = this._protection_enabled;
}
if (typeof this._ratelimit !== 'undefined') {
data.ratelimit = this._ratelimit;
}
if (typeof this._upstream_dns !== 'undefined') {
data.upstream_dns = this._upstream_dns;
}
if (typeof this._upstream_dns_file !== 'undefined') {
data.upstream_dns_file = this._upstream_dns_file;
}
if (typeof this._upstream_mode !== 'undefined') {
data.upstream_mode = this._upstream_mode;
}
return data;
}
validate(): string[] {
const validate = {
bootstrap_dns: !this._bootstrap_dns ? true : this._bootstrap_dns.reduce((result, p) => result && typeof p === 'string', true),
upstream_dns: !this._upstream_dns ? true : this._upstream_dns.reduce((result, p) => result && typeof p === 'string', true),
upstream_dns_file: !this._upstream_dns_file ? true : typeof this._upstream_dns_file === 'string' && !this._upstream_dns_file ? true : this._upstream_dns_file,
protection_enabled: !this._protection_enabled ? true : typeof this._protection_enabled === 'boolean',
dhcp_available: !this._dhcp_available ? true : typeof this._dhcp_available === 'boolean',
ratelimit: !this._ratelimit ? true : typeof this._ratelimit === 'number',
blocking_mode: !this._blocking_mode ? true : typeof this._blocking_mode === 'string' && !this._blocking_mode ? true : this._blocking_mode,
blocking_ipv4: !this._blocking_ipv4 ? true : typeof this._blocking_ipv4 === 'string' && !this._blocking_ipv4 ? true : this._blocking_ipv4,
blocking_ipv6: !this._blocking_ipv6 ? true : typeof this._blocking_ipv6 === 'string' && !this._blocking_ipv6 ? true : this._blocking_ipv6,
edns_cs_enabled: !this._edns_cs_enabled ? true : typeof this._edns_cs_enabled === 'boolean',
dnssec_enabled: !this._dnssec_enabled ? true : typeof this._dnssec_enabled === 'boolean',
cache_size: !this._cache_size ? true : typeof this._cache_size === 'number',
cache_ttl_min: !this._cache_ttl_min ? true : typeof this._cache_ttl_min === 'number',
cache_ttl_max: !this._cache_ttl_max ? true : typeof this._cache_ttl_max === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDNSConfig>): DNSConfig {
return new DNSConfig({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,90 @@
import DhcpConfigV4, { IDhcpConfigV4 } from './DhcpConfigV4';
import DhcpConfigV6, { IDhcpConfigV6 } from './DhcpConfigV6';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpConfig {
enabled?: boolean;
interface_name?: string;
v4?: IDhcpConfigV4;
v6?: IDhcpConfigV6;
}
export default class DhcpConfig {
readonly _enabled: boolean | undefined;
get enabled(): boolean | undefined {
return this._enabled;
}
readonly _interface_name: string | undefined;
get interfaceName(): string | undefined {
return this._interface_name;
}
readonly _v4: DhcpConfigV4 | undefined;
get v4(): DhcpConfigV4 | undefined {
return this._v4;
}
readonly _v6: DhcpConfigV6 | undefined;
get v6(): DhcpConfigV6 | undefined {
return this._v6;
}
constructor(props: IDhcpConfig) {
if (typeof props.enabled === 'boolean') {
this._enabled = props.enabled;
}
if (typeof props.interface_name === 'string') {
this._interface_name = props.interface_name.trim();
}
if (props.v4) {
this._v4 = new DhcpConfigV4(props.v4);
}
if (props.v6) {
this._v6 = new DhcpConfigV6(props.v6);
}
}
serialize(): IDhcpConfig {
const data: IDhcpConfig = {
};
if (typeof this._enabled !== 'undefined') {
data.enabled = this._enabled;
}
if (typeof this._interface_name !== 'undefined') {
data.interface_name = this._interface_name;
}
if (typeof this._v4 !== 'undefined') {
data.v4 = this._v4.serialize();
}
if (typeof this._v6 !== 'undefined') {
data.v6 = this._v6.serialize();
}
return data;
}
validate(): string[] {
const validate = {
enabled: !this._enabled ? true : typeof this._enabled === 'boolean',
interface_name: !this._interface_name ? true : typeof this._interface_name === 'string' && !this._interface_name ? true : this._interface_name,
v4: !this._v4 ? true : this._v4.validate().length === 0,
v6: !this._v6 ? true : this._v6.validate().length === 0,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpConfig>): DhcpConfig {
return new DhcpConfig({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,117 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpConfigV4 {
gateway_ip?: string;
lease_duration?: number;
range_end?: string;
range_start?: string;
subnet_mask?: string;
}
export default class DhcpConfigV4 {
readonly _gateway_ip: string | undefined;
/**
* Description: undefined
* Example: 192.168.1.1
*/
get gatewayIp(): string | undefined {
return this._gateway_ip;
}
readonly _lease_duration: number | undefined;
get leaseDuration(): number | undefined {
return this._lease_duration;
}
readonly _range_end: string | undefined;
/**
* Description: undefined
* Example: 192.168.10.50
*/
get rangeEnd(): string | undefined {
return this._range_end;
}
readonly _range_start: string | undefined;
/**
* Description: undefined
* Example: 192.168.1.2
*/
get rangeStart(): string | undefined {
return this._range_start;
}
readonly _subnet_mask: string | undefined;
/**
* Description: undefined
* Example: 255.255.255.0
*/
get subnetMask(): string | undefined {
return this._subnet_mask;
}
constructor(props: IDhcpConfigV4) {
if (typeof props.gateway_ip === 'string') {
this._gateway_ip = props.gateway_ip.trim();
}
if (typeof props.lease_duration === 'number') {
this._lease_duration = props.lease_duration;
}
if (typeof props.range_end === 'string') {
this._range_end = props.range_end.trim();
}
if (typeof props.range_start === 'string') {
this._range_start = props.range_start.trim();
}
if (typeof props.subnet_mask === 'string') {
this._subnet_mask = props.subnet_mask.trim();
}
}
serialize(): IDhcpConfigV4 {
const data: IDhcpConfigV4 = {
};
if (typeof this._gateway_ip !== 'undefined') {
data.gateway_ip = this._gateway_ip;
}
if (typeof this._lease_duration !== 'undefined') {
data.lease_duration = this._lease_duration;
}
if (typeof this._range_end !== 'undefined') {
data.range_end = this._range_end;
}
if (typeof this._range_start !== 'undefined') {
data.range_start = this._range_start;
}
if (typeof this._subnet_mask !== 'undefined') {
data.subnet_mask = this._subnet_mask;
}
return data;
}
validate(): string[] {
const validate = {
gateway_ip: !this._gateway_ip ? true : typeof this._gateway_ip === 'string' && !this._gateway_ip ? true : this._gateway_ip,
subnet_mask: !this._subnet_mask ? true : typeof this._subnet_mask === 'string' && !this._subnet_mask ? true : this._subnet_mask,
range_start: !this._range_start ? true : typeof this._range_start === 'string' && !this._range_start ? true : this._range_start,
range_end: !this._range_end ? true : typeof this._range_end === 'string' && !this._range_end ? true : this._range_end,
lease_duration: !this._lease_duration ? true : typeof this._lease_duration === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpConfigV4>): DhcpConfigV4 {
return new DhcpConfigV4({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,59 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpConfigV6 {
lease_duration?: number;
range_start?: string;
}
export default class DhcpConfigV6 {
readonly _lease_duration: number | undefined;
get leaseDuration(): number | undefined {
return this._lease_duration;
}
readonly _range_start: string | undefined;
get rangeStart(): string | undefined {
return this._range_start;
}
constructor(props: IDhcpConfigV6) {
if (typeof props.lease_duration === 'number') {
this._lease_duration = props.lease_duration;
}
if (typeof props.range_start === 'string') {
this._range_start = props.range_start.trim();
}
}
serialize(): IDhcpConfigV6 {
const data: IDhcpConfigV6 = {
};
if (typeof this._lease_duration !== 'undefined') {
data.lease_duration = this._lease_duration;
}
if (typeof this._range_start !== 'undefined') {
data.range_start = this._range_start;
}
return data;
}
validate(): string[] {
const validate = {
range_start: !this._range_start ? true : typeof this._range_start === 'string' && !this._range_start ? true : this._range_start,
lease_duration: !this._lease_duration ? true : typeof this._lease_duration === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpConfigV6>): DhcpConfigV6 {
return new DhcpConfigV6({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,103 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpLease {
expires: string;
hostname: string;
ip: string;
mac: string;
}
export default class DhcpLease {
readonly _expires: string;
/**
* Description: undefined
* Example: 2017-07-21T17:32:28Z
*/
get expires(): string {
return this._expires;
}
static expiresValidate(expires: string): boolean {
return typeof expires === 'string' && !!expires.trim();
}
readonly _hostname: string;
/**
* Description: undefined
* Example: dell
*/
get hostname(): string {
return this._hostname;
}
static hostnameValidate(hostname: string): boolean {
return typeof hostname === 'string' && !!hostname.trim();
}
readonly _ip: string;
/**
* Description: undefined
* Example: 192.168.1.22
*/
get ip(): string {
return this._ip;
}
static ipValidate(ip: string): boolean {
return typeof ip === 'string' && !!ip.trim();
}
readonly _mac: string;
/**
* Description: undefined
* Example: 00:11:09:b3:b3:b8
*/
get mac(): string {
return this._mac;
}
static macValidate(mac: string): boolean {
return typeof mac === 'string' && !!mac.trim();
}
constructor(props: IDhcpLease) {
this._expires = props.expires.trim();
this._hostname = props.hostname.trim();
this._ip = props.ip.trim();
this._mac = props.mac.trim();
}
serialize(): IDhcpLease {
const data: IDhcpLease = {
expires: this._expires,
hostname: this._hostname,
ip: this._ip,
mac: this._mac,
};
return data;
}
validate(): string[] {
const validate = {
mac: typeof this._mac === 'string' && !this._mac ? true : this._mac,
ip: typeof this._ip === 'string' && !this._ip ? true : this._ip,
hostname: typeof this._hostname === 'string' && !this._hostname ? true : this._hostname,
expires: typeof this._expires === 'string' && !this._expires ? true : this._expires,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpLease>): DhcpLease {
return new DhcpLease({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,62 @@
import DhcpSearchV4, { IDhcpSearchV4 } from './DhcpSearchV4';
import DhcpSearchV6, { IDhcpSearchV6 } from './DhcpSearchV6';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpSearchResult {
v4?: IDhcpSearchV4;
v6?: IDhcpSearchV6;
}
export default class DhcpSearchResult {
readonly _v4: DhcpSearchV4 | undefined;
get v4(): DhcpSearchV4 | undefined {
return this._v4;
}
readonly _v6: DhcpSearchV6 | undefined;
get v6(): DhcpSearchV6 | undefined {
return this._v6;
}
constructor(props: IDhcpSearchResult) {
if (props.v4) {
this._v4 = new DhcpSearchV4(props.v4);
}
if (props.v6) {
this._v6 = new DhcpSearchV6(props.v6);
}
}
serialize(): IDhcpSearchResult {
const data: IDhcpSearchResult = {
};
if (typeof this._v4 !== 'undefined') {
data.v4 = this._v4.serialize();
}
if (typeof this._v6 !== 'undefined') {
data.v6 = this._v6.serialize();
}
return data;
}
validate(): string[] {
const validate = {
v4: !this._v4 ? true : this._v4.validate().length === 0,
v6: !this._v6 ? true : this._v6.validate().length === 0,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpSearchResult>): DhcpSearchResult {
return new DhcpSearchResult({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,64 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpSearchResultOtherServer {
error?: string;
found?: string;
}
export default class DhcpSearchResultOtherServer {
readonly _error: string | undefined;
/** */
get error(): string | undefined {
return this._error;
}
readonly _found: string | undefined;
/**
* Description: yes|no|error
* Example: no
*/
get found(): string | undefined {
return this._found;
}
constructor(props: IDhcpSearchResultOtherServer) {
if (typeof props.error === 'string') {
this._error = props.error.trim();
}
if (typeof props.found === 'string') {
this._found = props.found.trim();
}
}
serialize(): IDhcpSearchResultOtherServer {
const data: IDhcpSearchResultOtherServer = {
};
if (typeof this._error !== 'undefined') {
data.error = this._error;
}
if (typeof this._found !== 'undefined') {
data.found = this._found;
}
return data;
}
validate(): string[] {
const validate = {
found: !this._found ? true : typeof this._found === 'string' && !this._found ? true : this._found,
error: !this._error ? true : typeof this._error === 'string' && !this._error ? true : this._error,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpSearchResultOtherServer>): DhcpSearchResultOtherServer {
return new DhcpSearchResultOtherServer({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,64 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpSearchResultStaticIP {
ip?: string;
static?: string;
}
export default class DhcpSearchResultStaticIP {
readonly _ip: string | undefined;
/** */
get ip(): string | undefined {
return this._ip;
}
readonly _static: string | undefined;
/**
* Description: yes|no|error
* Example: yes
*/
get static(): string | undefined {
return this._static;
}
constructor(props: IDhcpSearchResultStaticIP) {
if (typeof props.ip === 'string') {
this._ip = props.ip.trim();
}
if (typeof props.static === 'string') {
this._static = props.static.trim();
}
}
serialize(): IDhcpSearchResultStaticIP {
const data: IDhcpSearchResultStaticIP = {
};
if (typeof this._ip !== 'undefined') {
data.ip = this._ip;
}
if (typeof this._static !== 'undefined') {
data.static = this._static;
}
return data;
}
validate(): string[] {
const validate = {
static: !this._static ? true : typeof this._static === 'string' && !this._static ? true : this._static,
ip: !this._ip ? true : typeof this._ip === 'string' && !this._ip ? true : this._ip,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpSearchResultStaticIP>): DhcpSearchResultStaticIP {
return new DhcpSearchResultStaticIP({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,62 @@
import DhcpSearchResultOtherServer, { IDhcpSearchResultOtherServer } from './DhcpSearchResultOtherServer';
import DhcpSearchResultStaticIP, { IDhcpSearchResultStaticIP } from './DhcpSearchResultStaticIP';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpSearchV4 {
other_server?: IDhcpSearchResultOtherServer;
static_ip?: IDhcpSearchResultStaticIP;
}
export default class DhcpSearchV4 {
readonly _other_server: DhcpSearchResultOtherServer | undefined;
get otherServer(): DhcpSearchResultOtherServer | undefined {
return this._other_server;
}
readonly _static_ip: DhcpSearchResultStaticIP | undefined;
get staticIp(): DhcpSearchResultStaticIP | undefined {
return this._static_ip;
}
constructor(props: IDhcpSearchV4) {
if (props.other_server) {
this._other_server = new DhcpSearchResultOtherServer(props.other_server);
}
if (props.static_ip) {
this._static_ip = new DhcpSearchResultStaticIP(props.static_ip);
}
}
serialize(): IDhcpSearchV4 {
const data: IDhcpSearchV4 = {
};
if (typeof this._other_server !== 'undefined') {
data.other_server = this._other_server.serialize();
}
if (typeof this._static_ip !== 'undefined') {
data.static_ip = this._static_ip.serialize();
}
return data;
}
validate(): string[] {
const validate = {
other_server: !this._other_server ? true : this._other_server.validate().length === 0,
static_ip: !this._static_ip ? true : this._static_ip.validate().length === 0,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpSearchV4>): DhcpSearchV4 {
return new DhcpSearchV4({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,47 @@
import DhcpSearchResultOtherServer, { IDhcpSearchResultOtherServer } from './DhcpSearchResultOtherServer';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpSearchV6 {
other_server?: IDhcpSearchResultOtherServer;
}
export default class DhcpSearchV6 {
readonly _other_server: DhcpSearchResultOtherServer | undefined;
get otherServer(): DhcpSearchResultOtherServer | undefined {
return this._other_server;
}
constructor(props: IDhcpSearchV6) {
if (props.other_server) {
this._other_server = new DhcpSearchResultOtherServer(props.other_server);
}
}
serialize(): IDhcpSearchV6 {
const data: IDhcpSearchV6 = {
};
if (typeof this._other_server !== 'undefined') {
data.other_server = this._other_server.serialize();
}
return data;
}
validate(): string[] {
const validate = {
other_server: !this._other_server ? true : this._other_server.validate().length === 0,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpSearchV6>): DhcpSearchV6 {
return new DhcpSearchV6({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,85 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpStaticLease {
hostname: string;
ip: string;
mac: string;
}
export default class DhcpStaticLease {
readonly _hostname: string;
/**
* Description: undefined
* Example: dell
*/
get hostname(): string {
return this._hostname;
}
static hostnameValidate(hostname: string): boolean {
return typeof hostname === 'string' && !!hostname.trim();
}
readonly _ip: string;
/**
* Description: undefined
* Example: 192.168.1.22
*/
get ip(): string {
return this._ip;
}
static ipValidate(ip: string): boolean {
return typeof ip === 'string' && !!ip.trim();
}
readonly _mac: string;
/**
* Description: undefined
* Example: 00:11:09:b3:b3:b8
*/
get mac(): string {
return this._mac;
}
static macValidate(mac: string): boolean {
return typeof mac === 'string' && !!mac.trim();
}
constructor(props: IDhcpStaticLease) {
this._hostname = props.hostname.trim();
this._ip = props.ip.trim();
this._mac = props.mac.trim();
}
serialize(): IDhcpStaticLease {
const data: IDhcpStaticLease = {
hostname: this._hostname,
ip: this._ip,
mac: this._mac,
};
return data;
}
validate(): string[] {
const validate = {
mac: typeof this._mac === 'string' && !this._mac ? true : this._mac,
ip: typeof this._ip === 'string' && !this._ip ? true : this._ip,
hostname: typeof this._hostname === 'string' && !this._hostname ? true : this._hostname,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpStaticLease>): DhcpStaticLease {
return new DhcpStaticLease({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,116 @@
import DhcpConfigV4, { IDhcpConfigV4 } from './DhcpConfigV4';
import DhcpConfigV6, { IDhcpConfigV6 } from './DhcpConfigV6';
import DhcpLease, { IDhcpLease } from './DhcpLease';
import DhcpStaticLease, { IDhcpStaticLease } from './DhcpStaticLease';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpStatus {
enabled?: boolean;
interface_name?: string;
leases: IDhcpLease[];
static_leases?: IDhcpStaticLease[];
v4?: IDhcpConfigV4;
v6?: IDhcpConfigV6;
}
export default class DhcpStatus {
readonly _enabled: boolean | undefined;
get enabled(): boolean | undefined {
return this._enabled;
}
readonly _interface_name: string | undefined;
get interfaceName(): string | undefined {
return this._interface_name;
}
readonly _leases: DhcpLease[];
get leases(): DhcpLease[] {
return this._leases;
}
readonly _static_leases: DhcpStaticLease[] | undefined;
get staticLeases(): DhcpStaticLease[] | undefined {
return this._static_leases;
}
readonly _v4: DhcpConfigV4 | undefined;
get v4(): DhcpConfigV4 | undefined {
return this._v4;
}
readonly _v6: DhcpConfigV6 | undefined;
get v6(): DhcpConfigV6 | undefined {
return this._v6;
}
constructor(props: IDhcpStatus) {
if (typeof props.enabled === 'boolean') {
this._enabled = props.enabled;
}
if (typeof props.interface_name === 'string') {
this._interface_name = props.interface_name.trim();
}
this._leases = props.leases.map((p) => new DhcpLease(p));
if (props.static_leases) {
this._static_leases = props.static_leases.map((p) => new DhcpStaticLease(p));
}
if (props.v4) {
this._v4 = new DhcpConfigV4(props.v4);
}
if (props.v6) {
this._v6 = new DhcpConfigV6(props.v6);
}
}
serialize(): IDhcpStatus {
const data: IDhcpStatus = {
leases: this._leases.map((p) => p.serialize()),
};
if (typeof this._enabled !== 'undefined') {
data.enabled = this._enabled;
}
if (typeof this._interface_name !== 'undefined') {
data.interface_name = this._interface_name;
}
if (typeof this._static_leases !== 'undefined') {
data.static_leases = this._static_leases.map((p) => p.serialize());
}
if (typeof this._v4 !== 'undefined') {
data.v4 = this._v4.serialize();
}
if (typeof this._v6 !== 'undefined') {
data.v6 = this._v6.serialize();
}
return data;
}
validate(): string[] {
const validate = {
enabled: !this._enabled ? true : typeof this._enabled === 'boolean',
interface_name: !this._interface_name ? true : typeof this._interface_name === 'string' && !this._interface_name ? true : this._interface_name,
v4: !this._v4 ? true : this._v4.validate().length === 0,
v6: !this._v6 ? true : this._v6.validate().length === 0,
leases: this._leases.reduce((result, p) => result && p.validate().length === 0, true),
static_leases: !this._static_leases ? true : this._static_leases.reduce((result, p) => result && p.validate().length === 0, true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDhcpStatus>): DhcpStatus {
return new DhcpStatus({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,85 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDnsAnswer {
ttl?: number;
type?: string;
value?: string;
}
export default class DnsAnswer {
readonly _ttl: number | undefined;
/**
* Description: undefined
* Example: 55
*/
get ttl(): number | undefined {
return this._ttl;
}
readonly _type: string | undefined;
/**
* Description: undefined
* Example: A
*/
get type(): string | undefined {
return this._type;
}
readonly _value: string | undefined;
/**
* Description: undefined
* Example: 217.69.139.201
*/
get value(): string | undefined {
return this._value;
}
constructor(props: IDnsAnswer) {
if (typeof props.ttl === 'number') {
this._ttl = props.ttl;
}
if (typeof props.type === 'string') {
this._type = props.type.trim();
}
if (typeof props.value === 'string') {
this._value = props.value.trim();
}
}
serialize(): IDnsAnswer {
const data: IDnsAnswer = {
};
if (typeof this._ttl !== 'undefined') {
data.ttl = this._ttl;
}
if (typeof this._type !== 'undefined') {
data.type = this._type;
}
if (typeof this._value !== 'undefined') {
data.value = this._value;
}
return data;
}
validate(): string[] {
const validate = {
ttl: !this._ttl ? true : typeof this._ttl === 'number',
type: !this._type ? true : typeof this._type === 'string' && !this._type ? true : this._type,
value: !this._value ? true : typeof this._value === 'string' && !this._value ? true : this._value,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDnsAnswer>): DnsAnswer {
return new DnsAnswer({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,85 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDnsQuestion {
class?: string;
host?: string;
type?: string;
}
export default class DnsQuestion {
readonly _class: string | undefined;
/**
* Description: undefined
* Example: IN
*/
get class(): string | undefined {
return this._class;
}
readonly _host: string | undefined;
/**
* Description: undefined
* Example: example.org
*/
get host(): string | undefined {
return this._host;
}
readonly _type: string | undefined;
/**
* Description: undefined
* Example: A
*/
get type(): string | undefined {
return this._type;
}
constructor(props: IDnsQuestion) {
if (typeof props.class === 'string') {
this._class = props.class.trim();
}
if (typeof props.host === 'string') {
this._host = props.host.trim();
}
if (typeof props.type === 'string') {
this._type = props.type.trim();
}
}
serialize(): IDnsQuestion {
const data: IDnsQuestion = {
};
if (typeof this._class !== 'undefined') {
data.class = this._class;
}
if (typeof this._host !== 'undefined') {
data.host = this._host;
}
if (typeof this._type !== 'undefined') {
data.type = this._type;
}
return data;
}
validate(): string[] {
const validate = {
class: !this._class ? true : typeof this._class === 'string' && !this._class ? true : this._class,
host: !this._host ? true : typeof this._host === 'string' && !this._host ? true : this._host,
type: !this._type ? true : typeof this._type === 'string' && !this._type ? true : this._type,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IDnsQuestion>): DnsQuestion {
return new DnsQuestion({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,46 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IError {
message?: string;
}
export default class Error {
readonly _message: string | undefined;
/** */
get message(): string | undefined {
return this._message;
}
constructor(props: IError) {
if (typeof props.message === 'string') {
this._message = props.message.trim();
}
}
serialize(): IError {
const data: IError = {
};
if (typeof this._message !== 'undefined') {
data.message = this._message;
}
return data;
}
validate(): string[] {
const validate = {
message: !this._message ? true : typeof this._message === 'string' && !this._message ? true : this._message,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IError>): Error {
return new Error({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,136 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IFilter {
enabled: boolean;
id: number;
lastUpdated: string;
name: string;
rulesCount: number;
url: string;
}
export default class Filter {
readonly _enabled: boolean;
get enabled(): boolean {
return this._enabled;
}
static enabledValidate(enabled: boolean): boolean {
return typeof enabled === 'boolean';
}
readonly _id: number;
/**
* Description: undefined
* Example: 1234
*/
get id(): number {
return this._id;
}
static idValidate(id: number): boolean {
return typeof id === 'number';
}
readonly _lastUpdated: string;
/**
* Description: undefined
* Example: 2018-10-30T12:18:57+03:00
*/
get lastUpdated(): string {
return this._lastUpdated;
}
static lastUpdatedValidate(lastUpdated: string): boolean {
return typeof lastUpdated === 'string' && !!lastUpdated.trim();
}
readonly _name: string;
/**
* Description: undefined
* Example: AdGuard Simplified Domain Names filter
*/
get name(): string {
return this._name;
}
static nameValidate(name: string): boolean {
return typeof name === 'string' && !!name.trim();
}
readonly _rulesCount: number;
/**
* Description: undefined
* Example: 5912
*/
get rulesCount(): number {
return this._rulesCount;
}
static rulesCountValidate(rulesCount: number): boolean {
return typeof rulesCount === 'number';
}
readonly _url: string;
/**
* Description: undefined
* Example: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
*
*/
get url(): string {
return this._url;
}
static urlValidate(url: string): boolean {
return typeof url === 'string' && !!url.trim();
}
constructor(props: IFilter) {
this._enabled = props.enabled;
this._id = props.id;
this._lastUpdated = props.lastUpdated.trim();
this._name = props.name.trim();
this._rulesCount = props.rulesCount;
this._url = props.url.trim();
}
serialize(): IFilter {
const data: IFilter = {
enabled: this._enabled,
id: this._id,
lastUpdated: this._lastUpdated,
name: this._name,
rulesCount: this._rulesCount,
url: this._url,
};
return data;
}
validate(): string[] {
const validate = {
enabled: typeof this._enabled === 'boolean',
id: typeof this._id === 'number',
lastUpdated: typeof this._lastUpdated === 'string' && !this._lastUpdated ? true : this._lastUpdated,
name: typeof this._name === 'string' && !this._name ? true : this._name,
rulesCount: typeof this._rulesCount === 'number',
url: typeof this._url === 'string' && !this._url ? true : this._url,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IFilter>): Filter {
return new Filter({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,143 @@
import ResultRule, { IResultRule } from './ResultRule';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IFilterCheckHostResponse {
cname?: string;
filter_id?: number;
ip_addrs?: string[];
reason?: string;
rule?: string;
rules?: IResultRule[];
service_name?: string;
}
export default class FilterCheckHostResponse {
readonly _cname: string | undefined;
/** */
get cname(): string | undefined {
return this._cname;
}
readonly _filter_id: number | undefined;
/** */
get filterId(): number | undefined {
return this._filter_id;
}
readonly _ip_addrs: string[] | undefined;
/** */
get ipAddrs(): string[] | undefined {
return this._ip_addrs;
}
readonly _reason: string | undefined;
/** */
get reason(): string | undefined {
return this._reason;
}
readonly _rule: string | undefined;
/**
* Description: Filtering rule applied to the request (if any).
* Deprecated: use `rules[*].text` instead.
*
* Example: ||example.org^
*/
get rule(): string | undefined {
return this._rule;
}
readonly _rules: ResultRule[] | undefined;
/** */
get rules(): ResultRule[] | undefined {
return this._rules;
}
readonly _service_name: string | undefined;
/** */
get serviceName(): string | undefined {
return this._service_name;
}
constructor(props: IFilterCheckHostResponse) {
if (typeof props.cname === 'string') {
this._cname = props.cname.trim();
}
if (typeof props.filter_id === 'number') {
this._filter_id = props.filter_id;
}
if (props.ip_addrs) {
this._ip_addrs = props.ip_addrs;
}
if (typeof props.reason === 'string') {
this._reason = props.reason.trim();
}
if (typeof props.rule === 'string') {
this._rule = props.rule.trim();
}
if (props.rules) {
this._rules = props.rules.map((p) => new ResultRule(p));
}
if (typeof props.service_name === 'string') {
this._service_name = props.service_name.trim();
}
}
serialize(): IFilterCheckHostResponse {
const data: IFilterCheckHostResponse = {
};
if (typeof this._cname !== 'undefined') {
data.cname = this._cname;
}
if (typeof this._filter_id !== 'undefined') {
data.filter_id = this._filter_id;
}
if (typeof this._ip_addrs !== 'undefined') {
data.ip_addrs = this._ip_addrs;
}
if (typeof this._reason !== 'undefined') {
data.reason = this._reason;
}
if (typeof this._rule !== 'undefined') {
data.rule = this._rule;
}
if (typeof this._rules !== 'undefined') {
data.rules = this._rules.map((p) => p.serialize());
}
if (typeof this._service_name !== 'undefined') {
data.service_name = this._service_name;
}
return data;
}
validate(): string[] {
const validate = {
reason: !this._reason ? true : typeof this._reason === 'string' && !this._reason ? true : this._reason,
filter_id: !this._filter_id ? true : typeof this._filter_id === 'number',
rule: !this._rule ? true : typeof this._rule === 'string' && !this._rule ? true : this._rule,
rules: !this._rules ? true : this._rules.reduce((result, p) => result && p.validate().length === 0, true),
service_name: !this._service_name ? true : typeof this._service_name === 'string' && !this._service_name ? true : this._service_name,
cname: !this._cname ? true : typeof this._cname === 'string' && !this._cname ? true : this._cname,
ip_addrs: !this._ip_addrs ? true : this._ip_addrs.reduce((result, p) => result && typeof p === 'string', true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IFilterCheckHostResponse>): FilterCheckHostResponse {
return new FilterCheckHostResponse({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,59 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IFilterConfig {
enabled?: boolean;
interval?: number;
}
export default class FilterConfig {
readonly _enabled: boolean | undefined;
get enabled(): boolean | undefined {
return this._enabled;
}
readonly _interval: number | undefined;
get interval(): number | undefined {
return this._interval;
}
constructor(props: IFilterConfig) {
if (typeof props.enabled === 'boolean') {
this._enabled = props.enabled;
}
if (typeof props.interval === 'number') {
this._interval = props.interval;
}
}
serialize(): IFilterConfig {
const data: IFilterConfig = {
};
if (typeof this._enabled !== 'undefined') {
data.enabled = this._enabled;
}
if (typeof this._interval !== 'undefined') {
data.interval = this._interval;
}
return data;
}
validate(): string[] {
const validate = {
enabled: !this._enabled ? true : typeof this._enabled === 'boolean',
interval: !this._interval ? true : typeof this._interval === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IFilterConfig>): FilterConfig {
return new FilterConfig({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,45 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IFilterRefreshRequest {
whitelist?: boolean;
}
export default class FilterRefreshRequest {
readonly _whitelist: boolean | undefined;
get whitelist(): boolean | undefined {
return this._whitelist;
}
constructor(props: IFilterRefreshRequest) {
if (typeof props.whitelist === 'boolean') {
this._whitelist = props.whitelist;
}
}
serialize(): IFilterRefreshRequest {
const data: IFilterRefreshRequest = {
};
if (typeof this._whitelist !== 'undefined') {
data.whitelist = this._whitelist;
}
return data;
}
validate(): string[] {
const validate = {
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<IFilterRefreshRequest>): FilterRefreshRequest {
return new FilterRefreshRequest({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,45 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IFilterRefreshResponse {
updated?: number;
}
export default class FilterRefreshResponse {
readonly _updated: number | undefined;
get updated(): number | undefined {
return this._updated;
}
constructor(props: IFilterRefreshResponse) {
if (typeof props.updated === 'number') {
this._updated = props.updated;
}
}
serialize(): IFilterRefreshResponse {
const data: IFilterRefreshResponse = {
};
if (typeof this._updated !== 'undefined') {
data.updated = this._updated;
}
return data;
}
validate(): string[] {
const validate = {
updated: !this._updated ? true : typeof this._updated === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IFilterRefreshResponse>): FilterRefreshResponse {
return new FilterRefreshResponse({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,72 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IFilterSetUrl {
data?: any;
url?: string;
whitelist?: boolean;
}
export default class FilterSetUrl {
readonly _data: any | undefined;
get data(): any | undefined {
return this._data;
}
readonly _url: string | undefined;
get url(): string | undefined {
return this._url;
}
readonly _whitelist: boolean | undefined;
get whitelist(): boolean | undefined {
return this._whitelist;
}
constructor(props: IFilterSetUrl) {
if (props.data) {
this._data = props.data;
}
if (typeof props.url === 'string') {
this._url = props.url.trim();
}
if (typeof props.whitelist === 'boolean') {
this._whitelist = props.whitelist;
}
}
serialize(): IFilterSetUrl {
const data: IFilterSetUrl = {
};
if (typeof this._data !== 'undefined') {
data.data = this._data;
}
if (typeof this._url !== 'undefined') {
data.url = this._url;
}
if (typeof this._whitelist !== 'undefined') {
data.whitelist = this._whitelist;
}
return data;
}
validate(): string[] {
const validate = {
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<IFilterSetUrl>): FilterSetUrl {
return new FilterSetUrl({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,89 @@
import Filter, { IFilter } from './Filter';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IFilterStatus {
enabled?: boolean;
filters?: IFilter[];
interval?: number;
user_rules?: string[];
}
export default class FilterStatus {
readonly _enabled: boolean | undefined;
get enabled(): boolean | undefined {
return this._enabled;
}
readonly _filters: Filter[] | undefined;
get filters(): Filter[] | undefined {
return this._filters;
}
readonly _interval: number | undefined;
get interval(): number | undefined {
return this._interval;
}
readonly _user_rules: string[] | undefined;
get userRules(): string[] | undefined {
return this._user_rules;
}
constructor(props: IFilterStatus) {
if (typeof props.enabled === 'boolean') {
this._enabled = props.enabled;
}
if (props.filters) {
this._filters = props.filters.map((p) => new Filter(p));
}
if (typeof props.interval === 'number') {
this._interval = props.interval;
}
if (props.user_rules) {
this._user_rules = props.user_rules;
}
}
serialize(): IFilterStatus {
const data: IFilterStatus = {
};
if (typeof this._enabled !== 'undefined') {
data.enabled = this._enabled;
}
if (typeof this._filters !== 'undefined') {
data.filters = this._filters.map((p) => p.serialize());
}
if (typeof this._interval !== 'undefined') {
data.interval = this._interval;
}
if (typeof this._user_rules !== 'undefined') {
data.user_rules = this._user_rules;
}
return data;
}
validate(): string[] {
const validate = {
enabled: !this._enabled ? true : typeof this._enabled === 'boolean',
interval: !this._interval ? true : typeof this._interval === 'number',
filters: !this._filters ? true : this._filters.reduce((result, p) => result && p.validate().length === 0, true),
user_rules: !this._user_rules ? true : this._user_rules.reduce((result, p) => result && typeof p === 'string', true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IFilterStatus>): FilterStatus {
return new FilterStatus({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,46 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IGetVersionRequest {
recheck_now?: boolean;
}
export default class GetVersionRequest {
readonly _recheck_now: boolean | undefined;
/** */
get recheckNow(): boolean | undefined {
return this._recheck_now;
}
constructor(props: IGetVersionRequest) {
if (typeof props.recheck_now === 'boolean') {
this._recheck_now = props.recheck_now;
}
}
serialize(): IGetVersionRequest {
const data: IGetVersionRequest = {
};
if (typeof this._recheck_now !== 'undefined') {
data.recheck_now = this._recheck_now;
}
return data;
}
validate(): string[] {
const validate = {
recheck_now: !this._recheck_now ? true : typeof this._recheck_now === 'boolean',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IGetVersionRequest>): GetVersionRequest {
return new GetVersionRequest({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,89 @@
import AddressInfo, { IAddressInfo } from './AddressInfo';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IInitialConfiguration {
dns: IAddressInfo;
password: string;
username: string;
web: IAddressInfo;
}
export default class InitialConfiguration {
readonly _dns: AddressInfo;
get dns(): AddressInfo {
return this._dns;
}
readonly _password: string;
/**
* Description: Basic auth password
* Example: password
*/
get password(): string {
return this._password;
}
static passwordValidate(password: string): boolean {
return typeof password === 'string' && !!password.trim();
}
readonly _username: string;
/**
* Description: Basic auth username
* Example: admin
*/
get username(): string {
return this._username;
}
static usernameValidate(username: string): boolean {
return typeof username === 'string' && !!username.trim();
}
readonly _web: AddressInfo;
get web(): AddressInfo {
return this._web;
}
constructor(props: IInitialConfiguration) {
this._dns = new AddressInfo(props.dns);
this._password = props.password.trim();
this._username = props.username.trim();
this._web = new AddressInfo(props.web);
}
serialize(): IInitialConfiguration {
const data: IInitialConfiguration = {
dns: this._dns.serialize(),
password: this._password,
username: this._username,
web: this._web.serialize(),
};
return data;
}
validate(): string[] {
const validate = {
dns: this._dns.validate().length === 0,
web: this._web.validate().length === 0,
username: typeof this._username === 'string' && !this._username ? true : this._username,
password: typeof this._password === 'string' && !this._password ? true : this._password,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IInitialConfiguration>): InitialConfiguration {
return new InitialConfiguration({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,89 @@
import AddressInfoBeta, { IAddressInfoBeta } from './AddressInfoBeta';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IInitialConfigurationBeta {
dns: IAddressInfoBeta;
password: string;
username: string;
web: IAddressInfoBeta;
}
export default class InitialConfigurationBeta {
readonly _dns: AddressInfoBeta;
get dns(): AddressInfoBeta {
return this._dns;
}
readonly _password: string;
/**
* Description: Basic auth password
* Example: password
*/
get password(): string {
return this._password;
}
static passwordValidate(password: string): boolean {
return typeof password === 'string' && !!password.trim();
}
readonly _username: string;
/**
* Description: Basic auth username
* Example: admin
*/
get username(): string {
return this._username;
}
static usernameValidate(username: string): boolean {
return typeof username === 'string' && !!username.trim();
}
readonly _web: AddressInfoBeta;
get web(): AddressInfoBeta {
return this._web;
}
constructor(props: IInitialConfigurationBeta) {
this._dns = new AddressInfoBeta(props.dns);
this._password = props.password.trim();
this._username = props.username.trim();
this._web = new AddressInfoBeta(props.web);
}
serialize(): IInitialConfigurationBeta {
const data: IInitialConfigurationBeta = {
dns: this._dns.serialize(),
password: this._password,
username: this._username,
web: this._web.serialize(),
};
return data;
}
validate(): string[] {
const validate = {
dns: this._dns.validate().length === 0,
web: this._web.validate().length === 0,
username: typeof this._username === 'string' && !this._username ? true : this._username,
password: typeof this._password === 'string' && !this._password ? true : this._password,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IInitialConfigurationBeta>): InitialConfigurationBeta {
return new InitialConfigurationBeta({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,61 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ILogin {
password?: string;
username?: string;
}
export default class Login {
readonly _password: string | undefined;
/** */
get password(): string | undefined {
return this._password;
}
readonly _username: string | undefined;
/** */
get username(): string | undefined {
return this._username;
}
constructor(props: ILogin) {
if (typeof props.password === 'string') {
this._password = props.password.trim();
}
if (typeof props.username === 'string') {
this._username = props.username.trim();
}
}
serialize(): ILogin {
const data: ILogin = {
};
if (typeof this._password !== 'undefined') {
data.password = this._password;
}
if (typeof this._username !== 'undefined') {
data.username = this._username;
}
return data;
}
validate(): string[] {
const validate = {
username: !this._username ? true : typeof this._username === 'string' && !this._username ? true : this._username,
password: !this._password ? true : typeof this._password === 'string' && !this._password ? true : this._password,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ILogin>): Login {
return new Login({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,113 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface INetInterface {
flags: string;
hardware_address: string;
ip_addresses?: string[];
mtu: number;
name: string;
}
export default class NetInterface {
readonly _flags: string;
/**
* Description: undefined
* Example: up|broadcast|multicast
*/
get flags(): string {
return this._flags;
}
static flagsValidate(flags: string): boolean {
return typeof flags === 'string' && !!flags.trim();
}
readonly _hardware_address: string;
/**
* Description: undefined
* Example: 52:54:00:11:09:ba
*/
get hardwareAddress(): string {
return this._hardware_address;
}
static hardwareAddressValidate(hardwareAddress: string): boolean {
return typeof hardwareAddress === 'string' && !!hardwareAddress.trim();
}
readonly _ip_addresses: string[] | undefined;
get ipAddresses(): string[] | undefined {
return this._ip_addresses;
}
readonly _mtu: number;
get mtu(): number {
return this._mtu;
}
static mtuValidate(mtu: number): boolean {
return typeof mtu === 'number';
}
readonly _name: string;
/**
* Description: undefined
* Example: eth0
*/
get name(): string {
return this._name;
}
static nameValidate(name: string): boolean {
return typeof name === 'string' && !!name.trim();
}
constructor(props: INetInterface) {
this._flags = props.flags.trim();
this._hardware_address = props.hardware_address.trim();
if (props.ip_addresses) {
this._ip_addresses = props.ip_addresses;
}
this._mtu = props.mtu;
this._name = props.name.trim();
}
serialize(): INetInterface {
const data: INetInterface = {
flags: this._flags,
hardware_address: this._hardware_address,
mtu: this._mtu,
name: this._name,
};
if (typeof this._ip_addresses !== 'undefined') {
data.ip_addresses = this._ip_addresses;
}
return data;
}
validate(): string[] {
const validate = {
flags: typeof this._flags === 'string' && !this._flags ? true : this._flags,
hardware_address: typeof this._hardware_address === 'string' && !this._hardware_address ? true : this._hardware_address,
name: typeof this._name === 'string' && !this._name ? true : this._name,
ip_addresses: !this._ip_addresses ? true : this._ip_addresses.reduce((result, p) => result && typeof p === 'string', true),
mtu: typeof this._mtu === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<INetInterface>): NetInterface {
return new NetInterface({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,45 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IProfileInfo {
name?: string;
}
export default class ProfileInfo {
readonly _name: string | undefined;
get name(): string | undefined {
return this._name;
}
constructor(props: IProfileInfo) {
if (typeof props.name === 'string') {
this._name = props.name.trim();
}
}
serialize(): IProfileInfo {
const data: IProfileInfo = {
};
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,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IProfileInfo>): ProfileInfo {
return new ProfileInfo({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,65 @@
import QueryLogItem, { IQueryLogItem } from './QueryLogItem';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IQueryLog {
data?: IQueryLogItem[];
oldest?: string;
}
export default class QueryLog {
readonly _data: QueryLogItem[] | undefined;
get data(): QueryLogItem[] | undefined {
return this._data;
}
readonly _oldest: string | undefined;
/**
* Description: undefined
* Example: 2018-11-26T00:02:41+03:00
*/
get oldest(): string | undefined {
return this._oldest;
}
constructor(props: IQueryLog) {
if (props.data) {
this._data = props.data.map((p) => new QueryLogItem(p));
}
if (typeof props.oldest === 'string') {
this._oldest = props.oldest.trim();
}
}
serialize(): IQueryLog {
const data: IQueryLog = {
};
if (typeof this._data !== 'undefined') {
data.data = this._data.map((p) => p.serialize());
}
if (typeof this._oldest !== 'undefined') {
data.oldest = this._oldest;
}
return data;
}
validate(): string[] {
const validate = {
oldest: !this._oldest ? true : typeof this._oldest === 'string' && !this._oldest ? true : this._oldest,
data: !this._data ? true : this._data.reduce((result, p) => result && p.validate().length === 0, true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IQueryLog>): QueryLog {
return new QueryLog({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,76 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IQueryLogConfig {
anonymize_client_ip?: boolean;
enabled?: boolean;
interval?: number;
}
export default class QueryLogConfig {
readonly _anonymize_client_ip: boolean | undefined;
/** */
get anonymizeClientIp(): boolean | undefined {
return this._anonymize_client_ip;
}
readonly _enabled: boolean | undefined;
/** */
get enabled(): boolean | undefined {
return this._enabled;
}
readonly _interval: number | undefined;
/** */
get interval(): number | undefined {
return this._interval;
}
constructor(props: IQueryLogConfig) {
if (typeof props.anonymize_client_ip === 'boolean') {
this._anonymize_client_ip = props.anonymize_client_ip;
}
if (typeof props.enabled === 'boolean') {
this._enabled = props.enabled;
}
if (typeof props.interval === 'number') {
this._interval = props.interval;
}
}
serialize(): IQueryLogConfig {
const data: IQueryLogConfig = {
};
if (typeof this._anonymize_client_ip !== 'undefined') {
data.anonymize_client_ip = this._anonymize_client_ip;
}
if (typeof this._enabled !== 'undefined') {
data.enabled = this._enabled;
}
if (typeof this._interval !== 'undefined') {
data.interval = this._interval;
}
return data;
}
validate(): string[] {
const validate = {
enabled: !this._enabled ? true : typeof this._enabled === 'boolean',
interval: !this._interval ? true : typeof this._interval === 'number',
anonymize_client_ip: !this._anonymize_client_ip ? true : typeof this._anonymize_client_ip === 'boolean',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IQueryLogConfig>): QueryLogConfig {
return new QueryLogConfig({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,277 @@
import DnsAnswer, { IDnsAnswer } from './DnsAnswer';
import DnsQuestion, { IDnsQuestion } from './DnsQuestion';
import ResultRule, { IResultRule } from './ResultRule';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IQueryLogItem {
answer?: IDnsAnswer[];
answer_dnssec?: boolean;
client?: string;
client_proto?: any;
elapsedMs?: string;
filterId?: number;
original_answer?: IDnsAnswer[];
question?: IDnsQuestion;
reason?: string;
rule?: string;
rules?: IResultRule[];
service_name?: string;
status?: string;
time?: string;
upstream?: string;
}
export default class QueryLogItem {
readonly _answer: DnsAnswer[] | undefined;
get answer(): DnsAnswer[] | undefined {
return this._answer;
}
readonly _answer_dnssec: boolean | undefined;
get answerDnssec(): boolean | undefined {
return this._answer_dnssec;
}
readonly _client: string | undefined;
/**
* Description: undefined
* Example: 192.168.0.1
*/
get client(): string | undefined {
return this._client;
}
readonly _client_proto: any | undefined;
get clientProto(): any | undefined {
return this._client_proto;
}
readonly _elapsedMs: string | undefined;
/**
* Description: undefined
* Example: 54.023928
*/
get elapsedMs(): string | undefined {
return this._elapsedMs;
}
readonly _filterId: number | undefined;
/**
* Description: In case if there's a rule applied to this DNS request, this is ID of the filter list that the rule belongs to.
* Deprecated: use `rules[*].filter_list_id` instead.
*
* Example: 123123
*/
get filterId(): number | undefined {
return this._filterId;
}
readonly _original_answer: DnsAnswer[] | undefined;
/** */
get originalAnswer(): DnsAnswer[] | undefined {
return this._original_answer;
}
readonly _question: DnsQuestion | undefined;
get question(): DnsQuestion | undefined {
return this._question;
}
readonly _reason: string | undefined;
/** */
get reason(): string | undefined {
return this._reason;
}
readonly _rule: string | undefined;
/**
* Description: Filtering rule applied to the request (if any).
* Deprecated: use `rules[*].text` instead.
*
* Example: ||example.org^
*/
get rule(): string | undefined {
return this._rule;
}
readonly _rules: ResultRule[] | undefined;
/** */
get rules(): ResultRule[] | undefined {
return this._rules;
}
readonly _service_name: string | undefined;
/** */
get serviceName(): string | undefined {
return this._service_name;
}
readonly _status: string | undefined;
/**
* Description: DNS response status
* Example: NOERROR
*/
get status(): string | undefined {
return this._status;
}
readonly _time: string | undefined;
/**
* Description: DNS request processing start time
* Example: 2018-11-26T00:02:41+03:00
*/
get time(): string | undefined {
return this._time;
}
readonly _upstream: string | undefined;
/** */
get upstream(): string | undefined {
return this._upstream;
}
constructor(props: IQueryLogItem) {
if (props.answer) {
this._answer = props.answer.map((p) => new DnsAnswer(p));
}
if (typeof props.answer_dnssec === 'boolean') {
this._answer_dnssec = props.answer_dnssec;
}
if (typeof props.client === 'string') {
this._client = props.client.trim();
}
if (props.client_proto) {
this._client_proto = props.client_proto;
}
if (typeof props.elapsedMs === 'string') {
this._elapsedMs = props.elapsedMs.trim();
}
if (typeof props.filterId === 'number') {
this._filterId = props.filterId;
}
if (props.original_answer) {
this._original_answer = props.original_answer.map((p) => new DnsAnswer(p));
}
if (props.question) {
this._question = new DnsQuestion(props.question);
}
if (typeof props.reason === 'string') {
this._reason = props.reason.trim();
}
if (typeof props.rule === 'string') {
this._rule = props.rule.trim();
}
if (props.rules) {
this._rules = props.rules.map((p) => new ResultRule(p));
}
if (typeof props.service_name === 'string') {
this._service_name = props.service_name.trim();
}
if (typeof props.status === 'string') {
this._status = props.status.trim();
}
if (typeof props.time === 'string') {
this._time = props.time.trim();
}
if (typeof props.upstream === 'string') {
this._upstream = props.upstream.trim();
}
}
serialize(): IQueryLogItem {
const data: IQueryLogItem = {
};
if (typeof this._answer !== 'undefined') {
data.answer = this._answer.map((p) => p.serialize());
}
if (typeof this._answer_dnssec !== 'undefined') {
data.answer_dnssec = this._answer_dnssec;
}
if (typeof this._client !== 'undefined') {
data.client = this._client;
}
if (typeof this._client_proto !== 'undefined') {
data.client_proto = this._client_proto;
}
if (typeof this._elapsedMs !== 'undefined') {
data.elapsedMs = this._elapsedMs;
}
if (typeof this._filterId !== 'undefined') {
data.filterId = this._filterId;
}
if (typeof this._original_answer !== 'undefined') {
data.original_answer = this._original_answer.map((p) => p.serialize());
}
if (typeof this._question !== 'undefined') {
data.question = this._question.serialize();
}
if (typeof this._reason !== 'undefined') {
data.reason = this._reason;
}
if (typeof this._rule !== 'undefined') {
data.rule = this._rule;
}
if (typeof this._rules !== 'undefined') {
data.rules = this._rules.map((p) => p.serialize());
}
if (typeof this._service_name !== 'undefined') {
data.service_name = this._service_name;
}
if (typeof this._status !== 'undefined') {
data.status = this._status;
}
if (typeof this._time !== 'undefined') {
data.time = this._time;
}
if (typeof this._upstream !== 'undefined') {
data.upstream = this._upstream;
}
return data;
}
validate(): string[] {
const validate = {
answer: !this._answer ? true : this._answer.reduce((result, p) => result && p.validate().length === 0, true),
original_answer: !this._original_answer ? true : this._original_answer.reduce((result, p) => result && p.validate().length === 0, true),
upstream: !this._upstream ? true : typeof this._upstream === 'string' && !this._upstream ? true : this._upstream,
answer_dnssec: !this._answer_dnssec ? true : typeof this._answer_dnssec === 'boolean',
client: !this._client ? true : typeof this._client === 'string' && !this._client ? true : this._client,
elapsedMs: !this._elapsedMs ? true : typeof this._elapsedMs === 'string' && !this._elapsedMs ? true : this._elapsedMs,
question: !this._question ? true : this._question.validate().length === 0,
filterId: !this._filterId ? true : typeof this._filterId === 'number',
rule: !this._rule ? true : typeof this._rule === 'string' && !this._rule ? true : this._rule,
rules: !this._rules ? true : this._rules.reduce((result, p) => result && p.validate().length === 0, true),
reason: !this._reason ? true : typeof this._reason === 'string' && !this._reason ? true : this._reason,
service_name: !this._service_name ? true : typeof this._service_name === 'string' && !this._service_name ? true : this._service_name,
status: !this._status ? true : typeof this._status === 'string' && !this._status ? true : this._status,
time: !this._time ? true : typeof this._time === 'string' && !this._time ? true : this._time,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IQueryLogItem>): QueryLogItem {
return new QueryLogItem({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,49 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IRemoveUrlRequest {
url?: string;
}
export default class RemoveUrlRequest {
readonly _url: string | undefined;
/**
* Description: Previously added URL containing filtering rules
* Example: https://filters.adtidy.org/windows/filters/15.txt
*/
get url(): string | undefined {
return this._url;
}
constructor(props: IRemoveUrlRequest) {
if (typeof props.url === 'string') {
this._url = props.url.trim();
}
}
serialize(): IRemoveUrlRequest {
const data: IRemoveUrlRequest = {
};
if (typeof this._url !== 'undefined') {
data.url = this._url;
}
return data;
}
validate(): string[] {
const validate = {
url: !this._url ? true : typeof this._url === 'string' && !this._url ? true : this._url,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IRemoveUrlRequest>): RemoveUrlRequest {
return new RemoveUrlRequest({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,69 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IResultRule {
filter_list_id?: number;
text?: string;
}
export default class ResultRule {
readonly _filter_list_id: number | undefined;
/**
* Description: In case if there's a rule applied to this DNS request, this is ID of the filter list that the rule belongs to.
*
* Example: 123123
*/
get filterListId(): number | undefined {
return this._filter_list_id;
}
readonly _text: string | undefined;
/**
* Description: The text of the filtering rule applied to the request (if any).
*
* Example: ||example.org^
*/
get text(): string | undefined {
return this._text;
}
constructor(props: IResultRule) {
if (typeof props.filter_list_id === 'number') {
this._filter_list_id = props.filter_list_id;
}
if (typeof props.text === 'string') {
this._text = props.text.trim();
}
}
serialize(): IResultRule {
const data: IResultRule = {
};
if (typeof this._filter_list_id !== 'undefined') {
data.filter_list_id = this._filter_list_id;
}
if (typeof this._text !== 'undefined') {
data.text = this._text;
}
return data;
}
validate(): string[] {
const validate = {
filter_list_id: !this._filter_list_id ? true : typeof this._filter_list_id === 'number',
text: !this._text ? true : typeof this._text === 'string' && !this._text ? true : this._text,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IResultRule>): ResultRule {
return new ResultRule({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,67 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IRewriteEntry {
answer?: string;
domain?: string;
}
export default class RewriteEntry {
readonly _answer: string | undefined;
/**
* Description: value of A, AAAA or CNAME DNS record
* Example: 127.0.0.1
*/
get answer(): string | undefined {
return this._answer;
}
readonly _domain: string | undefined;
/**
* Description: Domain name
* Example: example.org
*/
get domain(): string | undefined {
return this._domain;
}
constructor(props: IRewriteEntry) {
if (typeof props.answer === 'string') {
this._answer = props.answer.trim();
}
if (typeof props.domain === 'string') {
this._domain = props.domain.trim();
}
}
serialize(): IRewriteEntry {
const data: IRewriteEntry = {
};
if (typeof this._answer !== 'undefined') {
data.answer = this._answer;
}
if (typeof this._domain !== 'undefined') {
data.domain = this._domain;
}
return data;
}
validate(): string[] {
const validate = {
domain: !this._domain ? true : typeof this._domain === 'string' && !this._domain ? true : this._domain,
answer: !this._answer ? true : typeof this._answer === 'string' && !this._answer ? true : this._answer,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IRewriteEntry>): RewriteEntry {
return new RewriteEntry({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,31 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IRewriteList {
}
export default class RewriteList {
constructor(props: IRewriteList) {
}
serialize(): IRewriteList {
const data: IRewriteList = {
};
return data;
}
validate(): string[] {
const validate = {
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IRewriteList>): RewriteList {
return new RewriteList({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,167 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IServerStatus {
dhcp_available?: boolean;
dns_address: string;
dns_port: number;
language: string;
protection_enabled: boolean;
querylog_enabled: boolean;
running: boolean;
version: string;
}
export default class ServerStatus {
readonly _dhcp_available: boolean | undefined;
get dhcpAvailable(): boolean | undefined {
return this._dhcp_available;
}
readonly _dns_address: string;
/**
* Description: undefined
* Example: 127.0.0.1
*/
get dnsAddress(): string {
return this._dns_address;
}
static dnsAddressValidate(dnsAddress: string): boolean {
return typeof dnsAddress === 'string' && !!dnsAddress.trim();
}
readonly _dns_port: number;
/**
* Description: undefined
* Example: 53
*/
get dnsPort(): number {
return this._dns_port;
}
static get dnsPortMinValue() {
return 1;
}
static get dnsPortMaxValue() {
return 65535;
}
static dnsPortValidate(dnsPort: number): boolean {
return dnsPort >= 1 && dnsPort <= 65535;
}
readonly _language: string;
/**
* Description: undefined
* Example: en
*/
get language(): string {
return this._language;
}
static languageValidate(language: string): boolean {
return typeof language === 'string' && !!language.trim();
}
readonly _protection_enabled: boolean;
get protectionEnabled(): boolean {
return this._protection_enabled;
}
static protectionEnabledValidate(protectionEnabled: boolean): boolean {
return typeof protectionEnabled === 'boolean';
}
readonly _querylog_enabled: boolean;
get querylogEnabled(): boolean {
return this._querylog_enabled;
}
static querylogEnabledValidate(querylogEnabled: boolean): boolean {
return typeof querylogEnabled === 'boolean';
}
readonly _running: boolean;
get running(): boolean {
return this._running;
}
static runningValidate(running: boolean): boolean {
return typeof running === 'boolean';
}
readonly _version: string;
/**
* Description: undefined
* Example: 0.1
*/
get version(): string {
return this._version;
}
static versionValidate(version: string): boolean {
return typeof version === 'string' && !!version.trim();
}
constructor(props: IServerStatus) {
if (typeof props.dhcp_available === 'boolean') {
this._dhcp_available = props.dhcp_available;
}
this._dns_address = props.dns_address.trim();
this._dns_port = props.dns_port;
this._language = props.language.trim();
this._protection_enabled = props.protection_enabled;
this._querylog_enabled = props.querylog_enabled;
this._running = props.running;
this._version = props.version.trim();
}
serialize(): IServerStatus {
const data: IServerStatus = {
dns_address: this._dns_address,
dns_port: this._dns_port,
language: this._language,
protection_enabled: this._protection_enabled,
querylog_enabled: this._querylog_enabled,
running: this._running,
version: this._version,
};
if (typeof this._dhcp_available !== 'undefined') {
data.dhcp_available = this._dhcp_available;
}
return data;
}
validate(): string[] {
const validate = {
dns_address: typeof this._dns_address === 'string' && !this._dns_address ? true : this._dns_address,
dns_port: this._dns_port >= 1 && this._dns_port <= 65535,
protection_enabled: typeof this._protection_enabled === 'boolean',
dhcp_available: !this._dhcp_available ? true : typeof this._dhcp_available === 'boolean',
querylog_enabled: typeof this._querylog_enabled === 'boolean',
running: typeof this._running === 'boolean',
version: typeof this._version === 'string' && !this._version ? true : this._version,
language: typeof this._language === 'string' && !this._language ? true : this._language,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IServerStatus>): ServerStatus {
return new ServerStatus({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,257 @@
import TopArrayEntry, { ITopArrayEntry } from './TopArrayEntry';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IStats {
avg_processing_time?: number;
blocked_filtering?: number[];
dns_queries?: number[];
num_blocked_filtering?: number;
num_dns_queries?: number;
num_replaced_parental?: number;
num_replaced_safebrowsing?: number;
num_replaced_safesearch?: number;
replaced_parental?: number[];
replaced_safebrowsing?: number[];
time_units?: string;
top_blocked_domains?: ITopArrayEntry[];
top_clients?: ITopArrayEntry[];
top_queried_domains?: ITopArrayEntry[];
}
export default class Stats {
readonly _avg_processing_time: number | undefined;
/**
* Description: Average time in milliseconds on processing a DNS
* Example: 0.34
*/
get avgProcessingTime(): number | undefined {
return this._avg_processing_time;
}
readonly _blocked_filtering: number[] | undefined;
get blockedFiltering(): number[] | undefined {
return this._blocked_filtering;
}
readonly _dns_queries: number[] | undefined;
get dnsQueries(): number[] | undefined {
return this._dns_queries;
}
readonly _num_blocked_filtering: number | undefined;
/**
* Description: Number of requests blocked by filtering rules
* Example: 50
*/
get numBlockedFiltering(): number | undefined {
return this._num_blocked_filtering;
}
readonly _num_dns_queries: number | undefined;
/**
* Description: Total number of DNS queries
* Example: 123
*/
get numDnsQueries(): number | undefined {
return this._num_dns_queries;
}
readonly _num_replaced_parental: number | undefined;
/**
* Description: Number of blocked adult websites
* Example: 15
*/
get numReplacedParental(): number | undefined {
return this._num_replaced_parental;
}
readonly _num_replaced_safebrowsing: number | undefined;
/**
* Description: Number of requests blocked by safebrowsing module
* Example: 5
*/
get numReplacedSafebrowsing(): number | undefined {
return this._num_replaced_safebrowsing;
}
readonly _num_replaced_safesearch: number | undefined;
/**
* Description: Number of requests blocked by safesearch module
* Example: 5
*/
get numReplacedSafesearch(): number | undefined {
return this._num_replaced_safesearch;
}
readonly _replaced_parental: number[] | undefined;
get replacedParental(): number[] | undefined {
return this._replaced_parental;
}
readonly _replaced_safebrowsing: number[] | undefined;
get replacedSafebrowsing(): number[] | undefined {
return this._replaced_safebrowsing;
}
readonly _time_units: string | undefined;
/**
* Description: Time units (hours | days)
* Example: hours
*/
get timeUnits(): string | undefined {
return this._time_units;
}
readonly _top_blocked_domains: TopArrayEntry[] | undefined;
get topBlockedDomains(): TopArrayEntry[] | undefined {
return this._top_blocked_domains;
}
readonly _top_clients: TopArrayEntry[] | undefined;
get topClients(): TopArrayEntry[] | undefined {
return this._top_clients;
}
readonly _top_queried_domains: TopArrayEntry[] | undefined;
get topQueriedDomains(): TopArrayEntry[] | undefined {
return this._top_queried_domains;
}
constructor(props: IStats) {
if (typeof props.avg_processing_time === 'number') {
this._avg_processing_time = props.avg_processing_time;
}
if (props.blocked_filtering) {
this._blocked_filtering = props.blocked_filtering;
}
if (props.dns_queries) {
this._dns_queries = props.dns_queries;
}
if (typeof props.num_blocked_filtering === 'number') {
this._num_blocked_filtering = props.num_blocked_filtering;
}
if (typeof props.num_dns_queries === 'number') {
this._num_dns_queries = props.num_dns_queries;
}
if (typeof props.num_replaced_parental === 'number') {
this._num_replaced_parental = props.num_replaced_parental;
}
if (typeof props.num_replaced_safebrowsing === 'number') {
this._num_replaced_safebrowsing = props.num_replaced_safebrowsing;
}
if (typeof props.num_replaced_safesearch === 'number') {
this._num_replaced_safesearch = props.num_replaced_safesearch;
}
if (props.replaced_parental) {
this._replaced_parental = props.replaced_parental;
}
if (props.replaced_safebrowsing) {
this._replaced_safebrowsing = props.replaced_safebrowsing;
}
if (typeof props.time_units === 'string') {
this._time_units = props.time_units.trim();
}
if (props.top_blocked_domains) {
this._top_blocked_domains = props.top_blocked_domains.map((p) => new TopArrayEntry(p));
}
if (props.top_clients) {
this._top_clients = props.top_clients.map((p) => new TopArrayEntry(p));
}
if (props.top_queried_domains) {
this._top_queried_domains = props.top_queried_domains.map((p) => new TopArrayEntry(p));
}
}
serialize(): IStats {
const data: IStats = {
};
if (typeof this._avg_processing_time !== 'undefined') {
data.avg_processing_time = this._avg_processing_time;
}
if (typeof this._blocked_filtering !== 'undefined') {
data.blocked_filtering = this._blocked_filtering;
}
if (typeof this._dns_queries !== 'undefined') {
data.dns_queries = this._dns_queries;
}
if (typeof this._num_blocked_filtering !== 'undefined') {
data.num_blocked_filtering = this._num_blocked_filtering;
}
if (typeof this._num_dns_queries !== 'undefined') {
data.num_dns_queries = this._num_dns_queries;
}
if (typeof this._num_replaced_parental !== 'undefined') {
data.num_replaced_parental = this._num_replaced_parental;
}
if (typeof this._num_replaced_safebrowsing !== 'undefined') {
data.num_replaced_safebrowsing = this._num_replaced_safebrowsing;
}
if (typeof this._num_replaced_safesearch !== 'undefined') {
data.num_replaced_safesearch = this._num_replaced_safesearch;
}
if (typeof this._replaced_parental !== 'undefined') {
data.replaced_parental = this._replaced_parental;
}
if (typeof this._replaced_safebrowsing !== 'undefined') {
data.replaced_safebrowsing = this._replaced_safebrowsing;
}
if (typeof this._time_units !== 'undefined') {
data.time_units = this._time_units;
}
if (typeof this._top_blocked_domains !== 'undefined') {
data.top_blocked_domains = this._top_blocked_domains.map((p) => p.serialize());
}
if (typeof this._top_clients !== 'undefined') {
data.top_clients = this._top_clients.map((p) => p.serialize());
}
if (typeof this._top_queried_domains !== 'undefined') {
data.top_queried_domains = this._top_queried_domains.map((p) => p.serialize());
}
return data;
}
validate(): string[] {
const validate = {
time_units: !this._time_units ? true : typeof this._time_units === 'string' && !this._time_units ? true : this._time_units,
num_dns_queries: !this._num_dns_queries ? true : typeof this._num_dns_queries === 'number',
num_blocked_filtering: !this._num_blocked_filtering ? true : typeof this._num_blocked_filtering === 'number',
num_replaced_safebrowsing: !this._num_replaced_safebrowsing ? true : typeof this._num_replaced_safebrowsing === 'number',
num_replaced_safesearch: !this._num_replaced_safesearch ? true : typeof this._num_replaced_safesearch === 'number',
num_replaced_parental: !this._num_replaced_parental ? true : typeof this._num_replaced_parental === 'number',
avg_processing_time: !this._avg_processing_time ? true : typeof this._avg_processing_time === 'number',
top_queried_domains: !this._top_queried_domains ? true : this._top_queried_domains.reduce((result, p) => result && p.validate().length === 0, true),
top_clients: !this._top_clients ? true : this._top_clients.reduce((result, p) => result && p.validate().length === 0, true),
top_blocked_domains: !this._top_blocked_domains ? true : this._top_blocked_domains.reduce((result, p) => result && p.validate().length === 0, true),
dns_queries: !this._dns_queries ? true : this._dns_queries.reduce((result, p) => result && typeof p === 'number', true),
blocked_filtering: !this._blocked_filtering ? true : this._blocked_filtering.reduce((result, p) => result && typeof p === 'number', true),
replaced_safebrowsing: !this._replaced_safebrowsing ? true : this._replaced_safebrowsing.reduce((result, p) => result && typeof p === 'number', true),
replaced_parental: !this._replaced_parental ? true : this._replaced_parental.reduce((result, p) => result && typeof p === 'number', true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IStats>): Stats {
return new Stats({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,46 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IStatsConfig {
interval?: number;
}
export default class StatsConfig {
readonly _interval: number | undefined;
/** */
get interval(): number | undefined {
return this._interval;
}
constructor(props: IStatsConfig) {
if (typeof props.interval === 'number') {
this._interval = props.interval;
}
}
serialize(): IStatsConfig {
const data: IStatsConfig = {
};
if (typeof this._interval !== 'undefined') {
data.interval = this._interval;
}
return data;
}
validate(): string[] {
const validate = {
interval: !this._interval ? true : typeof this._interval === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IStatsConfig>): StatsConfig {
return new StatsConfig({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,404 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ITlsConfig {
certificate_chain?: string;
certificate_path?: string;
dns_names?: string[];
enabled?: boolean;
force_https?: boolean;
issuer?: string;
key_type?: string;
not_after?: string;
not_before?: string;
port_dns_over_quic?: number;
port_dns_over_tls?: number;
port_https?: number;
private_key?: string;
private_key_path?: string;
server_name?: string;
subject?: string;
valid_cert?: boolean;
valid_chain?: boolean;
valid_key?: boolean;
valid_pair?: boolean;
warning_validation?: string;
}
export default class TlsConfig {
readonly _certificate_chain: string | undefined;
/** */
get certificateChain(): string | undefined {
return this._certificate_chain;
}
readonly _certificate_path: string | undefined;
/** */
get certificatePath(): string | undefined {
return this._certificate_path;
}
readonly _dns_names: string[] | undefined;
/**
* Description: The value of SubjectAltNames field of the first certificate in the chain.
*
* Example: *.example.org
*/
get dnsNames(): string[] | undefined {
return this._dns_names;
}
readonly _enabled: boolean | undefined;
/**
* Description: enabled is the encryption (DOT/DOH/HTTPS) status
* Example: true
*/
get enabled(): boolean | undefined {
return this._enabled;
}
readonly _force_https: boolean | undefined;
/**
* Description: if true, forces HTTP->HTTPS redirect
* Example: true
*/
get forceHttps(): boolean | undefined {
return this._force_https;
}
readonly _issuer: string | undefined;
/**
* Description: The issuer of the first certificate in the chain.
* Example: CN=Let's Encrypt Authority X3,O=Let's Encrypt,C=US
*/
get issuer(): string | undefined {
return this._issuer;
}
readonly _key_type: string | undefined;
/**
* Description: Key type.
* Example: RSA
*/
get keyType(): string | undefined {
return this._key_type;
}
readonly _not_after: string | undefined;
/**
* Description: The NotAfter field of the first certificate in the chain.
*
* Example: 2019-05-01T10:47:32Z
*/
get notAfter(): string | undefined {
return this._not_after;
}
readonly _not_before: string | undefined;
/**
* Description: The NotBefore field of the first certificate in the chain.
*
* Example: 2019-01-31T10:47:32Z
*/
get notBefore(): string | undefined {
return this._not_before;
}
readonly _port_dns_over_quic: number | undefined;
/**
* Description: DNS-over-QUIC port. If 0, DOQ will be disabled.
* Example: 784
*/
get portDnsOverQuic(): number | undefined {
return this._port_dns_over_quic;
}
readonly _port_dns_over_tls: number | undefined;
/**
* Description: DNS-over-TLS port. If 0, DOT will be disabled.
* Example: 853
*/
get portDnsOverTls(): number | undefined {
return this._port_dns_over_tls;
}
readonly _port_https: number | undefined;
/**
* Description: HTTPS port. If 0, HTTPS will be disabled.
* Example: 443
*/
get portHttps(): number | undefined {
return this._port_https;
}
readonly _private_key: string | undefined;
/** */
get privateKey(): string | undefined {
return this._private_key;
}
readonly _private_key_path: string | undefined;
/** */
get privateKeyPath(): string | undefined {
return this._private_key_path;
}
readonly _server_name: string | undefined;
/**
* Description: server_name is the hostname of your HTTPS/TLS server
* Example: example.org
*/
get serverName(): string | undefined {
return this._server_name;
}
readonly _subject: string | undefined;
/**
* Description: The subject of the first certificate in the chain.
* Example: CN=example.org
*/
get subject(): string | undefined {
return this._subject;
}
readonly _valid_cert: boolean | undefined;
/**
* Description: Set to true if the specified certificates chain is a valid chain of X509 certificates.
*
* Example: true
*/
get validCert(): boolean | undefined {
return this._valid_cert;
}
readonly _valid_chain: boolean | undefined;
/**
* Description: Set to true if the specified certificates chain is verified and issued by a known CA.
*
* Example: true
*/
get validChain(): boolean | undefined {
return this._valid_chain;
}
readonly _valid_key: boolean | undefined;
/**
* Description: Set to true if the key is a valid private key.
* Example: true
*/
get validKey(): boolean | undefined {
return this._valid_key;
}
readonly _valid_pair: boolean | undefined;
/**
* Description: Set to true if both certificate and private key are correct.
*
* Example: true
*/
get validPair(): boolean | undefined {
return this._valid_pair;
}
readonly _warning_validation: string | undefined;
/**
* Description: A validation warning message with the issue description.
*
* Example: You have specified an empty certificate
*/
get warningValidation(): string | undefined {
return this._warning_validation;
}
constructor(props: ITlsConfig) {
if (typeof props.certificate_chain === 'string') {
this._certificate_chain = props.certificate_chain.trim();
}
if (typeof props.certificate_path === 'string') {
this._certificate_path = props.certificate_path.trim();
}
if (props.dns_names) {
this._dns_names = props.dns_names;
}
if (typeof props.enabled === 'boolean') {
this._enabled = props.enabled;
}
if (typeof props.force_https === 'boolean') {
this._force_https = props.force_https;
}
if (typeof props.issuer === 'string') {
this._issuer = props.issuer.trim();
}
if (typeof props.key_type === 'string') {
this._key_type = props.key_type.trim();
}
if (typeof props.not_after === 'string') {
this._not_after = props.not_after.trim();
}
if (typeof props.not_before === 'string') {
this._not_before = props.not_before.trim();
}
if (typeof props.port_dns_over_quic === 'number') {
this._port_dns_over_quic = props.port_dns_over_quic;
}
if (typeof props.port_dns_over_tls === 'number') {
this._port_dns_over_tls = props.port_dns_over_tls;
}
if (typeof props.port_https === 'number') {
this._port_https = props.port_https;
}
if (typeof props.private_key === 'string') {
this._private_key = props.private_key.trim();
}
if (typeof props.private_key_path === 'string') {
this._private_key_path = props.private_key_path.trim();
}
if (typeof props.server_name === 'string') {
this._server_name = props.server_name.trim();
}
if (typeof props.subject === 'string') {
this._subject = props.subject.trim();
}
if (typeof props.valid_cert === 'boolean') {
this._valid_cert = props.valid_cert;
}
if (typeof props.valid_chain === 'boolean') {
this._valid_chain = props.valid_chain;
}
if (typeof props.valid_key === 'boolean') {
this._valid_key = props.valid_key;
}
if (typeof props.valid_pair === 'boolean') {
this._valid_pair = props.valid_pair;
}
if (typeof props.warning_validation === 'string') {
this._warning_validation = props.warning_validation.trim();
}
}
serialize(): ITlsConfig {
const data: ITlsConfig = {
};
if (typeof this._certificate_chain !== 'undefined') {
data.certificate_chain = this._certificate_chain;
}
if (typeof this._certificate_path !== 'undefined') {
data.certificate_path = this._certificate_path;
}
if (typeof this._dns_names !== 'undefined') {
data.dns_names = this._dns_names;
}
if (typeof this._enabled !== 'undefined') {
data.enabled = this._enabled;
}
if (typeof this._force_https !== 'undefined') {
data.force_https = this._force_https;
}
if (typeof this._issuer !== 'undefined') {
data.issuer = this._issuer;
}
if (typeof this._key_type !== 'undefined') {
data.key_type = this._key_type;
}
if (typeof this._not_after !== 'undefined') {
data.not_after = this._not_after;
}
if (typeof this._not_before !== 'undefined') {
data.not_before = this._not_before;
}
if (typeof this._port_dns_over_quic !== 'undefined') {
data.port_dns_over_quic = this._port_dns_over_quic;
}
if (typeof this._port_dns_over_tls !== 'undefined') {
data.port_dns_over_tls = this._port_dns_over_tls;
}
if (typeof this._port_https !== 'undefined') {
data.port_https = this._port_https;
}
if (typeof this._private_key !== 'undefined') {
data.private_key = this._private_key;
}
if (typeof this._private_key_path !== 'undefined') {
data.private_key_path = this._private_key_path;
}
if (typeof this._server_name !== 'undefined') {
data.server_name = this._server_name;
}
if (typeof this._subject !== 'undefined') {
data.subject = this._subject;
}
if (typeof this._valid_cert !== 'undefined') {
data.valid_cert = this._valid_cert;
}
if (typeof this._valid_chain !== 'undefined') {
data.valid_chain = this._valid_chain;
}
if (typeof this._valid_key !== 'undefined') {
data.valid_key = this._valid_key;
}
if (typeof this._valid_pair !== 'undefined') {
data.valid_pair = this._valid_pair;
}
if (typeof this._warning_validation !== 'undefined') {
data.warning_validation = this._warning_validation;
}
return data;
}
validate(): string[] {
const validate = {
enabled: !this._enabled ? true : typeof this._enabled === 'boolean',
server_name: !this._server_name ? true : typeof this._server_name === 'string' && !this._server_name ? true : this._server_name,
force_https: !this._force_https ? true : typeof this._force_https === 'boolean',
port_https: !this._port_https ? true : typeof this._port_https === 'number',
port_dns_over_tls: !this._port_dns_over_tls ? true : typeof this._port_dns_over_tls === 'number',
port_dns_over_quic: !this._port_dns_over_quic ? true : typeof this._port_dns_over_quic === 'number',
certificate_chain: !this._certificate_chain ? true : typeof this._certificate_chain === 'string' && !this._certificate_chain ? true : this._certificate_chain,
private_key: !this._private_key ? true : typeof this._private_key === 'string' && !this._private_key ? true : this._private_key,
certificate_path: !this._certificate_path ? true : typeof this._certificate_path === 'string' && !this._certificate_path ? true : this._certificate_path,
private_key_path: !this._private_key_path ? true : typeof this._private_key_path === 'string' && !this._private_key_path ? true : this._private_key_path,
valid_cert: !this._valid_cert ? true : typeof this._valid_cert === 'boolean',
valid_chain: !this._valid_chain ? true : typeof this._valid_chain === 'boolean',
subject: !this._subject ? true : typeof this._subject === 'string' && !this._subject ? true : this._subject,
issuer: !this._issuer ? true : typeof this._issuer === 'string' && !this._issuer ? true : this._issuer,
not_before: !this._not_before ? true : typeof this._not_before === 'string' && !this._not_before ? true : this._not_before,
not_after: !this._not_after ? true : typeof this._not_after === 'string' && !this._not_after ? true : this._not_after,
dns_names: !this._dns_names ? true : this._dns_names.reduce((result, p) => result && typeof p === 'string', true),
valid_key: !this._valid_key ? true : typeof this._valid_key === 'boolean',
key_type: !this._key_type ? true : typeof this._key_type === 'string' && !this._key_type ? true : this._key_type,
warning_validation: !this._warning_validation ? true : typeof this._warning_validation === 'string' && !this._warning_validation ? true : this._warning_validation,
valid_pair: !this._valid_pair ? true : typeof this._valid_pair === 'boolean',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ITlsConfig>): TlsConfig {
return new TlsConfig({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,45 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface ITopArrayEntry {
domain_or_ip?: number;
}
export default class TopArrayEntry {
readonly _domain_or_ip: number | undefined;
get domainOrIp(): number | undefined {
return this._domain_or_ip;
}
constructor(props: ITopArrayEntry) {
if (typeof props.domain_or_ip === 'number') {
this._domain_or_ip = props.domain_or_ip;
}
}
serialize(): ITopArrayEntry {
const data: ITopArrayEntry = {
};
if (typeof this._domain_or_ip !== 'undefined') {
data.domain_or_ip = this._domain_or_ip;
}
return data;
}
validate(): string[] {
const validate = {
domain_or_ip: !this._domain_or_ip ? true : typeof this._domain_or_ip === 'number',
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<ITopArrayEntry>): TopArrayEntry {
return new TopArrayEntry({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,69 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IUpstreamsConfig {
bootstrap_dns: string[];
upstream_dns: string[];
}
export default class UpstreamsConfig {
readonly _bootstrap_dns: string[];
/**
* Description: Bootstrap servers, port is optional after colon. Empty value will reset it to default values.
*
* Example: 8.8.8.8:53,1.1.1.1:53
*/
get bootstrapDns(): string[] {
return this._bootstrap_dns;
}
static bootstrapDnsValidate(bootstrapDns: string[]): boolean {
return bootstrapDns.reduce<boolean>((result, p) => result && (typeof p === 'string' && !!p.trim()), true);
}
readonly _upstream_dns: string[];
/**
* Description: Upstream servers, port is optional after colon. Empty value will reset it to default values.
*
* Example: tls://1.1.1.1,tls://1.0.0.1
*/
get upstreamDns(): string[] {
return this._upstream_dns;
}
static upstreamDnsValidate(upstreamDns: string[]): boolean {
return upstreamDns.reduce<boolean>((result, p) => result && (typeof p === 'string' && !!p.trim()), true);
}
constructor(props: IUpstreamsConfig) {
this._bootstrap_dns = props.bootstrap_dns;
this._upstream_dns = props.upstream_dns;
}
serialize(): IUpstreamsConfig {
const data: IUpstreamsConfig = {
bootstrap_dns: this._bootstrap_dns,
upstream_dns: this._upstream_dns,
};
return data;
}
validate(): string[] {
const validate = {
bootstrap_dns: this._bootstrap_dns.reduce((result, p) => result && typeof p === 'string', true),
upstream_dns: this._upstream_dns.reduce((result, p) => result && typeof p === 'string', true),
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IUpstreamsConfig>): UpstreamsConfig {
return new UpstreamsConfig({ ...this.serialize(), ...props });
}
}

View File

@@ -0,0 +1,31 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IUpstreamsConfigResponse {
}
export default class UpstreamsConfigResponse {
constructor(props: IUpstreamsConfigResponse) {
}
serialize(): IUpstreamsConfigResponse {
const data: IUpstreamsConfigResponse = {
};
return data;
}
validate(): string[] {
const validate = {
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IUpstreamsConfigResponse>): UpstreamsConfigResponse {
return new UpstreamsConfigResponse({ ...this.serialize(), ...props });
}
}

View 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 });
}
}

View File

@@ -0,0 +1,45 @@
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IWhoisInfo {
key?: string;
}
export default class WhoisInfo {
readonly _key: string | undefined;
get key(): string | undefined {
return this._key;
}
constructor(props: IWhoisInfo) {
if (typeof props.key === 'string') {
this._key = props.key.trim();
}
}
serialize(): IWhoisInfo {
const data: IWhoisInfo = {
};
if (typeof this._key !== 'undefined') {
data.key = this._key;
}
return data;
}
validate(): string[] {
const validate = {
key: !this._key ? true : typeof this._key === 'string' && !this._key ? true : this._key,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IWhoisInfo>): WhoisInfo {
return new WhoisInfo({ ...this.serialize(), ...props });
}
}