Documentation
¶
Overview ¶
Provides access to the posts and other information on the RAL textboard (https://ralee.org) using its API
Index ¶
- Constants
- func EscapeShSingle(s string) string
- func ShQuote(s string) string
- func SurroundQuoteSingle(s string) string
- type APIAction
- type APIRequest
- type Continuity
- type ContinuityList
- type Format
- type Reply
- type ReplyList
- type Site
- func (s Site) APIRequest(action APIAction, params map[string]string) (a APIRequest)
- func (s Site) Continuities() (ret ContinuityList, err error)
- func (s Site) Replies(continuity string, year int, topic int) (ret ReplyList, err error)
- func (s Site) Topics(continuity string, year int) (ret TopicList, err error)
- func (s Site) Years(continuity string) (ret YearList, err error)
- type Topic
- type TopicList
- type Year
- type YearList
Constants ¶
const USER_AGENT = "GoRAL"
Defines the user agent projected by the package
Variables ¶
This section is empty.
Functions ¶
func EscapeShSingle ¶
Escape single quotes in a string for shell
func SurroundQuoteSingle ¶
Surround string with single quotes
Types ¶
type APIAction ¶
type APIAction string
Functions exposed by the RAL API
const (
View APIAction = "view"
)
type APIRequest ¶
type APIRequest struct {
URL url.URL
// Action APIAction
// Endpoint string
UserAgent string
// Parameters map[string]string
Client http.Client
}
Defines a single request to the RAL API
func (APIRequest) Go ¶
func (areq APIRequest) Go() (body []byte, err error)
Execute a single request to the RAL API
type Continuity ¶
type ContinuityList ¶
type ContinuityList []Continuity
Continuities represent discussion topics like "Anime" or "Music"
func (ContinuityList) Print ¶
func (cl ContinuityList) Print(f Format)
Serialize ContinuityList to console
type ReplyList ¶
type ReplyList []Reply
Replies are posted to Topics; a reply looks like Anime/2019/1/3, which specifies the third reply to the first topic on [Anime] in 2019.
type Site ¶
Defines site-wide parameters for accessing information from RAL
func (Site) APIRequest ¶
func (s Site) APIRequest(action APIAction, params map[string]string) (a APIRequest)
Generates a single request for information on the given site, representing exactly one transaction / HTTP request
func (Site) Continuities ¶
func (s Site) Continuities() (ret ContinuityList, err error)
Generate and execute an API request which returns the full list of Continuities on the given Site
func (Site) Replies ¶
Generate and execute an API request which returns all Replies to a given topic
type TopicList ¶
type TopicList []Topic
Topics are posted to a certain Continuity/Year Example: Anime/2019/1 is the first Topic posted on the Anime continuity this year