Skip to content

feat: add ai gateway account endpoint#625

Merged
kathmbeck merged 2 commits intomasterfrom
aig-account-endpoint
Mar 2, 2026
Merged

feat: add ai gateway account endpoint#625
kathmbeck merged 2 commits intomasterfrom
aig-account-endpoint

Conversation

@kathmbeck
Copy link
Contributor

Adds account endpoint for ai gateway token

@kathmbeck kathmbeck requested review from a team as code owners February 27, 2026 21:57
@netlify
Copy link

netlify bot commented Feb 27, 2026

Deploy Preview for open-api ready!

Name Link
🔨 Latest commit 9bed0b6
🔍 Latest deploy log https://app.netlify.com/projects/open-api/deploys/69a2145e91a4dc0008fc6fba
😎 Deploy Preview https://deploy-preview-625--open-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added a public endpoint to retrieve account-scoped AI Gateway tokens: GET /accounts/{account_id}/ai-gateway/token.
    • Endpoint returns a token on success (200), a not-available response when AI Gateway isn't enabled for the account (404), and standard error responses for other failures.
    • Client libraries updated to support calling this endpoint and handling its responses.

Walkthrough

An account-scoped AI Gateway token endpoint was added: GET /accounts/{account_id}/ai-gateway/token in swagger.yml with a required path parameter account_id, a 200 response referencing aiGatewayToken, a 404 for unavailable accounts, and default error handling. Corresponding generated Go client code was added: parameter struct and constructors (GetAccountAIGatewayTokenParams), response reader and response types (GetAccountAIGatewayTokenReader, GetAccountAIGatewayTokenOK, GetAccountAIGatewayTokenNotFound, GetAccountAIGatewayTokenDefault), and a client method GetAccountAIGatewayToken wired into the operations client (appears duplicated in the diff).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add ai gateway account endpoint' accurately describes the main change - adding a new account-scoped AI gateway token endpoint.
Description check ✅ Passed The description 'Adds account endpoint for ai gateway token' is directly related to the changeset and accurately summarizes the main change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch aig-account-endpoint

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go/plumbing/operations/get_account_a_i_gateway_token_parameters.go`:
- Around line 127-130: The code calls r.SetPathParam("account_id", o.AccountID)
without validating AccountID; add a non-empty guard before building the path (in
the same function where SetPathParam is called) that returns a clear error if
o.AccountID == "" (e.g., "account_id is required"), then only call
r.SetPathParam when non-empty; ideally also add this requirement to the
parameter spec so regen will enforce it.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 96fd087 and 9bed0b6.

📒 Files selected for processing (3)
  • go/plumbing/operations/get_account_a_i_gateway_token_parameters.go
  • go/plumbing/operations/get_account_a_i_gateway_token_responses.go
  • go/plumbing/operations/operations_client.go

Comment on lines +127 to +130
// path param account_id
if err := r.SetPathParam("account_id", o.AccountID); err != nil {
return err
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Validate required account_id before building the path.

Line 128 writes account_id without checking for empty input. That can emit /accounts//ai-gateway/token and fail late with less actionable errors. Add a non-empty guard (ideally via spec validation + regen) before SetPathParam.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go/plumbing/operations/get_account_a_i_gateway_token_parameters.go` around
lines 127 - 130, The code calls r.SetPathParam("account_id", o.AccountID)
without validating AccountID; add a non-empty guard before building the path (in
the same function where SetPathParam is called) that returns a clear error if
o.AccountID == "" (e.g., "account_id is required"), then only call
r.SetPathParam when non-empty; ideally also add this requirement to the
parameter spec so regen will enforce it.

@kathmbeck kathmbeck merged commit 93c2e07 into master Mar 2, 2026
15 checks passed
@kathmbeck kathmbeck deleted the aig-account-endpoint branch March 2, 2026 14:15
kathmbeck pushed a commit that referenced this pull request Mar 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.50.0](v2.49.2...v2.50.0)
(2026-03-02)


### Features

* add ai gateway account endpoint
([#625](#625))
([93c2e07](93c2e07))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
Co-authored-by: token-generator-app[bot] <token-generator-app[bot]@users.noreply.github.com>
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.

2 participants