rest

package
v0.0.0-...-c8d982f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ProductURI = "https://api.octopus.energy/v1/products/%s/"

ProductURI defines the location of the tariff information page. Substitute %s with tariff name.

View Source
const RatesURI = ProductURI + "electricity-tariffs/%s/standard-unit-rates/"

RatesURI defines the location of the full tariff rates page, including speculation. Substitute first %s with product code, second with tariff code.

Variables

This section is empty.

Functions

func ConstructRatesAPIFromProductAndRegionCode

func ConstructRatesAPIFromProductAndRegionCode(product string, region string) string

ConstructRatesAPIFromProductAndRegionCode returns a validly formatted, fully qualified URI to the unit rate information derived from the given product code and region.

func ConstructRatesAPIFromTariffCode

func ConstructRatesAPIFromTariffCode(tariff string) string

ConstructRatesAPIFromTariffCode returns a validly formatted, fully qualified URI to the unit rate information derived from the given Tariff Code.

Types

type Rate

type Rate struct {
	ValidityStart     time.Time `json:"valid_from"`
	ValidityEnd       time.Time `json:"valid_to"`
	PriceInclusiveTax float64   `json:"value_inc_vat"`
	PriceExclusiveTax float64   `json:"value_exc_vat"`
}

type UnitRates

type UnitRates struct {
	Count    uint64 `json:"count"`
	Next     string `json:"next"`
	Previous string `json:"previous"`
	Results  []Rate `json:"results"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL