export type PositionPointModel = {Longitude?: number | undefined, Latitude?: number | undefined}; export type Place2EditModel = {Name: string, VehicleIds: Array, Radius: number, PositionPoint: PositionPointModel, Description?: string | undefined, TripType?: (0 | 1 | 2 | 3) | undefined, TripTypeTrigger?: (0 | 1 | 2 | 3) | undefined, DrivesBetweenAnotherPlaceId?: number | undefined}; export type UpdateApiV1ResourceownerPlace2PlaceIdArgs = {placeId: number, body: Place2EditModel}; export type UpdateApiV1ResourceownerPlace2PlaceIdOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates the given place with new model * * PUT /v1/resourceowner/place2/{placeId} */ export const updateApiV1ResourceownerPlace2PlaceId = async (args: UpdateApiV1ResourceownerPlace2PlaceIdArgs, options: UpdateApiV1ResourceownerPlace2PlaceIdOptions) => { 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/place2/${encodeURIComponent(String(args.placeId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };