export interface LoopTeamKey { teamName: string; apiKey: string; teamAddress: string; agentId: string; permissions: string[]; createdAt: string; updatedAt: string; } export interface TeamResult { teamName: string; data: T[]; } export interface AggregationFailure { teamName: string; reason: string; kind: "timeout" | "other"; } export interface AggregationResult { results: TeamResult[]; failures: AggregationFailure[]; skipped: { teamName: string; reason: string; }[]; totalTeams: number; } /** * Load all LoopTeamKey nodes for an account from Neo4j. */ export declare function loadTeamKeys(accountId: string): Promise; /** * Make a GET request to the Loop API V2. */ export declare function loopGet(apiKey: string, path: string, toolName: string, teamName: string): Promise; /** * Make a POST request to the Loop API V2. * For write operations: create viewings, record feedback, submit enquiries, etc. * Returns parsed JSON response. Treats 204 as success with empty result. */ export declare function loopPost(apiKey: string, path: string, body: unknown, toolName: string, teamName: string): Promise; /** * Make a PUT request to the Loop API V2. * For update operations: batch matching, submit quotes, update preferences, etc. */ export declare function loopPut(apiKey: string, path: string, body: unknown, toolName: string, teamName: string): Promise; export declare class LoopApiError extends Error { readonly status: number; readonly teamName: string; readonly path: string; readonly responseBody?: string | undefined; constructor(status: number, teamName: string, path: string, responseBody?: string | undefined); } /** * Fan out a request across all registered teams for an account, merging results. * * Each tool provides a `buildRequest` function that takes a decrypted API key * and returns the data for that team. The aggregation engine handles: * - Key loading and decryption * - Permission checking * - Concurrent fan-out via Promise.allSettled * - Result merging with teamName tags * - Aggregate logging * * When `teamName` is provided, only that team is queried (no fan-out). */ export declare function aggregateAcrossTeams(accountId: string, endpointGroup: string, toolName: string, buildRequest: (apiKey: string, teamName: string) => Promise, options?: { teamName?: string; limitPerTeam?: number; limitTotal?: number; }): Promise>; /** * Resolve a single team's API key with permission checking. * Handles key loading, decryption, and permission validation. * Used for both reads and writes that target a specific team — no fan-out. */ export declare function withTeamKey(accountId: string, teamName: string, endpointGroup: string, toolName: string, execute: (apiKey: string) => Promise): Promise; /** * Format an aggregation result into a human-readable text response. */ export declare function formatAggregationResult(result: AggregationResult, formatItem: (item: T, teamName: string) => string, entityName: string): string; //# sourceMappingURL=loop-api.d.ts.map