Documentation
¶
Overview ¶
Package hal is the library behind the hal command line: the HTTP client, request shaping, and the typed data models for archives-ouvertes.fr (HAL Open Archive).
The Client sets a real User-Agent, paces requests, and retries transient failures (429 and 5xx). Build endpoint calls and JSON decoding on top of it.
Index ¶
- Constants
- type Client
- func (c *Client) GetDocument(ctx context.Context, halID string) (*Document, error)
- func (c *Client) Recent(ctx context.Context, limit int) ([]*Document, error)
- func (c *Client) Search(ctx context.Context, query string, limit, start int) ([]*Document, int, error)
- func (c *Client) SearchByDomain(ctx context.Context, domain string, limit, start int) ([]*Document, int, error)
- type Config
- type Document
- type Domain
Constants ¶
const Host = "api.archives-ouvertes.fr"
Host is the API host for HAL open archive.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the HAL API over HTTP.
func (*Client) GetDocument ¶
GetDocument fetches a single document by HAL ID (e.g., "hal-04987097").
type Config ¶
type Config struct {
BaseURL string
Rate time.Duration
Retries int
Timeout time.Duration
UserAgent string
}
Config holds all tuneable Client parameters.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults: 300 ms pacing, 3 retries, 30 s timeout.
type Document ¶
type Document struct {
ID string `json:"id" kit:"id"`
Title string `json:"title"`
Authors []string `json:"authors,omitempty"`
Year int `json:"year,omitempty"`
DocType string `json:"doc_type,omitempty"`
Domain string `json:"domain,omitempty"`
Language string `json:"language,omitempty"`
URI string `json:"uri,omitempty"`
Abstract string `json:"abstract,omitempty"`
}
Document is a single HAL publication record.
type Domain ¶
type Domain struct{}
Domain is the HAL Open Archive kit driver.
func (Domain) Classify ¶
Classify turns any accepted input into (type, id). Any non-empty string is treated as a document ID.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, hostnames, and identity for the hal binary.