//native
type Xero = {
token: string
}
/**
* creates a project for the specified contact
* Allows you to update a specific projects.
*/
export async function main(
auth: Xero,
projectId: string,
Xero_Tenant_Id: string,
Idempotency_Key: string,
body: { status: 'INPROGRESS' | 'CLOSED' }
) {
const url = new URL(`https://api.xero.com/projects.xro/2.0/Projects/${projectId}`)
const response = await fetch(url, {
method: 'PATCH',
headers: {
Accept: 'application/json',
'Xero-Tenant-Id': Xero_Tenant_Id,
'Idempotency-Key': Idempotency_Key,
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 515 days ago