Skip to content

Commit e51cd4d

Browse files
committed
feat: add api handler for compliance check
1 parent 2f4e37e commit e51cd4d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/api-client.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getConfig } from './utils.js'
22
import { got } from 'got'
3-
import { APIHealthResponse, APIProjectDetails, APIGithubOrgDetails, APIChecklistItem } from './types.js'
3+
import { APIHealthResponse, APIProjectDetails, APIGithubOrgDetails, APIChecklistItem, APICheckItem } from './types.js'
44

55
export const apiClient = () => {
66
const config = getConfig()
@@ -61,3 +61,12 @@ export const getAllChecklistItems = async (): Promise<APIChecklistItem[]> => {
6161
}
6262
return response.body as APIChecklistItem[]
6363
}
64+
65+
export const getAllChecks = async (): Promise<APICheckItem[]> => {
66+
const client = apiClient()
67+
const response = await client.get('compliance-check', { responseType: 'json' })
68+
if (response.statusCode !== 200) {
69+
throw new Error(`Failed to get the data from the API: ${response.statusCode} ${response.body}`)
70+
}
71+
return response.body as APICheckItem[]
72+
}

0 commit comments

Comments
 (0)