nimcatapi
nimcatapi is a library that lets you easily request images from thecatapi and/or thedogapi.
Summary
| Latest Version | 2.0.0 |
|---|---|
| License | GPL-3.0-only |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:25 |
Tags
Authors
- nirokay
Installation
nimble install nimcatapi
choosenim install nimcatapi
git clone https://github.com/nirokay/nimcatapi
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| nimcatapi | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= | 1.1.0 | No |
Source
| Repository | https://github.com/nirokay/nimcatapi |
|---|---|
| Homepage | https://github.com/nirokay/nimcatapi |
| Registry Source | nimble_official |
README
nimcatapi
About
nimcatapi is a library that lets you easily request images from thecatapi and/or thedogapi.
Installation
nimble install nimcatapi
To use it in your projects, include requires "nimcatapi" in your .nimble file and import it!
Usage
Most of the functionality works without a token. If you however would like to request a specific amount of images (except just one or ten), you will need to request an API token: thecatapi / thedogapi
Requesting images
You can easily request one or multiple random images.
import std/options
import nimcatapi
# Both APIs work the same way:
let
cats*: TheCatApi = newCatApiClient(token = "meow")
dogs*: TheDogApi = newDogApiClient() # works without a token as well!
# A single image:
let singleImage*: string = cats.requestImageUrl()
# Multiple images (without token you can only request 1 or 10 images, with a token 1-100):
let multipleImages*: seq[string] = cats.requestImageUrls(10)
# Customise search patterns:
let customImages*: seq[string] = cats.requestImageUrls(
size = sizeFull,
formats = @[formatGif, formatJpg, formatPng],
amount = 5
)
# Same but with Request object (used internally):
let customImagesWithObj*: seq[string] = cats.requestImageUrls(Request(
size: some sizeFull,
mime_types: some @[formatGif, formatJpg, formatPng],
limit: some 5
))
Requesting breeds
Requesting breeds functions the same across both APIs, however you will get differently structured responses.
import nimcatapi
let
dogs: TheDogApi = newDogApiClient()
breeds: seq[DogBreed] = dogs.requestBreeds()
echo "Got " & breeds.len() & " dog breeds!"
For proper documentation about DogBreed and CatBreed objects, please visit the docs!
Documentation
For detiled documentation, please visit the nim generated docs page!