//native
type Miro = {
token: string;
};
/**
* Create group
* Creates a group of items on a board. The group is created with the items that are passed in the request body.Required scope boards:write Rate limiting Level 2
*/
export async function main(
auth: Miro,
board_id: string,
body: { data?: { items?: string[] } },
) {
const url = new URL(`https://api.miro.com//v2/boards/${board_id}/groups`);
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