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 AppCustomerPreConditionError
- type AppDefaultNotFoundError
- type AppFactory
- type AppFactoryInstallAppWithAPIKeyInput
- type AppID
- type AppNotFoundError
- type AppProviderAuthenticationError
- type AppProviderError
- type AppProviderPreConditionError
- type AppService
- type AppStatus
- type AppType
- type AuthorizeOauth2InstallInput
- type Capability
- type CapabilityType
- type CreateAppInput
- type CustomerApp
- type CustomerData
- type DeleteAppInstanceCustomerDataInput
- type DeleteCustomerInput
- type EnsureCustomerInput
- type GetAppInput
- type GetAppInstanceCustomerDataInput
- type GetDefaultAppInput
- type GetOauth2InstallURLInput
- type GetOauth2InstallURLOutput
- type InstallAppWithAPIKeyInput
- type ListAppInput
- type ListCustomerInput
- type MarketplaceGetInput
- type MarketplaceListInput
- type MarketplaceListing
- type MarketplaceListingID
- type RegisterMarketplaceListingInput
- type RegistryItem
- type Service
- type UninstallAppInput
- type UpdateAppInput
- type UpdateAppStatusInput
- type UpsertAppInstanceCustomerDataInput
Constants ¶
const ( DefaultPageNumber = 1 DefaultPageSize = 100 )
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)
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) 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 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 AppFactory ¶
type AppFactoryInstallAppWithAPIKeyInput ¶
type AppFactoryInstallAppWithAPIKeyInput struct {
Namespace string
APIKey string
BaseURL string
Name string
}
func (AppFactoryInstallAppWithAPIKeyInput) Validate ¶
func (i AppFactoryInstallAppWithAPIKeyInput) Validate() 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)
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 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 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 InstallAppWithAPIKeyInput ¶
type InstallAppWithAPIKeyInput struct {
MarketplaceListingID
Namespace string
APIKey string
Name string
}
func (InstallAppWithAPIKeyInput) Validate ¶
func (i InstallAppWithAPIKeyInput) 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"`
}
func (MarketplaceListing) Validate ¶
func (p MarketplaceListing) Validate() error
type MarketplaceListingID ¶
type MarketplaceListingID struct {
Type AppType
}
func (MarketplaceListingID) Validate ¶
func (i MarketplaceListingID) 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