Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): Changed objects to classes #306

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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