Documentation
¶
Overview ¶
Package nuget exposes nuget.org as a kit Domain.
A multi-domain host (ant) enables it with a single blank import:
import _ "github.com/tamnd/nuget-cli/nuget"
The same Domain also builds the standalone nuget binary.
Package nuget is the library behind the nuget command line: the HTTP client, request shaping, and the typed data models for NuGet.
The NuGet v3 API uses two separate base URLs: one for search (Azure Search) and one for package data (api.nuget.org). Both are configurable for testing. No API key is required for public read-only access.
Index ¶
Constants ¶
const DefaultUserAgent = "nuget-cli/0.1.0 (github.com/tamnd/nuget-cli)"
DefaultUserAgent identifies the client to NuGet.
const Host = "nuget.org"
Host is the primary nuget.org site hostname.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when the API returns no results for a package lookup.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to NuGet over HTTP.
func (*Client) Info ¶
Info returns the latest stable version info for a package by exact ID. It calls Search with the exact package ID and returns the first match.
type Config ¶
type Config struct {
QueryURL string // search endpoint base: https://azuresearch-usnc.nuget.org
DataURL string // package data base: https://api.nuget.org/v3
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the nuget driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, hostnames, and binary identity.
type Package ¶
type Package struct {
ID string `json:"id"`
Version string `json:"version"`
Description string `json:"description"`
Authors string `json:"authors"`
Downloads int64 `json:"total_downloads"`
Tags []string `json:"tags"`
URL string `json:"url"`
}
Package is one NuGet package record from the search endpoint.
type PackageVersion ¶
type PackageVersion struct {
Version string `json:"version"`
}
PackageVersion is one version string from the flat container index.