package xkcd
import "gitea.com/jolheiser/xkcd"
Index ¶
- type Client
- func New(opts ...ClientOption) *Client
- func (c *Client) Comic(ctx context.Context, num int) (*Comic, error)
- func (c *Client) Current(ctx context.Context) (*Comic, error)
- type ClientOption
- type Comic
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an XKCD client
func New ¶
func New(opts ...ClientOption) *Client
New returns a new XKCD Client
func (*Client) Comic ¶
Comic gets a specific XKCD Comic
func (*Client) Current ¶
Current gets the current XKCD Comic
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is options for a Client
func WithHTTP ¶
func WithHTTP(client *http.Client) ClientOption
WithHTTP sets the http.Client for the XKCD Client
type Comic ¶
type Comic struct {
Month string `json:"month"`
Num int `json:"num"`
Link string `json:"link"`
Year string `json:"year"`
News string `json:"news"`
SafeTitle string `json:"safe_title"`
Transcript string `json:"transcript"`
Alt string `json:"alt"`
Img string `json:"img"`
Title string `json:"title"`
Day string `json:"day"`
}
Comic is an XKCD comic
Source Files ¶
client.go xkcd.go
Directories ¶
| Path | Synopsis |
|---|---|
| cmd | |
| cmd/xkcd |
- Version
- v0.0.2 (latest)
- Published
- May 5, 2021
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 year ago –
Tools for package owners.