export type CreateApiDiscoverMsc1929NameArgs = {name: string}; export type CreateApiDiscoverMsc1929NameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Check a server's MSC1929 support file * * POST /discover/msc1929/{name} */ export const createApiDiscoverMsc1929Name = async (args: CreateApiDiscoverMsc1929NameArgs, options: CreateApiDiscoverMsc1929NameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/discover/msc1929/${encodeURIComponent(String(args.name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };