/** Whether a driver can delete posts through its provider's API. */ export declare function supportsDeletion(driver: unknown): driver is SocialDeletionDriver; /** Whether a driver can walk the connected account's own post history. */ export declare function supportsEnumeration(driver: unknown): driver is Required> & SocialDeletionDriver; /** * Normalized user type that all providers will map their responses to. * This ensures a consistent user structure regardless of the provider used. */ export declare interface SocialUser { id: string nickname: string | null name: string email: string | null emailVerified?: boolean | null avatar: string | null token: string raw?: any } /** * GitHub-specific user type from their API response */ export declare interface GitHubUser { id: number login: string name: string | null avatar_url: string | null [key: string]: any } /** * GitHub-specific email type from their API response */ export declare interface GitHubEmail { email: string primary: boolean verified: boolean } /** * GitHub-specific OAuth token response */ export declare interface GitHubTokenResponse { access_token: string error?: string error_description?: string } export declare interface ProviderInterface { getAuthUrl: () => Promise getAccessToken: (code: string) => Promise getUserByToken: (token: string) => Promise } export declare interface TwitterTokenResponse { access_token: string token_type: string expires_in: number scope: string error?: string error_description?: string } export declare interface TwitterUser { id: string username: string name: string email?: string profile_image_url?: string } /** * Apple-specific token response from https://appleid.apple.com/auth/token */ export declare interface AppleTokenResponse { access_token: string token_type: string expires_in: number refresh_token?: string id_token: string error?: string error_description?: string } /** * Claims Apple places in the id_token. `email_verified` and * `is_private_email` arrive as booleans or the strings 'true'/'false' * depending on the API era. */ export declare interface AppleIdTokenClaims { iss: string aud: string | string[] exp: number iat: number sub: string nonce?: string email?: string email_verified?: boolean | 'true' | 'false' is_private_email?: boolean | 'true' | 'false' [key: string]: any } export declare interface BlueskySessionCredentials { identifier: string password: string } export declare interface BlueskySession { did: string handle: string displayName?: string accessJwt: string refreshJwt: string } export declare interface SocialIdentityCredentials { handle: string did?: string accessToken?: string refreshToken?: string } export declare interface PublishPostInput { text: string scheduledAt?: string langs?: string[] external?: { uri: string title: string description?: string } reply?: { root: { uri: string, cid: string } parent: { uri: string, cid: string } } media?: Array<{ url?: string bytes?: Uint8Array mimeType?: string altText?: string }> facets?: unknown[] } export declare interface PublishedPost { provider: SocialPublishingProvider uri: string cid?: string url?: string } export declare interface TimelineQuery { cursor?: string limit?: number } /** * One post in a timeline, normalized to the same shape by every driver. * * Named rather than left inline in {@link TimelineResult} so a consumer can * type a single item - a mapper, a row renderer, a test fixture - without * restating the ten fields or reaching for `TimelineResult['items'][number]`. * Apps were redeclaring this verbatim because there was nothing to import. */ export declare interface TimelineItem { uri: string authorHandle: string authorName?: string authorAvatar?: string postUrl?: string body: string postedAt: string likeCount: number repostCount: number replyCount: number } export declare interface TimelineResult { cursor?: string items: TimelineItem[] } export declare interface SocialPublishingDriver { provider: SocialPublishingProvider characterLimit: number publish: (identity: SocialIdentityCredentials, post: PublishPostInput) => Promise timeline: (identity: SocialIdentityCredentials, query?: TimelineQuery) => Promise } /** * One post the connected account authored, as returned when walking that * account's own history. `uri` is whatever the provider's delete endpoint * keys on — an AT-URI on Bluesky, a numeric id on X and Mastodon, a URN on * LinkedIn — so it can be handed straight back to `deletePost`. */ export declare interface AuthoredPost { uri: string cid?: string text?: string postedAt?: string url?: string } /** A page of authored posts plus the cursor for the next page, if any. */ export declare interface AuthoredPostPage { cursor?: string posts: AuthoredPost[] } /** * The minimum needed to identify one remote post for deletion. `cid` matters * where the delete key differs from the stored URI — Mastodon records a public * status URL as its URI but deletes by status id. */ export declare interface RemotePostRef { uri: string cid?: string } /** * Deletion capability, kept separate from `SocialPublishingDriver` because * publishing and deleting are independently available: Instagram and Threads * can publish but their APIs cannot delete a feed post at all, and LinkedIn * can delete every post it published while needing an extra partner * permission before it will enumerate history. * * A driver implements what it can. Callers should feature-detect rather than * assume, which `supportsDeletion`/`supportsEnumeration` make cheap. */ export declare interface SocialDeletionDriver { provider: SocialPublishingProvider deletePost: (identity: SocialIdentityCredentials, ref: RemotePostRef) => Promise listAuthoredPosts?: ( identity: SocialIdentityCredentials, query?: TimelineQuery, ) => Promise } export type SocialPublishingProvider = | 'bluesky' | 'twitter' | 'mastodon' | 'facebook' | 'instagram' | 'tiktok' | 'linkedin' | 'threads';