-
Notifications
You must be signed in to change notification settings - Fork 0
/
links_data.go
75 lines (67 loc) · 2.38 KB
/
links_data.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
package rebrandly
import "time"
// Link represents a registered rebrandly link
type Link struct {
ID string `json:"id"`
Title string `json:"title"`
Slashtag string `json:"slashtag"`
Destination string `json:"destination"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Status string `json:"status"`
Clicks int `json:"clicks"`
Sessions int `json:"sessions"`
LastClickDate time.Time `json:"lastClickDate"`
LastClickAt time.Time `json:"lastClickAt"`
IsPublic bool `json:"isPublic"`
ShortURL string `json:"shortUrl"`
DomainID string `json:"domainId"`
DomainName string `json:"domainName"`
Domain struct {
ID string `json:"id"`
Ref string `json:"ref"`
FullName string `json:"fullName"`
Active bool `json:"active"`
} `json:"domain"`
HTTPS bool `json:"https"`
Favourite bool `json:"favourite"`
Creator struct {
ID string `json:"id"`
FullName string `json:"fullName"`
AvatarURL string `json:"avatarUrl"`
} `json:"creator"`
Integrated bool `json:"integrated"`
}
// Links represents a collection of Link
type Links []Link
// LinksFilters represents all filters usable on Links queries
type LinksFilters struct {
DomainID *string `urlQuery:"domain.id"`
DomainFullName *string `urlQuery:"domain.fullName"`
SlashTag *string `urlQuery:"slashtag"`
CreatorID *string `urlQuery:"creator.id"`
OrderBy *OrderBy `urlQuery:"orderBy"`
OrderDir *OrderDir `urlQuery:"orderDir"`
Limit *int `urlQuery:"limit"`
Last *string `urlQuery:"last"`
}
// LinksCountFilters represents the filters usable on the LinksCount query
type LinksCountFilters struct {
Favourite *bool `urlQuery:"favourite"`
DomainID *string `urlQuery:"domain.id"`
}
type linksCountAnswer struct {
Count int `json:"count"`
}
// LinkCreationPayload represents the payload used to create a link
type LinkCreationPayload struct {
Destination string `json:"destination"`
SlashTag string `json:"slashtag,omitempty"`
Title string `json:"title,omitempty"`
Domain *Domain `json:"domain,omitempty"`
}
// LinkUpdatePayload contains all the data needed to update a link
type LinkUpdatePayload struct {
Destination string `json:"destination"`
Title string `json:"title"`
}