mwater

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

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

Go to latest
Published: Jun 11, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoClientID = errors.New("client id not set")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url, un, pw string, dryRun bool) (*Client, error)

func (*Client) GetCustomerInfoList

func (c *Client) GetCustomerInfoList() ([]CustomerInfo, error)

TODO error handling TODO return value

func (*Client) PostCollections

func (c *Client) PostCollections(colns Collections) ([]byte, error)

type Collection

type Collection struct {
	Name    string        `json:"collection"`
	Entries []Transaction `json:"entries"`
	Bases   []string      `json:"bases"`
}

type Collections

type Collections struct {
	CollectionsToUpsert []Collection `json:"collectionsToUpsert"`
	CollectionsToDelete []Collection `json:"collectionsToDelete"`
}

func GetTransactionCollections

func GetTransactionCollections(txns []Transaction) Collections

type CustomerInfo

type CustomerInfo struct {
	Code          string  `json:"code"`
	Name          string  `json:"name"`
	LatestReading float64 `json:"latest_reading"`
	TarriffPrice  float64 `json:"tariff_price"`
	CustomerID    string  `json:"_id"`
}

type LoginResponse

type LoginResponse struct {
	ClientID string `json:"client"`
	Error    string `json:"error"`
}

type Transaction

type Transaction struct {
	ID          string  `json:"_id"`
	Date        string  `json:"date"`
	CustomerID  string  `json:"customer"`
	ToAccount   string  `json:"to_account"`
	FromAccount string  `json:"from_account"`
	MeterStart  float64 `json:"meter_start"`
	MeterEnd    float64 `json:"meter_end"`
	Amount      float64 `json:"amount"`
}

func NewTransaction

func NewTransaction() Transaction

Jump to

Keyboard shortcuts

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