export type DeleteApiApiV1TracksTrackIdArgs = {track_id: string, app_state: unknown}; export type DeleteApiApiV1TracksTrackIdOptions = {baseUrl: string, OAuth2PasswordBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Track:Delete * * DELETE /api/v1/tracks/{track_id} */ export const deleteApiApiV1TracksTrackId = async (args: DeleteApiApiV1TracksTrackIdArgs, options: DeleteApiApiV1TracksTrackIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2PasswordBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.app_state != null) query.append("app_state", String(args.app_state)) if (OAuth2PasswordBearer !== undefined) headers.set('authorization', `Bearer ${OAuth2PasswordBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/tracks/${encodeURIComponent(String(args.track_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };