ic-core-caller
TypeScript icon, indicating that this package has built-in type declarations

1.2.9 • Public • Published

IC-CORE-CALLER

is a simple library that focuses on making API calls simpler. For this, some information or objects instantiated in its constructor will be made, which will be used to guarantee the method of all calls as instances made in it, but the path is known in the concept called. in addition, the library makes a second call within its methods, checking if the token is saved in a table. If it doesn't exist, the information is saved.

For the implementation we have two kinds of methods parameters:

// POST, PUT parameters
{
    path: string;
    body: unknown;
}

// GET parameters
{
    path: string;
}

The path will be concatenated with the base url informed in the object creation to form the called url and the body will be forward on the call;

The constructor object should follow this interface:

{
    base_url: string;
    auth_url: string;
}

The base_url defines the domain in which the instanced object will request informations, The auth_url defines the domain of which object is instantiated requesting information regarding authentication.

The implementation should occur like the following:

import CoreCaller from 'ic-core-caller';

const core_caller = new CoreCaller(connection_info, auth_url);
const result_get = api.get(get_parameters);
const result_post = api.post(post_parameters);
const result = api.put(post_parameters);

Readme

Keywords

Package Sidebar

Install

npm i ic-core-caller

Weekly Downloads

26

Version

1.2.9

License

MIT

Unpacked Size

58.8 kB

Total Files

81

Last publish

Collaborators

  • rafael.medeiros.iclubs
  • arthur_machado
  • danielgroh
  • rafael.moura1
  • rodrigovb
  • fernandocardoso
  • luccavaladares
  • gabrieliclubs