export type CreateApiApiV1IndexSeedFsArgs = {artists: string}; export type CreateApiApiV1IndexSeedFsOptions = {baseUrl: string, LocalUserJWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * 🛡️ Seed the file system with mock music folders and files. * * POST /api/v1/index/seed/fs */ export const createApiApiV1IndexSeedFs = async (args: CreateApiApiV1IndexSeedFsArgs, options: CreateApiApiV1IndexSeedFsOptions) => { const {baseUrl, fetch: fetchFn = fetch, LocalUserJWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.artists != null) query.append("artists", String(args.artists)) if (LocalUserJWT !== undefined) headers.set('authorization', `Bearer ${LocalUserJWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/index/seed/fs${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };