An open API service indexing awesome lists of open source software.

https://github.com/fluffynuts/lights-out

A dotnet wrapper for the Eskom Se Push load-shedding api
https://github.com/fluffynuts/lights-out

Last synced: 10 months ago
JSON representation

A dotnet wrapper for the Eskom Se Push load-shedding api

Awesome Lists containing this project

README

          

Lights Out
---

dotnet Api & tooling around the Eskom Se Push REST api

You will need to obtain an api key from:

https://eskomsepush.gumroad.com/l/api

A personal token with usage limits can be obtained for free.

Installation
---
Use your favorite nuget package manager to install the package `LightsOut`, eg

`dotnet add package LightsOut`

Usage
---

```csharp
using LightsOut;

public class Program
{
public async Task Main()
{
// create an instance of the api with a token
// -> if the token is ommitted, the library
// will attempt to read it from the environment
// variable ESP_API_TOKEN
var api = new Api("");
var overallStatus = await api.FetchStatus();
Console.WriteLine($"national status: {overallStatus["eskom"].CurrentStage}");

var areas = await api.SearchAreas("johannesburg")
var areaId = areas.First().Id;
var schedule = await api.FetchAreaSchedule(areaId);
var next = schedule.Events.First();
Console.WriteLine(
$"Next demonstration of Eskom ineptitude: {next.Note} at {next.Start} (until {next.End})"
);
}
}
```