Skip to content

NodeJS library made to retrieve data from Gennai API.

Notifications You must be signed in to change notification settings

GennaiAPI/gennai-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gennai Node

Gennai Node

Gennai Node is a modular library created to facilitate retrieving data from the Gennai API in a NodeJS enviroment utilizing promises.

Installation

With npm:

npm install gennai-node

Or using yarn:

yarn add gennai-node

Usage

Gennai Node is fully modularized, which means you can import only what you need, like so:

import { getDigimons } from 'gennai-node';

async () => {
  const digimonList = await getDigimons();
}

Or, for some reason, you can import everything in at once:

import * as Gennai from 'gennai-node';

async () => {
  const digimonList = await Gennai.getDigimons();
}

It's recommended to use only what you need, for better performance.

Examples

Get by ID

import { getDigimonById } from 'gennai-node';

const agumon = await getDigimonById(1);
const gabumon = await getDigimonById(2);

Get by name

import { getDigimonByName } from 'gennai-node';

const patamon = await getDigimonByName('patamon');
const gatomon = await getDigimonByName('gatomon');

Get all

import { getDigimons } from 'gennai-node';

const digimonList = await getDigimons();

With filters:

import { getDigimons } from 'gennai-node';

const digimonList = await getDigimons({
  offset: 1,
  limit: 3,
  order: 'desc',
  orderBy: 'name'
});

Endpoints

For a full list of endpoints and structures check the official API documentation.