Ichigo
Simple and lightweight SauceNAO API wrapper written in Crystal.
Installation
-
Add the dependency to your
shard.yml
:dependencies: ichigo: github: Staraway225/ichigo version: 0.1.1
-
Run
shards install
Usage
require "ichigo"
Examples
-
Search by an image url:
client = Ichigo::Client.new "your_saucenao_api_key_here" response = client.search "https://example.com/image.png" pp response
-
Search by a local image:
-
by an image path as
String
:image = "/path/to/image.png" client = Ichigo::Client.new "your_saucenao_api_key_here" response = client.search(file: image) pp response
-
by an image path as
Path
object:image = Path["/path/to/image.png"] client = Ichigo::Client.new "your_saucenao_api_key_here" response = client.search(file: image) pp response
-
by an image as
File
object:image = File.new("/path/to/image.png") client = Ichigo::Client.new "your_saucenao_api_key_here" response = client.search(file: image) pp response
-
by an image as
IO
object:image = IO::Memory.new File.read("/path/to/image.png") client = Ichigo::Client.new "your_saucenao_api_key_here" response = client.search(file: image) pp response
-
You can also use Ichigo::RawClient
to perform a request with raw values:
raw_client = Ichigo::RawClient.new "your_saucenao_api_key_here"
response = raw_client.search(
url: "https://example.com/image.png",
mask: 8191_i64,
site: 5,
result_count: 8
)
pp response
Contributing
- Make your changes.
- Add additional specs if you introduced new logic, make sure they pass (
crystal spec
). - Run the code formatter (
crystal tool format
). - Check for code issues by using linter (
bin/ameba
). - Create a new pull request.