export type UserFtpEntryCreateBodyDto = {ftp: number, source?: ('manual' | 'apple-health' | null) | undefined}; export type CreateApiV1UserFtpEntriesArgs = {body: UserFtpEntryCreateBodyDto}; export type CreateApiV1UserFtpEntriesOptions = {baseUrl: string, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v1/user-ftp-entries */ export const createApiV1UserFtpEntries = async (args: CreateApiV1UserFtpEntriesArgs, options: CreateApiV1UserFtpEntriesOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/user-ftp-entries${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 };