Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) GetForecast(zip string, from, to time.Time) (*api.ForecastViewModel, error)
- func (c *Client) GetForecastContext(ctx context.Context, zip string, from, to time.Time) (*api.ForecastViewModel, error)
- func (c *Client) GetNow(zip string) (*api.RegionStateNowViewModel, error)
- func (c *Client) GetNowContext(ctx context.Context, zip string) (*api.RegionStateNowViewModel, error)
- func (c *Client) GetStates(zip string, from, to time.Time) (*api.RegionStateRangeViewModel, error)
- func (c *Client) GetStatesContext(ctx context.Context, zip string, from, to time.Time) (*api.RegionStateRangeViewModel, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultDateFormat may be changed for the whole package to use a different format // look in the time package for further information DefaultDateFormat = "2006-01-02" // DefaultDateTimeFormat may be changed for the whole package to use a different format // look in the time package for further information DefaultDateTimeFormat = "2006-01-02T15:04:05-07:00" // DefaultZipCodeRegex is used to validate German zip codes DefaultZipCodeRegex = regexp.MustCompile(`^((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))$`) // DefaultUserAgent is the default user agent of this library DefaultUserAgent = "github.com/jxsl13/stromgedacht" )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client which conforms to the OpenAPI3 specification for this service.
func (*Client) GetForecast ¶ added in v0.3.0
GetForecast Retrieval of the StromGedacht forecast in the TransnetBW control area for a specified time period at a specified location (zip code). Pass zero-time (time.Time{}) to fall back to API defaults for from and to parameters. By providing no date, it uses the date 7 days ago. Only up to 7 days into the past can be requested.
func (*Client) GetForecastContext ¶ added in v0.3.0
func (c *Client) GetForecastContext(ctx context.Context, zip string, from, to time.Time) (*api.ForecastViewModel, error)
GetForecastContext Retrieval of the StromGedacht forecast in the TransnetBW control area for a specified time period at a specified location (zip code). Pass zero-time (time.Time{}) to fall back to API defaults for from and to parameters. By providing no date, it uses the date 7 days ago. Only up to 7 days into the past can be requested.
func (*Client) GetNow ¶
func (c *Client) GetNow(zip string) (*api.RegionStateNowViewModel, error)
GetNow Retrieval of the StromGedacht status in the TransnetBW control area for the current time at a specified location (postal code).
func (*Client) GetNowContext ¶
func (c *Client) GetNowContext(ctx context.Context, zip string) (*api.RegionStateNowViewModel, error)
GetNowContext Retrieval of the StromGedacht status in the TransnetBW control area for the current time at a specified location (postal code).
func (*Client) GetStates ¶
GetStates Retrieval of the StromGedacht statuses in the TransnetBW control area for a specified time period at a specified location (zip code), whereby the status can be retrieved a maximum of 4 days into the past and a maximum of 2 days into the future.
func (*Client) GetStatesContext ¶
func (c *Client) GetStatesContext(ctx context.Context, zip string, from, to time.Time) (*api.RegionStateRangeViewModel, error)
GetStatesContext Retrieval of the StromGedacht statuses in the TransnetBW control area for a specified time period at a specified location (zip code), whereby the status can be retrieved a maximum of 4 days into the past and a maximum of 2 days into the future.
type Option ¶
type Option func(*clientOptions) error
func WithContext ¶
WithContext change sthe default context that is used for every method that does NOT expect a context
func WithHTTPClient ¶
WithHTTPCLient changes the used http client
func WithTimeFormat ¶
WithTimeFormat changes the format of the used time string
func WithUserAgent ¶ added in v0.2.0
WithUserAgent sets the User-Agent for every client request
func WithZipCodeRegex ¶
WithZipCodeRegex changes the format of the used time string