export type UpdateGameDto = {isPrivate?: boolean | undefined, bingSearch?: string | undefined, bingSearchClaim?: string | undefined, metadata?: Record | undefined, version: number}; export type PatchApiV1CreatorGamesGameIdArgs = {gameId: string, body: UpdateGameDto}; export type PatchApiV1CreatorGamesGameIdOptions = {baseUrl: string, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /v1/creator/games/{gameId} */ export const patchApiV1CreatorGamesGameId = async (args: PatchApiV1CreatorGamesGameIdArgs, options: PatchApiV1CreatorGamesGameIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/creator/games/${encodeURIComponent(String(args.gameId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };