sdkstore

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultServerURL is the default location of the global SDK Store API.
	// An alternate location can be configured by changing the URL
	// field in the Config struct.
	DefaultServerURL = "https://api.pkg.store"

	// RefreshTimeout is the timeout callers should use for Refresh calls.
	RefreshTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

func DefaultHTTPClient

func DefaultHTTPClient() https.HTTPClient

DefaultHTTPClient creates a new https.Client with the default configuration.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents the client side of an SDK store.

func NewClient

func NewClient(config Config) *Client

NewClient creates a new SDK Store client from the supplied configuration.

func (Client) Download

func (c Client) Download(ctx context.Context, w io.Writer, sdk SdkArchive, options ...DownloadOption) error

Download writes the given SDK into the given Writer.

func (Client) Find

func (c Client) Find(ctx context.Context, query string, options ...FindOption) (result []transport.FindResponse, err error)

Find searches the Store for SDKs matching the given query. The query matches most text fields: name, title, summary, description and publisher.

func (Client) Info

func (c Client) Info(ctx context.Context, name string, options ...InfoOption) (transport.InfoResponse, error)

Info queries the SDK Store for metadata belonging to the given SDK.

func (Client) Resolve

func (c Client) Resolve(ctx context.Context, req transport.ResolveRequest) (transport.ResolveResponse, error)

Resolve is used to find the latest revisions of a given set of SDKs.

type Config

type Config struct {
	// URL holds the base endpoint URL of the SDK Store API.
	// If nil use the default endpoint.
	URL *url.URL

	// HTTPClient represents the HTTP client to use for all API
	// requests. If nil, use the default HTTP client.
	HTTPClient https.HTTPClient
}

Config holds configuration for creating a new SDK Store client. The zero value is a valid default configuration.

func EnvConfig

func EnvConfig() (Config, error)

type DownloadOption

type DownloadOption func(*downloadOptions)

DownloadOption to be passed to Download to customize the resulting request.

func WithReporter

func WithReporter(reporter *progress.Reporter) DownloadOption

WithReporter sets the progress reporter on the option.

type FindOption

type FindOption func(*findOptions)

FindOption to be passed to Find to customize the resulting request.

func WithFindCategories

func WithFindCategories(categories []string) FindOption

WithFindCategories configures categories to filter by.

func WithFindFields

func WithFindFields(fields []string) FindOption

WithFindFields sets the fields to query (nil for default).

func WithFindPlatforms

func WithFindPlatforms(platforms []transport.Platform) FindOption

WithFindPlatforms configures platforms to filter by.

type InfoOption

type InfoOption func(*infoOptions)

InfoOption to be passed to Info to customize the resulting request.

func WithInfoFields

func WithInfoFields(fields []string) InfoOption

WithInfoFields sets the fields to query (nil for default).

type RESTClient

type RESTClient interface {
	// Get performs GET requests to a given Path.
	Get(context.Context, path.Path, any) (restResponse, error)
	// Post performs POST requests to a given Path.
	Post(context.Context, path.Path, http.Header, any, any) (restResponse, error)
}

RESTClient defines a type for making requests to a server.

type SdkArchive

type SdkArchive struct {
	Name      string
	PackageID string
	Revision  int
	Sha3_384  string
}

type SdkNotFoundError

type SdkNotFoundError struct {
	Name string
}

func (*SdkNotFoundError) Error

func (e *SdkNotFoundError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL