From 0706b05d2020f4908dd417a2db351b5657873f77 Mon Sep 17 00:00:00 2001 From: Kyle Mistele Date: Thu, 20 Mar 2025 21:22:31 -0500 Subject: [PATCH 1/2] add setApiKey method to base client --- js/sdk/src/baseClient.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/sdk/src/baseClient.ts b/js/sdk/src/baseClient.ts index 019bba55f..bf6c761b5 100644 --- a/js/sdk/src/baseClient.ts +++ b/js/sdk/src/baseClient.ts @@ -1,8 +1,8 @@ import axios, { AxiosInstance, - Method, - AxiosResponse, AxiosRequestConfig, + AxiosResponse, + Method, } from "axios"; import FormData from "form-data"; import { ensureCamelCase } from "./utils"; @@ -239,4 +239,9 @@ export abstract class BaseClient { this.accessToken = accessToken; this.refreshToken = refreshToken; } + + setApiKey(apiKey: string): void { + if (!apiKey) throw new Error("API key is required"); + this.apiKey = apiKey; + } } From a6eca2ebef2245de3f7f5ac56aba3a1fb5dded13 Mon Sep 17 00:00:00 2001 From: Kyle Mistele Date: Thu, 20 Mar 2025 21:23:24 -0500 Subject: [PATCH 2/2] feat: add ability to set API Key for client auth --- js/sdk/src/r2rClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/sdk/src/r2rClient.ts b/js/sdk/src/r2rClient.ts index 069e55d89..9b8b298ea 100644 --- a/js/sdk/src/r2rClient.ts +++ b/js/sdk/src/r2rClient.ts @@ -1,4 +1,4 @@ -import axios, { Method, AxiosError } from "axios"; +import axios, { AxiosError, Method } from "axios"; import { BaseClient } from "./baseClient"; import { ChunksClient } from "./v3/clients/chunks";