export type CreateApiPartnersStreamsArgs = {currentTrack?: boolean | undefined, 'X-Auth-Token': string, body: Array}; export type CreateApiPartnersStreamsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the partner information for a list of streams. * * POST /partners/streams */ export const createApiPartnersStreams = async (args: CreateApiPartnersStreamsArgs, options?: CreateApiPartnersStreamsOptions) => { const {baseUrl = "https://api.zeno.fm", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.currentTrack != null) query.append("currentTrack", String(args.currentTrack)) if (args['X-Auth-Token'] != null) headers.set("X-Auth-Token", String(args['X-Auth-Token'])) const url = `${baseUrl.replace(/\/+$/, '')}/partners/streams${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 res.blob() };