//native
type Miro = {
token: string;
};
/**
* Share board
* Shares the board and Invites new members to collaborate on a board by sending an invitation email. Depending on the board's Sharing policy, there might be various scenarios where membership in the team is required in order to share the board with a user.Required scope boards:write Rate limiting Level 3
*/
export async function main(
auth: Miro,
board_id: string,
body: {
emails: string[];
role?: "viewer" | "commenter" | "editor" | "coowner" | "owner";
message?: string;
},
) {
const url = new URL(`https://api.miro.com//v2/boards/${board_id}/members`);
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