Documentation
¶
Overview ¶
Package contentdb provides a minimal client for the ContentDB REST API.
Index ¶
- type Client
- func (c *Client) GetDependencies(ctx context.Context, author, name string) (DependenciesResponse, error)
- func (c *Client) GetPackage(ctx context.Context, author, name string) (*Package, error)
- func (c *Client) GetReleases(ctx context.Context, author, name string) ([]Release, error)
- func (c *Client) Install(ctx context.Context, author, name, destDir string) (string, error)
- func (c *Client) Search(ctx context.Context, query, pkgType string, limit int) ([]Package, error)
- type DependenciesResponse
- type Dependency
- type Package
- type PackageListResponse
- type Release
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a minimal ContentDB API client.
func NewWithClient ¶
NewWithClient returns a Client that uses the provided base URL and *http.Client. Pass the httptest.Server URL and ts.Client() in tests.
func (*Client) GetDependencies ¶
func (c *Client) GetDependencies(ctx context.Context, author, name string) (DependenciesResponse, error)
GetDependencies returns the full transitive dependency graph for a package. The map key is "author/name"; the value is that package's dependency list.
func (*Client) GetPackage ¶
GetPackage fetches metadata for a single package by author/name.
func (*Client) GetReleases ¶
GetReleases returns the release list for a package.
type DependenciesResponse ¶
type DependenciesResponse map[string][]Dependency
DependenciesResponse is returned by the ContentDB /dependencies/ endpoint. Each key is an "author/name" package ID; the value is that package's dependency list. The response covers the full transitive dep graph.
type Dependency ¶
type Dependency struct {
IsOptional bool `json:"is_optional"`
Name string `json:"name"`
Packages []string `json:"packages"`
}
Dependency describes one dependency entry for a package.
type Package ¶
type Package struct {
Author string `json:"author"`
Name string `json:"name"`
Title string `json:"title"`
ShortDescription string `json:"short_description"`
Type string `json:"type"`
Score float64 `json:"score"`
Downloads int `json:"downloads"`
Thumbnail string `json:"thumbnail"`
Tags []string `json:"tags"`
License string `json:"license"`
Repo string `json:"repo"`
// Provides lists every mod name shipped by this package.
// For modpacks this enumerates all sub-mod directory names.
Provides []string `json:"provides"`
}
Package represents a ContentDB package (mod, game, or texture pack).