Documentation ¶
Index ¶
- func IsExpired(expires *jwt.NumericDate) bool
- type ApiError
- type ApiMessage
- type ApplicationVersion
- type ConnectAPI
- type ConnectAPIClient
- func (c *ConnectAPIClient) AssertValidToken() error
- func (c *ConnectAPIClient) GetAllTransactions(stationId string) ([]Transaction, error)
- func (c *ConnectAPIClient) GetStation(id string) (Station, error)
- func (c *ConnectAPIClient) GetStations() ([]Station, error)
- func (c *ConnectAPIClient) GetTransaction(id string) (Transaction, error)
- func (c *ConnectAPIClient) GetTransactionStatistics(stationId string) (TransactionStats, error)
- func (c *ConnectAPIClient) GetTransactions(stationId string, limit int, offset int) ([]Transaction, error)
- func (c *ConnectAPIClient) Login() error
- func (c *ConnectAPIClient) Logout() error
- func (c *ConnectAPIClient) ParseToken() (*jwt.Token, TokenClaims, error)
- func (c *ConnectAPIClient) SetDebug()
- type Connector
- type GetStationsResponse
- type GetTransactionResponse
- type GetTransactionsResponse
- type LoginResponse
- type MeterValues
- type Station
- type TokenClaims
- type Transaction
- type TransactionStats
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApiError ¶
type ApiError struct { StatusCode int `json:"statusCode"` Timestamp string `json:"timestamp"` Path string `json:"path"` Message ApiMessage `json:"message"` }
An error response from the Connect API
type ApiMessage ¶
type ApiMessage struct { StatusCode int `json:"statusCode"` Message string `json:"message"` Error string `json:"error"` }
A message from the Connect API. This is used in error responses.
type ApplicationVersion ¶
type ApplicationVersion struct { Id string `json:"_id"` ApplicationName string `json:"applicationName"` IosLatestVersion string `json:"iosLatestVersion"` IosMinimalVersion string `json:"iosMinimalVersion"` AndroidLatestVersion string `json:"androidLatestVersion"` AndroidMinimalVersion string `json:"androidMinimalVersion"` }
*
- Contents of the X-Application-Version header
type ConnectAPI ¶
type ConnectAPI interface { SetDebug() AssertValidToken() error Login() error Logout() error GetStations() ([]Station, error) GetStation(id string) (Station, error) GetTransactionStatistics(stationId string) (TransactionStats, error) GetAllTransactions(stationId string) ([]Transaction, error) GetTransactions(stationId string, limit int, offset int) ([]Transaction, error) GetTransaction(id string) (Transaction, error) ParseToken() (*jwt.Token, TokenClaims, error) }
A Connect API client
type ConnectAPIClient ¶
type ConnectAPIClient struct { Username string Password string Token string Client *resty.Client PageSize int }
func NewConnectAPI ¶
func NewConnectAPI(username, password, host string) *ConnectAPIClient
func (*ConnectAPIClient) AssertValidToken ¶
func (c *ConnectAPIClient) AssertValidToken() error
Ensure the login token is valid
func (*ConnectAPIClient) GetAllTransactions ¶
func (c *ConnectAPIClient) GetAllTransactions(stationId string) ([]Transaction, error)
func (*ConnectAPIClient) GetStation ¶
func (c *ConnectAPIClient) GetStation(id string) (Station, error)
func (*ConnectAPIClient) GetStations ¶
func (c *ConnectAPIClient) GetStations() ([]Station, error)
func (*ConnectAPIClient) GetTransaction ¶
func (c *ConnectAPIClient) GetTransaction(id string) (Transaction, error)
func (*ConnectAPIClient) GetTransactionStatistics ¶
func (c *ConnectAPIClient) GetTransactionStatistics(stationId string) (TransactionStats, error)
func (*ConnectAPIClient) GetTransactions ¶
func (c *ConnectAPIClient) GetTransactions(stationId string, limit int, offset int) ([]Transaction, error)
Get a single page of transactions, defined by the limit and offset
func (*ConnectAPIClient) Login ¶
func (c *ConnectAPIClient) Login() error
func (*ConnectAPIClient) Logout ¶
func (c *ConnectAPIClient) Logout() error
func (*ConnectAPIClient) ParseToken ¶
func (c *ConnectAPIClient) ParseToken() (*jwt.Token, TokenClaims, error)
func (*ConnectAPIClient) SetDebug ¶
func (c *ConnectAPIClient) SetDebug()
Enable debug mode in the underlying resty client
type GetStationsResponse ¶
type GetStationsResponse struct {
Stations []Station `json:"stations"`
}
Response type of the stations endipoint
type GetTransactionResponse ¶
type GetTransactionResponse struct {
Transaction Transaction `json:"transaction"`
}
type GetTransactionsResponse ¶
type GetTransactionsResponse struct {
Transactions []Transaction `json:"data"`
}
type LoginResponse ¶
type LoginResponse struct { Token string `json:"token"` IsInitialLogIn bool `json:"isInitialLogIn"` User User `json:"user"` }
A login response from the Connect API
type MeterValues ¶
type MeterValues struct { Date []time.Time `json:"date"` CurrentImport []float64 `json:"currentImport"` CurrentOffered []float64 `json:"currentOffered"` EnergyActiveImportRegister []int `json:"energyActiveImportRegister"` PowerActiveImport []float64 `json:"powerActiveImport"` SoC []int `json:"SoC"` Temperature []float64 `json:"temperature"` Voltage []int `json:"voltage"` }
type Station ¶
type Station struct { ID string `json:"id"` Identity string `json:"identity"` SerialNumber string `json:"serialNumber"` Online bool `json:"online"` Mode string `json:"mode"` Status string `json:"status"` ErrorCode string `json:"errorCode"` Connectors []Connector `json:"connectors"` Currency string `json:"currency"` PriceKW float64 `json:"priceKW"` }
type TokenClaims ¶
type Transaction ¶
type Transaction struct { ID string `json:"_id"` User string `json:"user"` Station string `json:"station"` IdTag string `json:"idTag"` ConnectorId int `json:"connectorId"` StartAt string `json:"startAt"` Duration int `json:"duration"` Energy int `json:"energy"` Status int `json:"status"` Power int `json:"power"` Currency string `json:"currency"` PriceKW float64 `json:"priceKW"` PriceTotal float64 `json:"priceTotal"` MeterStart int `json:"meterStart"` MeterStop int `json:"meterStop"` StopAt string `json:"stopAt"` StopReason string `json:"stopReason"` AverageCurrent float64 `json:"averageCurrent"` ChargingDuration int `json:"chargingDuration"` MeterValues MeterValues `json:"meterValues"` }
type TransactionStats ¶
Click to show internal directories.
Click to hide internal directories.