Help us shape the future of Go! Take the 2026 Go Developer Survey

watches

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package watches sets thresholds on accounts: Blnk balance monitors, which fire the webhook event "balance.monitor" while they hold. Use it through humanblnk.Client.Watches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service creates, reads, changes and deletes watches.

func New

func New(k *core.Core) *Service

New returns a Service on k.

func (*Service) Change

func (s *Service) Change(ctx context.Context, id types.WatchID, w types.Watch) (types.Watch, error)

Change replaces watch id with w and returns the new watch, which has a new ID. Blnk can't change a monitor's threshold in place, so the new watch is created before the old one is deleted: the account is never unwatched, and both may fire once in between.

func (*Service) Create

func (s *Service) Create(ctx context.Context, w types.Watch) (types.Watch, error)

Create starts watching an account. The threshold must be in the account's currency, and at most 2^53 in its smallest unit (about 90 trillion naira, or 0.009 ETH): Blnk reads a threshold as a float, and only up to there is every whole number exact. Anything larger is ErrInvalid, and Create checks that Blnk stored exactly the threshold sent.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id types.WatchID) error

Delete stops a watch.

func (*Service) Get

func (s *Service) Get(ctx context.Context, id types.WatchID) (types.Watch, error)

Get fetches a watch by id.

func (*Service) List

func (s *Service) List(ctx context.Context, account types.AccountRef) ([]types.Watch, error)

List lists the watches on account, or every watch when account is empty.

Jump to

Keyboard shortcuts

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