export type FriendshipRequestInRemove = {userId: number}; export type BodyFriendshipsRemoveFriendApiV5FriendshipsRemoveFriendPut = {'friendship-request': FriendshipRequestInRemove}; export type UpdateApiApiV5FriendshipsRemoveFriendArgs = {body: BodyFriendshipsRemoveFriendApiV5FriendshipsRemoveFriendPut}; export type UpdateApiApiV5FriendshipsRemoveFriendOptions = {baseUrl?: string | undefined, RWAPIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove friend * * PUT /api/v5/friendships/remove-friend */ export const updateApiApiV5FriendshipsRemoveFriend = async (args: UpdateApiApiV5FriendshipsRemoveFriendArgs, options?: UpdateApiApiV5FriendshipsRemoveFriendOptions) => { const {baseUrl = "https://api.pavlok.com", fetch: fetchFn = fetch, RWAPIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (RWAPIKeyHeader !== undefined) headers.set("Authorization", RWAPIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/api/v5/friendships/remove-friend${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };