export type GetApiApiV1MusicArtistsArgs = {tracks?: boolean | undefined, metadata?: boolean | undefined, releases?: boolean | undefined, libraries?: Array | undefined, orderBy?: ('createdAt' | 'updatedAt' | 'name' | 'sortName') | undefined, take?: number | undefined, skip?: number | undefined, order?: ('ASC' | 'DESC') | undefined}; export type GetApiApiV1MusicArtistsOptions = {baseUrl: string, LocalUserJWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * 🛡️ Query music artists. * * GET /api/v1/music/artists */ export const getApiApiV1MusicArtists = async (args: GetApiApiV1MusicArtistsArgs, options: GetApiApiV1MusicArtistsOptions) => { const {baseUrl, fetch: fetchFn = fetch, LocalUserJWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.tracks != null) query.append("tracks", String(args.tracks)) if (args.metadata != null) query.append("metadata", String(args.metadata)) if (args.releases != null) query.append("releases", String(args.releases)) for (const item of args.libraries ?? []) query.append("libraries", String(item)) if (args.orderBy != null) query.append("orderBy", String(args.orderBy)) if (args.take != null) query.append("take", String(args.take)) if (args.skip != null) query.append("skip", String(args.skip)) if (args.order != null) query.append("order", String(args.order)) if (LocalUserJWT !== undefined) headers.set('authorization', `Bearer ${LocalUserJWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/music/artists${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };