Documentation
¶
Overview ¶
Package linuxdo is the library behind the linuxdo command: the HTTP client, request shaping, and the typed data models for linux.do.
The client fetches from the public Discourse JSON API at https://linux.do. No authentication is required. It sets a real User-Agent, paces requests, and retries transient 429/5xx errors with exponential backoff.
Index ¶
Constants ¶
const DefaultUserAgent = "linuxdo/dev (+https://github.com/tamnd/linuxdo-cli)"
DefaultUserAgent identifies the client to linux.do.
const Host = "linux.do"
Host is the hostname this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the linux.do Discourse JSON API.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
}
Config holds constructor parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults for linux.do.
type Domain ¶ added in v0.1.1
type Domain struct{}
Domain is the linux.do kit driver. It exposes hot, latest, and top topics from the Discourse-based linux.do forum. No API key is required.
func (Domain) Info ¶ added in v0.1.1
func (Domain) Info() kit.DomainInfo
Info returns the scheme, hostnames, and identity for the linuxdo domain.
type Topic ¶
type Topic struct {
ID int `json:"id"`
Title string `json:"title"`
Slug string `json:"slug"`
ReplyCount int `json:"reply_count"`
CreatedAt string `json:"created_at"`
LikeCount int `json:"like_count"`
Views int `json:"views"`
}
Topic is a single Discourse topic record.