From 052421193590083fe82b5044f8a69cae5f5cb8d0 Mon Sep 17 00:00:00 2001 From: Nicolas MASSE Date: Fri, 28 Oct 2022 22:13:21 +0200 Subject: [PATCH] doc --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 26b3306..aa17eb2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,24 @@ # Ego2mix This Go library calls the Eco2mix API from RTE and returns data about the French electricity grid. + +## Usage + +```go +package main + +import ( + "fmt" + + ego2mix "github.com/nmasse-itix/ego2mix" +) + +func main() { + client := ego2mix.NewEco2mixClient("", nil) + records, err := client.FetchNationalRealTimeData(1) // we want only the last result + if err != nil { + panic(err) + } + fmt.Printf("Intensité carbone à %s en France: %d gCO2eq / kWh\n", records[0].DateHeure, records[0].TauxCo2) +} +```