//native
type Miro = {
token: string;
};
/**
* Remove tag from item
* Removes the specified tag from the specified item.
*/
export async function main(
auth: Miro,
board_id_PlatformTags: string,
item_id: string,
tag_id: string | undefined,
) {
const url = new URL(
`https://api.miro.com//v2/boards/${board_id_PlatformTags}/items/${item_id}`,
);
for (const [k, v] of [["tag_id", tag_id]]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago