//native
type Codat = {
encodedKey: string
}
/**
* Add product
* Use the *Add product* endpoint to enable a product for the company specified by `companyId`.
> Note: This feature is currently in alpha and available only to participants in the development program.
*/
export async function main(auth: Codat, companyId: string, productIdentifier: string) {
const url = new URL(`https://api.codat.io/companies/${companyId}/products/${productIdentifier}`)
const response = await fetch(url, {
method: 'PUT',
headers: {
Authorization: `Basic ${auth.encodedKey}`
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago