Documentation
¶
Overview ¶
Package plugins provides clients for plugin repository APIs.
Index ¶
- type CachedPluginClient
- func (c *CachedPluginClient) ClearCache()
- func (c *CachedPluginClient) ClearProject(project string)
- func (c *CachedPluginClient) GetCompatibility(ctx context.Context, project, version string) (CompatibilityInfo, error)
- func (c *CachedPluginClient) GetVersions(ctx context.Context, project string) ([]PluginVersion, error)
- type CompatibilityInfo
- type HangarClient
- type PluginClient
- type PluginVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedPluginClient ¶
type CachedPluginClient struct {
// contains filtered or unexported fields
}
CachedPluginClient wraps a PluginClient with in-memory caching.
func NewCachedPluginClient ¶
func NewCachedPluginClient(client PluginClient, ttl time.Duration) *CachedPluginClient
NewCachedPluginClient creates a new caching wrapper around a PluginClient.
func (*CachedPluginClient) ClearCache ¶
func (c *CachedPluginClient) ClearCache()
ClearCache removes all entries from the cache.
func (*CachedPluginClient) ClearProject ¶
func (c *CachedPluginClient) ClearProject(project string)
ClearProject removes cache entries for a specific project.
func (*CachedPluginClient) GetCompatibility ¶
func (c *CachedPluginClient) GetCompatibility( ctx context.Context, project, version string, ) (CompatibilityInfo, error)
GetCompatibility retrieves compatibility info from cache or fetches from the underlying client.
func (*CachedPluginClient) GetVersions ¶
func (c *CachedPluginClient) GetVersions(ctx context.Context, project string) ([]PluginVersion, error)
GetVersions retrieves versions from cache or fetches from the underlying client.
type CompatibilityInfo ¶
type CompatibilityInfo struct {
// MinecraftVersions lists supported Minecraft versions.
MinecraftVersions []string
// PaperVersions lists supported Paper versions.
PaperVersions []string
}
CompatibilityInfo contains compatibility information for a plugin version.
type HangarClient ¶
type HangarClient struct {
// contains filtered or unexported fields
}
HangarClient implements PluginClient using the go-hangar library.
func NewHangarClient ¶
func NewHangarClient() *HangarClient
NewHangarClient creates a new Hangar API client.
func (*HangarClient) GetCompatibility ¶
func (c *HangarClient) GetCompatibility( ctx context.Context, project, version string, ) (CompatibilityInfo, error)
GetCompatibility retrieves compatibility information for a specific version.
func (*HangarClient) GetVersions ¶
func (c *HangarClient) GetVersions(ctx context.Context, project string) ([]PluginVersion, error)
GetVersions retrieves all available versions for a plugin from Hangar.
type PluginClient ¶
type PluginClient interface {
// GetVersions retrieves all available versions for a plugin.
GetVersions(ctx context.Context, project string) ([]PluginVersion, error)
// GetCompatibility retrieves compatibility information for a specific version.
GetCompatibility(ctx context.Context, project, version string) (CompatibilityInfo, error)
}
PluginClient defines the interface for plugin repository clients.
type PluginVersion ¶
type PluginVersion struct {
// Version is the plugin version string.
Version string
// ReleaseDate is when this version was released.
ReleaseDate time.Time
// PaperVersions lists compatible Paper versions.
PaperVersions []string
// MinecraftVersions lists compatible Minecraft versions.
MinecraftVersions []string
// DownloadURL is the URL to download this version's JAR.
DownloadURL string
// Hash is the SHA256 hash of the JAR file.
Hash string
}
PluginVersion contains metadata about a plugin version.