-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathtypes.go
90 lines (75 loc) · 2.44 KB
/
types.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
// Copyright 2012 Jimmy Zelinskie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package geddit
// vote represents the three possible states of a vote on reddit.
type Vote string
const (
UpVote Vote = "1"
DownVote = "-1"
RemoveVote = "0"
)
type Captcha struct {
Iden string
Response string
}
// NewSubmission contains the data needed to submit
type NewSubmission struct {
Subreddit string
Title string
Content string
Self bool
SendReplies bool
Resubmit bool
Save bool
Captcha *Captcha
}
// NewLinkSubmission returns a NewSubmission with parameters appropriate for a link submission
func NewLinkSubmission(sr, title, link string, replies bool, c *Captcha) *NewSubmission {
return &NewSubmission{sr, title, link, false, replies, true, true, c}
}
// NewTextSubmission returns a NewSubmission with parameters appropriate for a text submission
func NewTextSubmission(sr, title, text string, replies bool, c *Captcha) *NewSubmission {
return &NewSubmission{sr, title, text, true, replies, true, true, c}
}
// PopularitySort represents the possible ways to sort submissions by popularity.
type PopularitySort string
const (
DefaultPopularity PopularitySort = ""
HotSubmissions = "hot"
NewSubmissions = "new"
RisingSubmissions = "rising"
TopSubmissions = "top"
ControversialSubmissions = "controversial"
)
// ageSort represents the possible ways to sort submissions by age.
type ageSort string
const (
DefaultAge ageSort = ""
ThisHour = "hour"
ThisDay = "day"
ThisMonth = "month"
ThisYear = "year"
AllTime = "all"
)
type ListingOptions struct {
Time string `url:"t,omitempty"`
Limit int `url:"limit,omitempty"`
After string `url:"after,omitempty"`
Before string `url:"before,omitempty"`
Count int `url:"count,omitempty"`
Show string `url:"show,omitempty"`
Article string `url:"article,omitempty"`
}
// Voter represents something that can be voted on reddit.com.
type Voter interface {
voteID() string
}
// Deleter represents something that can be deleted on reddit.com.
type Deleter interface {
deleteID() string
}
// Replier represents something that can be replied to on reddit.com.
type Replier interface {
replyID() string
}