Notwithstanding Precautions, Misadventure

    slothpixel
    TypeScript icon, indicating that this package has built-in type declarations

    1.2.1 • Public • Published

    slothpixel Travis CI Build Status

    A simplified interface for the Slothpixel API.

    NPM Badge

    Install

    npm install slothpixel

    Usage

    const slothpixel = require("slothpixel");
     
    (async () => {
        const { uuid } = await slothpixel("players/Richienb");
     
        console.log(uuid);
        //=> "56da43a4088d4a7682b6dd431535015e"
    })();

    API

    slothpixel(endpoint, options?)

    endpoint

    Type: string

    The API endpoint to call.

    options

    Type: object

    The options to pass to the API.

    slothpixel.graphql(data)

    Send a request to the Slothpixel Graphql API.

    data

    Type: object

    The Graphql data to send. See https://graphql.org/learn/serving-over-http/#post-request.

    const slothpixel = require("slothpixel");
     
    (async () => {
        const query = `{
            players {
                player(player_name: "Richienb") {
                    uuid
                }
            }
        }`;
     
        const data = await slothpixel.graphql({ query });
     
        console.log(data.players.player.uuid)
        //=> "56da43a4088d4a7682b6dd431535015e"
    })();

    slothpixel.SlothpixelError

    Exposed for instanceof checks. This type of error is thrown when the API returns an error.

    Install

    npm i slothpixel

    DownloadsWeekly Downloads

    6

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    5.91 kB

    Total Files

    6

    Last publish

    Collaborators

    • richienb