export type DocumentSubmission = Record; export type PatchApiFleetifyRoutesRouteIDStepsStepIDArgs = {key: string, body: {mode?: string | undefined, status?: string | undefined, document?: DocumentSubmission | undefined}}; export type PatchApiFleetifyRoutesRouteIDStepsStepIDOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Driver Complete API * * PATCH /fleetify/routes/{routeID}/steps/{stepID} */ export const patchApiFleetifyRoutesRouteIDStepsStepID = async (args: PatchApiFleetifyRoutesRouteIDStepsStepIDArgs, options?: PatchApiFleetifyRoutesRouteIDStepsStepIDOptions) => { const {baseUrl = "https://api.nextbillion.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.key != null) query.append("key", String(args.key)) if (apiKey !== undefined) query.set("key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/fleetify/routes/${encodeURIComponent(String(args.routeID))}/steps/${encodeURIComponent(String(args.stepID))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };