client

package
v0.0.0-...-30acd1d Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
	JTI          string `json:"jti"`
}

type Client

type Client struct {
	Username    string
	Password    string
	AccessToken string

	HTTPClient *http.Client
}

func New

func New(username, password string) (*Client, error)

New returns a configured Client.

func (*Client) GetDay

func (c *Client) GetDay(plantId, year, month, day int) ([]FiveMinuteRecord, error)

GetDay returns data for a single plant for one day, in 5 minute intervals.

func (*Client) GetMonth

func (c *Client) GetMonth(plantId, year, month int) ([]DayRecord, error)

func (*Client) GetPlants

func (c *Client) GetPlants() ([]Plant, error)

GetPlants returns an array of plants (solar power plants) owned by the user.

func (*Client) Login

func (c *Client) Login() (string, error)

Login issues the login request. Required to perform authenticated requests afterwards.

type DayRecord

type DayRecord struct {
	Id                string  `json:"id"`
	PlantId           int     `json:"systemId"`
	Year              int     `json:"year"`
	Month             int     `json:"month"`
	Day               int     `json:"day"`
	GenerationValue   float64 `json:"generationValue,omitempty"`
	FullPowerHoursDay float64 `json:"fullPowerHoursDay,omitempty"`
}

type DayResponse

type DayResponse struct {
	Records []FiveMinuteRecord `json:"records"`
}

type FiveMinuteRecord

type FiveMinuteRecord struct {
	Id                 string  `json:"id"`
	PlantId            int     `json:"systemId"`
	DateTime           float64 `json:"dateTime"`
	GenerationPower    float64 `json:"generationPower,omitempty"`
	GenerationCapacity float64 `json:"generationCapacity,omitempty"`
}

type MonthResponse

type MonthResponse struct {
	Records []DayRecord `json:"records"`
}

type Plant

type Plant struct {
	Id int `json:"id"`
}

type PlantsResponse

type PlantsResponse struct {
	Total int     `json:"total"`
	Data  []Plant `json:"data"`
}

Jump to

Keyboard shortcuts

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