Skip to content

feat: per-request timeout and retry overrides #3

@0xneobyte

Description

@0xneobyte

Problem

timeout and maxRetries are configured once at client initialization and apply globally to every request. There is no way to override them for individual calls. A developer making a complex query may need a 60s timeout for that one call without affecting all other requests.

Proposed Behaviour

Each method accepts an optional options parameter to override the global defaults for that call only.

// Long timeout for one specific call, global default unchanged
const response = await client.query({ query: '...' }, { timeout: 60000, maxRetries: 0 })
  • Overrides apply to that single call only
  • Supported options: timeout, maxRetries
  • Global client config is never mutated

Files to Modify

File Change
src/client.ts Add optional RequestOptions second parameter to query(), getUsage(), getPlans()
src/types.ts Add RequestOptions interface

Acceptance Criteria

  • query() accepts per-request timeout and maxRetries
  • getUsage() and getPlans() accept the same options
  • Global client config is not affected by per-request options
  • Default behaviour when no options are passed is unchanged

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