moesif

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package moesif provides a block-partitioned, stateful Moesif management API for the API Portal's billing.

It answers the Moesif calls the API Portal makes: the billing catalog (plans and prices), billing meters, the connection to Stripe, and the usage search. Catalog prices are created in the testbench's Stripe service, as Moesif syncs its catalog to Stripe, and the usage a billing meter counts is reported to Stripe against the meter's price. It also receives the Stripe events sent to Moesif's Stripe endpoint. Control endpoints under /test record counted usage, fail chosen requests, and report the stored state.

Index

Constants

View Source
const Port = 3023

Port is the container port used by the testbench.

Variables

This section is empty.

Functions

This section is empty.

Types

type Billing

type Billing interface {
	// AddPrice adds a catalog price to the account of the partition key.
	AddPrice(key string, spec stripe.PriceSpec) error
	// ArchivePrice stops new subscriptions to a price.
	ArchivePrice(key, priceID string) error
	// RecordUsage adds usage to a subscription's metered price. The subscription is named by its
	// id or by a value in its metadata; its id is returned.
	RecordUsage(key, subscriptionRef, priceID string, quantity int64) (string, error)
}

Billing is the Stripe account Moesif syncs its catalog to and reports counted usage to.

type Service

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

Service is the Moesif service. Each block has its own Moesif application.

func New

func New(billing Billing) (*Service, error)

New returns a Moesif service that syncs its catalog to billing.

func (*Service) Handler

func (s *Service) Handler() http.Handler

func (*Service) Name

func (s *Service) Name() string

func (*Service) PartitionKey

func (s *Service) PartitionKey() string

func (*Service) Port

func (s *Service) Port() int

func (*Service) Stateful

func (s *Service) Stateful() bool

Jump to

Keyboard shortcuts

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