go-grab-xkcd: github.com/carlmjohnson/go-grab-xkcd/grabxkcd Index | Files

package grabxkcd

import "github.com/carlmjohnson/go-grab-xkcd/grabxkcd"

Index

Package Files

api.go grabxkcd.go

Constants

const LatestComic = 0

LatestComic is a magic number that grabs whatever is the latest comic

func BuildURL Uses

func BuildURL(comicNumber int) string

BuildURL from comicNumber (or LatestComic).

func CLI Uses

func CLI(args []string) int

CLI runs the go-grab-xkcd command line app and returns its exit status.

type APIResponse Uses

type APIResponse struct {
    Month       string `json:"month"`
    Number      int    `json:"num"`
    Link        string `json:"link"`
    Year        string `json:"year"`
    News        string `json:"news"`
    SafeTitle   string `json:"safe_title"`
    Transcript  string `json:"transcript"`
    Description string `json:"alt"`
    Image       string `json:"img"`
    Title       string `json:"title"`
    Day         string `json:"day"`
}

APIResponse returned by the XKCD API

func (APIResponse) Date Uses

func (ar APIResponse) Date() *time.Time

Date returns a *time.Time based on the API strings (or nil if the response is malformed).

func (APIResponse) Filename Uses

func (ar APIResponse) Filename() string

type Output Uses

type Output struct {
    Title       string `json:"title"`
    Number      int    `json:"number"`
    Date        string `json:"date"`
    Description string `json:"description"`
    Image       string `json:"image"`
}

Output is the JSON output of this app

Package grabxkcd imports 8 packages (graph). Updated 2020-06-01. Refresh now. Tools for package owners. This is a quick bug-fix fork (has fewer than three commits, and only during the week it was created).