export type UserDataDTO = {user_id: number, channels: Array>}; export type DevAttachUserToTopicDTO = {users: Array}; export type CreateApiV3TopicsTopicIdUsersArgs = {topicId: number, body: DevAttachUserToTopicDTO}; export type CreateApiV3TopicsTopicIdUsersOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /v3/topics/{topicId}/users */ export const createApiV3TopicsTopicIdUsers = async (args: CreateApiV3TopicsTopicIdUsersArgs, options: CreateApiV3TopicsTopicIdUsersOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v3/topics/${encodeURIComponent(String(args.topicId))}/users${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };