Documentation
¶
Overview ¶
Package bioproject is the library behind the bioproject command line: the HTTP client, request shaping, and the typed data models for NCBI BioProject.
The Client here is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public API throws under load.
Index ¶
- Constants
- type Client
- func (c *Client) FetchProjects(ctx context.Context, ids []string) ([]*Project, error)
- func (c *Client) GetProject(ctx context.Context, uid string) (*Project, error)
- func (c *Client) Search(ctx context.Context, query string, limit, start int) ([]string, int, error)
- func (c *Client) SearchAndFetch(ctx context.Context, query string, limit, start int) ([]*Project, int, error)
- type Config
- type Domain
- type Project
Constants ¶
const DefaultUserAgent = "bioproject-cli/0.1.0 (github.com/tamnd/bioproject-cli)"
DefaultUserAgent identifies the client to NCBI eUtils.
const Host = "eutils.ncbi.nlm.nih.gov"
Host is the eUtils hostname this client talks to, and the host the URI driver in domain.go claims.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to NCBI eUtils for BioProject records.
func (*Client) FetchProjects ¶
FetchProjects fetches project details for the given UIDs (up to ~500 per call; callers should batch if needed).
func (*Client) GetProject ¶
GetProject fetches a single BioProject by its numeric UID.
type Config ¶
type Config struct {
BaseURL string
Rate time.Duration
Retries int
Timeout time.Duration
UserAgent string
}
Config holds the runtime settings for the BioProject client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults: 400ms rate limit, 3 retries, and a 30s timeout.
type Domain ¶
type Domain struct{}
Domain is the bioproject driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Classify ¶
Classify turns any accepted input into the canonical (type, id). Any non-empty string maps to ("project", input).
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Project ¶
type Project struct {
ID string `json:"id" kit:"id"`
Accession string `json:"accession,omitempty"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Organism string `json:"organism,omitempty"`
Type string `json:"type,omitempty"`
Supergroup string `json:"supergroup,omitempty"`
}
Project is a single NCBI BioProject record.