Documentation
¶
Index ¶
- Constants
- Variables
- func NewSubscriptionID(consumer SpaceDID) (string, error)
- type AccountDID
- type Service
- func (s *Service) GetConsumer(ctx context.Context, provider ServiceDID, space SpaceDID) (consumer.Record, error)
- func (s *Service) GetSubscription(ctx context.Context, provider ServiceDID, subscription SubscriptionID) (subscription.Record, error)
- func (s *Service) ListServiceProviders(ctx context.Context, space SpaceDID) ([]ServiceDID, error)
- func (s *Service) Provision(ctx context.Context, customer AccountDID, consumer SpaceDID, ...) (SubscriptionID, error)
- type ServiceDID
- type SpaceDID
- type SubscriptionID
Constants ¶
const ProviderNotAllowedErrorName = "ProviderNotAllowed"
Variables ¶
var ErrProviderNotAllowed = errors.New(ProviderNotAllowedErrorName, "provider not allowed")
ErrProviderNotAllowed is returned when a provider is not in the allowed list.
Functions ¶
func NewSubscriptionID ¶
Types ¶
type AccountDID ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(providers []ServiceDID, consumerStore consumer.Store, subscriptionStore subscription.Store) *Service
func (*Service) GetConsumer ¶
func (s *Service) GetConsumer(ctx context.Context, provider ServiceDID, space SpaceDID) (consumer.Record, error)
GetConsumer returns the consumer record for a given service provider and consumer (space). It may return consumer.ErrConsumerNotFound.
func (*Service) GetSubscription ¶
func (s *Service) GetSubscription(ctx context.Context, provider ServiceDID, subscription SubscriptionID) (subscription.Record, error)
GetSubscription returns the subscription record for a given service provider. It may return subscription.ErrSubscriptionNotFound.
func (*Service) ListServiceProviders ¶
ListServiceProviders returns a list of services that have been provisioned for the given consumer (space).
func (*Service) Provision ¶
func (s *Service) Provision(ctx context.Context, customer AccountDID, consumer SpaceDID, provider ServiceDID, cause cid.Cid) (SubscriptionID, error)
Provision provisions a service provider for a consumer (space) on behalf of a customer (account). It may return [customer.ErrCustomerNotFound] if the customer does not exist and consumer.ErrConsumerExists if the consumer is already provisioned for the provider.
type ServiceDID ¶
type SubscriptionID ¶
type SubscriptionID = string