export type GetApiAccountHistoryWsArgs = {timeout?: number | undefined, event_types?: (Array<'channel_created' | 'channel_updated' | 'channel_deleted' | 'mirror_registered' | 'mirror_deleted' | 'mirroring_completed' | 'mirroring_failed' | 'artifact_registered' | 'artifact_removed' | 'artifact_copied' | 'artifact_generated' | 'artifact_metadata_updated' | 'artifact_downloaded'>) | undefined}; export type GetApiAccountHistoryWsOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /account/history/ws */ export const getApiAccountHistoryWs = async (args: GetApiAccountHistoryWsArgs, options?: GetApiAccountHistoryWsOptions) => { const {baseUrl = "https://api.anaconda.cloud/api", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.timeout != null) query.append("timeout", String(args.timeout)) for (const item of args.event_types ?? []) query.append("event_types", String(item)) if (jwt !== undefined) headers.set('authorization', `Bearer ${jwt}`) const url = `${baseUrl.replace(/\/+$/, '')}/account/history/ws${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };