This repository was archived by the owner on Jan 19, 2026. It is now read-only.
feat: add a generated api client#135
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a generated API client by introducing a new OpenAPI-based client generation system that works alongside the existing manual API client implementation.
Key changes:
- Adds automated OpenAPI client generation from PostHog's API schema
- Integrates the generated client into the existing ApiClient class
- Updates the insights API endpoint to use the new generated client as a proof of concept
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| typescript/src/api/fetcher.ts | Implements a custom fetch adapter for the generated API client with authentication and parameter handling |
| typescript/src/api/client.ts | Integrates the generated client and updates insights list method to use it |
| typescript/scripts/update-openapi-client.ts | Provides automation script to fetch OpenAPI schema and generate TypeScript client |
| typescript/package.json | Adds new dependencies and npm script for client generation |
| biome.json | Excludes generated TypeScript files from linting |
Files not reviewed (1)
- typescript/pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
joshsny
commented
Sep 15, 2025
jonathanlab
approved these changes
Sep 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now, half the work for adding tools is adding the schema from the API.
Our OpenAPI spec is far from perfect, and we can't rely on it for our API client, but it does have some useful types that we can generate a client from and use within our own API client.
This adds a generated client and uses it for the
insights().list()method as an example.