//native
type Miro = {
token: string;
};
/**
* Create project
* Projects are essentially folders of boards with the option to manage user access for a smaller group of people within a team.
*/
export async function main(
auth: Miro,
org_id: string,
team_id: string,
body: { name: string },
) {
const url = new URL(
`https://api.miro.com//v2/orgs/${org_id}/teams/${team_id}/projects`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago