//native
type Miro = {
token: string;
};
/**
* Create shape item
* Adds a flowchart shape item to a board.Required scope boards:write Rate limiting Level 2
*/
export async function main(
auth: Miro,
board_id: string,
body: {
data?: { content?: string; shape?: string };
style?: {
borderColor?: string;
borderOpacity?: string;
borderStyle?: "normal" | "dotted" | "dashed";
borderWidth?: string;
color?: string;
fillColor?: string;
fillOpacity?: string;
fontFamily?:
| "arial"
| "abril_fatface"
| "bangers"
| "eb_garamond"
| "georgia"
| "graduate"
| "gravitas_one"
| "fredoka_one"
| "nixie_one"
| "open_sans"
| "permanent_marker"
| "pt_sans"
| "pt_sans_narrow"
| "pt_serif"
| "rammetto_one"
| "roboto"
| "roboto_condensed"
| "roboto_slab"
| "caveat"
| "times_new_roman"
| "titan_one"
| "lemon_tuesday"
| "roboto_mono"
| "noto_sans"
| "plex_sans"
| "plex_serif"
| "plex_mono"
| "spoof"
| "tiempos_text"
| "formular";
fontSize?: string;
textAlign?: "left" | "right" | "center" | "unknown";
textAlignVertical?: "unknown" | "top" | "middle" | "bottom";
};
position?: { x?: number; y?: number };
geometry?: { height?: number; rotation?: number; width?: number };
parent?: { id?: string };
},
) {
const url = new URL(
`https://api.miro.com//v2-experimental/boards/${board_id}/shapes`,
);
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