export type GetApiChannelsChannelIdThreadMembersArgs = {with_member?: string | undefined, limit?: string | undefined, after?: string | undefined, channel_id: string}; export type GetApiChannelsChannelIdThreadMembersOptions = {baseUrl: string, apikeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * list thread members * * GET /channels/{channel_id}/thread-members */ export const getApiChannelsChannelIdThreadMembers = async (args: GetApiChannelsChannelIdThreadMembersArgs, options: GetApiChannelsChannelIdThreadMembersOptions) => { const {baseUrl, fetch: fetchFn = fetch, apikeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.with_member != null) query.append("with_member", String(args.with_member)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.after != null) query.append("after", String(args.after)) if (apikeyAuth !== undefined) headers.set('authorization', `apikey ${apikeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/channels/${encodeURIComponent(String(args.channel_id))}/thread-members${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 res.text() };