export type GetApiV2DvrScreenshotsXuidArgs = {xuid: string, continuationToken?: string | undefined}; export type GetApiV2DvrScreenshotsXuidOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get screenshots by XUID * * GET /v2/dvr/screenshots/{xuid} */ export const getApiV2DvrScreenshotsXuid = async (args: GetApiV2DvrScreenshotsXuidArgs, options?: GetApiV2DvrScreenshotsXuidOptions) => { const {baseUrl = "https://api.xbl.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.continuationToken != null) query.append("continuationToken", String(args.continuationToken)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v2/dvr/screenshots/${encodeURIComponent(String(args.xuid))}${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 };