Documentation
¶
Index ¶
- func AddMarketplacePluginFeedback(pluginID int, feedback *models.PluginFeedback) error
- func CheckMarketplacePlugin(pluginID int) (bool, error)
- func CompressTarGz(sourceDir, targetFile string) error
- func ExtractTarGz(file io.Reader, dest string) error
- func ParsePluginYML(path string) (pluginpkg.PluginManifest, error)
- func SetGlobalMarketplaceManager(storageCfg StorageConfig) error
- type GitStorage
- func (g *GitStorage) DeleteFile(ctx context.Context, key string) error
- func (g *GitStorage) DownloadFile(ctx context.Context, key string, storagePath string) error
- func (g *GitStorage) GetFileURL(ctx context.Context, key string) (string, error)
- func (g *GitStorage) UploadFile(ctx context.Context, key string, data io.Reader) error
- type MarketplaceManager
- func (m *MarketplaceManager) AddFeedback(feedback *models.PluginFeedback, pluginID int) error
- func (m *MarketplaceManager) AddPlugin(plugin *MarketplacePlugin) error
- func (m *MarketplaceManager) CheckPluginExists(pluginID int) bool
- func (m *MarketplaceManager) GetAllPluginTags() []string
- func (m *MarketplaceManager) GetAllPlugins() []*MarketplacePlugin
- func (m *MarketplaceManager) GetFeaturedPlugins() []*MarketplacePlugin
- func (m *MarketplaceManager) GetPluginByID(pluginID int) (*MarketplacePlugin, error)
- func (m *MarketplaceManager) GetPluginDependencies(pluginID int) (models.DependenciesList, error)
- func (m *MarketplaceManager) GetPluginFeedback(pluginID int) ([]models.PluginFeedback, error)
- func (m *MarketplaceManager) GetRatingAverage(pluginID int) (float32, error)
- func (m *MarketplaceManager) GetRatingCount(pluginID int) (int, error)
- func (m *MarketplaceManager) IncrementDownloads(pluginID int) error
- func (m *MarketplaceManager) RemovePlugin(pluginID int) error
- func (m *MarketplaceManager) SearchPlugins(keyword, sortBy, tag string) []*MarketplacePlugin
- type MarketplacePlugin
- type StorageConfig
- type StorageProvider
- type StorageType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMarketplacePluginFeedback ¶
func AddMarketplacePluginFeedback(pluginID int, feedback *models.PluginFeedback) error
add a feedback
func CheckMarketplacePlugin ¶
check if the plugin is from the marketplace using pluginDetailsID
func CompressTarGz ¶
func ParsePluginYML ¶
func ParsePluginYML(path string) (pluginpkg.PluginManifest, error)
func SetGlobalMarketplaceManager ¶
func SetGlobalMarketplaceManager(storageCfg StorageConfig) error
Types ¶
type GitStorage ¶
type GitStorage struct {
Remote string // e.g. "https://github.com/user/repo.git"
Branch string // e.g. "main" - the branch to use
PublicBase string // base URL to access the files, looks like https://raw.githubusercontent.com/user/repo/main
Token string // Github Token / personal access token
}
func (*GitStorage) DeleteFile ¶
func (g *GitStorage) DeleteFile(ctx context.Context, key string) error
func (*GitStorage) DownloadFile ¶
func (*GitStorage) GetFileURL ¶
func (*GitStorage) UploadFile ¶
type MarketplaceManager ¶
type MarketplaceManager struct {
Store StorageProvider
// contains filtered or unexported fields
}
var (
GlobalMarketplaceManager *MarketplaceManager
)
func GetGlobalMarketplaceManager ¶
func GetGlobalMarketplaceManager() *MarketplaceManager
func NewMarketplaceManager ¶
func NewMarketplaceManager(store StorageProvider) (*MarketplaceManager, error)
func (*MarketplaceManager) AddFeedback ¶
func (m *MarketplaceManager) AddFeedback(feedback *models.PluginFeedback, pluginID int) error
func (*MarketplaceManager) AddPlugin ¶
func (m *MarketplaceManager) AddPlugin(plugin *MarketplacePlugin) error
func (*MarketplaceManager) CheckPluginExists ¶
func (m *MarketplaceManager) CheckPluginExists(pluginID int) bool
func (*MarketplaceManager) GetAllPluginTags ¶
func (m *MarketplaceManager) GetAllPluginTags() []string
func (*MarketplaceManager) GetAllPlugins ¶
func (m *MarketplaceManager) GetAllPlugins() []*MarketplacePlugin
func (*MarketplaceManager) GetFeaturedPlugins ¶
func (m *MarketplaceManager) GetFeaturedPlugins() []*MarketplacePlugin
func (*MarketplaceManager) GetPluginByID ¶
func (m *MarketplaceManager) GetPluginByID(pluginID int) (*MarketplacePlugin, error)
func (*MarketplaceManager) GetPluginDependencies ¶
func (m *MarketplaceManager) GetPluginDependencies(pluginID int) (models.DependenciesList, error)
func (*MarketplaceManager) GetPluginFeedback ¶
func (m *MarketplaceManager) GetPluginFeedback(pluginID int) ([]models.PluginFeedback, error)
func (*MarketplaceManager) GetRatingAverage ¶
func (m *MarketplaceManager) GetRatingAverage(pluginID int) (float32, error)
func (*MarketplaceManager) GetRatingCount ¶
func (m *MarketplaceManager) GetRatingCount(pluginID int) (int, error)
func (*MarketplaceManager) IncrementDownloads ¶
func (m *MarketplaceManager) IncrementDownloads(pluginID int) error
func (*MarketplaceManager) RemovePlugin ¶
func (m *MarketplaceManager) RemovePlugin(pluginID int) error
func (*MarketplaceManager) SearchPlugins ¶
func (m *MarketplaceManager) SearchPlugins(keyword, sortBy, tag string) []*MarketplacePlugin
type MarketplacePlugin ¶
type MarketplacePlugin struct {
PluginDetailsID int `json:"plugin_id"`
PluginName string `json:"plugin_name"`
Author string `json:"author"`
Description string `json:"description"`
Version string `json:"version"`
Featured bool `json:"featured"`
RatingAverage float32 `json:"rating_average"`
RatingCount int `json:"rating_count"`
Downloads int `json:"downloads"`
ActiveInstalls int `json:"active_installs"`
License string `json:"license"`
Tags []string `json:"tags"`
MinVersion string `json:"min_version"`
MaxVersion string `json:"max_version"`
Dependencies models.DependenciesList `json:"dependencies"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
Feedback []models.PluginFeedback `json:"feedback"`
}
type StorageConfig ¶
type StorageConfig struct {
Type StorageType
// Git option
GitRemoteURL string // e.g. https://github.com/user/repo.git
GitBranch string // e.g. main
GitBaseURL string // raw.githubusercontent.com/...
GitToken string // GitHub token for private repos
// R2 option
Bucket string // r2 bucket name
AccessKey string
SecretKey string
Endpoint string // e.g. for R2: https://<account>.r2.cloudflarestorage.com
// local option
LocalBase string // e.g. location of the plugin files "./data/plugins"
BaseURL string // e.g. the URL to get all the plugins http://localhost:8080/marketplace/plugins
}
type StorageProvider ¶
type StorageProvider interface {
UploadFile(ctx context.Context, key string, data io.Reader) error
GetFileURL(ctx context.Context, key string) (string, error)
DeleteFile(ctx context.Context, key string) error
DownloadFile(ctx context.Context, key string, storagePath string) error
}
func NewStorageProvider ¶
func NewStorageProvider(cfg StorageConfig) (StorageProvider, error)
type StorageType ¶
type StorageType string
const ( StorageR2 StorageType = "r2" StorageLocal StorageType = "local" StorageGit StorageType = "git" )
Click to show internal directories.
Click to hide internal directories.