This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: génère la documentation automatiquement (#431)
- Loading branch information
1 parent
6fe11e7
commit f76cce1
Showing
36 changed files
with
1,196 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ | |
/dist | ||
/docs | ||
/files | ||
/manual | ||
/docs-sources | ||
/node_modules | ||
/sources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Docs | ||
|
||
on: | ||
release: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- name: Generate docs | ||
run: | | ||
npm ci | ||
npm run docs | ||
env: | ||
CI: true | ||
- name: Build Docker image | ||
run: docker build -f Dockerfile.docs . --tag caminofr/camino-api-docs | ||
- name: Push Docker image to the Docker Hub | ||
run: | | ||
docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" | ||
docker push caminofr/camino-api-docs | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM nginx | ||
COPY default.conf.template /etc/nginx/templates/default.conf.template | ||
COPY docs /usr/share/nginx/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
server { | ||
listen ${NGINX_PORT}; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '3' | ||
|
||
services: | ||
app: | ||
image: caminofr/camino-api-docs | ||
environment: | ||
VIRTUAL_HOST: ${URL} | ||
VIRTUAL_PORT: ${PORT} | ||
LETSENCRYPT_HOST: ${URL} | ||
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} | ||
NGINX_PORT: ${PORT} | ||
expose: | ||
- ${PORT} | ||
restart: always | ||
|
||
networks: | ||
default: | ||
external: | ||
name: nginx-proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Utilisation de l'API de Camino | ||
|
||
> [api.camino.beta.gouv.fr](https://api.camino.beta.gouv.fr) | ||
L'API de Camino propose deux manières d'interagir: | ||
|
||
- {@page API GraphQL} (complète) | ||
- {@page API Rest} (interaction limitée) |
26 changes: 15 additions & 11 deletions
26
manual/api/readme.md → docs-sources/01-utilisation/02-graphql.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
# Api GraphQL | ||
# Api GraphQL de Camino | ||
|
||
- [Documentation offcielle de GraphQL](https://graphql.org/) | ||
L'API GraphQl de Camino est accessible à cette url: [api.camino.beta.gouv.fr/](https://api.camino.beta.gouv.fr/). | ||
|
||
## Requêtes avec _GraphiQL_ | ||
La documentation de cette API est consultable dans l'onglets `Docs` (en haut à droite) de l'application _GraphiQL_. | ||
|
||
_GraphiQL_ est une application qui permet de tester une API GraphQL dans un navigateur. Pour Camino, elle est accessible à l'url racine de l'API: https://api.camino.beta.gouv.fr/. | ||
## _GraphiQL_ | ||
|
||
_GraphiQL_ expose une documentation de l'API qui est accessible en cliquant sur le bouton `Docs` (en haut à droite). | ||
_GraphiQL_ est une application qui permet de consulter la documentation et de tester une API GraphQL dans un navigateur. Concernant l'API Camino, cette application est accessible à l'url racine de l'API: [api.camino.beta.gouv.fr/](https://api.camino.beta.gouv.fr/). | ||
|
||
Des exemples de requêtes se trouvent dans [ce dossier](https://github.com/MTES-MCT/camino-api/blob/master/tests/queries/). | ||
|
||
### Requêtes simples | ||
|
||
Par exemple, pour obtenir la liste des substances: | ||
|
||
- copier une requête dans le champs principal de l'interface de _GraphiQL_: [substances.graphql](https://github.com/MTES-MCT/camino-api/blob/master/manual/api/queries/substances.graphql) | ||
- valider en cliquant sur le bouton "play" | ||
- copier une requête dans le champs principal de l'interface de _GraphiQL_: [substances.graphql](https://github.com/MTES-MCT/camino-api/blob/master/tests/queries/substances.graphql) | ||
- valider en cliquant sur le bouton `▶`. | ||
|
||
### Requêtes avec des variables | ||
|
||
Certaines requêtes nécessitent le passage de variables. Par exemple, pour obtenir la liste des titres: | ||
|
||
- copier la requête dans le champs principal de l'interface de _GraphiQL_: [titres.graphql](https://github.com/MTES-MCT/camino-api/blob/master/manual/api/queries/titres.graphql) | ||
- copier les variables dans le champs `query variables` (en bas à gauche de l'écran): [titres-variables.json](https://github.com/MTES-MCT/camino-api/blob/master/manual/api/queries/titres-variables.json) | ||
- valider en cliquant sur le bouton "play" | ||
- copier la requête dans le champs principal de l'interface de _GraphiQL_: [titres.graphql](https://github.com/MTES-MCT/camino-api/blob/master/tests/queries/titres.graphql) | ||
- copier les variables dans le champs `query variables` (en bas à gauche de l'écran): [titres-variables.json](https://github.com/MTES-MCT/camino-api/blob/master/tests/queries/titres-variables.json) | ||
- valider en cliquant sur le bouton `▶`. | ||
|
||
### Requêtes nécessitant une authentification | ||
|
||
Certaines requêtes sont protégées et nécessitent une authentification par token (jwt). Pour les tester, il faut passer le token dans le header http de la requête. Cela n'est pas possible avec l'interface _GraphiQL_. C'est possible avec [GraphQL Playground](https://github.com/prisma/graphql-playground), [GraphiQL App](https://github.com/skevy/graphiql-app) ou une application pour faire des requêtes http ([exemple](https://github.com/MTES-MCT/camino-api/blob/master/manual/api/test.http)). | ||
Certaines requêtes sont protégées et nécessitent une authentification par token (jwt). Pour les tester, il faut passer le token dans le header http de la requête. Cela n'est pas possible avec _GraphiQL_. C'est possible avec [GraphQL Playground](https://github.com/prisma/graphql-playground), [GraphiQL App](https://github.com/skevy/graphiql-app). | ||
|
||
### Liens | ||
|
||
- [Documentation offcielle de GraphQL](https://graphql.org/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Api Rest de Camino |
Empty file.
File renamed without changes.
Oops, something went wrong.