/dila-api-client

a client for the (currently private) DILA API that publishes the french law

Primary LanguageTypeScript

Dila Api Client

NPM

Build Status Pipeline status NPM version codecov jest renovate

This JS package helps querying the DILA API

Usage

You need to set two environment variables : OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET.

These variables are the "oauth identifier" defined in your custom application in the AIFE portal

You can also override the variables API_HOST (https://api.aife.economie.gouv.fr/dila/legifrance-beta/lf-engine-app) and TOKEN_HOST (https://oauth.aife.economie.gouv.fr) for AIFE endpoints.

Récupérer la table des matières d'un code

const DilaApiClient = require("dila-api-client");

const dilaApi = new DilaApiClient();

// fetch table des matières code-du-travail
dilaApi
  .fetch({
    path: "consult/code/tableMatieres",
    method: "POST",
    params: {
      date: new Date().getTime(),
      sctId: "",
      textId: "LEGITEXT000006072050"
    }
  })
  .then(console.log);

// fetch list of available codes
dilaApi
  .fetch({
    path: "list/code",
    method: "POST"
  })
  .then(console.log);

See also ./examples

Debug

you need to set the DEBUG=dila-api-client environment variable in order to see the output of inner logs.

Release policy

Auto

Trigger a custom build on Travis (in the "More options" right menu) on the master branch with a custom config:

env:
  global:
    - RELEASE=true

You can change the lerna arguments though the LERNA_ARGS variable.

env:
  global:
    - STANDARD_VERSION_ARGS="--release-as major"
    - RELEASE=true