export type ConnectivityTestInput = {input?: {[key: string]: Record} | undefined, sink?: string | undefined}; export type CreateApiApiEventQueueConnectivityArgs = {body: ConnectivityTestInput}; export type CreateApiApiEventQueueConnectivityOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Test connectivity for a given queue using a workflow with EVENT task and an EventHandler * * POST /api/event/queue/connectivity */ export const createApiApiEventQueueConnectivity = async (args: CreateApiApiEventQueueConnectivityArgs, options?: CreateApiApiEventQueueConnectivityOptions) => { const {baseUrl = "https://developer.orkescloud.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/event/queue/connectivity${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 res.blob() };