API to create fancy cards for FFXIV characters based on their Lodestone data, hosted at https://ffxiv-character-cards.herokuapp.com.
Find a file
2021-10-25 16:47:34 +02:00
.github/workflows clean up release with ay suggestions 2021-06-04 21:57:23 -04:00
resources Moved resource files into one directory 2021-10-25 16:40:53 +02:00
.gitignore ignore package-lock 2021-06-04 21:59:25 -04:00
.npmignore Add .github to .npmignore 2021-05-28 02:30:55 -07:00
create-card.js Consistent styling: no var for CardCreator 2021-10-25 16:47:34 +02:00
create-ilvl-filter.js Updated createIlvlFilter to include xivApiKey 2021-10-25 16:42:13 +02:00
gh-pages.js Updated gh-pages to similar styling 2021-10-25 16:42:28 +02:00
index.js Added optional xivApiKey to CardCreator 2021-10-25 16:41:34 +02:00
LICENSE Create LICENSE 2021-05-27 12:41:32 -04:00
package.json Added rate limiter to all XIV API requests 2021-10-25 16:40:39 +02:00
readme.md Add badges to README 2021-05-27 19:28:10 -07:00
yarn.lock Added rate limiter to all XIV API requests 2021-10-25 16:40:39 +02:00

XIV Character Cards

npm Version Documentation

API to create fancy cards for FFXIV characters based on their Lodestone data, hosted at https://ffxiv-character-cards.herokuapp.com.

Demo image

Endpoints

Getting images

https://ffxiv-character-cards.herokuapp.com/characters/id/<LODESTONE ID>.png
Get the PNG for a character by its Lodestone ID.


https://ffxiv-character-cards.herokuapp.com/characters/name/<WORLD>/<CHARACTER NAME>.png
Get the PNG for a character by its world and name.

Requesting images to be cached

If you are using this API together with an application that requires the API to respond very quickly, like Discord, you need to ask it to "prepare" the image for a character beforehand.

https://ffxiv-character-cards.herokuapp.com/prepare/id/<LODESTONE ID>
Request a character image to be cached by its Lodestone ID.


https://ffxiv-character-cards.herokuapp.com/prepare/name/<WORLD>/<CHARACTER NAME>
Request a character image to be cached by its world and name.

The API will reply with its status, and in case of success, the URL to the final image. {"status":"ok","url":"/characters/id/123456789.png"}

Using in your application

yarn add xiv-character-cards
# or
npm i xiv-character-cards

You will receive a PNG-buffer for you to use in your bot or application.
Check index.js for other usage examples.

Example

const { CardCreator } = require("xiv-character-cards");
const fs = require("fs");

const card = new CardCreator();
const lodestoneid = "13821878";

function example(cb) {
  card.ensureInit()
    .then(
      () => card.createCard(lodestoneid),
      (reason) => cb("Init failed: " + reason, null)
    )
    .then((image) =>
      cb(null, {
        binary: {
          image: image,
        },
      })
    )
    .catch((reason) => cb("createCard failed: " + reason, null));
}

example((err, response) => {
  const buffer = response.binary.image;
  fs.writeFileSync(`./${lodestoneid}.png`, response.binary.image, (err) => {
    if (err) {
      console.log(err);
    }
  });
});