export type UpdatePlaylistDto = {gameIds?: Array | undefined, autofill?: boolean | undefined, totalGames?: number | undefined, autofillCategories?: Array | undefined, autofillCreators?: Array | undefined, autofillExcludedCreators?: Array | undefined}; export type PatchApiV1CreatorPlaylistsPlaylistIdArgs = {playlistId: string, body: UpdatePlaylistDto}; export type PatchApiV1CreatorPlaylistsPlaylistIdOptions = {baseUrl: string, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /v1/creator/playlists/{playlistId} */ export const patchApiV1CreatorPlaylistsPlaylistId = async (args: PatchApiV1CreatorPlaylistsPlaylistIdArgs, options: PatchApiV1CreatorPlaylistsPlaylistIdOptions) => { 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/playlists/${encodeURIComponent(String(args.playlistId))}${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 };