//native
/**
* List database backups
* By default it returns the 20 last results. The response is paginated. In order to request the next page, you can use the startId query parameter
*/
export async function main(auth: RT.Qovery, databaseId: string, startId?: string | undefined) {
const url = new URL(`https://api.qovery.com/database/${databaseId}/backup`)
for (const [k, v] of [['startId', startId]]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Token ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago