utils

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// APIVersion ...
	APIVersion = "1.1.0"
	// APIName ...
	APIName = "Droll GraphQL API"
	// ComicsSupported ...
	// TODO: Update this via JSON file
	ComicsSupported = []model.ComicInfo{
		model.ComicInfo{
			Name:  "xkcd",
			About: "A webcomic of romance, sarcasm, math, and language",
			Link:  "https://xkcd.com/",
			Logo:  "https://xkcd.com/s/0b7742.png",
		},
		model.ComicInfo{
			Name:  "phdcomic",
			About: "\"Piled Higher and Deeper\" (PhD) is the comic strip about life (or the lack thereof) in academia.",
			Link:  "https://phdcomics.com",
			Logo:  "http://www.userlogos.org/files/logos/inductiveload/PhD%20Comics.png",
		},
	}
	// Limit ...
	Limit = 10

	// XKCDComicName ...
	XKCDComicName = "xkcd"
	// XKCDBaseAPIURL ...
	XKCDBaseAPIURL = "https://xkcd.com/"
	// XKCDBaseAPIPath ...
	XKCDBaseAPIPath = "/info.0.json"
	// XKCDStartIndex ...
	XKCDStartIndex = 1

	// PHDComicName ...
	PHDComicName = "phdcomic"
	// PHDComicBaseURL ...
	PHDComicBaseURL = "http://phdcomics.com"
	// PHDComicBaseRoute ...
	PHDComicBaseRoute = "/comics/archive_print.php?comicid="
	// PHDComicLink ...
	PHDComicLink = "http://phdcomics.com/comics/archive.php?comicid="
)

Functions

func BuildAPIURL

func BuildAPIURL(comic string, num int) string

BuildAPIURL : Creates the API URL based on Comic and URL parameters

func FetchResponse

func FetchResponse(apiURL string) ([]byte, error)

FetchResponse : Gets response for HTTP GET request made on API URL

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL