Skip to content

Add Request ID Exposure for API Responses #128

Description

@Lakes41

Difficulty: Advanced

Type: Feature

Summary

Expose safe response metadata such as request IDs so SDK consumers can correlate client-side failures with backend logs and support tickets.

Current Behaviour

SDK service methods return typed data objects and throw GuildPassError on failures, but successful calls do not expose response metadata. If the backend returns headers such as X-Request-ID, X-Correlation-ID, or Traceparent, consumers have no clear way to access those values for diagnostics.

Expected Behaviour

Consumers should be able to access safe response metadata when they need it, without changing the default ergonomic service method return values.

Suggested Implementation

Add an optional request option such as includeMeta: true or provide parallel methods that return { data, meta }. Capture safe headers like request ID, correlation ID, trace ID, status, and duration. Keep the default API backwards-compatible by returning plain data unless metadata is explicitly requested.

Files or Areas Likely Affected

  • src/http/httpClient.ts
  • src/http/http.types.ts
  • src/types/common.ts
  • src/access/access.service.ts
  • src/membership/membership.service.ts
  • src/roles/roles.service.ts
  • src/guilds/guilds.service.ts
  • docs/sdk-guide.md
  • tests/

Acceptance Criteria

  • SDK consumers can opt into response metadata.
  • Default service method behaviour remains backwards-compatible.
  • Request ID or correlation ID headers are captured when present.
  • Metadata does not expose API keys or sensitive headers.
  • Error paths preserve useful request metadata where safe.
  • Documentation shows how to use response metadata for support/debugging.
  • Tests cover success, error, and missing-header cases.

Additional Notes

Do not make every service return a new shape by default. This should be an opt-in diagnostic feature to avoid breaking existing consumers.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions