export type DeleteApiConnectionConnectionSlugConnectArgs = {profile: string}; export type DeleteApiConnectionConnectionSlugConnectOptions = {baseUrl?: string | undefined, BearerProfile?: string | undefined, fetch?: typeof fetch | undefined}; /** * Disconnect Wearable * * DELETE /connection/{connection_slug}/connect/ */ export const deleteApiConnectionConnectionSlugConnect = async (args: DeleteApiConnectionConnectionSlugConnectArgs, options?: DeleteApiConnectionConnectionSlugConnectOptions) => { const {baseUrl = "https://api.wefitter.com/api/v1", fetch: fetchFn = fetch, BearerProfile} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.profile != null) query.append("profile", String(args.profile)) if (BearerProfile !== undefined) headers.set("Authorization", BearerProfile) const url = `${baseUrl.replace(/\/+$/, '')}/connection/${encodeURIComponent(String(args.connection_slug))}/connect/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };