export type GetApiV1ResourceownerTripsTripIdAdvancedArgs = {tripId: number}; export type GetApiV1ResourceownerTripsTripIdAdvancedOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the advanced details about the trip including driving events, speeding, idling, speed and rpm data series * * GET /v1/resourceowner/trips/{tripId}/advanced */ export const getApiV1ResourceownerTripsTripIdAdvanced = async (args: GetApiV1ResourceownerTripsTripIdAdvancedArgs, options: GetApiV1ResourceownerTripsTripIdAdvancedOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/resourceowner/trips/${encodeURIComponent(String(args.tripId))}/advanced${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 };