export type RoutingOptions = {deleteOutdatedRoutes?: boolean | undefined}; export type Route = {params: {[key: string]: string}, priority?: number | undefined, public: boolean, type: string, validUntil?: number | undefined}; export type RoutingFile = {options?: RoutingOptions | undefined, routes: Array}; export type RoutingFileRequest = {routing: RoutingFile, organizationId?: string | undefined}; export type UpdateApiApiV1RoutingfilesId4nArgs = {id4n: string, body: RoutingFileRequest}; export type UpdateApiApiV1RoutingfilesId4nOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Store routing file * * PUT /api/v1/routingfiles/{id4n} */ export const updateApiApiV1RoutingfilesId4n = async (args: UpdateApiApiV1RoutingfilesId4nArgs, options: UpdateApiApiV1RoutingfilesId4nOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/routingfiles/${encodeURIComponent(String(args.id4n))}${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 };