export type UpdateApiApiChannelsChannelIdMessagesPinsMessageIdArgs = {channel_id: string, message_id: string}; export type UpdateApiApiChannelsChannelIdMessagesPinsMessageIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /api/channels/{channel_id}/messages/pins/{message_id} */ export const updateApiApiChannelsChannelIdMessagesPinsMessageId = async (args: UpdateApiApiChannelsChannelIdMessagesPinsMessageIdArgs, options?: UpdateApiApiChannelsChannelIdMessagesPinsMessageIdOptions) => { const {baseUrl = "https://api.rory.server.spacebar.chat", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/channels/${encodeURIComponent(String(args.channel_id))}/messages/pins/${encodeURIComponent(String(args.message_id))}${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 };