ic-core-caller
v1.2.9
Published
Lib to make calls fetching or saving the token in table
Downloads
40
Readme
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);