//native
type Neondb = {
apiKey: string
}
/**
* Transfer projects from your personal account to a specified destination account
* Transfers selected projects, identified by their IDs, from your personal account to a specified organization.
*/
export async function main(auth: Neondb, body: { org_id: string; project_ids: string[] }) {
const url = new URL(`https://console.neon.tech/api/v2/users/me/projects/transfer`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 428 days ago