1
//native
2
type Actimo = {
3
apiKey: string
4
}
5
6
export async function main(
7
auth: Actimo,
8
body: { fileName?: string; parts?: number; type?: string; size?: number }
9
) {
10
const url = new URL(`https://actimo.com/api/v1/media/multipart/complete`)
11
12
const response = await fetch(url, {
13
method: 'POST',
14
headers: {
15
'api-key': auth.apiKey,
16
'Content-Type': 'application/json'
17
},
18
body: JSON.stringify(body)
19
})
20
21
if (!response.ok) {
22
const text = await response.text()
23
throw new Error(`${response.status} ${text}`)
24
25
26
return await response.json()
27
28