Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Aug 29, 2025

Summary by CodeRabbit

  • New Features
    • Added account-level telephony API key management.
    • New endpoint: /api/accounts/me/telephony_api_keys to view and update your telephony keys.
    • GET returns your current telephony key configuration.
    • PATCH supports partial updates with a JSON payload, including setting or clearing the Telnyx API key.
    • Responses consistently return the updated configuration for easy verification.

@coderabbitai
Copy link

coderabbitai bot commented Aug 29, 2025

Walkthrough

Adds a new account-level telephony key management endpoint to the OpenAPI spec. Introduces GET and PATCH operations at /api/accounts/me/telephony_api_keys, secured by apiKeyAuth. Defines AccountTelephonyKeys and PatchedSetTelephonyApiKeysRequest schemas, exposing and updating a Telnyx API key field.

Changes

Cohort / File(s) Summary of Changes
OpenAPI: Account Telephony Keys
src/libs/Ultravox/openapi.yaml
Added path /api/accounts/me/telephony_api_keys with GET (retrieve AccountTelephonyKeys) and PATCH (partial update via PatchedSetTelephonyApiKeysRequest). Introduced schemas: AccountTelephonyKeys (includes telnyx using KeyPrefix) and PatchedSetTelephonyApiKeysRequest (telnyx string, nullable, with portal link). Both operations use apiKeyAuth security.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Client
    participant API as Ultravox API
    participant Auth as apiKeyAuth
    participant Keys as Telephony Key Store

    Note over API,Keys: GET /api/accounts/me/telephony_api_keys

    Client->>API: GET /accounts/me/telephony_api_keys
    API->>Auth: Validate API key
    Auth-->>API: Auth OK
    API->>Keys: Fetch AccountTelephonyKeys
    Keys-->>API: AccountTelephonyKeys { telnyx: KeyPrefix... }
    API-->>Client: 200 application/json (AccountTelephonyKeys)

    rect rgba(240,250,255,0.6)
    Note right of API: Error path
    API-->>Client: 401/403 on auth failure
    end
Loading
sequenceDiagram
    autonumber
    actor Client
    participant API as Ultravox API
    participant Auth as apiKeyAuth
    participant Keys as Telephony Key Store

    Note over API,Keys: PATCH /api/accounts/me/telephony_api_keys

    Client->>API: PATCH ... { telnyx?: string|null }
    API->>Auth: Validate API key
    Auth-->>API: Auth OK
    API->>Keys: Partially update telnyx key
    Keys-->>API: Updated AccountTelephonyKeys
    API-->>Client: 200 application/json (AccountTelephonyKeys)

    rect rgba(255,245,240,0.6)
    Note right of API: Validation errors
    API-->>Client: 400 on invalid body
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at keys anew,
A Telnyx string in morning dew—
GET to peek, PATCH to mend,
Account-bound secrets we now send.
In YAML fields I softly hop,
Secure and neat—thump, thump, non-stop! 🐇🔑

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202508290056

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot merged commit 2e48e9f into main Aug 29, 2025
3 of 4 checks passed
@github-actions github-actions bot deleted the bot/update-openapi_202508290056 branch August 29, 2025 00:57
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add GET/PATCH /api/accounts/me/telephony_api_keys to OpenAPI Aug 29, 2025
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

🧹 Nitpick comments (2)
src/libs/Ultravox/openapi.yaml (2)

112-143: Add concise operation descriptions (parity with other endpoints).

Helps docs/codegen consumers understand behavior (prefix-only on GET; PATCH accepts full secret, returns prefix).

   /api/accounts/me/telephony_api_keys:
     get:
       tags:
         - accounts
+      description: Gets account-level telephony provider API keys. Response returns key prefixes only.
       operationId: accounts_me_telephony_api_keys_retrieve
@@
     patch:
       tags:
         - accounts
+      description: Partially updates account-level telephony provider API keys. Accepts full secrets; response returns key prefixes only. Set a field to null to clear.
       operationId: accounts_me_telephony_api_keys_partial_update

2592-2599: Clarify response field describes a prefix, not the full key.

Matches usage of KeyPrefix and avoids confusion.

     AccountTelephonyKeys:
       type: object
       properties:
         telnyx:
           allOf:
             - $ref: '#/components/schemas/KeyPrefix'
-          description: The Telnyx API key.
+          description: The Telnyx API key prefix.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b8398b2 and 1c26183.

⛔ Files ignored due to path filters (9)
  • src/libs/Ultravox/Generated/Ultravox.AccountsClient.AccountsMeTelephonyApiKeysPartialUpdate.g.cs is excluded by !**/generated/**
  • src/libs/Ultravox/Generated/Ultravox.AccountsClient.AccountsMeTelephonyApiKeysRetrieve.g.cs is excluded by !**/generated/**
  • src/libs/Ultravox/Generated/Ultravox.IAccountsClient.AccountsMeTelephonyApiKeysPartialUpdate.g.cs is excluded by !**/generated/**
  • src/libs/Ultravox/Generated/Ultravox.IAccountsClient.AccountsMeTelephonyApiKeysRetrieve.g.cs is excluded by !**/generated/**
  • src/libs/Ultravox/Generated/Ultravox.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/Ultravox/Generated/Ultravox.Models.AccountTelephonyKeys.Json.g.cs is excluded by !**/generated/**
  • src/libs/Ultravox/Generated/Ultravox.Models.AccountTelephonyKeys.g.cs is excluded by !**/generated/**
  • src/libs/Ultravox/Generated/Ultravox.Models.PatchedSetTelephonyApiKeysRequest.Json.g.cs is excluded by !**/generated/**
  • src/libs/Ultravox/Generated/Ultravox.Models.PatchedSetTelephonyApiKeysRequest.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Ultravox/openapi.yaml (3 hunks)

Comment on lines +3667 to 3673
type: object
properties:
telnyx:
type: string
description: "Your Telnyx API key.\nhttps://portal.telnyx.com/#/api-keys"
nullable: true
PatchedSetTtsApiKeysRequest:
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Mark secrets as writeOnly and add minimal validation.

Prevents accidental echo in clients, hints UIs to mask, and rejects empty strings while still allowing null to clear.

     PatchedSetTelephonyApiKeysRequest:
       type: object
       properties:
         telnyx:
           type: string
-          description: "Your Telnyx API key.\nhttps://portal.telnyx.com/#/api-keys"
+          description: "Your Telnyx API key.\nhttps://portal.telnyx.com/#/api-keys"
+          format: password
+          writeOnly: true
+          minLength: 1
           nullable: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: object
properties:
telnyx:
type: string
description: "Your Telnyx API key.\nhttps://portal.telnyx.com/#/api-keys"
nullable: true
PatchedSetTtsApiKeysRequest:
PatchedSetTelephonyApiKeysRequest:
type: object
properties:
telnyx:
type: string
description: "Your Telnyx API key.\nhttps://portal.telnyx.com/#/api-keys"
format: password
writeOnly: true
minLength: 1
nullable: true
PatchedSetTtsApiKeysRequest:
🤖 Prompt for AI Agents
In src/libs/Ultravox/openapi.yaml around lines 3667 to 3673, the telnyx API key
property should be marked writeOnly and validate against empty strings while
still allowing null to clear; change the telnyx property to include writeOnly:
true and a minimal validation (minLength: 1) while keeping nullable: true, e.g.
keep type: string and add writeOnly: true and minLength: 1; apply the same
pattern to any other API key/secret properties in this object so clients don't
echo secrets and empty strings are rejected but null is allowed to clear.

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