//native
type Circleci = {
token: string
}
/**
* Collaborations
* Provides the set of organizations of which a user is a member or a collaborator.
The set of organizations that a user can collaborate on is composed of:
* Organizations that the current user belongs to across VCS types (e.g. BitBucket, GitHub)
* The parent organization of repository that the user can collaborate on, but is not necessarily a member of
* The organization of the current user's account
*/
export async function main(auth: Circleci) {
const url = new URL(`https://circleci.com/api/v2/me/collaborations`)
const response = await fetch(url, {
method: 'GET',
headers: {
'Circle-Token': auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 536 days ago