export type VehicleCheckInModel = {ContactId?: number | undefined, VehicleId?: number | undefined, DefaultTripType?: (0 | 1 | 2 | 3) | undefined, CheckOutAtUtc?: string | undefined, UserDeviceType?: (0 | 1 | 2) | undefined, UserDeviceToken?: string | undefined}; export type CreateApiV1ResourceownerVehicles2CheckinArgs = {body: VehicleCheckInModel}; export type CreateApiV1ResourceownerVehicles2CheckinOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Check-in to a vehicle * * POST /v1/resourceowner/vehicles2/checkin */ export const createApiV1ResourceownerVehicles2Checkin = async (args: CreateApiV1ResourceownerVehicles2CheckinArgs, options: CreateApiV1ResourceownerVehicles2CheckinOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/resourceowner/vehicles2/checkin${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 };