Fetch all the events for an organisation.
1
type Certopus = {
2
apiKey: string
3
}
4
5
export async function main(resource: Certopus, organisationId: string) {
6
const endpoint = `https://api.certopus.com/v1/events/${organisationId}`
7
8
const response = await fetch(endpoint, {
9
method: 'GET',
10
headers: {
11
accept: 'application/json',
12
'x-api-key': resource.apiKey
13
14
})
15
16
if (!response.ok) {
17
throw new Error(`HTTP error! status: ${response.status}`)
18
19
20
const data = await response.json()
21
22
return data
23
24