export type ModelsGatewayStatus = {ipVersion: string, owner: string, pubKey: string, up: boolean}; export type ModelsBatchGatewayStatus = {status: Array}; export type CreateApiApiStatusGatewayBatchArgs = {body: ModelsBatchGatewayStatus}; export type CreateApiApiStatusGatewayBatchOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Lets the network monitor create a new uptime status for multiple gateways * * POST /api/status/gateway/batch */ export const createApiApiStatusGatewayBatch = async (args: CreateApiApiStatusGatewayBatchArgs, options: CreateApiApiStatusGatewayBatchOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/status/gateway/batch${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 };