Skip to main content

Module rest

Module rest 

Source
Expand description

A blocking REST client for GitLab and Forgejo, shaped like Client: tokens tried in order, a 401 moving on to the next source, retries after a 5xx or a dropped connection, and pages followed through the Link header.

A host’s tokens come from the environment variables that belong to it (forge::token_vars: GitLab’s to GITLAB_HOST or gitlab.com, FORGEJO_TOKEN to codeberg.org, GITEA_TOKEN to gitea.com, a configured host’s token_env to that host), then from glab’s or tea’s config.yml, which keep a token per host. No token is ever sent to a host it does not belong to. With no token at all a request goes without one, which public projects answer. Messages name a token’s source, never its value.

Structs§

Response
A REST response. status is 304, with an empty body, when the ETag given still matches.
Rest

Constants§

MAX_PAGES
Pages of a list read at most.

Functions§

encode
Percent-encodes everything but unreserved characters, for a path segment such as GitLab’s group%2Fproject or a query value.
utc
A timestamp sent with the server’s offset (+01:00), in UTC as GitHub sends them.