export type DVRConfig = {windowDuration: number, dvrMediaCacheEnabled: boolean, dvrEnable: boolean, startRecordingOnStartup: boolean, serverName: string, store: string, version: string, recorders: string, dvrOnlyStreaming: boolean, httpRandomizeMediaName: boolean, licenseType: string, dvrEncryptionSharedSecret: string, inUse: boolean, archiveStrategy: string, storageDir: string, saveFieldList?: Array | undefined}; export type UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDvrArgs = {serverName: string, vhostName: string, appName: string, body: DVRConfig}; export type UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDvrOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update DVR config * * PUT /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/dvr */ export const updateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDvr = async (args: UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDvrArgs, options?: UpdateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameDvrOptions) => { 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))}/applications/${encodeURIComponent(String(args.appName))}/dvr${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };