Expand description
REST API standards helpers per .spec/sot/rest-api-standards.sot.md:
- P-3: RFC 8288
Linkpagination (page/per_pagedefault 30, max 100) +X-Total-Count. - P-4: Strong
ETag("sha256-..."),If-None-Match(304),If-Match(412/428). - P-5 & O-10: IETF
RateLimit-Policy/RateLimit+X-RateLimit-*+ global limiter + quotas.
Structs§
Constants§
Functions§
- apply_
etag_ and_ conditional_ get - Apply strong
ETagandIf-None-Match(304 Not Modified) conditional GET handling. - attach_
pagination_ headers - Attach
X-Total-Countand optional RFC 8288Linkpagination headers to a response. - attach_
rate_ limit_ headers - Attach both IETF draft
RateLimit-Policy/RateLimitand GitHub-compatX-RateLimit-*headers. - check_
api_ rate_ limit - Evaluate the per-client-IP 60-second fixed-window API rate limiter (P-5 / O-10).
Setting
ARKS_API_RATE_LIMIT_PER_MIN=0disables enforcement while still reporting unlimited. - check_
api_ rate_ limit_ with_ cap - check_
body_ quota - Check request body size against
ARKS_MAX_BODY_BYTES(default 64 MiB -> 413 Payload Too Large). - check_
if_ match - Verify
If-Matchprecondition on optimistic-concurrency mutations (RFC 9110 §13.1.1). Returns 412 Precondition Failed on mismatch, or 428 Precondition Required whenrequiredis true and header is absent. - check_
storage_ quota - Check directory byte usage against an optional quota (507 Insufficient Storage).
- compute_
etag - Compute a strong quoted SHA-256
ETag("sha256-<16-byte-hex>"). - configured_
api_ rate_ limit - format_
link_ header - Format an RFC 8288
Linkheader (rel="next",rel="prev",rel="first",rel="last"). - paginate_
slice - Slice a collection for
(page, per_page)and return(items, total, Link header). - rate_
limit_ exceeded_ response - Build a 429 Too Many Requests RFC 9457 response with
Retry-Afterand rate-limit headers.