Skip to content

Commit 458486b

Browse files
wrn14897claude
andauthored
Add configurable API version option to CLI (#220)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 61b8d6e commit 458486b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.changeset/ten-jobs-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/cli': patch
3+
---
4+
5+
feat: Add --apiVersion flag to configure API version (v1 or v2)

packages/cli/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ program
2424
'-bp, --basePath [string]',
2525
'An optional base path for the uploaded sourcemaps',
2626
)
27+
.option(
28+
'--apiVersion [string]',
29+
'The API version to use (v1 or v2)',
30+
'v1',
31+
)
2732
.action(uploadSourcemaps);
2833

2934
program.parse();

packages/cli/src/lib.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ export const uploadSourcemaps = async ({
1111
allowNoop,
1212
serviceKey,
1313
apiUrl,
14+
apiVersion,
1415
basePath,
1516
path,
1617
releaseId,
1718
}: {
1819
allowNoop?: boolean;
1920
serviceKey: string;
2021
apiUrl?: string;
22+
apiVersion?: string;
2123
basePath?: string;
2224
path: string;
2325
releaseId?: string;
@@ -31,8 +33,9 @@ export const uploadSourcemaps = async ({
3133
}
3234

3335
const backend = apiUrl || 'https://api.hyperdx.io';
36+
const version = apiVersion || 'v1';
3437

35-
const res = await fetch(join(backend, 'api', 'v1'), {
38+
const res = await fetch(join(backend, 'api', version), {
3639
method: 'get',
3740
headers: {
3841
'Content-Type': 'application/json',
@@ -71,7 +74,7 @@ export const uploadSourcemaps = async ({
7174
}));
7275

7376
const urlRes = await fetch(
74-
join(backend, 'api', 'v1', 'sourcemaps', 'upload-presigned-urls'),
77+
join(backend, 'api', version, 'sourcemaps', 'upload-presigned-urls'),
7578
{
7679
method: 'post',
7780
headers: {

0 commit comments

Comments
 (0)