Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Profile(username string) (UserModel, ContentModel, error)
- func (c *Client) Rant(rantId int) (RantModel, []CommentModel, error)
- func (c *Client) Rants(sort string, limit int, skip int) ([]RantModel, error)
- func (c *Client) Search(term string) ([]RantModel, error)
- func (c *Client) Surprise() (RantModel, error)
- func (c *Client) WeeklyRants() ([]RantModel, error)
- type CommentModel
- type ContentModel
- type GetUserIdResponse
- type ImageModel
- type NewsModel
- type RantModel
- type RantResponse
- type RantsResponse
- type SearchResponse
- type UserModel
- type UserResponse
Constants ¶
View Source
const ( API = "https://www.devrant.io/api" APP_VERSION = 3 RANTS_PATH = "%s/devrant/rants?sort=%s&limit=%d&skip=%d&app=%d" RANT_PATH = "%s/devrant/rants/%d?app=%d" USER_PATH = "%s/users/%d?app=%d" USER_ID_PATH = "%s/get-user-id?username=%s&app=%d" SEARCH_PATH = "%s/devrant/search?term=%s&app=%d" SURPRISE_PATH = "%s/devrant/rants/surprise?app=%d" WEEKLY_PATH = "%s/devrant/weekly-rants?app=%d" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
}
func (*Client) Profile ¶
func (c *Client) Profile(username string) (UserModel, ContentModel, error)
Fetches ranter's profile data
func (*Client) Rant ¶
func (c *Client) Rant(rantId int) (RantModel, []CommentModel, error)
Fetches a rant and its comments given a valid rant id
func (*Client) WeeklyRants ¶
Returns the rants tagged for 'weekly'
type CommentModel ¶
type CommentModel struct {
Id int `json:"id"`
RantId int `json:"rant_id"`
Body string `json:"body"`
Upvotes int `json:"num_upvotes"`
Downvotes int `json:"num_downvotes"`
Score int `json:"score"`
CreatedTime int `json:"created_time"`
UserId int `json:"user_id"`
UserUsername string `json:"user_username"`
UserScore int `json:"user_score"`
}
type ContentModel ¶
type ContentModel struct {
Rants []RantModel `json:"rants"`
Upvoted []RantModel `json:"upvoted"`
Comments []CommentModel `json:"comments"`
Favorites []RantModel `json:"favorites"`
}
type GetUserIdResponse ¶
type ImageModel ¶
type RantModel ¶
type RantModel struct {
Id int `json:"id"`
Text string `json:"text"`
Upvotes int `json:"num_upvotes"`
Downvotes int `json:"num_downvotes"`
Score int `json:"score"`
CreatedTime int `json:"created_time"`
AttachedImage ImageModel `json:"attached_image"`
NumComments int `json:"num_comments"`
Tags []string `json:"tags"`
UserId int `json:"user_id"`
UserUsername string `json:"user_username"`
UserScore int `json:"user_score"`
}
type RantResponse ¶
type RantResponse struct {
Success bool `json:"success"`
Error string `json:"error"`
Rant RantModel `json:"rant"`
Comments []CommentModel `json:"comments"`
}
type RantsResponse ¶
type SearchResponse ¶
type UserModel ¶
type UserModel struct {
Username string `json:"username"`
Score int `json:"score"`
About string `json:"about"`
Location string `json:"location"`
CreatedTime int `json:"created_time"`
Skills string `json:"skills"`
Github string `json:"github"`
Content struct {
Content ContentModel `json:"content"`
} `json:"content"`
}
type UserResponse ¶
Click to show internal directories.
Click to hide internal directories.