Skip to content

hackx2/monosodium

Repository files navigation

monosodium logo


monosodium

A lightweight, easy-to-use synchronous e621 / e926 API wrapper written natively in Haxe.


Installation

  1. Install the library

Haxelib:

haxelib install monosodium

Git:

haxelib git monosodium https://github.com/hackx2/monosodium.git
  1. Adding the library to your project

HXML :

-lib monosodium

Lime/OpenFL :

<haxelib name="monosodium"/>

Basic Usage

final api:Monosodium = new monosodium.Monosodium(); // Create a new wrapper instance 
api.mirror(monosodium.Mirror.E926); // Change the mirror target (E926 / E621)
api.verbose = true; // Enable verbose mode (optional)
api.authorize('USERNAME', 'TOKEN'); // authorization

// Get a post using an id:
api.posts.get(
    12345, // Post id
    post -> trace('Post #${post.id} has rating ${post.rating}'), // success callback by tracing "Post #12345 has rating s"
    error -> trace(error) // error callback
);

// Get a random post:
api.posts.random(
    ["gay", "-female"], // tags
    post -> trace(post.file_url), // success callback by tracing the file url 
    error -> trace(error) // error callback
);

For more examples, please refer to Main


Resources used


About

A lightweight, easy-to-use synchronous e621 / e926 API wrapper written in Haxe

Resources

License

Stars

Watchers

Forks