export type GetApiApiItemPlatformIdSubplatformArgs = {id: number, team_id?: number | undefined, season?: number | undefined}; export type GetApiApiItemPlatformIdSubplatformOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get platform's subplatforms * * GET /api/item-platform/{id}/subplatform */ export const getApiApiItemPlatformIdSubplatform = async (args: GetApiApiItemPlatformIdSubplatformArgs, options: GetApiApiItemPlatformIdSubplatformOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.team_id != null) query.append("team_id", String(args.team_id)) if (args.season != null) query.append("season", String(args.season)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/item-platform/${encodeURIComponent(String(args.id))}/subplatform${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 };