Documentation
¶
Index ¶
Constants ¶
View Source
const StoriesBaseURL = "/s"
View Source
const TagsBaseURL = "/tags"
Variables ¶
This section is empty.
Functions ¶
func NewStdLogger ¶
func NewStdLogger(l Logger) retryablehttp.Logger
Types ¶
type Client ¶
type Client struct { Stories StoriesService Tags TagsService // contains filtered or unexported fields }
func NewClient ¶
func NewClient(cc *ClientConfig) *Client
type ClientConfig ¶
type ClientConfig struct { Endpoint string Credentials map[string]string HTTPClient *http.Client Logger Logger }
func NewDefaultClientConfig ¶
type Logger ¶
type Logger interface { Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) }
type RequestError ¶
type RequestError struct {
Err error
}
func (*RequestError) Error ¶
func (re *RequestError) Error() string
type StoriesService ¶
type StoriesService interface { Show( ctx context.Context, id string, ) (*StoryModel, error) List( ctx context.Context, tag string, ) (*[]StoryModel, error) }
type StoryModel ¶
type StoryModel struct { ShortID string `json:"short_id"` ShortIDURL string `json:"short_id_url"` CreatedAt string `json:"created_at"` Title string `json:"title"` URL string `json:"url"` Score int `json:"score"` Flags int `json:"flags"` CommentCount int `json:"comment_count"` Description string `json:"description"` DescriptionPlain string `json:"description_plain"` CommentsURL string `json:"comments_url"` CategoryID int `json:"category_id"` SubmitterUser UserModel `json:"submitter_user"` Tags []string `json:"tags"` Comments []struct { ShortID string `json:"short_id"` ShortIDURL string `json:"short_id_url"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` IsDeleted bool `json:"is_deleted"` IsModerated bool `json:"is_moderated"` Score int `json:"score"` Flags int `json:"flags"` ParentComment string `json:"parent_comment"` Comment string `json:"comment"` CommentPlain string `json:"comment_plain"` CommentsURL string `json:"comments_url"` URL string `json:"url"` IndentLevel int `json:"indent_level"` CommentingUser UserModel `json:"commenting_user"` } `json:"comments"` }
type StoryServiceHandler ¶
type StoryServiceHandler struct {
// contains filtered or unexported fields
}
func (*StoryServiceHandler) List ¶
func (a *StoryServiceHandler) List( ctx context.Context, tag string, ) (*[]StoryModel, error)
List
func (*StoryServiceHandler) Show ¶
func (a *StoryServiceHandler) Show( ctx context.Context, id string, ) (*StoryModel, error)
Show
type TagModel ¶
type TagModel struct { ID int `json:"id"` Tag string `json:"tag"` Description string `json:"description"` Privileged bool `json:"privileged"` IsMedia bool `json:"is_media"` Active bool `json:"active"` HotnessMod float32 `json:"hotness_mod"` PermitByNewUsers bool `json:"permit_by_new_users"` CategoryID int `json:"category_id"` }
type TagServiceHandler ¶
type TagServiceHandler struct {
// contains filtered or unexported fields
}
type UserModel ¶
type UserModel struct { Username string `json:"username"` CreatedAt string `json:"created_at"` IsAdmin bool `json:"is_admin"` About string `json:"about"` IsModerator bool `json:"is_moderator"` Karma int `json:"karma"` AvatarURL string `json:"avatar_url"` InvitedByUser string `json:"invited_by_user"` GithubUsername string `json:"github_username"` TwitterUsername string `json:"twitter_username"` }
Click to show internal directories.
Click to hide internal directories.