export type UpdateApiV2FriendsXuidArgs = {xuid: string}; export type UpdateApiV2FriendsXuidOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add a friend * * PUT /v2/friends/{xuid} */ export const updateApiV2FriendsXuid = async (args: UpdateApiV2FriendsXuidArgs, options?: UpdateApiV2FriendsXuidOptions) => { const {baseUrl = "https://api.xbl.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v2/friends/${encodeURIComponent(String(args.xuid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };