0.3.3 • Published 8 years ago

weeb-sh v0.3.3

Weekly downloads
17
License
ISC
Repository
github
Last release
8 years ago

ci-badge docs-badge

weeb-sh

Weeb-SH is a Typescript Library which makes interacting with weeb.sh v2 simple.

Installation

If using yarn,

$ yarn add weeb-sh --save

If using npm,

$ npm install weeb-sh --save

To use the library you need to obtain a WeebAPI token.

If using a WolkeToken, create the WeebSH instance this way:

import WeebSH, { TokenType } from 'weeb-sh'

const weebSh = new WeebSH(process.env.WOLKE_TOKEN, TokenType.Wolke);

Examples

Get an array of all the current types:

import WeebSH from "weeb-sh";

const weebSh = new WeebSH(process.env.TOKEN);

(async () => {
  let response;

  try {
    response = await weebSh.getTypes();
  } catch(e) {
    // Handle error with request

    console.log(e);
    return;
  }
  // Do something with returned response

  console.log(response);
})();

Get an array of all the current tags:

import WeebSH from "weeb-sh";

const weebSh = new WeebSH(process.env.TOKEN);

(async () => {
  let response;

  try {
    response = await weebSh.getTags()
  } catch(e) {
    // Handle error with request

    console.log(e);
    return;
  }
  //Do something with response

  console.log(response);
})();

Get info on an image by its ID:

import WeebSH from "weeb-sh";

const weebSh = new WeebSH(process.env.TOKEN);

(async () => {
  let response;

  try {
    response = await weebSh.getImage(id)
  } catch(e) {
  // Handle error with request

   console.log(e);
   return;
  }
  // Do something with returned response

  console.log(response);
})();

Supplying all options:

import WeebSH from "weeb-sh";

const weebSh = new WeebSH(process.env.TOKEN);

(async () => {
  let response;

  try {
    response = await weebSh.getRandom({
      type: "kiss",
      tags: "girl",
      nsfw: "true",
    });
  } catch(e) {
    // Handle error with request

    console.log(e);
    return;
  }
  // Do something with the returned response

  console.log(response);
})();

Image request options:

const options = {
  type: string, // Image type
  tags: string, // Image tags, a list of tags seperated by commas
  nsfw: string, // false(no nsfw), true(nsfw and no-nsfw), only(only nsfw)
}

License

This project is licensed under ISC.

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago