export type UpdateApiNewEndpointArgs = {Authorization: string, body: {Name?: string | undefined, id?: number | undefined}}; export type UpdateApiNewEndpointOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /new-endpoint */ export const updateApiNewEndpoint = async (args: UpdateApiNewEndpointArgs, options?: UpdateApiNewEndpointOptions) => { const {baseUrl = "https://api-smartflo.tatateleservices.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/new-endpoint${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 };