1.8.0 • Published 8 months ago

@dnum-mi/ds-api-client v1.8.0

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
8 months ago

ds-api-client

Un DS Client GraphQL prenant en charge Node et les navigateurs pour les scripts ou les applications simples

Fonctionnalités

  • DS API V2 Client GraphQL
  • Promise-based API (fonctionne avec async / await)
  • Prise en charge de TypeScript
  • Isomorphic (fonctionne avec Node / navigateurs)

Run Test

cp test/env.example .env 
# Changer les valeurs dans le .env
npm test

Installation

NPM: https://www.npmjs.com/package/@dnum-mi/ds-api-client

npm add ds-api-client

Utilisation

import { DsApiClient } from 'ds-api-client'

const token = 'xxxxx'
const url = 'https://www.demarches-simplifiees.fr/api/v2/graphql'

// ... Créer une instance DS API client  
const client = new DsApiClient(url, token)

// ... Créer une instance DS API client avec un http proxy
const client = new DsApiClient(url, token, proxyUrl)

// ... Rechercher une demarche par id de demarche 
const demarche = await client.demarche(idDemarche)

// ... Rechercher les dossiers d'une demarche par id de demarche 
const demarcheDossiers = await client.demarcheDossiers(idDemarche).then((data) => console.log(data))

// ... Rechercher les dossiers supprimés d'une demarche par id de demarche 
const demarcheDeletedDossiers = await client.demarcheDeletedDossiers(idDemarche).then((data) => console.log(data))

// ... Rechercher un dossier par id de dossier
const dossier = await client.dossier(idDossier).then((data) => console.log(data))

// ... Rechercher les groupeInstructeur par une id
const groupeInstructeur = await client.groupeInstructeur(idGroupeInstructeur).then((data) => console.log(data))

Generation des types à partir du schema grapghql

Le schema de Demarches-Simplifiées peut-être récupérer de lien ici.

Pour générer, utliser le site generation https://the-guild.dev/graphql/codegen. La configuration à mettre est au nivau de codegen.yml est

generates:
  generated-types.ts:
    plugins:
      - typescript
    config:
      enumsAsConst: true

Publier dans le registre npm

  • Sur un action de 'push' ou fusion sur la branche "main", un "pull resquet" de création de "release" sera crée
  • Fusionner cet "pull request" sur main
1.8.0

8 months ago

1.7.12

12 months ago

1.7.13

11 months ago

1.7.10

1 year ago

1.7.11

1 year ago

1.7.9

1 year ago

1.7.8

1 year ago

1.7.7

1 year ago

1.7.6

1 year ago

1.7.5

1 year ago

1.7.4

1 year ago

1.7.3

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.2.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.1.4

2 years ago