monta

package module
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 9 Imported by: 1

README

Monta Go SDK

Contributor Covenant

A Go SDK for the Monta Partner API.

Usage

Client
client := monta.NewClient(monta.WithClientIDAndSecret("<ID>", "<SECRET>")
GET /v1/auth/me
me, err := client.GetMe(ctx)
if err != nil {
	panic(err)
}
fmt.Println(me)
GET /v1/sites
response, err := client.ListSites(ctx, &monta.ListSitesRequest{
	Page:    1,
	PerPage: 10,
})
if err != nil {
	panic(err)
}
fmt.Println(response)
GET /v1/charge-points
response, err := client.ListChargePoints(ctx, &monta.ListChargePointsRequest{
	Page:    1,
	PerPage: 10,
})
if err != nil {
	panic(err)
}
fmt.Println(response)
CLI
Build

First you need to build the CLI - to create the monta CLI executable. Assuming you are on root level of the project:

$ cd cmd/monta
$ go build
Login
$ ./monta login --client-id <ID> --client-secret <SECRET>
GET /v1/auth/me
$ ./monta me
GET /v1/sites
$ ./monta sites
GET /v1/charge-points
$ ./monta charge-points

Documentation

Overview

Package monta provides primitives for accessing the Monta Partner API.

Index

Constants

View Source
const (
	VisibilityPrivate = "private"
	VisibilityPublic  = "public"
)

Known Visibility values.

View Source
const (
	ToFromTypeOperator = "operator"
	ToFromTypeTeam     = "team"
)

Known ToFromType values.

Variables

This section is empty.

Functions

This section is empty.

Types

type Additional added in v0.33.0

type Additional struct {
	// Type of the additional pricing. absolute means the value is a price.
	Type AdditionalType `json:"type"`
	// The value of this additional pricing. Both absolute and percentage values here are represented as a money object.
	Value Price `json:"value"`
	// A title for this additional pricing.
	Title *string `json:"title"`
}

An additional pricing.

type AdditionalType added in v0.33.0

type AdditionalType string

Type of an additional pricing.

const (
	AdditionalTypeAbsolute   AdditionalType = "absolute"
	AdditionalTypePercentage AdditionalType = "percentage"
)

Know AdditionalType values.

type Address

type Address struct {
	// Address1 is the first line of address.
	Address1 string `json:"address1"`

	// Address2 is the second line of address (optional).
	Address2 *string `json:"address2"`

	// Address3 is the third line of address (optional).
	Address3 *string `json:"address3"`

	// Zip is the zip code of the address.
	Zip string `json:"zip"`

	// City is the human-readable name of the city.
	City string `json:"city"`

	// Country is the human-readable name of the country.
	Country string `json:"country"`
}

Address represents a postal address.

type AppliedTo added in v0.33.0

type AppliedTo struct {
	// ID's of the ChargePoints this price group has been applied to.
	ChargePoints []int64 `json:"chargePoints"`

	// ID's of the Sites this price group has been applied to.
	Sites []int64 `json:"sites"`

	// ID's of the Team Members this price group has been applied to.
	TeamMembers []int64 `json:"teamMembers"`
}

Objects a price group is applied to.

type ApplyPriceGroupRequest added in v0.33.0

type ApplyPriceGroupRequest struct {
	// List of charge point IDs.
	SelectedChargePointIDs *[]int64 `json:"selectedChargePointIds"`
	// List of site IDs.
	SelectedSiteIDs *[]int64 `json:"selectedSiteIds"`
	// List of team member IDs.
	SelectedTeamMemberIDs *[]int64 `json:"selectedTeamMemberIds"`
	// Flag to indicate if costs should be reset.
	ResetCost *bool `json:"resetCost"`
}

ApplyPriceGroupRequest is the request input to the [Client.ApplyPriceGroup] method.

type Charge

type Charge struct {
	// ID of the charge.
	ID int64 `json:"id"`

	// ID of the charge point related to this charge.
	ChargePointID int64 `json:"chargePointId"`

	// When the charge was created.
	CreatedAt time.Time `json:"createdAt"`

	// When the charge was last updated.
	UpdatedAt time.Time `json:"updatedAt"`

	// Date when cable was plugged in.
	CablePluggedInAt *time.Time `json:"cablePluggedInAt"`

	// Date when charge started.
	StartedAt *time.Time `json:"startedAt"`

	// Date when charge stopped.
	StoppedAt *time.Time `json:"stoppedAt"`

	// Date when EV was fully charged.
	FullyChargedAt *time.Time `json:"fullyChargedAt"`

	// Date when charge failed.
	FailedAt *time.Time `json:"failedAt"`

	// Date when charge timed out.
	TimeoutAt *time.Time `json:"timeoutAt"`

	// State of the charge.
	State ChargeState `json:"state"`

	// Consumed Kwh.
	ConsumedKWh *float64 `json:"consumedKwh"`

	// List of consumed Kwh split by hour.
	KwhPerHour []KwhPerHour `json:"kwhPerHour"`

	// Kwh of the meter before charging started.
	StartMeterKWh *float64 `json:"startMeterKwh"`

	// Kwh of the meter after charging stopped.
	EndMeterKWh *float64 `json:"endMeterKwh"`

	// Price for this charge.
	Price *float64 `json:"price"`

	// Configured price limit for this charge.
	PriceLimit *float64 `json:"priceLimit"`

	// Average price per Kwh.
	AveragePricePerKWh *float64 `json:"averagePricePerKwh"`

	// Average CO2 consumption per Kwh.
	AverageCo2PerKWh *float64 `json:"averageCo2PerKwh"`

	// Average percentage of renewable energy per Kwh.
	AverageRenewablePerKWh *float64 `json:"averageRenewablePerKwh"`

	// Failure reason for this charge.
	FailureReason *string `json:"failureReason"`

	// Stop reason for this charge.
	StopReason *string `json:"stopReason"`

	// Payment method for this charge.
	PaymentMethod *PaymentMethod `json:"paymentMethod"`

	// A note taken for this charge.
	Note *string `json:"note"`

	// The charge point KW recorded during the charge.
	ChargePointKw *float64 `json:"chargePointKw"`

	// Configured Kwh limit for this charge.
	KWhLimit *float64 `json:"kwhLimit"`

	// Currency for paying the charge.
	Currency *Currency `json:"currency"`

	// PayingTeam is the team paying for the charge.
	PayingTeam *PayingTeam `json:"payingTeam"`

	// ChargeAuth is the method used to authenticate the charge.
	ChargeAuth *ChargeAuth `json:"chargeAuth"`

	// Information about the state of charge.
	SoC *SoC `json:"soc"`

	// Configured SoC limit for this charge.
	SoCLimit *float64 `json:"socLimit"`

	// Operator of this charge
	Operator *Operator `json:"operator"`
}

Charge is a charging transaction.

type ChargeAuth added in v0.9.0

type ChargeAuth struct {
	// The method type used to authenticate a charge.
	Type ChargeAuthType `json:"type"`

	// The id of the chosen authentication method.
	ID string `json:"id"`
}

ChargeAuth method used to authenticate the charge.

type ChargeAuthToken added in v0.10.0

type ChargeAuthToken struct {
	// The id of the charge auth token.
	ID int64 `json:"id"`
	// The identifier of the charge auth token, Note: without prefix e.g VID:.
	Identifier string `json:"identifier"`
	// The method type used for this charge auth token.
	Type ChargeAuthTokenType `json:"type"`
	// Id of the team that the charge auth token belongs.
	TeamID int64 `json:"teamId"`
	// Name of the charge auth token.
	Name *string `json:"name"`
	// External Id of this entity, managed by you.
	PartnerExternalID *string `json:"partnerExternalId"`
	// Blocked date of this charge auth token.
	BlockedAt *time.Time `json:"blockedAt"`
	// Creation date of this charge auth token.
	CreatedAt time.Time `json:"createdAt"`
	// Update date of this charge auth token.
	UpdatedAt time.Time `json:"updatedAt"`
	// Operator of this charge auth token.
	Operator *Operator `json:"operator"`
}

ChargeAuthToken used to authenticate the charge.

type ChargeAuthTokenType added in v0.16.0

type ChargeAuthTokenType string

ChargeAuthTokenType is the types charge authentications.

const (
	ChargeAuthTokenTypeVehicleID ChargeAuthTokenType = "vehicleId"
	ChargeAuthTokenTypeRFID      ChargeAuthTokenType = "rfid"
)

Known ChargeAuthTokenType values.

type ChargeAuthType added in v0.9.0

type ChargeAuthType string

ChargeAuthType is the types charge authentications.

const (
	ChargeAuthTypeVehicleID ChargeAuthType = "vehicleId"
	ChargeAuthTypeRFID      ChargeAuthType = "rfid"
	ChargeAuthTypeApp       ChargeAuthType = "app"
)

Known ChargeAuthType values.

type ChargePoint

type ChargePoint struct {
	// ID of this charge point.
	ID int64 `json:"id"`

	// ID of the site
	SiteID *int64 `json:"siteId"`

	// ID of the team.
	TeamID int64 `json:"teamId"`

	// Serial number of this charge point.
	SerialNumber *string `json:"serialNumber"`

	// Name of the site.
	Name *string `json:"name"`

	// Indicates if this charge point is public or private.
	Visibility Visibility `json:"visibility"`

	// Max KW available at this charge point.
	MaxKW *float64 `json:"maxKW"`

	// Type of charge point (AC / DC).
	Type *ChargePointType `json:"type"`

	// A note you have entered for this charge point, e.g. via our Portal.
	Note *string `json:"note"`

	// State of the charge point.
	State *ChargePointState `json:"state"`

	// Last meter reading (KWH) for this charge point.
	LastMeterReadingKwh *float64 `json:"lastMeterReadingKwh"`

	// Indicates if a cable is plugged in (true)
	CablePluggedIn bool `json:"cablePluggedIn"`

	// Brand name for this charge point.
	BrandName *string `json:"brandName"`

	// External Id of this entity, managed by you.
	PartnerExternalID *string `json:"partnerExternalId"`

	// Location of the charge point.
	Location Location `json:"location"`

	// List of supported connector types at this charge point.
	Connectors []Connector `json:"connectors"`

	// DeepLinks to the charge point.
	DeepLinks ChargePointDeepLinks `json:"deeplinks"`

	// When the charge point was created.
	CreatedAt time.Time `json:"createdAt"`

	// When the charge point was last updated.
	UpdatedAt time.Time `json:"updatedAt"`

	// Operator of this charge point
	Operator *Operator `json:"operator"`
}

ChargePoint is a charging point.

type ChargePointDeepLinks struct {
	// Follow this link to open the Monta App with this charge point.
	App string `json:"app"`

	// Follow this link to open the Monta Web App with this charge point.
	Web string `json:"web"`
}

ChargePointDeepLinks contains deep-links to a charge point.

type ChargePointIntegration added in v0.36.0

type ChargePointIntegration struct {
	// The id of this charge point integration.
	ID int64 `json:"id"`

	// Enumerate the possible states for a charge point integration
	State ChargePointIntegrationState `json:"state"`

	// The serial number of this charge point integration
	SerialNumber string `json:"serialNumber"`

	// The identity number of this charge point integration
	ChargePointIdentity string `json:"chargePointIdentity"`

	// Identifier of the integration type.
	IntegrationTypeIdentifier string `json:"integrationTypeIdentifier"`

	// The connector id for this charge point integration
	ConnectorID *int64 `json:"connectorId"`

	// The charge point for this charge point integration
	ChargePoint ChargePoint `json:"chargePoint"`

	// The Date this charge point integration was set to active
	ActiveAt *time.Time `json:"activeAt"`

	// The Creation date of this charge point integration
	CreatedAt time.Time `json:"createdAt"`

	// The Date this charge point integration was last updated
	UpdatedAt time.Time `json:"updatedAt"`

	// The Date this charge point integration was deleted
	DeletedAt *time.Time `json:"deletedAt"`
}

type ChargePointIntegrationState added in v0.36.0

type ChargePointIntegrationState string
const (
	ChargePointIntegrationStatePending      ChargePointIntegrationState = "pending"
	ChargePointIntegrationStateConnected    ChargePointIntegrationState = "connected"
	ChargePointIntegrationStateDisconnected ChargePointIntegrationState = "disconnected"
	ChargePointIntegrationStateError        ChargePointIntegrationState = "error"
	ChargePointIntegrationStateUnknown      ChargePointIntegrationState = "unknown"
)

type ChargePointState

type ChargePointState string

ChargePointState represents the state of a charge point.

const (
	ChargePointStateAvailable       ChargePointState = "available"
	ChargePointStateBusy            ChargePointState = "busy"
	ChargePointStateBusyBlocked     ChargePointState = "busy-blocked"
	ChargePointStateBusyCharging    ChargePointState = "busy-charging"
	ChargePointStateBusyNonCharging ChargePointState = "busy-non-charging"
	ChargePointStateBusyNonReleased ChargePointState = "busy-non-released"
	ChargePointStateBusyReserved    ChargePointState = "busy-reserved"
	ChargePointStateBusyScheduled   ChargePointState = "busy-scheduled"
	ChargePointStateError           ChargePointState = "error"
	ChargePointStateDisconnected    ChargePointState = "disconnected"
	ChargePointStatePassive         ChargePointState = "passive"
	ChargePointStateOther           ChargePointState = "other"
)

Known ChargePointState values.

type ChargePointType

type ChargePointType string

ChargePointType is the type of charge point.

const (
	ChargePointTypeAC ChargePointType = "ac"
	ChargePointTypeDC ChargePointType = "dc"
)

Known ChargePointType values.

type ChargeState

type ChargeState string

ChargeState is the state of a charging transaction.

const (
	ChargeStatePaying    ChargeState = "paying"
	ChargeStateReserved  ChargeState = "reserved"
	ChargeStateStarting  ChargeState = "starting"
	ChargeStateCharging  ChargeState = "charging"
	ChargeStateStopping  ChargeState = "stopping"
	ChargeStatePaused    ChargeState = "paused"
	ChargeStateScheduled ChargeState = "scheduled"
	ChargeStateStopped   ChargeState = "stopped"
	ChargeStateCompleted ChargeState = "completed"
	ChargeStateReleasing ChargeState = "releasing"
	ChargeStateReleased  ChargeState = "released"
	ChargeStateOther     ChargeState = "other"
)

Known ChargeState values.

type Client

type Client interface {
	GetMe(ctx context.Context) (*Me, error)

	// Tokens
	CreateToken(ctx context.Context, request *CreateTokenRequest) (*Token, error)
	RefreshToken(ctx context.Context, request *RefreshTokenRequest) (*Token, error)

	// Charge Auth Tokens
	ListChargeAuthTokens(ctx context.Context, request *ListChargeAuthTokensRequest) (*ListChargeAuthTokensResponse, error)
	GetChargeAuthToken(ctx context.Context, chargeAuthTokenID int64) (*ChargeAuthToken, error)
	CreateChargeAuthToken(ctx context.Context, request CreateChargeAuthTokenRequest) (*ChargeAuthToken, error)
	DeleteChargeAuthToken(ctx context.Context, chargeAuthTokenID int64) error
	PatchChargeAuthToken(
		ctx context.Context,
		chargeAuthTokenID int64,
		request PatchChargeAuthTokenRequest,
	) (*ChargeAuthToken, error)

	// Charge Points
	ListChargePoints(ctx context.Context, request *ListChargePointsRequest) (*ListChargePointsResponse, error)
	GetChargePoint(ctx context.Context, chargePointID int64) (*ChargePoint, error)

	// Charge Point Integrations
	GetChargePointIntegration(ctx context.Context, chargePointIntegrationID int64) (*ChargePointIntegration, error)
	ListChargePointIntegrations(
		ctx context.Context,
		request *ListChargePointIntegrationsRequest,
	) (*ListChargePointIntegrationsResponse, error)

	// Charges
	ListCharges(ctx context.Context, request *ListChargesRequest) (*ListChargesResponse, error)
	GetCharge(ctx context.Context, chargeID int64) (*Charge, error)
	StartCharge(ctx context.Context, request *StartChargeRequest) (*StartChargeResponse, error)
	StopCharge(ctx context.Context, chargeID int64) (*Charge, error)
	RestartCharge(ctx context.Context, chargeID int64) (*Charge, error)

	// Sites
	ListSites(ctx context.Context, request *ListSitesRequest) (*ListSitesResponse, error)
	GetSite(ctx context.Context, siteID int64) (*Site, error)

	// Wallet Transactions
	ListWalletTransactions(
		ctx context.Context,
		request *ListWalletTransactionsRequest,
	) (*ListWalletTransactionsResponse, error)
	GetWalletTransaction(ctx context.Context, transactionID int64) (*WalletTransaction, error)

	// Teams
	ListTeams(
		ctx context.Context,
		request *ListTeamsRequest,
	) (*ListTeamsResponse, error)

	// Webhooks
	GetWebhookConfig(ctx context.Context) (*WebhookConfig, error)
	UpdateWebhookConfig(
		ctx context.Context,
		request *WebhookConfig,
	) (*WebhookConfig, error)
	DeleteWebhookConfig(ctx context.Context) error
	ListWebhookEntries(ctx context.Context, request *ListWebhookEntriesRequest) (*ListWebhookEntriesResponse, error)

	// Price Groups
	ListPriceGroups(ctx context.Context, request *ListPriceGroupsRequest) (*ListPriceGroupsResponse, error)
	CreatePriceGroup(ctx context.Context, request CreateOrUpdatePriceGroupRequest) (*PriceGroup, error)
	GetPriceGroup(ctx context.Context, priceGroupID int64) (*PriceGroup, error)
	UpdatePriceGroup(ctx context.Context, priceGroupID int64, request CreateOrUpdatePriceGroupRequest) (*PriceGroup, error)
	DeletePriceGroup(ctx context.Context, priceGroupID int64) error
	ApplyPriceGroup(ctx context.Context, priceGroupID int64, request ApplyPriceGroupRequest) (*PriceGroup, error)
	SetDefaultPriceGroup(ctx context.Context, priceGroupID int64) error
}

func NewClient

func NewClient(options ...ClientOption) Client

NewClient creates a new Client with the provided [ClientConfig].

type ClientOption

type ClientOption func(*clientConfig)

ClientOption for configuring a Client.

func WithClientIDAndSecret

func WithClientIDAndSecret(clientID, clientSecret string) ClientOption

WithClientIDAndSecret configures authentication using the provided client ID and secret.

func WithToken

func WithToken(token *Token) ClientOption

WithToken configures authentication using the provided authentication token.

type Connector

type Connector struct {
	// Identifier of connector.
	Identifier string `json:"identifier"`
	// Readable name of connector.
	Name string `json:"name"`
}

Connector is a charge point connector.

type CreateChargeAuthTokenRequest added in v0.16.0

type CreateChargeAuthTokenRequest struct {
	// Id of the team the charge auth token belongs to.
	TeamID int64 `json:"teamId"`
	// Id of the user the charge auth token should be associated to.
	UserID *int64 `json:"userId"`
	// Identifier of the the charge auth token. Note: without prefix e.g VID:
	Identifier string `json:"identifier"`
	// Type of the charge auth token.
	Type ChargeAuthTokenType `json:"type"`
	// Name of the charge auth token.
	Name *string `json:"name"`
	// If the charge auth token should be active in the Monta network.
	MontaNetwork bool `json:"montaNetwork"`
	// If the charge auth token should be active in the Roaming network.
	RoamingNetwork bool `json:"roamingNetwork"`
	// Until when the charge auth token should be active, when nil it will be active forever.
	ActiveUntil *time.Time `json:"activeUntil"`
}

CreateChargeAuthTokenRequest is the request input to the [Client.CreateChargeAuthToken] method.

type CreateOrUpdatePriceGroupRequest added in v0.33.0

type CreateOrUpdatePriceGroupRequest struct {
	// Team ID.
	TeamID int64 `json:"teamId"`
	// Name of the price group.
	Name string `json:"name"`
	// Type of the price group.
	Type PriceGroupType `json:"type"`
	// The master price.
	MasterPrice Pricing `json:"masterPrice"`
	// All the fees for the price group.
	Fees *[]Pricing `json:"fees"`
}

CreatePriceGroupRequest is the request input to the [Client.CreatePriceGroup] method.

type CreateTokenRequest

type CreateTokenRequest struct {
	// The ClientID to use.
	ClientID string `json:"clientId"`
	// The ClientSecret to use.
	ClientSecret string `json:"clientSecret"`
}

CreateTokenRequest is the request input to the [Client.CreateToken] method.

type Currency

type Currency struct {
	// ID of the currency, e.g. DKK.
	ID string `json:"identifier"`

	// Readable name of currency.
	Name string `json:"name"`

	// Number of decimals for this currency.
	Decimals int32 `json:"decimals"`
}

Currency represents a currency.

type KwhPerHour added in v0.13.0

type KwhPerHour struct {
	// Hour for the sum of the kwh.
	Time time.Time `json:"time"`

	// Sum of kwh for this hour.
	Value float64 `json:"value"`
}

Sum of kwh for a given hour.

type LatLng

type LatLng struct {
	// Latitude of the coordinate.
	Latitude float64 `json:"latitude"`
	// Longitude of the coordinate.
	Longitude float64 `json:"longitude"`
}

LatLng is a latitude longitude pair of geographical coordinates.

type ListChargeAuthTokensRequest added in v0.10.0

type ListChargeAuthTokensRequest struct {
	PageFilters
	// Filter to retrieve charges auth tokens with specified teamId.
	TeamID *int64
}

ListChargeAuthTokensRequest is the request input to the [Client.ListChargeAuthTokens] method.

type ListChargeAuthTokensResponse added in v0.10.0

type ListChargeAuthTokensResponse struct {
	// Charges in the current page.
	ChargeAuthTokens []*ChargeAuthToken `json:"data"`
	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListChargeAuthTokensResponse is the response output from the [Client.ListChargeAuthTokens] method.

type ListChargePointIntegrationsRequest added in v0.37.0

type ListChargePointIntegrationsRequest struct {
	PageFilters
	// Allows to filter list of charge points integrations by a charge point id
	ChargePointID int64
	// Includes deleted resources in the response
	IncludeDeleted *bool
}

ListChargePointIntegrationsRequest is the request output from the [Client.ListChargePointIntegrations] method.

type ListChargePointIntegrationsResponse added in v0.37.0

type ListChargePointIntegrationsResponse struct {
	// List of charges point integrations that match the criteria.
	ChargePointIntegrations []*ChargePointIntegration `json:"data"`
	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListChargePointIntegrationsResponse is the response output from the [Client.ListChargePointIntegrations] method.

type ListChargePointsRequest

type ListChargePointsRequest struct {
	PageFilters
	// SiteID allows to filter list of charge points by a site id.
	SiteID *int64
	// TeamID allows to filter list of charge points by a team id.
	TeamID *int64
}

ListChargePointsRequest is the request input to the [Client.ListChargePoints] method.

type ListChargePointsResponse

type ListChargePointsResponse struct {
	// ChargePoints in the current page.
	ChargePoints []*ChargePoint `json:"data"`
	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListChargePointsResponse is the response output from the [Client.ListChargePoints] method.

type ListChargesRequest

type ListChargesRequest struct {
	PageFilters

	// Filter to retrieve charges with specified chargePointId.
	ChargePointID *int64

	// Filter to retrieve charges with specified teamId.
	TeamID *int64

	// Filter to retrieve charges with specified siteId.
	SiteID *int64

	// Filter to retrieve charges with specified operatorId.
	OperatorID *int64

	// Filter to retrieve charges by state.
	State *ChargeState

	// Filter to retrieve charges by the charge authentication type, must be combined with chargeAuthId.
	ChargeAuthType *ChargeAuthType

	// Filter to retrieve charges by the charge authentication ID, must be combined with chargeAuthType
	// Note: for type vehicleId, chargeAuthId must not include the VID: prefix.
	ChargeAuthID *string

	// Filter to retrieve charges where createdAt >= fromDate.
	FromDate *time.Time

	// Filter to retrieve charges where createdAt <= toDate.
	ToDate *time.Time
}

ListChargesRequest is the request input to the [Client.ListCharges] method.

type ListChargesResponse

type ListChargesResponse struct {
	// Charges in the current page.
	Charges []*Charge `json:"data"`
	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListChargesResponse is the response output from the [Client.ListCharges] method.

type ListPriceGroupsRequest added in v0.33.0

type ListPriceGroupsRequest struct {
	PageFilters
	// Filter to retrieve price groups with specified team ID.
	TeamID *int64
}

ListPriceGroupsRequest is the request input to the [Client.ListPriceGroups] method.

type ListPriceGroupsResponse added in v0.33.0

type ListPriceGroupsResponse struct {
	// Price groups in the current page.
	PriceGroups []*PriceGroup `json:"data"`
	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListPriceGroupsResponse is the response output from the [Client.ListPriceGroups] method.

type ListSitesRequest

type ListSitesRequest struct {
	PageFilters
}

ListSitesRequest is the request input to the [Client.ListSites] method.

type ListSitesResponse

type ListSitesResponse struct {
	// Sites in the current page.
	Sites []*Site `json:"data"`
	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListSitesResponse is the response output from the [Client.ListSites] method.

type ListTeamsRequest added in v0.21.0

type ListTeamsRequest struct {
	PageFilters
	// Filter teams by partner external id. To filter only resources without PartnerExternalID use "".
	PartnerExternalID *string
	// If the team can be deleted.
	IncludeDeleted bool
}

ListTeamsRequest is the request input to the [Client.ListTeams] method.

type ListTeamsResponse added in v0.21.0

type ListTeamsResponse struct {
	// Teams in the current page.
	Teams []*Team `json:"data"`
	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListTeamsResponse is the response output from the [Client.ListTeams] method.

type ListWalletTransactionsRequest

type ListWalletTransactionsRequest struct {
	PageFilters
	// FromDate allows to filter to retrieve transactions where [WalletTransaction.CreatedAt] >= FromDate.
	FromDate *time.Time
	// ToDate allows to filter to retrieve transactions where [WalletTransaction.CreatedAt] <= ToDate.
	ToDate *time.Time
	TeamID *int64
}

ListWalletTransactionsRequest is the request input to the [Client.ListWalletTransactions] method.

type ListWalletTransactionsResponse

type ListWalletTransactionsResponse struct {
	// WalletTransactions in the current page.
	WalletTransactions []*WalletTransaction `json:"data"`
	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListWalletTransactionsResponse is the response output from the [Client.ListWalletTransactions] method.

type ListWebhookEntriesRequest added in v0.28.0

type ListWebhookEntriesRequest struct {
	PageFilters
}

ListWebhookEntriesRequest is the request for [Client.ListWebhookEntries] method.

Status filter is not implemented due to undefined integer value mapping by docs at this moment in time.

type ListWebhookEntriesResponse added in v0.28.0

type ListWebhookEntriesResponse struct {
	// List of webhook entries events for your consumer in the past 24 hours
	Events []WebhookEvent `json:"data"`

	// PageMeta with metadata about the current page.
	PageMeta PageMeta `json:"meta"`
}

ListWebhookEntriesResponse is the response for [Client.ListWebhookEntries] method.

type Location

type Location struct {
	// Coordinates of the location.
	Coordinates *LatLng `json:"coordinates"`
	// Address of the location.
	Address *Address `json:"address"`
}

Location represents a geographical location.

type Me

type Me struct {
	// My Name (e.g. Monta Team A).
	Name string `json:"name"`

	// My OperatorID.
	OperatorID int64 `json:"operatorId"`

	// TeamIDs that are unlocked for API operations. If empty, all teams of this operator are unlocked.
	TeamIDs []int64 `json:"teamIds"`

	// My ClientID.
	ClientID string `json:"clientId"`

	// RateLimit for my account; requests per minute.
	RateLimit int64 `json:"rateLimit"`

	// My Scopes.
	Scopes []Scope `json:"scopes"`
}

Me - the current API consumer.

type Operator

type Operator struct {
	// ID of the operator.
	ID int64 `json:"id"`

	// Name of operator.
	Name string `json:"name"`

	// Identifier of operator.
	Identifier string `json:"identifier"`

	// VATNumber of the operator.
	VATNumber string `json:"vatNumber"`

	// PartnerID of the operator (owner of this operator).
	PartnerID int64 `json:"partnerId"`
}

Operator is a charge point operator.

type PageFilters added in v0.6.0

type PageFilters struct {
	// Page number to request (starts with 0).
	Page int
	// Number of items PerPage (between 1 and 100, default 10).
	PerPage int
}

Common page filters.

func (PageFilters) Apply added in v0.6.0

func (p PageFilters) Apply(query url.Values)

Set the filters to the given query.

type PageMeta

type PageMeta struct {
	// ItemCount is the number of items in the page.
	ItemCount int32 `json:"itemCount"`
	// CurrentPage is the index of the current page.
	CurrentPage int32 `json:"currentPage"`
	// PerPage is the requested number of items per page.
	PerPage int32 `json:"perPage"`
	// TotalPageCount is the total number of pages.
	TotalPageCount int32 `json:"totalPageCount"`
	// TotalItemCount is the total number of items.
	TotalItemCount int64 `json:"totalItemCount"`
}

PageMeta holds page metadata.

type PatchChargeAuthTokenRequest added in v0.16.0

type PatchChargeAuthTokenRequest struct {
	// External Id of this entity, managed by you.
	PartnerExternalID *string `json:"partnerExternalId,omitempty"`
}

PatchChargeAuthTokenRequest is the request input to the [Client.PatchChargeAuthToken] method.

type PayingTeam added in v0.21.0

type PayingTeam struct {
	// ID of the team.
	ID int64 `json:"id"`

	// Public name of the team.
	PublicName string `json:"publicName"`

	// External Id of this entity, managed by you.
	PartnerExternalID *string `json:"partnerExternalId"`
}

Team of Monta users.

type PaymentMethod

type PaymentMethod string

PaymentMethod is a payment method.

const (
	PaymentMethodFree              PaymentMethod = "free"
	PaymentMethodTeamHasFunds      PaymentMethod = "team-has-funds"
	PaymentMethodTeamHasAutoRefill PaymentMethod = "team-has-auto-refill"
	PaymentMethodSource            PaymentMethod = "source"
	PaymentMethodPayment           PaymentMethod = "payment"
)

Known PaymentMethod values.

type Price added in v0.33.0

type Price struct {
	// The amount of money.
	Amount int64 `json:"amount"`
	// Currency.
	Currency PriceCurrency `json:"currency"`
	// Current user locale.
	Locale string `json:"locale"`
}

Price of a fee, tariff or a master price.

type PriceCurrency added in v0.33.0

type PriceCurrency struct {
	// ID of the currency.
	ID *int64 `json:"id"`

	// Whether the currency is master or not, master meaning the default currency.
	Master *bool `json:"master"`

	// 3 characters identifier.
	Identifier string `json:"identifier"`

	// Name of the currency.
	Name *string `json:"name"`

	// How many decimals the currency has.
	Decimals int32 `json:"decimals"`
}

Currency object of a Price.

type PriceGroup added in v0.33.0

type PriceGroup struct {
	// ID of the price group.
	ID int64 `json:"id"`

	// Name of the price group.
	Name string `json:"name"`

	// Default price group.
	Default bool `json:"default"`

	// Type of the price group.
	Type PriceGroupType `json:"type"`

	// The master price.
	MasterPrice Pricing `json:"masterPrice"`

	// Tariffs of the price group.
	Tariffs []Pricing `json:"tariffs"`

	// Fees of the price group.
	Fees []Pricing `json:"fees"`

	// To how many team members the price group has been applied to.
	TeamMemberCount *int32 `json:"teamMemberCount"`

	// To how many charge points the price group has been applied to.
	ChargePointCount *int32 `json:"chargePointCount"`

	// Objects the price group is applied to.
	AppliedTo *AppliedTo `json:"appliedTo"`

	// When the price group was created.
	CreatedAt time.Time `json:"createdAt"`

	// When the price group was updated.
	UpdatedAt *time.Time `json:"updatedAt"`
}

PriceGroup is a price group.

type PriceGroupType added in v0.33.0

type PriceGroupType string

Type of price group.

const (
	PriceGroupTypePublic        PriceGroupType = "public"
	PriceGroupTypeMember        PriceGroupType = "member"
	PriceGroupTypeSponsored     PriceGroupType = "sponsored"
	PriceGroupTypeCost          PriceGroupType = "cost"
	PriceGroupTypeRoaming       PriceGroupType = "roaming"
	PriceGroupTypeReimbursement PriceGroupType = "reimbursement"
	PriceGroupTypeOther         PriceGroupType = "other"
)

Known PriceGroupType values.

type Pricing added in v0.33.0

type Pricing struct {
	// Id of the pricing.
	ID int64 `json:"id"`

	// Name of the pricing. It will be null when it's the master price.
	Description *string `json:"description"`

	// Type of the pricing. minute is used for Minute fee. min is used for the master price.
	Type PricingType `json:"type"`

	// If this is the master price (not a fee).
	Master bool `json:"master"`

	// If it's a dynamic price. It will be true if a tariffId is present.
	DynamicPricing bool `json:"dynamicPricing"`

	// Used by the Minute fee. True means it will stop charging the fee when the charge is complete.
	// False means it will stop charging the fee when the cable is unplugged.
	EndAtFullyCharged bool `json:"endAtFullyCharged"`

	// Used by Spot Price. True means it will add % of VAT on top the price calculations.
	// Note: vat rates differ from country to country.
	VAT bool `json:"vat"`

	// Used by Spot Price. It will multiply the fallback price by this percentage.
	Percentage *float64 `json:"percentage"`

	// The id of the selected Tariff
	TariffID *int64 `json:"tariffId"`

	// When the pricing was last updated.
	UpdatedAt time.Time `json:"updatedAt"`

	// Used by Charging, Minute and Idle Fees. After how many minutes the fee should start being applied.
	ApplyAfterMinutes *int32 `json:"applyAfterMinutes"`

	// The price of this Fee or Master price.
	Price Price `json:"price"`

	// Used by spot price. The minimum that the raw spot price can be.
	// This will be used in calculations if spot price is lower than this.
	PriceMin *Price `json:"priceMin"`

	// Used by spot price. The maximum that the raw spot price can be.
	// This will be used in calculations if spot price is higher than this.
	PriceMax *Price `json:"priceMax"`

	// Used by Idle fee. The maximum the user will be charged for the idle fee.
	FeePriceMax *Price `json:"feePriceMax"`

	// Used by spot price. Additional absolute money or percentages values to be added on top of the previous calculations.
	Additional []*Additional `json:"additional"`

	// DateTime "from" time to which this pricing should apply from.
	From *time.Time `json:"from"`

	// DateTime "to" time to which this pricing should apply to
	To *time.Time `json:"to"`

	// The id of the charge pricing tag for this pricing.
	TagID *int64 `json:"tagId"`
}

A pricing object.

type PricingRequestBody added in v0.33.0

type PricingRequestBody struct {
	// Name of the pricing. It will be null when it's the master price.
	Description *string `json:"description"`
	// Type of the pricing. minute is used for Minute fee. min is used for the master price.
	Type PricingType `json:"type"`
	// Used by the Minute fee. True means it will stop charging the fee when the charge is complete.
	// False means it will stop charging the fee when the cable is unplugged.
	EndAtFullyCharged bool `json:"endAtFullyCharged"`
	// Used by Spot Price. True means it will add % of VAT on top the price calculations.
	// Note: vat rates differ from country to country.
	VAT bool `json:"vat"`
	// Used by Spot Price. It will multiply the fallback price by this percentage.
	Percentage *float64 `json:"percentage"`
	// The id of the selected Tariff
	TariffID *int64 `json:"tariffId"`
	// The id of the charge pricing tag for this pricing.
	TagID *int64 `json:"tagId"`
	// Used by Charging, Minute and Idle Fees. After how many minutes the fee should start being applied.
	ApplyAfterMinutes *int32 `json:"applyAfterMinutes"`
	// The price of this Fee or Master price.
	Price Price `json:"price"`
	// Used by spot price. The minimum that the raw spot price can be.
	// This will be used in calculations if spot price is lower than this.
	PriceMin *Price `json:"priceMin"`
	// Used by spot price. The maximum that the raw spot price can be.
	// This will be used in calculations if spot price is higher than this.
	PriceMax *Price `json:"priceMax"`
	// Used by Idle fee. The maximum the user will be charged for the idle fee.
	FeePriceMax *Price `json:"feePriceMax"`
	// Used by spot price. Additional absolute money or percentages values to be added on top of the previous calculations.
	Additional []*Additional `json:"additional"`
	// DateTime "from" time to which this pricing should apply from.
	From *time.Time `json:"from"`
	// DateTime "to" time to which this pricing should apply to
	To *time.Time `json:"to"`
}

A pricing object for a create or update request body.

type PricingType added in v0.33.0

type PricingType string

Type of pricing.

const (
	PricingTypeKwh      PricingType = "kwh"
	PricingTypeMin      PricingType = "min"
	PricingTypeSpot     PricingType = "spot"
	PricingTypeTariff   PricingType = "tariff"
	PricingTypeStarting PricingType = "starting"
	PricingTypeCharging PricingType = "charging"
	PricingTypeIdle     PricingType = "idle"
	PricingTypeMinute   PricingType = "minute"
)

Know PricingType values.

type RefreshTokenRequest

type RefreshTokenRequest struct {
	// The refresh token.
	RefreshToken string `json:"refreshToken"`
}

RefreshTokenRequest is the request input to the [Client.RefreshToken] method.

type Scope

type Scope string

Scope is an authorization scope.

const (
	ScopeAll                Scope = "all"
	ScopeChargePoints       Scope = "charge-points"
	ScopeMap                Scope = "map"
	ScopeChargeTransactions Scope = "charge-transactions"
	ScopeWalletTransactions Scope = "wallet-transactions"
	ScopeControlCharging    Scope = "control-charging"
	ScopeManageWebhooks     Scope = "manage-webhooks"
)

Known Scope values.

type Site

type Site struct {
	// ID of the site.
	ID int64 `json:"id"`

	// Name of the site.
	Name string `json:"name"`

	// ChargePointCount is the number of charge points at this site.
	ChargePointCount int64 `json:"chargePointCount"`

	// ActiveChargePointCount is the number of active charge points at this site.
	ActiveChargePointCount int64 `json:"activeChargePointCount"`

	// AvailableChargePointCount is the number of available charge points at this site.
	AvailableChargePointCount int64 `json:"availableChargePointCount"`

	// MaxKW available at this site.
	MaxKW *float64 `json:"maxKW"`

	// Type of charge points at this site.
	Type *ChargePointType `json:"type"`

	// Visibility indicates if this site is public or private.
	Visibility Visibility `json:"visibility"`

	// A Note you have entered for this site, e.g. via our Portal.
	Note *string `json:"note"`

	// External Id of this entity, managed by you.
	PartnerExternalID *string `json:"partnerExternalId"`

	// Location of the site.
	Location Location `json:"location"`

	// Connectors is a list of supported connector types at this site.
	Connectors []Connector `json:"connectors"`

	// When the charging site was created.
	CreatedAt time.Time `json:"createdAt"`

	// When the charging site was last updated.
	UpdatedAt time.Time `json:"updatedAt"`

	// Operator of this site
	Operator *Operator `json:"operator"`
}

Site is a charging site.

type SoC added in v0.14.0

type SoC struct {
	// Value of SoC in %
	Percentage *float64 `json:"percentage"`

	// Source of this value, eg vehicle or charge-point.
	Source SoCSource `json:"source"`
}

Information about the state of charge if available.

type SoCSource added in v0.14.0

type SoCSource string

SoCSource source of the SoC.

const (
	SoCSourceChargePoint   SoCSource = "charge-point"
	SoCSourceChargeVehicle SoCSource = "vehicle"
)

Known SoCSource values.

type StartChargeRequest added in v0.4.0

type StartChargeRequest struct {
	// PayingTeamID is the ID of the team that will be paying for the charge.
	PayingTeamID int64 `json:"payingTeamId"`
	// ChargePointID is the ID of the charge point used for this charge.
	ChargePointID int64 `json:"chargePointId"`
	// ReserveCharge determines whether the charge point will be reserved or start the charge directly.
	ReserveCharge bool `json:"reserveCharge"`
}

StartChargeRequest is the request input to the [Client.StartCharge] method.

type StartChargeResponse added in v0.4.0

type StartChargeResponse struct {
	// Charge that started.
	Charge Charge `json:"charge"`
}

StartChargeResponse is the response output from the [Client.StartCharge] method.

type StatusError

type StatusError struct {
	Status     string
	StatusCode int
	Body       string
}

StatusError represents a HTTP status error from the Monta Partner API.

func (*StatusError) Error

func (s *StatusError) Error() string

Error implements error.

type Team

type Team struct {
	// ID of the team.
	ID int64 `json:"id"`

	// Name of the team.
	Name string `json:"name"`

	// External Id of the team.
	ExternalID *string `json:"externalId"`

	// External Id of this entity, managed by you.
	PartnerExternalID *string `json:"partnerExternalId"`

	// Code to share with a user to join the team.
	JoinCode string `json:"joinCode"`

	// Company name for the given team.
	CompanyName *string `json:"companyName"`

	// Operator of the team.
	Operator Operator `json:"operator"`

	// Address of the team.
	Address Address `json:"address"`

	// Type of the team.
	Type *string `json:"type"`

	// Operator Id of the team.
	OperatorID int64 `json:"operatorId"`

	// When the team was blocked.
	BlockedAt *time.Time `json:"blockedAt"`

	// When the team was created.
	CreatedAt time.Time `json:"createdAt"`

	// When the team was last updated.
	UpdatedAt time.Time `json:"updatedAt"`

	// When the team was deleted.
	DeletedAt *time.Time `json:"deletedAt"`
}

Team of Monta users.

type ToFromType

type ToFromType string

ToFromType denotes the type of transaction sender or receiver.

type Token

type Token struct {
	// AccessToken for accessing the Monta Partner API.
	AccessToken string `json:"accessToken"`
	// RefreshToken for refreshing an access token.
	RefreshToken string `json:"refreshToken"`
	// AccessTokenExpirationDate is the expiration time of the access token.
	AccessTokenExpirationTime time.Time `json:"accessTokenExpirationDate"`
	// RefreshTokenExpirationDate is the expiration date of the access token.
	RefreshTokenExpirationTime time.Time `json:"refreshTokenExpirationDate"`
}

Token holds authentication tokens for the Monta Partner API.

type TransactionGroup

type TransactionGroup string

TransactionGroup is a wallet transaction group.

const (
	TransactionGroupDeposit  TransactionGroup = "deposit"
	TransactionGroupWithdraw TransactionGroup = "withdraw"
	TransactionGroupCharge   TransactionGroup = "charge"
	TransactionGroupOther    TransactionGroup = "other"
)

Known TransactionGroup values.

type UnixTimestamp added in v0.23.0

type UnixTimestamp struct {
	time.Time
}

func (*UnixTimestamp) UnmarshalJSON added in v0.23.0

func (ut *UnixTimestamp) UnmarshalJSON(data []byte) error

Unmarshal a unix timestamp (in milliseconds) from a JSON object to a human readable timestamp.

type Visibility

type Visibility string

Visibility represents the visibility of a site or charge point.

type WalletTransaction

type WalletTransaction struct {
	// ID of the transaction.
	ID int64 `json:"id"`

	// FromAmount is the amount sent from the sender.
	FromAmount float64 `json:"fromAmount"`

	// FromCurrency is the currency sent by the sender.
	FromCurrency Currency `json:"fromCurrency"`

	// FromType is the type of sender.
	FromType ToFromType `json:"fromType"`

	// From is the raw JSON message representing sender of the transaction.
	From json.RawMessage `json:"from"`

	// FromTeam holds the parsed value of From when [FromType] is [TypeTeam].
	FromTeam *PayingTeam `json:"-"`

	// FromOperator holds the parsed value of From when [FromType] is [TypeOperator].
	FromOperator *Operator `json:"-"`

	// ToAmount is the amount received by the receiver.
	ToAmount float64 `json:"toAmount"`

	// Type of receiver: operator, team
	ToCurrency Currency `json:"toCurrency"`

	// Type of the sender.
	ToType ToFromType `json:"toType"`

	// From is the sender of the transaction.
	To json.RawMessage `json:"to"`

	// ToOperator is used when [ToType] is "operator".
	ToOperator *Operator `json:"-"`

	// ToTeam is used when [ToType] is "team".
	ToTeam *PayingTeam `json:"-"`

	// Exchange rate used for currency conversion.
	ExchangeRate float64 `json:"exchangeRate"`

	// Creation date of transaction.
	CreatedAt time.Time `json:"createdAt"`

	// Update date of transaction.
	UpdatedAt time.Time `json:"updatedAt"`

	// Reference type of this transaction.
	ReferenceType string `json:"referenceType"`

	// Reference id of this transaction.
	ReferenceID string `json:"referenceId"`

	// Transaction group of this transaction.
	Group TransactionGroup `json:"group"`

	// Transaction state of this transaction
	State WalletTransactionState `json:"state"`

	// A note that has been entered for this transaction.
	Note string `json:"note"`
}

WalletTransaction is a wallet transaction.

func (*WalletTransaction) MarshalJSON

func (w *WalletTransaction) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*WalletTransaction) UnmarshalJSON

func (w *WalletTransaction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type WalletTransactionState

type WalletTransactionState string

WalletTransactionState is a wallet transaction state.

const (
	WalletTransactionStateComplete WalletTransactionState = "complete"
	WalletTransactionStateReserved WalletTransactionState = "reserved"
	WalletTransactionStatePending  WalletTransactionState = "pending"
	WalletTransactionStateFailed   WalletTransactionState = "failed"
)

Known WalletTransactionState values.

type WebhookConfig added in v0.26.1

type WebhookConfig struct {
	// A HTTPS URL to send the webhook payload to when an event occurs.
	WebhookURL string `json:"webhookUrl"`
	// A cryptoghrapic secret used to sign the webhook payload.
	WebhookSecret string `json:"webhookSecret"`
	// List of entity types in plural to subscribe to. Use ["*"] to subscribe to all.
	EventTypes []*WebhookEntityPluralType `json:"eventTypes"`
}

WebhookConfig is the request for and response from Get and Update WebhookConfig methods.

type WebhookEntityPluralType added in v0.28.0

type WebhookEntityPluralType string

WebhookEntityPluralType represents the type of a webhook entity in plural form.

const (
	WebhookEntityPluralTypeAll                WebhookEntityPluralType = "*"
	WebhookEntityPluralTypeCharges            WebhookEntityPluralType = "charges"
	WebhookEntityPluralTypeChargePoints       WebhookEntityPluralType = "charge-points"
	WebhookEntityPluralTypeSites              WebhookEntityPluralType = "sites"
	WebhookEntityPluralTypeTeams              WebhookEntityPluralType = "teams"
	WebhookEntityPluralTypeTeamMembers        WebhookEntityPluralType = "team-members"
	WebhookEntityPluralTypeInstallerJobs      WebhookEntityPluralType = "installer-jobs"
	WebhookEntityPluralTypeWalletTransactions WebhookEntityPluralType = "wallet-transactions"
	WebhookEntityPluralTypePriceGroups        WebhookEntityPluralType = "price-groups"
	WebhookEntityPluralTypePlans              WebhookEntityPluralType = "plans"
	WebhookEntityPluralTypeSubscriptions      WebhookEntityPluralType = "subscriptions"
)

Known WebhookEntityPluralType values.

type WebhookEntityType added in v0.23.0

type WebhookEntityType string

WebhookEtityType represents the type of a webhook entity.

const (
	WebhookEntityTypeCharge            WebhookEntityType = "charge"
	WebhookEntityTypeChargePoint       WebhookEntityType = "charge-point"
	WebhookEntityTypeSite              WebhookEntityType = "site"
	WebhookEntityTypeTeamMember        WebhookEntityType = "team-member"
	WebhookEntityPluralTypeTeam        WebhookEntityType = "team"
	WebhookEntityTypeInstallerJob      WebhookEntityType = "installer-job"
	WebhookEntityTypeWalletTransaction WebhookEntityType = "wallet-transaction"
	WebhookEntityTypePriceGroup        WebhookEntityType = "price-group"
	WebhookEntityTypePlan              WebhookEntityType = "plan"
	WebhookEntityTypeSubscription      WebhookEntityType = "subscription"
)

Known WebhookEntityType values.

type WebhookEntry added in v0.23.0

type WebhookEntry struct {
	// Type of the entity.
	EntityType WebhookEntityType `json:"entityType"`

	// ID of the entity.
	EntityID string `json:"entityId"`

	// Type of event, ie. created, deleted, updated.
	EventType WebhookEventType `json:"eventType"`

	// Payload of this entity, e.g. a full Charge object.
	Payload interface{} `json:"payload"`
}

WebhookEntry is an entry of the webhook request.

type WebhookEvent added in v0.28.0

type WebhookEvent struct {
	// ID of the webhook event.
	ID int64 `json:"id"`

	// ConsumerID of the intended receiver of the webhook.
	ConsumerID int64 `json:"consumerId"`

	// ID of the operator.
	OperatorID int64 `json:"operatorId"`

	// Entity type related to webhook event.
	WebhookEntityPluralType WebhookEntityPluralType `json:"eventType"`

	// Payload of the related webhook call.
	WebhookEntry WebhookEntry `json:"payload"`

	// Status of the webhook call.
	Status WebhookEventStatus `json:"status"`

	// Error related to the webhook call.
	Error string `json:"error"`

	// When the webhook event was created.
	CreatedAt time.Time `json:"createdAt"`

	// When the webhook event was last updated.
	UpdatedAt time.Time `json:"updatedAt"`
}

WebhookEvent wraps a WebhookEntry and metadata on a webhook call.

type WebhookEventStatus added in v0.28.0

type WebhookEventStatus string

Status of the webhook call.

const (
	WebhookStatusPending   WebhookEventStatus = "pending"
	WebhookStatusCompleted WebhookEventStatus = "completed"
	WebhookStatusFailure   WebhookEventStatus = "failure"
)

Known WebhookEventStatus values.

type WebhookEventType added in v0.23.0

type WebhookEventType string

WebhookEventType represents the type of a webhook event.

const (
	WebhookEventTypeCreated WebhookEventType = "created"
	WebhookEventTypeDeleted WebhookEventType = "deleted"
	WebhookEventTypeUpdated WebhookEventType = "updated"
)

Known WebhookEventType values.

type WebhookRequest added in v0.23.0

type WebhookRequest struct {
	// List of webhook entries delivered in a batch.
	Entries []WebhookEntry `json:"entries"`

	// Number of pending events left for delivery.
	Pending int64 `json:"pending"`

	// Timestamp of the request (milliseconds from the epoch of 1970-01-01T00:00:00Z).
	Timestamp UnixTimestamp `json:"timestamp"`
}

WebhookRequest is a webhook request from Monta.

Directories

Path Synopsis
cmd
monta module

Jump to

Keyboard shortcuts

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