diff --git a/apps/cli/src/http/auth.ts b/apps/cli/src/http/auth.ts index bd8d9b41..9c8a1b67 100644 --- a/apps/cli/src/http/auth.ts +++ b/apps/cli/src/http/auth.ts @@ -1,22 +1,23 @@ import { Logger } from '@/util/logger' -const AuthController = { - async checkApiKeyValidity(baseUrl: string, apiKey: string): Promise { - Logger.info('Checking API key validity...') - const response = await fetch(`${baseUrl}/api/api-key/access/live-updates`, { - headers: { - 'x-keyshade-token': apiKey +class AuthController { + static async checkApiKeyValidity(baseUrl: string, apiKey: string): Promise { + Logger.info('Checking API key validity...') + const response = await fetch(`${baseUrl}/api/api-key/access/live-updates`, { + headers: { + 'x-keyshade-token': apiKey + } + }) + + if (!response.ok) { + throw new Error( + 'API key is not valid. Please check the key and try again.' + ) + } + + Logger.info('API key is valid!') } - }) - - if (!response.ok) { - throw new Error( - 'API key is not valid. Please check the key and try again.' - ) - } - - Logger.info('API key is valid!') - } } + export default AuthController diff --git a/apps/cli/src/http/secret.ts b/apps/cli/src/http/secret.ts index 80eabf09..63379467 100644 --- a/apps/cli/src/http/secret.ts +++ b/apps/cli/src/http/secret.ts @@ -1,7 +1,7 @@ import type { Configuration } from '@/types/command/run.types' -const SecretController = { - async fetchSecrets( +class SecretController { + static async fetchSecrets( baseUrl: string, apiKey: string, projectId: string, @@ -25,4 +25,5 @@ const SecretController = { } } + export default SecretController diff --git a/apps/cli/src/http/variable.ts b/apps/cli/src/http/variable.ts index 03e0d210..6ae80ad1 100644 --- a/apps/cli/src/http/variable.ts +++ b/apps/cli/src/http/variable.ts @@ -1,7 +1,7 @@ import type { Configuration } from '@/types/command/run.types' -const VariableController = { - async fetchVariables( +class VariableController{ + static async fetchVariables( baseUrl: string, apiKey: string, projectId: string,