Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I built a transport-independent foundation for JSON API clients in Perl

说明与用途

HTTP::API::Core 通过将 HTTP 传输与策略逻辑分离,帮助 Perl 开发者构建可移植的 JSON API 客户端,统一处理重试、分页、速率限制和身份验证。

问题

API clients quickly grow from simple wrappers to complex infrastructure code handling retries, pagination, rate limits, authentication, etc.

结果

Clients can focus on API logic while HTTP::API::Core handles retries, pagination, rate limits, and authentication in a transport-agnostic way, reducing code duplication and improving maintainability.

工作流

  • 1. Choose an HTTP transport (e.g., HTTP::Tiny).
  • 2. Instantiate HTTP::API::Core with base_url, headers, timeout, and retry config.
  • 3. Call API methods (get, post, etc.) via the core instance.
  • 4. Use core’s json() to decode responses.
  • 5. For pagination, use paginate() with mode (cursor/page) and mapping options.
  • 6. Handle rate limits via response->rate_limit().
  • 7. Implement authentication by providing a hook or headers.
  • 8. Keep service-specific client code minimal, delegating infrastructure to the core.

证据

HTTP::API::Core sits above the transport layer.

来源

Retries are more complicated than they look

来源

  • 记录日期: 2026-09-22T02:30:21.275Z