caruna

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationURL  = "https://plus.caruna.fi/api/authorization/login"
	AuthenticationURL = "https://authentication2.caruna.fi"
	PortalURL         = "https://authentication2.caruna.fi/portal"
	TokenURL          = "https://plus.caruna.fi/api/authorization/token"
	RedirectURL       = "https://plus.caruna.fi"
	CustomersURL      = "https://plus.caruna.fi/api/customers"
	LogoutURL         = "https://authentication2.caruna.fi/portal/logout"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CarunaAPIClient

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

func NewCarunaClient

func NewCarunaClient() (*CarunaAPIClient, error)

func (*CarunaAPIClient) ConsumedHours

func (api *CarunaAPIClient) ConsumedHours(customer string, meteringPoint string, date time.Time) ([]ConsumerCost, error)

func (*CarunaAPIClient) CustomerInfo

func (api *CarunaAPIClient) CustomerInfo(customerId string) (*CustomerInfo, error)

func (*CarunaAPIClient) HttpGet

func (api *CarunaAPIClient) HttpGet(url string) (*http.Response, error)

func (*CarunaAPIClient) Login

func (api *CarunaAPIClient) Login(username, password string) error

func (*CarunaAPIClient) LoginInfo

func (api *CarunaAPIClient) LoginInfo() LoginInfo

func (*CarunaAPIClient) Logout

func (api *CarunaAPIClient) Logout() error

func (*CarunaAPIClient) MeteringPoints

func (api *CarunaAPIClient) MeteringPoints(customer string) ([]MeteringPoint, error)

type ConsumerCost

type ConsumerCost struct {
	Timestamp                                 time.Time       `json:"timestamp"`
	TotalConsumption                          float64         `json:"totalConsumption"`
	InvoicedConsumption                       float64         `json:"invoicedConsumption"`
	TotalFee                                  float64         `json:"totalFee"`
	DistributionFee                           float64         `json:"distributionFee"`
	DistributionFeeBase                       float64         `json:"distributionFeeBase"`
	ElectricityTax                            float64         `json:"electricityTax"`
	ValueAddedTax                             float64         `json:"valueAddedTax"`
	Temperature                               float64         `json:"temperature"`
	InvoicedConsumptionByTransferProductParts ConsumptionPart `json:"invoicedConsumptionByTransferProductParts"`
	DistributionFeeByTransferProductParts     ConsumptionPart `json:"distributionFeeByTransferProductParts"`
}

type ConsumptionPart

type ConsumptionPart struct {
	NightTime float64 `json:"nighttime"`
	DayTime   float64 `json:"daytime"`
}

type CustomerContactingPermissions

type CustomerContactingPermissions struct {
	ViaEmail bool `json:"email"`
}

type CustomerInfo

type CustomerInfo struct {
	ID                         string                        `json:"id"`
	Name                       string                        `json:"name"`
	Email                      string                        `json:"email"`
	BusinessID                 string                        `json:"businessId"`
	Phone                      string                        `json:"phone"`
	PostalAddress              PostalAddress                 `json:"postalAddress"`
	BillingAddresses           []PostalAddress               `json:"billingAddresses"`
	MarketingPermissions       CustomerMarketingPermissions  `json:"marketingPermissions"`
	ContactingPermissions      CustomerContactingPermissions `json:"contactingPermissions"`
	ElectronicInvoiceAddresses []ElectronicInvoiceAddress    `json:"eInvoiceAddresses"`
	RepresentedCustomer        bool                          `json:"representedCustomer"`
	JointCustomer              bool                          `json:"jointCustomer"`
	IsMissingRequiredInfo      bool                          `json:"isMissingRequiredInfo"`
	Language                   string                        `json:"language"`
	DefaultRefundAccount       string                        `json:"defaultRefundAccount"`
	DefaultRefundAccountBIC    string                        `json:"defaultRefundAccountBIC"`
	UpdateCampaignSeen         bool                          `json:"updateCampaignSeen"`
}

type CustomerMarketingPermissions

type CustomerMarketingPermissions struct {
	ViaEmail          bool `json:"email"`
	ViaSMS            bool `json:"sms"`
	MarketingIsBanned bool `json:"ban"`
}

type ElectronicInvoiceAddress

type ElectronicInvoiceAddress struct {
	ID                 string `json:"id"`
	AddressTypeKey     string `json:"addressTypeKey"`
	Address            string `json:"address"`
	Operator1          string `json:"operator1"`
	Operator2          string `json:"operator2"`
	OvtCode            string `json:"ovtCode"`
	PaymentInstruction string `json:"paymentInstruction"`
	BuyerServiceCode   int    `json:"buyerSericeCode"`
	State              int    `json:"state"`
}

type LoginInfo

type LoginInfo struct {
	Token                 string    `json:"token"`
	ExpiresAt             int       `json:"expiresAt"`
	User                  UserInfo  `json:"user"`
	RedirectAfterLoginURL ParsedURL `json:"redirectAfterLogin"`
}

type MeteringPoint

type MeteringPoint struct {
	Type               string                  `json:"type"`
	ID                 string                  `json:"id"`
	Address            PostalAddress           `json:"address"`
	AssetID            string                  `json:"assetId"`
	ContractID         string                  `json:"contractId"`
	ContractType       string                  `json:"energyJunctionContract"`
	CustomerAddressId  string                  `json:"customerAddressId"`
	IsSupplierInvoiced bool                    `json:"isSupplierInvoiced"`
	FuseSize           string                  `json:"fuseSize"`
	Group              string                  `json:"group"`
	NetworkID          string                  `json:"networkId"`
	Position           MeteringPointCoordinate `json:"position"`
	Tabs               []string                `json:"tabs"`
	Use                string                  `json:"use"`
	CustomerID         string                  `json:"customerId"`
}

type MeteringPointCoordinate

type MeteringPointCoordinate struct {
	Latitude  float64 `json:"lat"`
	Longitude float64 `json:"lng"`
}

type ParsedURL

type ParsedURL url.URL

func (*ParsedURL) UnmarshalJSON

func (m *ParsedURL) UnmarshalJSON(data []byte) error

type PostalAddress

type PostalAddress struct {
	ID                 string `json:"id"`
	StreetName         string `json:"streetName"`
	HouseNumber        string `json:"houseNumber"`
	PostOffice         string `json:"postOffice"`
	PostalCode         string `json:"postalCode"`
	LocalityType       string `json:"postalAddress"`
	InvoicingBaseCount int    `json:"invoicingBaseCount"`
}

type UserInfo

type UserInfo struct {
	UserName                   string    `json:"userName"`
	UserType                   string    `json:"userType"`
	Email                      string    `json:"email"`
	FirstName                  string    `json:"FirstName"`
	LastName                   string    `json:"LastName"`
	PhoneNumber                string    `json:"PhoneNumber"`
	ProfileURL                 ParsedURL `json:"iamProfileUrl"`
	OwnCustomerNumbers         []string  `json:"ownCustomerNumbers"`
	RepresentedCustomerNumbers []string  `json:"representedCustomerNumbers"`
	HashedUserID               string    `json:"HashedUserId"`
	VisitorParams              string    `json:"giosgVisitorParams"`
}

Jump to

Keyboard shortcuts

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