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

https://github.com/trickfilm400/primagas-api

NodeJS API for accessing data from primagas.de customer portal
https://github.com/trickfilm400/primagas-api

api gas nodejs nodejs-api nodejs-modules npm npm-module npm-package npm-registry primagas

Last synced: about 2 months ago
JSON representation

NodeJS API for accessing data from primagas.de customer portal

Awesome Lists containing this project

README

          

# primagas-api

This NPM package provides a full nodejs-api for the Primagas-Website to fetch data of your account, your gas tank and more.

~~Note: As of July 2023, there is a new customer portal, which is a complete rewrite of the old one. This script will currently not work with the new one and the old one is offline.~~

Some information about the new portal:
- OAuth2 Authorization URL: `https://depgprodaadb2c.b2clogin.com/depgprodaadb2c.onmicrosoft.com/b2c_1a_signinorsignup/oauth2/v2.0/authorize`
- OAuth2 Token URL: `https://depgprodaadb2c.b2clogin.com/depgprodaadb2c.onmicrosoft.com/b2c_1a_signinorsignup/oauth2/v2.0/token`
- OAuth2 Client ID: `15f4b687-8555-413c-bafd-acb38cff6837`
- OAuth2 redirect URL: `https://kunden.primagas.de/api/auth/callback/azureadb2c`
- OAuth2 flow uses PKCE with SHA256
- API Endpoint for tank data: `https://api.shvenergy.com/assets-api/v1/business-units/DE-PG/accounts//delivery-points/_T_1/assets/_T_1/readings?$filter=`

This NPM package provides a full nodejs-api for the Primagas-Website to fetch data of your account, our gas tank...

**Note:** Currently, not all API functions are implemented which are available of the [shvenergy-api](https://github.com/Trickfilm400/shvenergy-api)

## Usage

- Install NPM package from GitHub.
- Functions return a Promise
- For detailed information about the function return values, view the Typescript interface files in `/src/interfaces`

## Example

```typescript
import PrimaGasClient from "@trickfilm400/primagas-api";

const client = new PrimaGasClient<"timestamp">("", "", "", "timestamp");

client.tankDaten().then(console.log, console.error);
// client.rechnungsDaten().then(console.log, console.error);
// client.stammDaten().then(console.log, console.error);
```

© 2022-2024 Trickfilm400