//native
/**
* List Services By OrganizationId
*
*/
export async function main(
auth: RT.Qovery,
organizationId: string,
project_id?: string | undefined,
environment_id?: string | undefined,
cluster_id?: string | undefined
) {
const url = new URL(`https://api.qovery.com/organization/${organizationId}/services`)
for (const [k, v] of [
['project_id', project_id],
['environment_id', environment_id],
['cluster_id', cluster_id]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Token ' + 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