export type StorageConfig = {type: 'aws' | 'azure' | 'digitalocean' | 'gcs' | 'sftp', access_key?: string | undefined, secret?: string | undefined, bucket?: string | undefined, region?: string | undefined, path?: string | undefined, auth_method?: ('KEY' | 'PASSWORD') | undefined, username?: string | undefined, password?: string | undefined, host?: string | undefined, port?: number | undefined, private_key?: string | undefined} | null; export type TrackLayerOutput = {type?: ('DYTE_BUCKET' | 'STORAGE_CONFIG') | undefined, storage_config?: StorageConfig | undefined}; export type TrackConfigLayer = {file_name_prefix?: string | undefined, outputs?: Array | undefined}; export type CreateApiRecordingsTrackArgs = {body: {meeting_id?: string | undefined, layers: {[key: string]: TrackConfigLayer}, max_seconds?: string | undefined}}; export type CreateApiRecordingsTrackOptions = {baseUrl?: string | undefined, Authorization?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * POST /recordings/track */ export const createApiRecordingsTrack = async (args: CreateApiRecordingsTrackArgs, options?: CreateApiRecordingsTrackOptions) => { const {baseUrl = "https://api.dyte.io/v2", fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Authorization !== undefined) headers.set('authorization', `Basic ${btoa(`${Authorization.username}:${Authorization.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/recordings/track${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 };