-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.go
More file actions
73 lines (55 loc) · 1.91 KB
/
Copy pathmodels.go
File metadata and controls
73 lines (55 loc) · 1.91 KB
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
package websitecategorization
import (
"fmt"
)
// CategoryItem is part of the category directory.
type CategoryItem struct {
// ID is the unique category identifier.
ID int `json:"id"`
// Name is the readable name of the category.
Name string `json:"name"`
}
// WCategorizationResponse is a response of Website Categorization API.
type WCategorizationResponse struct {
// AS Autonomous System.
AS *AS `json:"as,omitempty"`
// DomainName is a domain/website name.
DomainName string `json:"domainName"`
// Categories is the list of website's categories.
Categories []Category `json:"categories"`
// CreatedDate is date of initial creation of the WHOIS record for the domain in ISO8601 format. Omitted if the record is not found.
CreatedDate *string `json:"createdDate,omitempty"`
// WebsiteResponded Determines if the website was active during the crawling.
WebsiteResponded bool `json:"websiteResponded"`
}
// Category is a part of the Website Categorization API v3 response.
type Category struct {
// Confidence The probability of how the category may be relevant for the website.
Confidence float64 `json:"confidence"`
// ID The unique category identifier.
ID int `json:"id"`
// Name The readable name of the category.
Name string `json:"name"`
}
// AS is a part of the Website Categorization API response.
type AS struct {
// ASN Autonomous System Number.
ASN int `json:"asn"`
// Domain Autonomous System Website's URL.
Domain string `json:"domain"`
// Name Autonomous System Name.
Name string `json:"name"`
// Route Autonomous System Route.
Route string `json:"route"`
// Type Autonomous System Type.
Type string `json:"type"`
}
// ErrorMessage is the error message.
type ErrorMessage struct {
Code int `json:"code"`
Message string `json:"messages"`
}
// Error returns error message as a string.
func (e *ErrorMessage) Error() string {
return fmt.Sprintf("API error: [%d] %s", e.Code, e.Message)
}