imoshortlist

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package imoshortlist is the library behind the imoslx command: the HTTP client, request shaping, and the typed data models for IMO Shortlist PDFs.

The client probes PDF availability with HEAD requests at https://www.imo-official.org/problems/IMO{YEAR}SL.pdf No authentication is required. It sets a real User-Agent, paces requests, and retries transient 429/5xx errors with exponential back-off.

Index

Constants

View Source
const Host = "www.imo-official.org"

Host is the IMO official site host.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client talks to imo-official.org via HEAD requests to check PDF availability.

func NewClient

func NewClient(cfg Config) *Client

NewClient returns a Client ready to use.

func (*Client) Shortlists

func (c *Client) Shortlists(ctx context.Context, limit int) ([]Shortlist, error)

Shortlists probes each year from MaxYear down to MinYear with a HEAD request and returns those that return HTTP 200, newest first. If limit > 0, at most limit items are returned.

type Config

type Config struct {
	BaseURL   string
	UserAgent string
	Rate      time.Duration
	Timeout   time.Duration
	Retries   int
	MinYear   int
	MaxYear   int
}

Config holds constructor parameters for the Client.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns sensible production defaults.

type Domain

type Domain struct{}

Domain is the imoshortlist driver. It carries no state.

func (Domain) Classify

func (Domain) Classify(input string) (uriType, id string, err error)

Classify turns an input into (type, id) — not meaningful for this domain.

func (Domain) Info

func (Domain) Info() kit.DomainInfo

Info describes the scheme, accepted hostnames, and the binary identity.

func (Domain) Locate

func (Domain) Locate(uriType, id string) (string, error)

Locate is the inverse of Classify.

func (Domain) Register

func (Domain) Register(app *kit.App)

Register installs the client factory and every operation onto app.

type Shortlist

type Shortlist struct {
	Rank      int    `json:"rank"`
	Year      int    `json:"year"`
	URL       string `json:"url"`
	SizeBytes int64  `json:"size_bytes"` // -1 if Content-Length absent
}

Shortlist is one available IMO Shortlist PDF.

Jump to

Keyboard shortcuts

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