export type FriendshipRequestInCancel = {addresseeId: number}; export type BodyFriendshipsCancelRequestApiV5FriendshipsCancelRequestPut = {'friendship-request': FriendshipRequestInCancel}; export type UpdateApiApiV5FriendshipsCancelRequestArgs = {body: BodyFriendshipsCancelRequestApiV5FriendshipsCancelRequestPut}; export type UpdateApiApiV5FriendshipsCancelRequestOptions = {baseUrl?: string | undefined, RWAPIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel friendship request * * PUT /api/v5/friendships/cancel-request */ export const updateApiApiV5FriendshipsCancelRequest = async (args: UpdateApiApiV5FriendshipsCancelRequestArgs, options?: UpdateApiApiV5FriendshipsCancelRequestOptions) => { 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/cancel-request${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 };