import type { Stream } from "@futureporn/types"; import { configs } from "../../../services/bot/src/config.ts"; import { logger } from "@discordeno/bot"; export default async function patchVod(stream_id: string, payload: Partial): Promise { const url = `${configs.postgrestUrl}/vods?id=eq.${stream_id}` const fetchOptions = { method: 'PATCH', headers: { 'Authorization': `Bearer ${configs.automationUserJwt}`, 'Content-Type': 'application/json', 'Prefer': 'return=headers-only' }, body: JSON.stringify(payload) } try { const res = await fetch(url, fetchOptions) if (!res.ok) { const body = await res.json() logger.error(body) throw new Error(`Problem during patchVod. res.status=${res.status}, res.statusText=${res.statusText}`) } return } catch (e) { logger.error(e) throw e } }