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 ¶
- type Service
- func (s *Service) Change(ctx context.Context, id types.WatchID, w types.Watch) (types.Watch, error)
- func (s *Service) Create(ctx context.Context, w types.Watch) (types.Watch, error)
- func (s *Service) Delete(ctx context.Context, id types.WatchID) error
- func (s *Service) Get(ctx context.Context, id types.WatchID) (types.Watch, error)
- func (s *Service) List(ctx context.Context, account types.AccountRef) ([]types.Watch, error)
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 (*Service) Change ¶
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 ¶
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.