Skip to content

Simple Nekos API wrapper written in Go

License

Notifications You must be signed in to change notification settings

rinnothing/go-necos

Repository files navigation

go-necos

Simple Nekos API wrapper written in Go

Go tests

Documentation for the API can be found by the links below:

nekosapi.com/docs | api.nekosapi.com/v3/docs

Usage

The wrapper provides you with a Client structure that has DefaultQuery field for setting the default query, which will be merged with every request from that Client, and Domain for setting base domain for all API calls.

All methods to interact with API (except 'Get a random image file redirect', which is not implemented) have the same names as in the documentation (with adding Get or Post prefixes here and there).

Mandatory arguments for calls are in the signature of methods and optional arguments are given through Request structure (simply a url.Values alias). What fields can be used by a call is stated in API docs or in the method comment.

To simplify the creation of Requests the wrapper gives you SetFields and AddFields functions that can set and add new fields to already existing Request or make a new one. Odd arguments are responsible for keys and even for values.

Also, since the API goal is to provide you with pictures, wrapper simplifies it here as well. You can use Save, SaveTemp and SaveSlice functions to create writers to file by given path, file in temp directory or to slice respectfully. The latter writers can be used by methods like DownloadImage, DownloadSample and Download to download images into them.

Examples of usage can be found in tests and in examples

About

Simple Nekos API wrapper written in Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages