From 6162a84dc90827a4b692e78a598b8273fa51604b Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Sat, 12 Oct 2024 12:02:25 -0400 Subject: [PATCH] chore: deprecate buildAuthorization --- src/utils/public/buildAuthorization.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/public/buildAuthorization.ts b/src/utils/public/buildAuthorization.ts index 4419bc6..738710a 100644 --- a/src/utils/public/buildAuthorization.ts +++ b/src/utils/public/buildAuthorization.ts @@ -19,11 +19,19 @@ import type { ApiAuthorization } from "./models"; * webApiKey: "LtjCwW16nJI7cqOyPIQtXk8v1cfF0tmO" * }); * ``` + * + * @deprecated You can just pass your API key directly to the functions instead, eg: + * ```ts + * const game = await getGame(webApiKey, { gameId: 14402 }); + * ``` */ export const buildAuthorization = ( options: ApiAuthorization ): ApiAuthorization => { - if (!options.username || !options.webApiKey) { + if ( + typeof options !== "string" && + (!options.username || !options.webApiKey) + ) { throw new Error(` buildAuthorization() requires an object containing a username and webApiKey. eg: