import { AbstractProvider } from '../abstract'; import type { AuthoredPostPage, ProviderInterface, PublishedPost, PublishPostInput, RemotePostRef, SocialDeletionDriver, SocialIdentityCredentials, SocialPublishingDriver, SocialUser, TimelineQuery, TimelineResult } from '../types'; export declare interface TwitterDriverOptions { apiBase?: string authorizeBase?: string } export declare interface TwitterAuthUrlInput { clientId: string redirectUrl: string scopes: string[] state: string } export declare interface TwitterTokenExchangeInput { clientId: string clientSecret?: string redirectUrl: string code: string codeVerifier: string } export declare interface TwitterRefreshInput { clientId: string clientSecret?: string refreshToken: string } export declare interface TwitterToken { accessToken: string refreshToken?: string expiresIn?: number scope?: string } export declare interface TwitterProfile { id: string username: string name?: string } export declare class TwitterProvider extends AbstractProvider implements ProviderInterface { protected baseUrl: string; protected apiUrl: string; getAuthUrl(): Promise; getAccessToken(code: string): Promise; getUserByToken(token: string): Promise; protected validateConfig(): void; protected getTokenUrl(): string; } /** * Publishing driver for X/Twitter. * * Separate from `TwitterProvider` above, which only signs users in. Auth here * is OAuth 2.0 with PKCE (X's user-context flow); posting is `POST /2/tweets`, * images upload first via `POST /2/media/upload` and attach by media id, and * threads chain through `reply.in_reply_to_tweet_id`. * * Posting on X requires a paid API tier, so this is exercised against mocked * endpoints; the request shapes follow X's documented v2 API. */ export declare class TwitterApiError extends Error { public status: number; public body: string; constructor(message: string, status: number, body: string); get isAuthError(): boolean; } export declare class TwitterPublishingDriver implements SocialPublishingDriver, SocialDeletionDriver { readonly provider: 'twitter'; characterLimit: number; protected apiBase: string; protected authorizeBase: string; constructor(options?: TwitterDriverOptions); createAuthorization(input: TwitterAuthUrlInput): Promise<{ url: string, codeVerifier: string }>; exchangeCode(input: TwitterTokenExchangeInput): Promise; refreshAccessToken(input: TwitterRefreshInput): Promise; getProfile(accessToken: string): Promise; uploadMedia(accessToken: string, bytes: Uint8Array, mimeType: string): Promise; publish(identity: SocialIdentityCredentials, post: PublishPostInput): Promise; timeline(_identity: SocialIdentityCredentials, _query?: TimelineQuery): Promise; listAuthoredPosts(identity: SocialIdentityCredentials, query?: TimelineQuery): Promise; deletePost(identity: SocialIdentityCredentials, ref: RemotePostRef): Promise; protected tokenRequest(body: URLSearchParams, clientId: string, clientSecret?: string): Promise; protected request(url: string, init: RequestInit): Promise; }