type Baremetrics = {
apiKey: string
}
export async function main(resource: Baremetrics, sourceId: string, oid: string) {
const endpoint = ` https://api.baremetrics.com/v1/${sourceId}/plans/${oid}`
const response = await fetch(endpoint, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `Bearer ${resource.apiKey}`
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data.plan
}
Submitted by hugo697 89 days ago