//native
type Miro = {
token: string;
};
/**
* Update sticky note item
* Updates a sticky note item on a board based on the data and style properties provided in the request body.Required scope boards:write Rate limiting Level 2
*/
export async function main(
auth: Miro,
board_id: string,
item_id: string,
body: {
data?: { content?: string; shape?: "square" | "rectangle" };
style?: {
fillColor?:
| "gray"
| "light_yellow"
| "yellow"
| "orange"
| "light_green"
| "green"
| "dark_green"
| "cyan"
| "light_pink"
| "pink"
| "violet"
| "red"
| "light_blue"
| "blue"
| "dark_blue"
| "black";
textAlign?: "left" | "right" | "center";
textAlignVertical?: "top" | "middle" | "bottom";
};
position?: { x?: number; y?: number };
geometry?: { height?: number; width?: number };
parent?: { id?: string };
},
) {
const url = new URL(
`https://api.miro.com//v2/boards/${board_id}/sticky_notes/${item_id}`,
);
const response = await fetch(url, {
method: "PATCH",
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