//native
type Miro = {
token: string;
};
/**
* Update connector
* Updates a connector 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,
connector_id: string,
body: {
startItem?: {
id?: string;
position?: { x?: string; y?: string };
snapTo?: "auto" | "top" | "right" | "bottom" | "left";
};
endItem?: {
id?: string;
position?: { x?: string; y?: string };
snapTo?: "auto" | "top" | "right" | "bottom" | "left";
};
shape?: "straight" | "elbowed" | "curved";
captions?: {
content: string;
position?: string;
textAlignVertical?: "top" | "bottom" | "middle";
}[];
style?: {
color?: string;
endStrokeCap?:
| "none"
| "stealth"
| "rounded_stealth"
| "diamond"
| "filled_diamond"
| "oval"
| "filled_oval"
| "arrow"
| "triangle"
| "filled_triangle"
| "erd_one"
| "erd_many"
| "erd_only_one"
| "erd_zero_or_one"
| "erd_one_or_many"
| "erd_zero_or_many"
| "unknown";
fontSize?: string;
startStrokeCap?:
| "none"
| "stealth"
| "rounded_stealth"
| "diamond"
| "filled_diamond"
| "oval"
| "filled_oval"
| "arrow"
| "triangle"
| "filled_triangle"
| "erd_one"
| "erd_many"
| "erd_only_one"
| "erd_zero_or_one"
| "erd_one_or_many"
| "erd_zero_or_many"
| "unknown";
strokeColor?: string;
strokeStyle?: "normal" | "dotted" | "dashed";
strokeWidth?: string;
textOrientation?: "horizontal" | "aligned";
};
},
) {
const url = new URL(
`https://api.miro.com//v2/boards/${board_id}/connectors/${connector_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