//native
type Docspring = {
tokenId: string
tokenSecret: string
}
/**
* Rename a folder
*
*/
export async function main(auth: Docspring, folder_id: string) {
const url = new URL(`https://api.docspring.com/api/v1/folders/${folder_id}/rename`)
const token = btoa(auth.tokenId + ':' + auth.tokenSecret)
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: `Basic ${token}`
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 537 days ago