Skip to content

feat: Clean up the endpoints list#295

Draft
erichare wants to merge 2 commits intodatastax:mainfrom
erichare:feat-endpoints-url-trim
Draft

feat: Clean up the endpoints list#295
erichare wants to merge 2 commits intodatastax:mainfrom
erichare:feat-endpoints-url-trim

Conversation

@erichare
Copy link
Collaborator

Fixes #294

This pull request refactors the database API endpoint commands and their naming to improve clarity and consistency. The primary change is the renaming of the api endpoint and command to client, with additional adjustments to endpoint types, command classes, and test snapshots to match the new naming convention. It also introduces a new curl endpoint and cleans up some internal logic.

Key changes include:

Endpoint and Command Refactoring:

  • Renamed the API endpoint to CLIENT in the Endpoint enum, updated its logic, and replaced all uses of api with client throughout the codebase. The EndpointsApiCmd class was removed and replaced by EndpointsClientCmd. [1] [2] [3] [4]
  • Updated the legacy command EndpointApiCmd to use the new CLIENT endpoint instead of API.

Endpoint List and Output Updates:

  • Changed the output of the endpoints list to show client and curl endpoints instead of api and data-api, and updated the corresponding test snapshots in CSV, JSON, and human-readable formats. [1] [2] [3] [4] [5]

Internal Logic Improvements:

  • Added a helper method apiBaseUrl to centralize the logic for determining the API base URL in the Endpoint enum.
  • Updated the EndpointsDataApiCmd to use the new CURL endpoint type.

Test and Snapshot Updates:

  • Renamed all test classes and snapshot files from Api to Client to match the new endpoint naming, and updated the test commands accordingly. [1] [2] [3] [4] [5] [6]

These changes improve the clarity of endpoint naming and ensure consistency across commands, code, and documentation.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the database “endpoints” surface to improve naming clarity and address the mismatch between “client-usable” URLs vs Data API URLs (Issue #294), including renaming the api endpoint/command concept to client and adding a distinct curl endpoint type for /api/v1/json.

Changes:

  • Renames the api endpoint/command to client and updates snapshots/tests accordingly.
  • Introduces a new CURL endpoint type and updates the endpoints list output to show client + curl instead of api + data-api.
  • Centralizes base URL computation via Endpoint.apiBaseUrl(...) and updates legacy endpoint wiring.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/Endpoint.java Renames/reshapes endpoint types (CLIENT, CURL) and centralizes base URL logic.
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsCmd.java Swaps EndpointsApiCmd for EndpointsClientCmd in subcommand registration.
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsClientCmd.java Adds new client subcommand returning the “client” base URL.
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsDataApiCmd.java Re-points data-api subcommand to use the new CURL endpoint type.
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/legacy/EndpointApiCmd.java Updates legacy command to use Endpoint.CLIENT.
src/test/java/com/dtsx/astra/cli/snapshot/commands/db/endpoints/EndpointsClientCmdSnapshotTest.java Renames snapshot test to validate the new client subcommand.
src/test/resources/snapshots/_db/_endpoints/** Updates snapshots for list/client outputs to reflect new endpoint naming and ordering.
Comments suppressed due to low confidence (1)

src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsCmd.java:16

  • The endpoints command registers EndpointsDataApiCmd but there is no subcommand named curl, even though Endpoint now includes CURL and endpoints list displays it as curl. If the intent is to introduce a curl endpoint (per PR description and snapshots), add a dedicated curl subcommand (or rename EndpointsDataApiCmd to curl and keep data-api as an alias) so the listed endpoint name matches an actual command users can run.
@Command(
    name = "endpoints",
    description = "Get various endpoints for your database",
    subcommands = {
        EndpointsListCmd.class,
        EndpointsClientCmd.class,
        EndpointsDataApiCmd.class,
        EndpointsSwaggerCmd.class,
        EndpointsPlaygroundCmd.class,
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@toptobes
Copy link
Collaborator

toptobes commented Mar 19, 2026

I don't mind having a specific endpoint for curl data api but I wouldn't call it "client" and "curl", I'd just leave it as "api" and add "data-api" so it's both backwards and forwards compatable

if we really want we can add "data-api-client" as an alias to "api" though

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.

astra db endpoints Enhancement, trim url for client usage

3 participants