Skip to content

Commit f8a77e5

Browse files
committed
feat: add api handler for compliance checklist
1 parent f555298 commit f8a77e5

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 } from './types.js'
3+
import { APIHealthResponse, APIProjectDetails, APIGithubOrgDetails, APIChecklistItem } from './types.js'
44

55
export const apiClient = () => {
66
const config = getConfig()
@@ -52,3 +52,12 @@ export const addGithubOrgToProject = async (projectId: number, githubOrgUrl: str
5252
}
5353
return response.body as APIGithubOrgDetails
5454
}
55+
56+
export const getAllChecklistItems = async (): Promise<APIChecklistItem[]> => {
57+
const client = apiClient()
58+
const response = await client.get('compliance-checklist', { responseType: 'json' })
59+
if (response.statusCode !== 200) {
60+
throw new Error(`Failed to get the data from the API: ${response.statusCode} ${response.body}`)
61+
}
62+
return response.body as APIChecklistItem[]
63+
}

0 commit comments

Comments
 (0)