πŸ†“Custom request

It is possible that there are missing implementations, to counter this problem we propose you the possibility to use the http client built in the repository and the JSON parser that allows to translate objects.

For this, you need to use the VidalRespository. If you use injection, you can inject it in your desired provider. If you use classic method, you can get this class with exported function vidalClient.

const { api } = await vidalClient({
    auth: {
        clientId: '*****',
        clientSecret: '*************',
    }
});

Usage

This method is used like the basic axios method. The options are of type AxiosRequestConfig and the result is processed by our JSON parser.

You can use custom method like this

import { vidalClient } from '@monordo/json-vidal-client';


(async () => {
    const { client, api, routes } = await vidalClient({
        auth: {
            clientId: '************',
            clientSecret: '********************',
        }
    });
    
    const result = await api.custom({
        method: 'GET',
        url: "package/37939" // or you can use : routes.package(37939),
    })
    console.log(result);
})();

Last updated