This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.go
127 lines (115 loc) · 3.02 KB
/
constants.go
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package userstack
type EntityType string
const (
EntityUnknown EntityType = "unknown"
EntityBrowser EntityType = "browser"
EntityMobileBrowser EntityType = "mobile-browser"
EntityEmailClient EntityType = "email-client"
EntityApp EntityType = "app"
EntityFeedReader EntityType = "feed-reader"
EntityCrawler EntityType = "crawler"
EntityOfflineBrowser EntityType = "offline-browser"
)
func (e EntityType) String() string { return string(e) }
// UnmarshalText satisfies TextUnmarshaler
func (e *EntityType) UnmarshalText(text []byte) error {
enum := string(text)
if !strictUnmarshal {
*e = EntityType(enum)
return nil
}
switch enum {
case "unknown":
*e = EntityUnknown
case "browser":
*e = EntityBrowser
case "mobile-browser":
*e = EntityMobileBrowser
case "email-client":
*e = EntityEmailClient
case "app":
*e = EntityApp
case "feed-reader":
*e = EntityFeedReader
case "crawler":
*e = EntityCrawler
case "offline-browser":
*e = EntityOfflineBrowser
default:
return &UnsupportedTypeError{typ: enum, fieldName: "entity"}
}
return nil
}
type DeviceType string
const (
DeviceUnknown DeviceType = "unknown"
DeviceDesktop DeviceType = "desktop"
DeviceTablet DeviceType = "tablet"
DeviceSmartPhone DeviceType = "smartphone"
DeviceConsole DeviceType = "console"
DeviceSmartTV DeviceType = "smarttv"
DeviceWearable DeviceType = "wearable"
)
func (d DeviceType) String() string { return string(d) }
// UnmarshalText satisfies TextUnmarshaler
func (d *DeviceType) UnmarshalText(text []byte) error {
enum := string(text)
if !strictUnmarshal {
*d = DeviceType(enum)
return nil
}
switch enum {
case "unknown":
*d = DeviceUnknown
case "desktop":
*d = DeviceDesktop
case "tablet":
*d = DeviceTablet
case "smartphone":
*d = DeviceSmartPhone
case "console":
*d = DeviceConsole
case "smarttv":
*d = DeviceSmartTV
case "wearable":
*d = DeviceWearable
default:
return &UnsupportedTypeError{typ: enum, fieldName: "device"}
}
return nil
}
type CategoryType string
const (
CategoryUnknown CategoryType = "unknown"
CategorySearchEngine CategoryType = "search-engine"
CategoryMonitoring CategoryType = "monitoring"
CategoryScreenshotService CategoryType = "screenshot-service"
CategoryScraper CategoryType = "scraper"
CategorySecurityScanner CategoryType = "security-scanner"
)
func (c CategoryType) String() string { return string(c) }
// UnmarshalText satisfies TextUnmarshaler
func (c *CategoryType) UnmarshalText(text []byte) error {
enum := string(text)
if !strictUnmarshal {
*c = CategoryType(enum)
return nil
}
switch enum {
case "unknown":
*c = CategoryUnknown
case "search-engine":
*c = CategorySearchEngine
case "monitoring":
*c = CategoryMonitoring
case "screenshot-service":
*c = CategoryScreenshotService
case "scraper":
*c = CategoryScraper
case "security-scanner":
*c = CategorySecurityScanner
default:
return &UnsupportedTypeError{typ: enum, fieldName: "category"}
}
return nil
}