export type LeagueUpdateRequest = {name?: (string | null) | undefined, short_name?: (string | null) | undefined, currency?: (string | null) | undefined, is_continuous?: boolean | undefined, logo_url?: (string | null) | undefined, website_url?: (string | null) | undefined, sport_id?: (number | null) | undefined, owner_id?: (number | null) | undefined, scouting_priority?: (number | null) | undefined, platforms_scouted?: (number | null) | undefined, times_scouted_per_year?: (number | null) | undefined, genre_id?: (number | null) | undefined, subgenre_id?: (number | null) | undefined, notes?: (string | null) | undefined, assistants?: Array | undefined, divisions?: Array> | undefined, rejected_companies?: Array<{id: number}> | undefined, order?: number | undefined, separator_text?: (string | null) | undefined, release_date?: (string | null) | undefined, start_date?: (string | null) | undefined, end_date?: (string | null) | undefined, social_start_date?: (string | null) | undefined, social_end_date?: (string | null) | undefined}; export type UpdateApiApiLeagueLeagueArgs = {league: number, body: LeagueUpdateRequest}; export type UpdateApiApiLeagueLeagueOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a league. * * PUT /api/league/{league} */ export const updateApiApiLeagueLeague = async (args: UpdateApiApiLeagueLeagueArgs, options: UpdateApiApiLeagueLeagueOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/league/${encodeURIComponent(String(args.league))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 undefined };