0
Start a multipart upload to S3
One script reply has been approved by the moderators Verified
Created by hugo697 40 days ago Viewed 5 times
0
Submitted by hugo697 Bun
Verified 40 days ago
1
//native
2
type Actimo = {
3
	apiKey: string
4
}
5

6
export async function main(
7
	auth: Actimo,
8
	body: {
9
		fileName?: string
10
		parts?: number
11
		uploadId?: string
12
		mediaFileId?: number
13
	}
14
) {
15
	const url = new URL(`https://actimo.com/api/v1/media/multipart/start`)
16

17
	const response = await fetch(url, {
18
		method: 'POST',
19
		headers: {
20
			'api-key': auth.apiKey,
21
			'Content-Type': 'application/json'
22
		},
23
		body: JSON.stringify(body)
24
	})
25

26
	if (!response.ok) {
27
		const text = await response.text()
28
		throw new Error(`${response.status} ${text}`)
29
	}
30

31
	return await response.json()
32
}
33