export type PatchApiV1AdminGamesGameIdCancelArgs = {gameId: string, version: number}; export type PatchApiV1AdminGamesGameIdCancelOptions = {baseUrl: string, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /v1/admin/games/{gameId}/cancel */ export const patchApiV1AdminGamesGameIdCancel = async (args: PatchApiV1AdminGamesGameIdCancelArgs, options: PatchApiV1AdminGamesGameIdCancelOptions) => { const {baseUrl, fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.version != null) query.append("version", String(args.version)) if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/admin/games/${encodeURIComponent(String(args.gameId))}/cancel${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };