//native
type Render = {
apiKey: string
}
/**
* List blueprints
* List blueprints for the specified workspaces. If no workspaces are provided, returns all blueprints the API key has access to.
*/
export async function main(
auth: Render,
ownerId: string | undefined,
cursor: string | undefined,
limit: string | undefined
) {
const url = new URL(`https://api.render.com/v1/blueprints`)
for (const [k, v] of [
['ownerId', ownerId],
['cursor', cursor],
['limit', limit]
]) {
if (v !== undefined && v !== '' && k !== undefined) {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + 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