Skip to content

Commit

Permalink
chore(cli): Changed objects to classes (#306)
Browse files Browse the repository at this point in the history
Co-authored-by: vr-varad <varadgupta21#gmail.com>
  • Loading branch information
vr-varad authored and rajdip-b committed Jul 29, 2024
1 parent 538ea7f commit c83f2db
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
33 changes: 17 additions & 16 deletions apps/cli/src/http/auth.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { Logger } from '@/util/logger'

const AuthController = {
async checkApiKeyValidity(baseUrl: string, apiKey: string): Promise<void> {
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<void> {
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
5 changes: 3 additions & 2 deletions apps/cli/src/http/secret.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -25,4 +25,5 @@ const SecretController = {
}
}


export default SecretController
4 changes: 2 additions & 2 deletions apps/cli/src/http/variable.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit c83f2db

Please sign in to comment.