export type CreateCommunityMemberDto = {wallet: string, tags: Array}; export type CreateApiCommunityIdMemberArgs = {id: string, body: CreateCommunityMemberDto}; export type CreateApiCommunityIdMemberOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add community member * * POST /community/{id}/member */ export const createApiCommunityIdMember = async (args: CreateApiCommunityIdMemberArgs, options?: CreateApiCommunityIdMemberOptions) => { const {baseUrl = "https://api.openpage.fun/v1", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("X-Api-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/community/${encodeURIComponent(String(args.id))}/member${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 };