-
Notifications
You must be signed in to change notification settings - Fork 1
/
items_request.go
63 lines (52 loc) · 1.18 KB
/
items_request.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
package pr0gramm
type ItemsRequest struct {
Older, Newer, Around Id
Tags, User, Likes string
Random, Top bool
ContentTypes ContentTypes
}
func NewItemsRequest() ItemsRequest {
return ItemsRequest{ContentTypes: AllContentTypes}
}
func (req ItemsRequest) WithOlderThan(id Id) ItemsRequest {
req.Older = id
req.Newer = 0
req.Around = 0
return req
}
func (req ItemsRequest) WithNewerThan(id Id) ItemsRequest {
req.Older = id
req.Newer = 0
req.Around = 0
return req
}
func (req ItemsRequest) WithAround(id Id) ItemsRequest {
req.Older = 0
req.Newer = 0
req.Around = id
return req
}
func (req ItemsRequest) WithTag(tag string) ItemsRequest {
req.Tags = tag
return req
}
func (req ItemsRequest) WithUser(user string) ItemsRequest {
req.User = user
return req
}
func (req ItemsRequest) WithLikes(user string) ItemsRequest {
req.Likes = user
return req
}
func (req ItemsRequest) WithRandom(random bool) ItemsRequest {
req.Random = random
return req
}
func (req ItemsRequest) WithTopOnly(topOnly bool) ItemsRequest {
req.Top = topOnly
return req
}
func (req ItemsRequest) WithFlags(flags []ContentType) ItemsRequest {
req.ContentTypes = flags
return req
}