1
//native
2
type Docspring = {
3
tokenId: string
4
tokenSecret: string
5
}
6
/**
7
* Check the status of a combined submission (merged PDFs)
8
*
9
*/
10
export async function main(auth: Docspring, combined_submission_id: string) {
11
const url = new URL(
12
`https://api.docspring.com/api/v1/combined_submissions/${combined_submission_id}`
13
)
14
15
const token = btoa(auth.tokenId + ':' + auth.tokenSecret)
16
17
const response = await fetch(url, {
18
method: 'GET',
19
headers: {
20
Authorization: `Basic ${token}`
21
},
22
body: undefined
23
})
24
if (!response.ok) {
25
const text = await response.text()
26
throw new Error(`${response.status} ${text}`)
27
28
return await response.text()
29
30