| 1 | export interface TwitterOAuthTokenResponse { |
| 2 | token_type: 'bearer'; |
| 3 | expires_in: number; // typically 7200 seconds (2 hours) |
| 4 | access_token: string; |
| 5 | scope: string; // e.g., "users.read tweet.read offline.access" |
| 6 | refresh_token?: string; // Present if 'offline.access' scope was requested |
| 7 | } |
| 8 | |
| 9 | export interface TwitterUser { |
| 10 | id: string; |
| 11 | name: string; // Display name |
| 12 | username: string; // Handle |
| 13 | profile_image_url?: string; |
| 14 | description?: string; |
| 15 | public_metrics?: { |
| 16 | followers_count: number; |
| 17 | following_count: number; |
| 18 | tweet_count: number; |
| 19 | listed_count: number; |
| 20 | }; |
| 21 | created_at?: string; // ISO 8601 date string |
| 22 | verified?: boolean; |
| 23 | // Add other fields as needed from the Twitter API v2 user object |
| 24 | } |
| 25 | |
| 26 | // For storing in our AccountToken schema |
| 27 | export interface TwitterStoredTokenInfo { |
| 28 | accessToken: string; |
| 29 | refreshToken?: string; |
| 30 | expiresAt: Date; |
| 31 | scopes: string[]; |
| 32 | } |