Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nishanths/go-xkcd
xkcd.com API client in Go
https://github.com/nishanths/go-xkcd
Last synced: about 2 months ago
JSON representation
xkcd.com API client in Go
- Host: GitHub
- URL: https://github.com/nishanths/go-xkcd
- Owner: nishanths
- License: mit
- Created: 2016-02-26T05:14:31.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-23T01:37:07.000Z (about 2 years ago)
- Last Synced: 2024-10-25T05:25:18.953Z (about 2 months ago)
- Language: Go
- Homepage: https://pkg.go.dev/github.com/nishanths/go-xkcd/v2
- Size: 95.7 KB
- Stars: 51
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - go-xkcd - Go client for the xkcd API. (Third-party APIs / Utility/Miscellaneous)
- awesome-go - go-xkcd - xkcd.com API client - ★ 36 (Third-party APIs)
- awesome-go-extra - go-xkcd - 02-26T05:14:31Z|2021-10-27T13:26:22Z| (Third-party APIs / Fail injection)
README
# go-xkcd
HTTP Client for the xkcd API.
[![wercker status](https://app.wercker.com/status/6c1de0bfd64a428d6ece5a2337268160/s "wercker status")](https://app.wercker.com/project/bykey/6c1de0bfd64a428d6ece5a2337268160) [![Coverage Status](https://coveralls.io/repos/github/nishanths/go-xkcd/badge.svg?branch=master)](https://coveralls.io/github/nishanths/go-xkcd?branch=master)
[![GoDoc](https://godoc.org/github.com/nishanths/go-xkcd?status.svg)](https://godoc.org/github.com/nishanths/go-xkcd)[](https://xkcd.com/1481/)
Details on the xkcd API can be found [here](https://xkcd.com/json.html).
## Install
Outside a project using go modules, get the latest version by running:
```
go get github.com/nishanths/go-xkcd
```Inside a project using go modules, use:
```
go get github.com/nishanths/go-xkcd/v2
```## Example
The following program prints details about [xkcd.com/599](http://xkcd.com/599):
```go
package mainimport (
"context"
"fmt"
"log""github.com/nishanths/go-xkcd/v2"
)func main() {
client := xkcd.NewClient()comic, err := client.Get(context.Background(), 599)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s: %s\n", comic.Title, comic.ImageURL) // Apocalypse: http://imgs.xkcd.com/comics/apocalypse.png
}
```## Test
To run tests:
```
$ go test -race
```## Godoc
https://godoc.org/github.com/nishanths/go-xkcd
## License
The [MIT License](http://nishanths.mit-license.org). Copyright © [Nishanth Shanmugham](https://github.com/nishanths).