api

package
v0.0.0-...-7873577 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceReadingDuration = time.Minute * 30
View Source
const ResourceReadingMaxDuration = time.Hour * 24 * 10

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(logger log.Logger, email, password string) (*Client, error)

func (*Client) CatchupResource

func (c *Client) CatchupResource(ctx context.Context, resourceID string) error

func (*Client) GetResourceFirstTime

func (c *Client) GetResourceFirstTime(ctx context.Context, resourceID string) (time.Time, error)

func (*Client) GetResourceLastTime

func (c *Client) GetResourceLastTime(ctx context.Context, resourceID string) (time.Time, error)

func (*Client) GetResourceReadings

func (c *Client) GetResourceReadings(ctx context.Context, resourceID string, from, to time.Time) (*ResourceReadings, error)

func (*Client) GetResources

func (c *Client) GetResources(ctx context.Context) ([]*Resource, error)

type Resource

type Resource struct {
	Active                     bool   `json:"active"`
	ResourceTypeID             string `json:"resourceTypeId"`
	OwnerID                    string `json:"ownerId"`
	Name                       string `json:"name"`
	Description                string `json:"description"`
	Label                      string `json:"label"`
	DataSourceResourceTypeInfo struct {
		Unit string `json:"unit"`
		Type string `json:"type"`
	} `json:"dataSourceResourceTypeInfo"`
	DataSourceType     string    `json:"dataSourceType"`
	Classifier         string    `json:"classifier"`
	BaseUnit           string    `json:"baseUnit"`
	ResourceID         string    `json:"resourceId"`
	UpdatedAt          time.Time `json:"updatedAt"`
	CreatedAt          time.Time `json:"createdAt"`
	DataSourceUnitInfo struct {
		Shid string `json:"shid"`
	} `json:"dataSourceUnitInfo"`
	HasOwnerPermissions bool `json:"hasOwnerPermissions"`
}

type ResourceReading

type ResourceReading struct {
	Time  time.Time
	Value float64
}

func (*ResourceReading) UnmarshalJSON

func (r *ResourceReading) UnmarshalJSON(b []byte) error

type ResourceReadings

type ResourceReadings struct {
	Status         string `json:"status"`
	Name           string `json:"name"`
	ResourceTypeID string `json:"resourceTypeId"`
	ResourceID     string `json:"resourceId"`
	Query          struct {
		From     string `json:"from"`
		To       string `json:"to"`
		Period   string `json:"period"`
		Function string `json:"function"`
	} `json:"query"`
	Data       []ResourceReading `json:"data"`
	Units      string            `json:"units"`
	Classifier string            `json:"classifier"`
}

Jump to

Keyboard shortcuts

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