//native
type Figma = {
token: string;
};
/**
* Update dev resources
* Bulk update dev resources across multiple files.
Ids for dev resources that are successfully updated will show up in the `links_updated` array in the response.
If there are any dev resources that cannot be updated, you may still get a 200 response. These resources will show up in the `errors` array.
*/
export async function main(
auth: Figma,
body: { dev_resources: { id: string; name?: string; url?: string }[] },
) {
const url = new URL(`https://api.figma.com/v1/dev_resources`);
const response = await fetch(url, {
method: "PUT",
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 428 days ago