Documentation
¶
Index ¶
- Constants
- func IsAppCustomerPreConditionError(err error) bool
- func IsAppDefaultNotFoundError(err error) bool
- func IsAppNotFoundError(err error) bool
- func IsAppProviderAuthenticationError(err error) bool
- func IsAppProviderError(err error) bool
- func IsAppProviderPreConditionError(err error) bool
- type Adapter
- type App
- type AppAdapter
- type AppBase
- func (a AppBase) GetAppBase() AppBase
- func (a AppBase) GetDescription() *string
- func (a AppBase) GetID() AppID
- func (a AppBase) GetListing() MarketplaceListing
- func (a AppBase) GetMetadata() map[string]string
- func (a AppBase) GetName() string
- func (a AppBase) GetStatus() AppStatus
- func (a AppBase) GetType() AppType
- func (a AppBase) Validate() error
- func (a AppBase) ValidateCapabilities(capabilities ...CapabilityType) error
- type AppCreateEvent
- type AppCustomerPreConditionError
- type AppDefaultNotFoundError
- type AppDeleteEvent
- type AppFactory
- type AppFactoryInstall
- type AppFactoryInstallAppInput
- type AppFactoryInstallAppWithAPIKeyInput
- type AppFactoryInstallWithAPIKey
- type AppID
- type AppNotFoundError
- type AppProviderAuthenticationError
- type AppProviderError
- type AppProviderPreConditionError
- type AppService
- type AppStatus
- type AppType
- type AppUpdateEvent
- type AuthorizeOauth2InstallInput
- type Capability
- type CapabilityType
- type CreateAppInput
- type CustomerApp
- type CustomerData
- type CustomerPaymentSetupResult
- type CustomerPaymentSetupSucceededEvent
- type DeleteAppInstanceCustomerDataInput
- type DeleteCustomerInput
- type EnsureCustomerInput
- type GetAppInput
- type GetAppInstanceCustomerDataInput
- type GetDefaultAppInput
- type GetOauth2InstallURLInput
- type GetOauth2InstallURLOutput
- type InstallAppInput
- type InstallAppWithAPIKeyInput
- type InstallMethod
- type ListAppInput
- type ListCustomerInput
- type MarketplaceGetInput
- type MarketplaceListInput
- type MarketplaceListing
- type MarketplaceListingID
- type PaymentSetupAppData
- type RegisterMarketplaceListingInput
- type RegistryItem
- type Service
- type UninstallAppInput
- type UpdateAppInput
- type UpdateAppStatusInput
- type UpsertAppInstanceCustomerDataInput
Constants ¶
const ( DefaultPageNumber = 1 DefaultPageSize = 100 )
const ( AppEventSubsystem metadata.EventSubsystem = "app" AppCreateEventName metadata.EventName = "app.created" AppUpdateEventName metadata.EventName = "app.updated" AppDeleteEventName metadata.EventName = "app.deleted" )
const (
EventSubsystemAppCustomer = "app_customer"
)
Variables ¶
This section is empty.
Functions ¶
func IsAppNotFoundError ¶
IsAppNotFoundError returns true if the error is a AppNotFoundError.
func IsAppProviderError ¶
Types ¶
type Adapter ¶
type Adapter interface {
AppAdapter
entutils.TxCreator
}
type App ¶
type App interface {
GetAppBase() AppBase
GetID() AppID
GetType() AppType
GetName() string
GetDescription() *string
GetStatus() AppStatus
GetMetadata() map[string]string
GetListing() MarketplaceListing
// ValidateCapabilities validates if the app can run for the given capabilities
ValidateCapabilities(capabilities ...CapabilityType) error
// Customer data
GetCustomerData(ctx context.Context, input GetAppInstanceCustomerDataInput) (CustomerData, error)
UpsertCustomerData(ctx context.Context, input UpsertAppInstanceCustomerDataInput) error
DeleteCustomerData(ctx context.Context, input DeleteAppInstanceCustomerDataInput) error
}
App represents an installed app
type AppAdapter ¶
type AppAdapter interface {
// Marketplace
RegisterMarketplaceListing(input RegisterMarketplaceListingInput) error
GetMarketplaceListing(ctx context.Context, input MarketplaceGetInput) (RegistryItem, error)
ListMarketplaceListings(ctx context.Context, input MarketplaceListInput) (pagination.PagedResponse[RegistryItem], error)
InstallMarketplaceListingWithAPIKey(ctx context.Context, input InstallAppWithAPIKeyInput) (App, error)
InstallMarketplaceListing(ctx context.Context, input InstallAppInput) (App, error)
GetMarketplaceListingOauth2InstallURL(ctx context.Context, input GetOauth2InstallURLInput) (GetOauth2InstallURLOutput, error)
AuthorizeMarketplaceListingOauth2Install(ctx context.Context, input AuthorizeOauth2InstallInput) error
// Installed app
CreateApp(ctx context.Context, input CreateAppInput) (AppBase, error)
GetApp(ctx context.Context, input GetAppInput) (App, error)
GetDefaultApp(ctx context.Context, input GetDefaultAppInput) (App, error)
UpdateApp(ctx context.Context, input UpdateAppInput) (App, error)
ListApps(ctx context.Context, input ListAppInput) (pagination.PagedResponse[App], error)
UninstallApp(ctx context.Context, input UninstallAppInput) (*AppBase, error)
UpdateAppStatus(ctx context.Context, input UpdateAppStatusInput) error
// Customer data
ListCustomerData(ctx context.Context, input ListCustomerInput) (pagination.PagedResponse[CustomerApp], error)
EnsureCustomer(ctx context.Context, input EnsureCustomerInput) error
DeleteCustomer(ctx context.Context, input DeleteCustomerInput) error
}
type AppBase ¶
type AppBase struct {
models.ManagedResource
Type AppType `json:"type"`
Status AppStatus `json:"status"`
Default bool `json:"default"`
Listing MarketplaceListing `json:"listing"`
Metadata map[string]string `json:"metadata,omitempty"`
}
AppBase represents an abstract with the base fields of an app
func (AppBase) GetAppBase ¶
func (AppBase) GetDescription ¶
func (AppBase) GetListing ¶
func (a AppBase) GetListing() MarketplaceListing
func (AppBase) GetMetadata ¶
func (AppBase) ValidateCapabilities ¶
func (a AppBase) ValidateCapabilities(capabilities ...CapabilityType) error
ValidateCapabilities validates if the app can run for the given capabilities
type AppCreateEvent ¶
type AppCreateEvent struct {
AppBase AppBase `json:"appBase"`
UserID *string `json:"userId,omitempty"`
}
AppCreateEvent is an event that is emitted when an app is created
func NewAppCreateEvent ¶
func NewAppCreateEvent(ctx context.Context, appBase AppBase) AppCreateEvent
NewAppCreateEvent creates a new app create event
func (AppCreateEvent) EventMetadata ¶
func (e AppCreateEvent) EventMetadata() metadata.EventMetadata
func (AppCreateEvent) EventName ¶
func (e AppCreateEvent) EventName() string
func (AppCreateEvent) Validate ¶
func (e AppCreateEvent) Validate() error
type AppCustomerPreConditionError ¶
type AppCustomerPreConditionError struct {
// contains filtered or unexported fields
}
func NewAppCustomerPreConditionError ¶
func NewAppCustomerPreConditionError(appID AppID, appType AppType, customerID *customer.CustomerID, condition string) *AppCustomerPreConditionError
AppCustomerPreConditionError
func (AppCustomerPreConditionError) Error ¶
func (e AppCustomerPreConditionError) Error() string
func (AppCustomerPreConditionError) Unwrap ¶
func (e AppCustomerPreConditionError) Unwrap() error
type AppDefaultNotFoundError ¶
type AppDefaultNotFoundError struct {
// contains filtered or unexported fields
}
func NewAppDefaultNotFoundError ¶
func NewAppDefaultNotFoundError(appType AppType, namespace string) *AppDefaultNotFoundError
AppDefaultNotFoundError
func (AppDefaultNotFoundError) Error ¶
func (e AppDefaultNotFoundError) Error() string
func (AppDefaultNotFoundError) Unwrap ¶
func (e AppDefaultNotFoundError) Unwrap() error
type AppDeleteEvent ¶
type AppDeleteEvent struct {
AppBase AppBase `json:"appBase"`
UserID *string `json:"userId,omitempty"`
}
AppDeleteEvent is an event that is emitted when an app is deleted
func NewAppDeleteEvent ¶
func NewAppDeleteEvent(ctx context.Context, appBase AppBase) AppDeleteEvent
NewAppDeleteEvent creates a new app delete event
func (AppDeleteEvent) EventMetadata ¶
func (e AppDeleteEvent) EventMetadata() metadata.EventMetadata
func (AppDeleteEvent) EventName ¶
func (e AppDeleteEvent) EventName() string
func (AppDeleteEvent) Validate ¶
func (e AppDeleteEvent) Validate() error
type AppFactory ¶
type AppFactoryInstall ¶
type AppFactoryInstall interface {
InstallApp(ctx context.Context, input AppFactoryInstallAppInput) (App, error)
}
type AppFactoryInstallAppWithAPIKeyInput ¶
type AppFactoryInstallAppWithAPIKeyInput struct {
Namespace string
APIKey string
BaseURL string
Name string
}
func (AppFactoryInstallAppWithAPIKeyInput) Validate ¶
func (i AppFactoryInstallAppWithAPIKeyInput) Validate() error
type AppFactoryInstallWithAPIKey ¶
type AppFactoryInstallWithAPIKey interface {
InstallAppWithAPIKey(ctx context.Context, input AppFactoryInstallAppWithAPIKeyInput) (App, error)
}
type AppNotFoundError ¶
type AppNotFoundError struct {
// contains filtered or unexported fields
}
func (AppNotFoundError) Error ¶
func (e AppNotFoundError) Error() string
func (AppNotFoundError) Unwrap ¶
func (e AppNotFoundError) Unwrap() error
type AppProviderAuthenticationError ¶
type AppProviderAuthenticationError struct {
// contains filtered or unexported fields
}
func NewAppProviderAuthenticationError ¶
func NewAppProviderAuthenticationError(appID *AppID, namespace string, providerError error) *AppProviderAuthenticationError
AppProviderAuthenticationError
func (AppProviderAuthenticationError) Error ¶
func (e AppProviderAuthenticationError) Error() string
func (AppProviderAuthenticationError) Unwrap ¶
func (e AppProviderAuthenticationError) Unwrap() error
type AppProviderError ¶
type AppProviderError struct {
// contains filtered or unexported fields
}
func NewAppProviderError ¶
func NewAppProviderError(appID *AppID, namespace string, providerError error) *AppProviderError
AppProviderError
func (AppProviderError) Error ¶
func (e AppProviderError) Error() string
func (AppProviderError) Unwrap ¶
func (e AppProviderError) Unwrap() error
type AppProviderPreConditionError ¶
type AppProviderPreConditionError struct {
// contains filtered or unexported fields
}
func NewAppProviderPreConditionError ¶
func NewAppProviderPreConditionError(appID AppID, condition string) *AppProviderPreConditionError
func (AppProviderPreConditionError) Error ¶
func (e AppProviderPreConditionError) Error() string
func (AppProviderPreConditionError) Unwrap ¶
func (e AppProviderPreConditionError) Unwrap() error
type AppService ¶
type AppService interface {
// Marketplace
RegisterMarketplaceListing(input RegisterMarketplaceListingInput) error
GetMarketplaceListing(ctx context.Context, input MarketplaceGetInput) (RegistryItem, error)
ListMarketplaceListings(ctx context.Context, input MarketplaceListInput) (pagination.PagedResponse[RegistryItem], error)
InstallMarketplaceListingWithAPIKey(ctx context.Context, input InstallAppWithAPIKeyInput) (App, error)
InstallMarketplaceListing(ctx context.Context, input InstallAppInput) (App, error)
GetMarketplaceListingOauth2InstallURL(ctx context.Context, input GetOauth2InstallURLInput) (GetOauth2InstallURLOutput, error)
AuthorizeMarketplaceListingOauth2Install(ctx context.Context, input AuthorizeOauth2InstallInput) error
// Installed app
CreateApp(ctx context.Context, input CreateAppInput) (AppBase, error)
GetApp(ctx context.Context, input GetAppInput) (App, error)
UpdateAppStatus(ctx context.Context, input UpdateAppStatusInput) error
GetDefaultApp(ctx context.Context, input GetDefaultAppInput) (App, error)
UpdateApp(ctx context.Context, input UpdateAppInput) (App, error)
ListApps(ctx context.Context, input ListAppInput) (pagination.PagedResponse[App], error)
UninstallApp(ctx context.Context, input UninstallAppInput) error
// Customer data
ListCustomerData(ctx context.Context, input ListCustomerInput) (pagination.PagedResponse[CustomerApp], error)
EnsureCustomer(ctx context.Context, input EnsureCustomerInput) error
DeleteCustomer(ctx context.Context, input DeleteCustomerInput) error
}
type AppStatus ¶
type AppStatus string
AppStatus represents the status of an app
const ( AppStatusReady AppStatus = "ready" )
type AppUpdateEvent ¶
type AppUpdateEvent struct {
AppBase AppBase `json:"appBase"`
UserID *string `json:"userId,omitempty"`
}
AppUpdateEvent is an event that is emitted when an app is updated
func NewAppUpdateEvent ¶
func NewAppUpdateEvent(ctx context.Context, appBase AppBase) AppUpdateEvent
NewAppUpdateEvent creates a new app update event
func (AppUpdateEvent) EventMetadata ¶
func (e AppUpdateEvent) EventMetadata() metadata.EventMetadata
func (AppUpdateEvent) EventName ¶
func (e AppUpdateEvent) EventName() string
func (AppUpdateEvent) Validate ¶
func (e AppUpdateEvent) Validate() error
type AuthorizeOauth2InstallInput ¶
type AuthorizeOauth2InstallInput struct {
MarketplaceListingID
Code string
// Success response fields
State string
// Error response fields
Error string
ErrorDescription string
ErrorURI string
}
func (AuthorizeOauth2InstallInput) Validate ¶
func (i AuthorizeOauth2InstallInput) Validate() error
type Capability ¶
type Capability struct {
Type CapabilityType `json:"type"`
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description"`
}
func (Capability) Validate ¶
func (c Capability) Validate() error
type CapabilityType ¶
type CapabilityType string
const ( CapabilityTypeReportUsage CapabilityType = "reportUsage" CapabilityTypeReportEvents CapabilityType = "reportEvents" CapabilityTypeCalculateTax CapabilityType = "calculateTax" CapabilityTypeInvoiceCustomers CapabilityType = "invoiceCustomers" CapabilityTypeCollectPayments CapabilityType = "collectPayments" )
type CreateAppInput ¶
type CreateAppInput struct {
// AppID is optional. If not provided, a new AppID will be generated by the database
ID *AppID
Namespace string
Name string
Description string
Type AppType
}
CreateAppInput is the input for creating an app
func (CreateAppInput) Validate ¶
func (i CreateAppInput) Validate() error
type CustomerApp ¶
type CustomerApp struct {
App App
CustomerData CustomerData
}
type CustomerData ¶
type CustomerData interface {
Validate() error
}
type CustomerPaymentSetupResult ¶
func (CustomerPaymentSetupResult) Validate ¶
func (r CustomerPaymentSetupResult) Validate() error
type CustomerPaymentSetupSucceededEvent ¶
type CustomerPaymentSetupSucceededEvent struct {
App AppBase `json:"app"`
Customer customer.CustomerID `json:"customer"`
Result CustomerPaymentSetupResult `json:"result"`
}
func (CustomerPaymentSetupSucceededEvent) EventMetadata ¶
func (e CustomerPaymentSetupSucceededEvent) EventMetadata() metadata.EventMetadata
func (CustomerPaymentSetupSucceededEvent) EventName ¶
func (e CustomerPaymentSetupSucceededEvent) EventName() string
func (CustomerPaymentSetupSucceededEvent) Validate ¶
func (e CustomerPaymentSetupSucceededEvent) Validate() error
type DeleteAppInstanceCustomerDataInput ¶
type DeleteAppInstanceCustomerDataInput struct {
CustomerID customer.CustomerID
}
func (DeleteAppInstanceCustomerDataInput) Validate ¶
func (i DeleteAppInstanceCustomerDataInput) Validate() error
type DeleteCustomerInput ¶
type DeleteCustomerInput struct {
AppID *AppID
CustomerID *customer.CustomerID
}
func (DeleteCustomerInput) Validate ¶
func (a DeleteCustomerInput) Validate() error
type EnsureCustomerInput ¶
type EnsureCustomerInput struct {
AppID AppID
CustomerID customer.CustomerID
}
func (EnsureCustomerInput) Validate ¶
func (a EnsureCustomerInput) Validate() error
type GetAppInstanceCustomerDataInput ¶
type GetAppInstanceCustomerDataInput struct {
CustomerID customer.CustomerID
}
func (GetAppInstanceCustomerDataInput) Validate ¶
func (i GetAppInstanceCustomerDataInput) Validate() error
type GetDefaultAppInput ¶
GetAppInput is the input for getting the default app for a type
func (GetDefaultAppInput) Validate ¶
func (i GetDefaultAppInput) Validate() error
type GetOauth2InstallURLInput ¶
type GetOauth2InstallURLInput = MarketplaceListingID
type GetOauth2InstallURLOutput ¶
type GetOauth2InstallURLOutput struct {
URL string
}
type InstallAppInput ¶
type InstallAppInput struct {
MarketplaceListingID
Namespace string
Name string
}
func (InstallAppInput) Validate ¶
func (i InstallAppInput) Validate() error
type InstallAppWithAPIKeyInput ¶
type InstallAppWithAPIKeyInput struct {
InstallAppInput
APIKey string
}
func (InstallAppWithAPIKeyInput) Validate ¶
func (i InstallAppWithAPIKeyInput) Validate() error
type InstallMethod ¶
type InstallMethod string
const ( InstallMethodOAuth2 InstallMethod = "with_oauth2" InstallMethodAPIKey InstallMethod = "with_api_key" InstallMethodNoCredentials InstallMethod = "no_credentials_required" )
func (InstallMethod) Validate ¶
func (i InstallMethod) Validate() error
type ListAppInput ¶
type ListAppInput struct {
Namespace string
pagination.Page
Type *AppType
IncludeDeleted bool
// Only list apps that has data for the given customer
CustomerID *customer.CustomerID
}
ListAppInput is the input for listing installed apps
func (ListAppInput) Validate ¶
func (i ListAppInput) Validate() error
type ListCustomerInput ¶
type ListCustomerInput struct {
pagination.Page
CustomerID customer.CustomerID
Type *AppType
}
func (ListCustomerInput) Validate ¶
func (a ListCustomerInput) Validate() error
type MarketplaceGetInput ¶
type MarketplaceGetInput = MarketplaceListingID
type MarketplaceListInput ¶
type MarketplaceListInput struct {
pagination.Page
}
func (MarketplaceListInput) Validate ¶
func (i MarketplaceListInput) Validate() error
type MarketplaceListing ¶
type MarketplaceListing struct {
Type AppType `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Capabilities []Capability `json:"capabilities"`
InstallMethods []InstallMethod `json:"installMethods"`
}
func (MarketplaceListing) Validate ¶
func (p MarketplaceListing) Validate() error
type MarketplaceListingID ¶
type MarketplaceListingID struct {
Type AppType
}
func (MarketplaceListingID) Validate ¶
func (i MarketplaceListingID) Validate() error
type PaymentSetupAppData ¶
type PaymentSetupAppData interface {
Validate() error
}
type RegisterMarketplaceListingInput ¶
type RegisterMarketplaceListingInput = RegistryItem
type RegistryItem ¶
type RegistryItem struct {
Listing MarketplaceListing
Factory AppFactory
}
func (RegistryItem) Validate ¶
func (r RegistryItem) Validate() error
type Service ¶
type Service interface {
AppService
}
type UninstallAppInput ¶
type UninstallAppInput = AppID
type UpdateAppInput ¶
type UpdateAppInput struct {
AppID AppID
Name string
Description *string
Default bool
Metadata *map[string]string
}
UpdateAppInput is the input for setting an app as default for a type
func (UpdateAppInput) Validate ¶
func (i UpdateAppInput) Validate() error
type UpdateAppStatusInput ¶
UpdateAppStatusInput is the input for updating an app status
func (UpdateAppStatusInput) Validate ¶
func (i UpdateAppStatusInput) Validate() error
type UpsertAppInstanceCustomerDataInput ¶
type UpsertAppInstanceCustomerDataInput struct {
CustomerID customer.CustomerID
Data CustomerData
}
func (UpsertAppInstanceCustomerDataInput) Validate ¶
func (i UpsertAppInstanceCustomerDataInput) Validate() error