Skip to content

update download to include auth #780

Description

@mgdenno

Implement teehr client updates for teehr-hub API key authentication and robust paginated fetch behavior under server-side hard row limits.

Required teehr-hub API details

  • API key auth header is x-api-key.
  • Bearer auth remains supported via Authorization: Bearer <token>.
  • Pagination uses limit and offset query parameters.
  • GeoJSON collection responses include pagination links in links[], including rel: "next" when another page is available.
  • Response includes numberReturned for current page size.
  • Server may clamp requested limit based on caller role; client must treat this as expected behavior.
  • Auth errors:
    • 401 for invalid/missing credentials on protected routes.
    • 403 for authenticated caller lacking required permissions.

Required teehr client behavior

  • Add API key auth mode:
    • Accept API key in client config/session.
    • Send x-api-key on outbound requests when configured.
  • Keep existing bearer-token behavior unchanged.
  • Add fetch-all pagination mode:
    • Prefer following links[].rel == "next" when present.
    • Fallback to offset pagination when next link is absent.
    • Preserve all filter/query params across page requests.
    • Continue until no next page exists.
  • Hard-limit compatibility:
    • Do not stop after first page just because returned rows are less than requested limit.
    • Continue paging whenever a next page is indicated.

Required acceptance criteria

  • Client can call protected teehr-hub endpoints using x-api-key.
  • Fetch-all mode retrieves complete multi-page datasets.
  • Client handles server-clamped first page without truncating overall result set.
  • Tests cover:
    • API key auth success/failure.
    • Next-link pagination.
    • Offset fallback pagination.
    • Clamped-first-page scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions