Giter Club home page Giter Club logo

entsoe-api-client's Introduction

entsoe-api-client

Unofficial ENTSO-e REST API Client for Deno and Node. Comprehensive. User-friendly. Minimalistic.

Module type: CJS+ESM NPM Downloads MIT License

Check out the full documentation at https://entsoe-api-client.56k.guru

Features

  • Supports all requests listed in Entso-e REST API Documentation
  • Supports zip-file endpoints and transparently unzips documents
  • Includes examples that support both Deno and Node
  • Supports both Deno and Node (>=18.0)
  • Written in fully typed TypeScript
  • Offers ESM (for Deno and Node) and CommonJS (for Node) support
  • Adds descriptions to codes while parsing the documents

Quick usage

Here's a quick example on how a entsoe api query is made using entsoe-api-client.

// Run ENTSO-e transparency playform query
const result = await QueryPublication(
    typeof process !== "undefined" ?  // Your entsoe api-token by environment variable
        process.env.API_TOKEN // ... in Node
        : Deno.env.get("API_TOKEN"), // ... in Deno
     {
        documentType: "A44",              // A44 - Price document
        processType: "A01",               // A01 - Day ahead
        inDomain: Area("BZN|SE2"),            // In_Domain: For A44 - Electricity price area
        outDomain: Area("BZN|SE2"),           // Out_Domain: For A44 - Electricity price area
        startDateTime: dateToday,         // Start date
        endDateTime: dateTomorrow         // End date
    }
); 

For full documentation on installation and usage, refer to the full documentation at https://entsoe-api-client.56k.guru.

Examples can be found in the /examples directory.

To run the examples, pass your ENTSO-e API key as an environment variable called API_TOKEN. Deno

Powershell

$env:API_TOKEN="your-api-token"; deno run -A .\spot-prices-today.ts

Bash

API_TOKEN="your-api-token" deno run -A .\spot-prices-today.ts

Node

Powershell

$env:API_TOKEN="your-api-token"; node .\spot-prices-today.ts

Bash

API_TOKEN="your-api-token" node .\spot-prices-today.ts

Contributing & Support

entsoe-api-client is founded and actively maintained by Hexagon. If you find value in entsoe-api-client and want to contribute:

Code Contributions: See our Contribution Guide for details on how to contribute code.

Sponsorship and Donations: See github.com/sponsors/hexagon

Your trust, support, and contributions drive the project. Every bit, irrespective of its size, is deeply appreciated.

License

MIT License

entsoe-api-client's People

Contributors

fetimo avatar hexagon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fetimo

entsoe-api-client's Issues

older Node version possible

Why is very recent node version required?

I would like to use 14.18.3

Are there release notes which denote why later version is required?

XMLParser

I get this error message:

ERROR in /Users/xxxxxx/typescript/solarWindAxios/src/yyyyyyyyyy/deps.ts(17,27)
TS2307: Cannot find module 'https://esm.sh/[email protected]' or its corresponding type declarations.

The deps.ts file is a simple one line export statement:
export { XMLParser } from "https://esm.sh/[email protected]";

when I use the link in the browser, the response is:
/* esm.sh - [email protected] */
export * from "https://esm.sh/v114/[email protected]/es2022/fast-xml-parser.mjs";
export { default } from "https://esm.sh/v114/[email protected]/es2022/fast-xml-parser.mjs";
This looks OK to me
But ??

nb: the file on esm.sh is using the .mjs extension. I suppose this does not matter as I use in my TS Config the node option

Cloudflare Worker support

Hey! Just wanted to say this is an absolutely fantastic library. Everything you could wish for from a client and makes this arcane API bearable to work with.

I've forked the library as the inclusion of undici was causing a deployment to Cloudflare Workers to fail. Is it possible that this could be something that is configurable at runtime or to generate two separate builds? No worries if not :)

CORS issue

I have the package working very fine on Postman as well as in my app provided for I use the CORS plugin on Chrome.
So essentially I believe I have a problem with CORS.
This plugin on Chrome is not recommendable for other than a quick and dirty check.

When I don't use the plugin, I get a error message in the console:

Uncaught (in promise) TypeError: Failed to fetch
at Query......

when I follow the link of the failure, I see that it points to the fetch command
const result = await fetch(${ENTSOE_ENDPOINT}?${query})

I am trying since > 1 day to resolve but I am not able.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.