Documentation
¶
Index ¶
Constants ¶
View Source
const ( ConsumerNotFoundErrorName = "ConsumerNotFound" ConsumerExistsErrorName = "ConsumerExists" )
Variables ¶
View Source
var ( // ErrConsumerNotFound indicates a consumer was not found that matches the passed details. ErrConsumerNotFound = errors.New(ConsumerNotFoundErrorName, "consumer not found") // ErrConsumerExists indicates a consumer already exists that matches the passed details. ErrConsumerExists = errors.New(ConsumerExistsErrorName, "consumer already exists") )
Functions ¶
This section is empty.
Types ¶
type ListByCustomerConfig ¶
type ListByCustomerConfig = store.PaginationConfig
type ListByCustomerOption ¶
type ListByCustomerOption func(cfg *ListByCustomerConfig)
func WithListByCustomerCursor ¶
func WithListByCustomerCursor(cursor string) ListByCustomerOption
func WithListByCustomerLimit ¶
func WithListByCustomerLimit(limit int) ListByCustomerOption
type ListConfig ¶
type ListConfig = store.PaginationConfig
type ListOption ¶
type ListOption func(cfg *ListConfig)
func WithListCursor ¶
func WithListCursor(cursor string) ListOption
func WithListLimit ¶
func WithListLimit(limit int) ListOption
type Record ¶
type Record struct {
/** DID of the provider who provides services for the consumer. */
Provider did.DID
/** DID of the consumer (e.g. a space) for whom services have been provisioned. */
Consumer did.DID
/** DID of the customer (e.g. an account) who owns the consumer. */
Customer did.DID
/** ID of the subscription representing the relationship between the consumer and provider. */
Subscription string
/**
* CID of the UCAN invocation that created this record.
* Note: May be nil - this became a required field after 2023-07-10T23:12:38.000Z.
*/
Cause cid.Cid
}
type Store ¶
type Store interface {
// May return [ErrConsumerExists] if a consumer record already exists for the
// given provider, consumer, customer and subscription.
Add(ctx context.Context, provider did.DID, space did.DID, customer did.DID, subscription string, cause cid.Cid) error
// May return [ErrConsumerNotFound] if no consumer record exists for the given
// provider and consumer.
Get(ctx context.Context, provider did.DID, space did.DID) (Record, error)
GetBySubscription(ctx context.Context, provider did.DID, subscription string) (Record, error)
List(ctx context.Context, space did.DID, options ...ListOption) (store.Page[Record], error)
ListByCustomer(ctx context.Context, customer did.DID, options ...ListByCustomerOption) (store.Page[Record], error)
}
Click to show internal directories.
Click to hide internal directories.