-
Notifications
You must be signed in to change notification settings - Fork 7
/
GeolocationParams.ts
111 lines (88 loc) · 2.56 KB
/
GeolocationParams.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
export class GeolocationParams {
ipAddress: string;
ipAddresses: string[];
lang: string;
fields: string;
excludes: string;
includeHostname: boolean;
includeHostnameFallbackLive: boolean;
includeLiveHostname: boolean;
includeSecurity: boolean;
includeUserAgent: boolean;
constructor() {
this.ipAddress = "";
this.ipAddresses = [];
this.lang = "en";
this.fields = "";
this.excludes = "";
this.includeHostname = false;
this.includeHostnameFallbackLive = false;
this.includeLiveHostname = false;
this.includeSecurity = false;
this.includeUserAgent = false;
}
setIPAddress(ipAddress: string = ""): void {
this.ipAddress = ipAddress;
}
getIPAddress(): string {
return this.ipAddress;
}
setIPAddresses(ipAddresses: string[] = []): void {
if (ipAddresses.length > 50) {
console.log("Max. number of IP addresses cannot be more than 50.");
} else {
this.ipAddresses = ipAddresses;
}
}
getIPAddresses(): string[] {
return this.ipAddresses;
}
setLang(lang: string = "en"): void {
this.lang = lang;
}
getLang(): string {
return this.lang;
}
setFields(fields: string = ""): void {
this.fields = fields;
}
getFields(): string {
return this.fields;
}
setExcludes(excludes: string = ""): void {
this.excludes = excludes;
}
getExcludes(): string {
return this.excludes;
}
setIncludeHostname(hostname: boolean = false): void {
this.includeHostname = hostname;
}
isIncludeHostname(): boolean {
return this.includeHostname;
}
setIncludeHostnameFallbackLive(hostnameFallbackLive: boolean = false): void {
this.includeHostnameFallbackLive = hostnameFallbackLive;
}
isIncludeHostnameFallbackLive(): boolean {
return this.includeHostnameFallbackLive;
}
setIncludeLiveHostname(liveHostname: boolean = false): void {
this.includeLiveHostname = liveHostname;
}
isIncludeLiveHostname(): boolean {
return this.includeLiveHostname;
}
setIncludeSecurity(security: boolean = false): void {
this.includeSecurity = security;
}
isIncludeSecurity(): boolean {
return this.includeSecurity;
}
setIncludeUserAgent(userAgent: boolean = false): void {
this.includeUserAgent = userAgent;
}
isIncludeUserAgent(): boolean {
return this.includeUserAgent;
}
}