1.0.8-rc • Published 1 year ago

kev-rcl-tsx v1.0.8-rc

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Rest Client Library

Hi guys, I'm just a beginner, and this is the first library I create and still in development, it's a Rest API Client Library for the RESTful Pokémon API -> https://pokeapi.co/, using a JavaScript Proxy. It was built in typescript so it's completely type safety. You can collaborate on the project if you want. I know there's already different libraries for this out there, but I made this just for learning, so leet me see your feedback :). At the beginning I wanted to create a rest api client library for all the restful apis that exist, but it's kinda hard :(, because I don't know all the queries parameter a restful api could have, so I first started focusing on just one.

Features I will add later

  • Auto caching.
  • A doc that explains how to use it.
  • An easier way to use it and with more options like:
# Here you get a pokemon by its id and then u can also select what you want to receive like GraphQL or tRPC.

const bulbasaur = await pokeApi.pokemon('get_by_id')('1')({ select: { name: true } }); // { name: Bulbasaur }
  • And more...

Example

  import { pokeApi } from 'kev-rcl-tsx'

  # get all pokemons
  const res = await pokeApi.pokemon('get_all')({ limit: 2, offset: 2 });

  # get pokemon by id
  const res = await pokeApi.pokemon('get_by_id')(1);

  # get pokemon by its name
  const res = await pokeApi.pokemon('get_by_id')('bulbasaur');

DEPRECATED

import { pokeApi } from 'kev-rcl-tsx'
    
# get all pokemons
const pokemons = await pokeApi.pokemon({
  # total of pokemons to get
  limit: 10, 
  offset: 10 
});

# get pokemon by id
const bulbasaur = await pokeApi.pokemon('1');

# get pokemon by its name
const bulbasaur = await pokeApi.pokemon('bulbasaur');
1.0.8-rc

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0-rc

1 year ago

1.0.0

1 year ago