ATlast — you'll never need to find your favorites on another platform again. Find your favs in the ATmosphere.
atproto
at master 86 lines 1.9 kB view raw
1import type { 2 AtprotoSession, 3 BatchSearchResult, 4 BatchFollowResult, 5 SaveResultsResponse, 6 SearchResult, 7} from "../../types"; 8 9/** 10 * API Client Interface 11 * Defines the contract that all API implementations must follow 12 **/ 13export interface IApiClient { 14 // Authentication 15 startOAuth(handle: string): Promise<{ url: string }>; 16 getSession(): Promise<AtprotoSession>; 17 logout(): Promise<void>; 18 19 // Upload History 20 getUploads(): Promise<{ 21 uploads: Array<{ 22 uploadId: string; 23 sourcePlatform: string; 24 createdAt: string; 25 totalUsers: number; 26 matchedUsers: number; 27 unmatchedUsers: number; 28 }>; 29 }>; 30 31 getUploadDetails( 32 uploadId: string, 33 page?: number, 34 pageSize?: number 35 ): Promise<{ 36 results: SearchResult[]; 37 pagination?: { 38 page: number; 39 pageSize: number; 40 totalPages: number; 41 totalUsers: number; 42 hasNextPage: boolean; 43 hasPrevPage: boolean; 44 }; 45 }>; 46 47 getAllUploadDetails(uploadId: string): Promise<{ results: SearchResult[] }>; 48 49 // Search Operations 50 batchSearchActors( 51 usernames: string[], 52 followLexicon?: string 53 ): Promise<{ results: BatchSearchResult[] }>; 54 55 checkFollowStatus( 56 dids: string[], 57 followLexicon: string 58 ): Promise<Record<string, boolean>>; 59 60 // Follow Operations 61 batchFollowUsers( 62 dids: string[], 63 followLexicon: string 64 ): Promise<{ 65 success: boolean; 66 total: number; 67 succeeded: number; 68 failed: number; 69 alreadyFollowing: number; 70 results: BatchFollowResult[]; 71 }>; 72 73 // Save Results 74 saveResults( 75 uploadId: string, 76 sourcePlatform: string, 77 results: SearchResult[] 78 ): Promise<SaveResultsResponse | null>; 79 80 // Cache management 81 cache: { 82 clear: () => void; 83 invalidate: (key: string) => void; 84 invalidatePattern: (pattern: string) => void; 85 }; 86}