import { fetch } from "https://esm.town/v/std/fetch";
import process from "node:process";
export async function setSFTidbytImage({ image, key }: {
image: string;
key: string;
}) {
const apiKey = process.env.sf_tidbyt_api_key;
const deviceId = process.env.sf_tidbyt_device_id;
const res = await fetch(
`https://api.tidbyt.com/v0/devices/${deviceId}/push`,
{
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify({
"deviceID": deviceId,
"image": image,
"installationID": key,
"background": false,
}),
},
);
return { status: res.status, body: await res.json() };
}