The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/api
Roberto Jiménez Sánchez ae4dc181d1
Provisioning: Add user token to git and bitbucket repository specs (#108186)
4 days ago
..
clients Provisioning: Add user token to git and bitbucket repository specs (#108186) 4 days ago
README.md API clients: Add generator (#104093) 3 months ago
createBaseQuery.ts API Client: Add client-level error handler (#102091) 4 months ago
utils.ts Chore: reduces barrel files part II (#107688) 2 weeks ago

README.md

Generating RTK Query API Clients

To show the steps to follow, we are going to work on adding an API client to create a new dashboard. Just adapt the following guide to your use case.

1. Generate an OpenAPI snapshot

First, check if the group and the version are already present in openapi_test.go. If so, move on to the next step.
If you need to add a new block, you can check for the right group and version in the backend API call that you want to replicate in the frontend.

{
  Group:   "dashboard.grafana.app",
  Version: "v0alpha1",
}

Afterwards, you need to run the TestIntegrationOpenAPIs test. Note that it will fail the first time you run it. On the second run, it will generate the corresponding OpenAPI spec, which you can find in openapi_snapshots.

Note: You don’t need to follow these two steps if the group you’re working with is already in the openapi_test.go file.

2. Run the API generator script

Run yarn generate:api-client and follow the prompts. See API Client Generator for details.