export type StreamFileAppConfig = {sourceControlDriver: string, sourceControlUserName: string, sourceControlPassword: string, name: string, serverName: string, saveFieldList?: Array | undefined, version: string, uri: string}; export type CreateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameStreamfilesArgs = {serverName: string, vhostName: string, appName: string, body: StreamFileAppConfig}; export type CreateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameStreamfilesOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update stream file list * * POST /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/streamfiles */ export const createApiV2ServersServerNameVhostsVhostNameApplicationsAppNameStreamfiles = async (args: CreateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameStreamfilesArgs, options?: CreateApiV2ServersServerNameVhostsVhostNameApplicationsAppNameStreamfilesOptions) => { 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))}/streamfiles${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 };