export type GetApiV3ConnectorsConnectorNameUpdateArgs = {userId?: number | undefined, connectorName: 'facebook' | 'fitbit' | 'github' | 'googlecalendar' | 'googlefit' | 'medhelper' | 'mint' | 'moodpanda' | 'moodscope' | 'myfitnesspal' | 'mynetdiary' | 'netatmo' | 'rescuetime' | 'runkeeper' | 'slack' | 'sleepcloud' | 'slice' | 'up' | 'whatpulse' | 'withings' | 'worldweatheronline' | 'foursquare' | 'strava' | 'gmail'}; export type GetApiV3ConnectorsConnectorNameUpdateOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sync with data source * * GET /v3/connectors/{connectorName}/update * * Also accepts auth: curedao_oauth2 */ export const getApiV3ConnectorsConnectorNameUpdate = async (args: GetApiV3ConnectorsConnectorNameUpdateArgs, options?: GetApiV3ConnectorsConnectorNameUpdateOptions) => { const {baseUrl = "https://app.quantimo.do/api", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.userId != null) query.append("userId", String(args.userId)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/connectors/${encodeURIComponent(String(args.connectorName))}/update${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };