Thanks to visit codestin.com
Credit goes to lib.haxe.org

monosodium

A lightweight, easy-to-use synchronous e621 / e926 API wrapper.
https://github.com/hackx2/monosodium

To install, run:

haxelib install monosodium 0.1.0 

See using Haxelib in Haxelib documentation for more information.

README.md

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


Contributors
hackx2
Version
0.1.0
Published
2 weeks ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub