regapi

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package regapi is the HTTP client the registry API listers share: JSON GETs with authentication, paging through Link headers, and a count of calls for the crawl's request totals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scheme

func Scheme(insecure bool) string

Scheme returns the URL scheme for a registry host.

Types

type Client

type Client struct {
	// HTTP sends requests; nil means http.DefaultClient.
	HTTP *http.Client
	// Auth, when set, adds credentials to each request.
	Auth func(*http.Request) error
	// UserAgent identifies strata.
	UserAgent string
	// contains filtered or unexported fields
}

Client calls one API.

func (*Client) Calls

func (c *Client) Calls() int64

Calls returns how many API calls the client has made.

func (*Client) Get

func (c *Client) Get(ctx context.Context, u string, out any) (string, error)

Get fetches u and decodes its JSON body into out. It returns the next page's URL from the Link header, resolved against u, or "".

func (*Client) GetVia

func (c *Client) GetVia(ctx context.Context, hc *http.Client, u string, out any) (string, error)

GetVia is Get over another HTTP client, such as one whose transport carries a token for a narrower scope.

type StatusError

type StatusError struct {
	URL  string
	Code int
	Body string
}

StatusError is a response other than 200 OK.

func (*StatusError) Error

func (e *StatusError) Error() string

Error describes the failed call.

Jump to

Keyboard shortcuts

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