Documentation
¶
Overview ¶
Package packagist exposes packagist.org as a kit Domain.
A multi-domain host (ant) enables it with a single blank import:
import _ "github.com/tamnd/packagist-cli/packagist"
The same Domain also builds the standalone packagist binary.
Package packagist is the library behind the packagist command line: the HTTP client, request shaping, and the typed data models for packagist.org.
The Client paces requests, sets an honest User-Agent, and retries transient failures (429 and 5xx). No API key is required.
Index ¶
Constants ¶
const DefaultUserAgent = "packagist/dev (+https://github.com/tamnd/packagist-cli)"
DefaultUserAgent identifies the client to Packagist.
const Host = "packagist.org"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to Packagist over HTTP.
func (*Client) Info ¶ added in v0.1.1
Info fetches info for a single package by its vendor/package name.
type Config ¶ added in v0.1.1
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶ added in v0.1.1
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the packagist driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, hostnames, and binary identity.
type Package ¶ added in v0.1.1
type Package struct {
Rank int `json:"rank"`
Name string `json:"name"`
Description string `json:"description"`
Downloads int64 `json:"downloads"`
Favers int `json:"favers"`
Repository string `json:"repository"`
URL string `json:"url"`
}
Package is one Composer package record from packagist.org.