export type SMILFileStreamConfig = {systemLanguage: string, dur: string, ngrp: string, keyFrameOnly: string, src: string, systemBitrate: string, serverName: string, videoCodecId: string, type: string, version: string, audioBitrate: string, audioCodecId: string, videoBitrate: string, isWowzaCaptionStream: string, videoOnly: string, audioOnly: string, width: string, saveFieldList?: Array | undefined, idx: number, begin: string, wowzaCaptionIngestType: string, height: string}; export type SMILFileConfig = {name: string, serverName: string, smilStreams: Array, saveFieldList?: Array | undefined, title: string, version: string}; export type CreateApiV2ServersServerNameVhostsVhostNameSmilfilesSmilfileNameArgs = {serverName: string, vhostName: string, smilfileName: string, body: SMILFileConfig}; export type CreateApiV2ServersServerNameVhostsVhostNameSmilfilesSmilfileNameOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Create SMIL file * * POST /v2/servers/{serverName}/vhosts/{vhostName}/smilfiles/{smilfileName} */ export const createApiV2ServersServerNameVhostsVhostNameSmilfilesSmilfileName = async (args: CreateApiV2ServersServerNameVhostsVhostNameSmilfilesSmilfileNameArgs, options?: CreateApiV2ServersServerNameVhostsVhostNameSmilfilesSmilfileNameOptions) => { const {baseUrl = "http://localhost:8087", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/servers/${encodeURIComponent(String(args.serverName))}/vhosts/${encodeURIComponent(String(args.vhostName))}/smilfiles/${encodeURIComponent(String(args.smilfileName))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };