Documentation
¶
Overview ¶
Package lemmy is a dependency-free read client for the Lemmy REST API (/api/v3). It targets CGO_ENABLED=0 builds and uses only the Go standard library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Instance is the base URL of the Lemmy instance,
// e.g. https://lemmy.world.
Instance string
// HTTPClient is used for all requests. Defaults to http.DefaultClient.
HTTPClient *http.Client
// UserAgent is sent with every request.
UserAgent string
// contains filtered or unexported fields
}
Client is a read client for a single Lemmy instance.
func New ¶
New returns a Client for the given instance base URL (e.g. https://lemmy.world). Trailing slashes are trimmed.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithHTTPClient ¶
WithHTTPClient sets the http.Client used for requests.
func WithUserAgent ¶
WithUserAgent sets the User-Agent header sent with every request.
type Post ¶
type Post struct {
ID int
Title string
URL string
Body string
Permalink string
ThumbnailURL string
Published time.Time
NSFW bool
Creator string
Community string
Score int
Comments int
}
Post is a flattened view of a Lemmy post.
type PostsOptions ¶
type PostsOptions struct {
Community string // community name; empty = instance-wide
Sort string // Active|Hot|New|Top...; default "Hot"
Type string // All|Local|Subscribed; default "All"
Limit int // default 20
Page int // 1-based; default 1
}
PostsOptions configures a Posts request.
Click to show internal directories.
Click to hide internal directories.