Skip to content

feat!: return full FetchResponse from context.fetch()#20

Open
TheRealAgentK wants to merge 4 commits intomasterfrom
issue-12/fetch-response
Open

feat!: return full FetchResponse from context.fetch()#20
TheRealAgentK wants to merge 4 commits intomasterfrom
issue-12/fetch-response

Conversation

@TheRealAgentK
Copy link
Collaborator

Summary

Closes #12. context.fetch() now returns a FetchResponse dataclass instead of the raw parsed body, giving callers access to HTTP status codes and response headers.

Changes

Implementation

  • Added FetchResponse dataclass with status, headers, and data fields
  • Updated ExecutionContext.fetch() to return FetchResponse (return type + body)
  • Exported FetchResponse from __init__.py

Docs & samples

  • Updated all manual docs (billing.md, building_your_first_integration.md, connected_account.md, integration_structure.md, patterns.md)
  • Updated all code samples (api-fetch, template)
  • Updated all docstrings in integration.py

Migration plan

  • Added docs/plans/12.md with a full audit of all downstream repos that need updating (4 repos, ~100 Python files, 3 markdown files)

Breaking change

Callers must now use response.data to access the parsed body:

# Before
response = await context.fetch(url)
items = response.get("items")

# After
response = await context.fetch(url)
items = response.data.get("items")

See docs/plans/12.md for the full rollout plan across autohive-integrations, integrations, Autohive, and autohive-docs.

Add FetchResponse dataclass (status, headers, data) and update
ExecutionContext.fetch() to return it instead of the raw parsed body.
Export FetchResponse from the package.
Update all code examples, docstrings, and prose to use response.data
instead of the raw response body, reflecting the new FetchResponse
return type from context.fetch().
Add 43 missing production files and 13 test files to the
autohive-integrations audit list.
@TheRealAgentK TheRealAgentK changed the title Return full FetchResponse from context.fetch() (#12) feat!: return full FetchResponse from context.fetch() Mar 17, 2026
Copy link
Contributor

@Hamish-taylor Hamish-taylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment about the plan file. But I am happy with the code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this plan file belong in this repo? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair question, but I think it's useful - I'm a big fan of information in the repo and given that - while 12 is completed in here - there's follow-up work I want to audit against at some point when this change goes into a release, I think it's a good place. Happy to remove in the future.

The other options are to put it into a discussion thread, a new GH issue or in our internal Notion, but none of those are ideal either.

@TheRealAgentK
Copy link
Collaborator Author

Please don't merge for the time being - waiting for the Action Error PR (#19) to be merged first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide entire response object for context.fetch

2 participants