# Routes

The library provides a class that allows to build the urls of the API vidal. You can use it with and without injection. If you use the injection, you just have to inject the provider `VidalRoutes`. If you use the classic method, you can retrieve it from the `vidalClient` function.

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


(async () => {
    const { client, api, routes } = await vidalClient({
        auth: {
            clientId: 'b566ca15',
            clientSecret: 'ff1a663ec6c71c272d51cd62ef702c3d',
        }
    });


    result = await api.custom({
        method: 'GET',
        url: routes.package(37939),
    })
})();

```

You can use:

```typescript
packages = () => 'packages';

package = (id: number) => `package/${id}`;

packageIndicators = (id: number) => `package/${id}/indicators`;

search = (code: number, filter: 'package' | 'product' | 'ucd') => `search?code=${code}&filter=${filter}`;

vmp = (id: number) => `vmp/${id}`;

vmpProducts = (id: number) => `vmp/${id}/products`;

productPackages = (id: number) => `product/${id}/packages`;

productMolecules = (id: number) => `product/${id}/molecules`;

```
