scrapebadger 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internal/exceptions.ts","../src/internal/client.ts","../src/internal/config.ts","../src/internal/pagination.ts","../src/twitter/tweets.ts","../src/twitter/users.ts","../src/twitter/lists.ts","../src/twitter/communities.ts","../src/twitter/trends.ts","../src/twitter/geo.ts","../src/twitter/client.ts","../src/client.ts"],"names":[],"mappings":";;;AAOO,IAAM,iBAAA,GAAN,MAAM,kBAAA,SAA0B,KAAA,CAAM;AAAA,EAC3C,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AACZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,kBAAA,CAAkB,SAAS,CAAA;AAAA,EACzD;AACF;AAKO,IAAM,mBAAA,GAAN,MAAM,oBAAA,SAA4B,iBAAA,CAAkB;AAAA,EACzD,WAAA,CAAY,UAAU,4CAAA,EAA8C;AAClE,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,qBAAA;AACZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,oBAAA,CAAoB,SAAS,CAAA;AAAA,EAC3D;AACF;AAKO,IAAM,cAAA,GAAN,MAAM,eAAA,SAAuB,iBAAA,CAAkB;AAAA;AAAA,EAE3C,UAAA;AAAA;AAAA,EAEA,KAAA;AAAA;AAAA,EAEA,SAAA;AAAA,EAET,WAAA,CACE,OAAA,GAAU,sBAAA,EACV,OAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AACZ,IAAA,IAAA,CAAK,aAAa,OAAA,EAAS,UAAA;AAC3B,IAAA,IAAA,CAAK,QAAQ,OAAA,EAAS,KAAA;AACtB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,MAAmB;AAAA,EACP,UAAA;AAAA;AAAA,EAGR,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2BT,WAAA,CAAY,MAAA,GAAsC,EAAC,EAAG;AAEpD,IAAA,MAAM,MAAA,GAAS,MAAA,CAAO,MAAA,IAAU,gBAAA,EAAiB;AAEjD,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AAEA,IAAA,MAAM,iBAAiB,aAAA,CAAc,EAAE,GAAG,MAAA,EAAQ,QAAQ,CAAA;AAC1D,IAAA,IAAA,CAAK,UAAA,GAAa,IAAI,UAAA,CAAW,cAAc,CAAA;AAG/C,IAAA,IAAA,CAAK,OAAA,GAAU,IAAI,aAAA,CAAc,IAAA,CAAK,UAAU,CAAA;AAAA,EAClD;AACF","file":"index.js","sourcesContent":["/**\n * Custom exceptions for the ScrapeBadger SDK.\n */\n\n/**\n * Base error class for all ScrapeBadger errors.\n */\nexport class ScrapeBadgerError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ScrapeBadgerError\";\n Object.setPrototypeOf(this, ScrapeBadgerError.prototype);\n }\n}\n\n/**\n * Raised when authentication fails (invalid or missing API key).\n */\nexport class AuthenticationError extends ScrapeBadgerError {\n constructor(message = \"Authentication failed. Check your API key.\") {\n super(message);\n this.name = \"AuthenticationError\";\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n/**\n * Raised when rate limit is exceeded.\n */\nexport class RateLimitError extends ScrapeBadgerError {\n /** Unix timestamp when the rate limit resets */\n readonly retryAfter: number | undefined;\n /** Maximum requests per minute for this tier */\n readonly limit: number | undefined;\n /** Remaining requests in the current window */\n readonly remaining: number | undefined;\n\n constructor(\n message = \"Rate limit exceeded.\",\n options?: { retryAfter?: number; limit?: number; remaining?: number }\n ) {\n super(message);\n this.name = \"RateLimitError\";\n this.retryAfter = options?.retryAfter;\n this.limit = options?.limit;\n this.remaining = options?.remaining;\n Object.setPrototypeOf(this, RateLimitError.prototype);\n }\n}\n\n/**\n * Raised when the requested resource is not found.\n */\nexport class NotFoundError extends ScrapeBadgerError {\n /** The resource type that was not found */\n readonly resourceType: string | undefined;\n /** The resource ID that was not found */\n readonly resourceId: string | undefined;\n\n constructor(message = \"Resource not found.\", resourceType?: string, resourceId?: string) {\n super(message);\n this.name = \"NotFoundError\";\n this.resourceType = resourceType;\n this.resourceId = resourceId;\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n\n/**\n * Raised when the request is invalid.\n */\nexport class ValidationError extends ScrapeBadgerError {\n /** Validation errors by field */\n readonly errors: Record<string, string[]> | undefined;\n\n constructor(message = \"Validation error.\", errors?: Record<string, string[]>) {\n super(message);\n this.name = \"ValidationError\";\n this.errors = errors;\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\n/**\n * Raised when an internal server error occurs.\n */\nexport class ServerError extends ScrapeBadgerError {\n /** HTTP status code */\n readonly statusCode: number;\n\n constructor(message = \"Internal server error.\", statusCode = 500) {\n super(message);\n this.name = \"ServerError\";\n this.statusCode = statusCode;\n Object.setPrototypeOf(this, ServerError.prototype);\n }\n}\n\n/**\n * Raised when the request times out.\n */\nexport class TimeoutError extends ScrapeBadgerError {\n /** Timeout duration in milliseconds */\n readonly timeout: number;\n\n constructor(message = \"Request timed out.\", timeout: number) {\n super(message);\n this.name = \"TimeoutError\";\n this.timeout = timeout;\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\n/**\n * Raised when the account has insufficient credits.\n */\nexport class InsufficientCreditsError extends ScrapeBadgerError {\n /** Current credit balance */\n readonly creditsBalance: number | undefined;\n\n constructor(message = \"Insufficient credits.\", creditsBalance?: number) {\n super(message);\n this.name = \"InsufficientCreditsError\";\n this.creditsBalance = creditsBalance;\n Object.setPrototypeOf(this, InsufficientCreditsError.prototype);\n }\n}\n\n/**\n * Raised when the account is restricted.\n */\nexport class AccountRestrictedError extends ScrapeBadgerError {\n /** Reason for the restriction */\n readonly reason: string | undefined;\n\n constructor(message = \"Account restricted.\", reason?: string) {\n super(message);\n this.name = \"AccountRestrictedError\";\n this.reason = reason;\n Object.setPrototypeOf(this, AccountRestrictedError.prototype);\n }\n}\n","/**\n * Base HTTP client with retry logic and error handling.\n */\n\nimport type { ResolvedConfig } from \"./config.js\";\nimport {\n AuthenticationError,\n RateLimitError,\n NotFoundError,\n ValidationError,\n ServerError,\n TimeoutError,\n InsufficientCreditsError,\n AccountRestrictedError,\n ScrapeBadgerError,\n} from \"./exceptions.js\";\n\nexport interface RequestOptions {\n method?: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\";\n params?: Record<string, string | number | boolean | undefined>;\n body?: unknown;\n headers?: Record<string, string>;\n}\n\ninterface ErrorResponse {\n detail?: string;\n message?: string;\n errors?: Record<string, string[]>;\n limit?: number;\n remaining?: number;\n reset_at?: number;\n reason?: string;\n credits_balance?: number;\n}\n\n/**\n * Base HTTP client for making API requests.\n */\nexport class BaseClient {\n private readonly config: ResolvedConfig;\n\n constructor(config: ResolvedConfig) {\n this.config = config;\n }\n\n /**\n * Make an HTTP request to the API.\n */\n async request<T>(path: string, options: RequestOptions = {}): Promise<T> {\n const { method = \"GET\", params, body, headers = {} } = options;\n\n // Build URL with query parameters\n const url = new URL(path, this.config.baseUrl);\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n // Build headers\n const requestHeaders: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n \"X-API-Key\": this.config.apiKey,\n \"User-Agent\": \"scrapebadger-node/0.1.0\",\n ...headers,\n };\n\n // Build request options\n const fetchOptions: RequestInit = {\n method,\n headers: requestHeaders,\n };\n\n if (body && method !== \"GET\") {\n fetchOptions.body = JSON.stringify(body);\n }\n\n // Execute with retry logic\n return this.executeWithRetry<T>(url.toString(), fetchOptions);\n }\n\n /**\n * Execute request with exponential backoff retry logic.\n */\n private async executeWithRetry<T>(url: string, options: RequestInit): Promise<T> {\n let lastError: Error | undefined;\n\n for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {\n try {\n const response = await this.fetchWithTimeout(url, options);\n return await this.handleResponse<T>(response);\n } catch (error) {\n lastError = error as Error;\n\n // Don't retry on client errors (4xx) except rate limits\n if (error instanceof ScrapeBadgerError && !(error instanceof RateLimitError)) {\n if (\n error instanceof AuthenticationError ||\n error instanceof NotFoundError ||\n error instanceof ValidationError ||\n error instanceof InsufficientCreditsError ||\n error instanceof AccountRestrictedError\n ) {\n throw error;\n }\n }\n\n // Don't retry after exhausting attempts\n if (attempt === this.config.maxRetries) {\n break;\n }\n\n // Calculate delay with exponential backoff\n const delay = this.config.retryDelay * Math.pow(2, attempt);\n\n // For rate limits, use retry-after if available\n if (error instanceof RateLimitError && error.retryAfter) {\n const retryDelay = (error.retryAfter - Date.now() / 1000) * 1000;\n if (retryDelay > 0 && retryDelay < 60000) {\n await this.sleep(retryDelay);\n continue;\n }\n }\n\n await this.sleep(delay);\n }\n }\n\n throw lastError ?? new ScrapeBadgerError(\"Request failed after retries\");\n }\n\n /**\n * Fetch with timeout support.\n */\n private async fetchWithTimeout(url: string, options: RequestInit): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n try {\n const response = await fetch(url, {\n ...options,\n signal: controller.signal,\n });\n return response;\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new TimeoutError(`Request timed out after ${this.config.timeout}ms`, this.config.timeout);\n }\n throw error;\n } finally {\n clearTimeout(timeoutId);\n }\n }\n\n /**\n * Handle HTTP response and convert errors.\n */\n private async handleResponse<T>(response: Response): Promise<T> {\n // Parse response body\n let data: T | ErrorResponse;\n const contentType = response.headers.get(\"content-type\");\n\n if (contentType?.includes(\"application/json\")) {\n data = (await response.json()) as T | ErrorResponse;\n } else {\n const text = await response.text();\n data = { detail: text } as ErrorResponse;\n }\n\n // Handle success\n if (response.ok) {\n return data as T;\n }\n\n // Handle errors\n const errorData = data as ErrorResponse;\n const message = errorData.detail ?? errorData.message ?? \"Request failed\";\n\n switch (response.status) {\n case 401:\n throw new AuthenticationError(message);\n\n case 402:\n throw new InsufficientCreditsError(message, errorData.credits_balance);\n\n case 403:\n if (message.toLowerCase().includes(\"restricted\")) {\n throw new AccountRestrictedError(message, errorData.reason);\n }\n throw new AuthenticationError(message);\n\n case 404:\n throw new NotFoundError(message);\n\n case 422:\n throw new ValidationError(message, errorData.errors);\n\n case 429:\n throw new RateLimitError(message, {\n retryAfter: errorData.reset_at,\n limit: errorData.limit,\n remaining: errorData.remaining,\n });\n\n default:\n if (response.status >= 500) {\n throw new ServerError(message, response.status);\n }\n throw new ScrapeBadgerError(message);\n }\n }\n\n /**\n * Sleep for a given duration.\n */\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n","/**\n * Configuration management for the ScrapeBadger SDK.\n */\n\nexport interface ScrapeBadgerConfig {\n /** API key for authentication */\n apiKey: string;\n /** Base URL for the API (default: https://api.scrapebadger.com) */\n baseUrl?: string;\n /** Request timeout in milliseconds (default: 30000) */\n timeout?: number;\n /** Maximum number of retry attempts (default: 3) */\n maxRetries?: number;\n /** Initial retry delay in milliseconds (default: 1000) */\n retryDelay?: number;\n}\n\nexport interface ResolvedConfig {\n apiKey: string;\n baseUrl: string;\n timeout: number;\n maxRetries: number;\n retryDelay: number;\n}\n\nconst DEFAULT_BASE_URL = \"https://api.scrapebadger.com\";\nconst DEFAULT_TIMEOUT = 30000;\nconst DEFAULT_MAX_RETRIES = 3;\nconst DEFAULT_RETRY_DELAY = 1000;\n\n/**\n * Resolve configuration with defaults.\n */\nexport function resolveConfig(config: ScrapeBadgerConfig): ResolvedConfig {\n if (!config.apiKey) {\n throw new Error(\"API key is required\");\n }\n\n return {\n apiKey: config.apiKey,\n baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,\n timeout: config.timeout ?? DEFAULT_TIMEOUT,\n maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES,\n retryDelay: config.retryDelay ?? DEFAULT_RETRY_DELAY,\n };\n}\n\n/**\n * Load API key from environment variable.\n */\nexport function getApiKeyFromEnv(): string | undefined {\n if (typeof process !== \"undefined\" && process.env) {\n return process.env.SCRAPEBADGER_API_KEY;\n }\n return undefined;\n}\n","/**\n * Pagination utilities for the ScrapeBadger SDK.\n */\n\n/**\n * Response wrapper for paginated API responses.\n */\nexport interface PaginatedResponse<T> {\n /** Array of items in the current page */\n data: T[];\n /** Cursor for the next page, if available */\n nextCursor?: string;\n /** Whether there are more pages available */\n hasMore: boolean;\n}\n\n/**\n * Options for paginated requests.\n */\nexport interface PaginationOptions {\n /** Maximum number of items to fetch per request (default: 20) */\n count?: number;\n /** Cursor for pagination */\n cursor?: string;\n}\n\n/**\n * Options for async iteration.\n */\nexport interface IteratorOptions extends PaginationOptions {\n /** Maximum total number of items to fetch (default: unlimited) */\n maxItems?: number;\n}\n\n/**\n * Create a paginated response from API response data.\n */\nexport function createPaginatedResponse<T>(\n data: T[],\n cursor?: string\n): PaginatedResponse<T> {\n return {\n data,\n nextCursor: cursor,\n hasMore: !!cursor,\n };\n}\n\n/**\n * Async generator for paginating through API results.\n *\n * @param fetchPage - Function to fetch a single page\n * @param options - Pagination options\n * @yields Individual items from each page\n *\n * @example\n * ```typescript\n * // Iterate through all results\n * for await (const tweet of client.twitter.tweets.searchAll(\"query\")) {\n * console.log(tweet.text);\n * }\n *\n * // With max items limit\n * for await (const tweet of client.twitter.tweets.searchAll(\"query\", { maxItems: 100 })) {\n * console.log(tweet.text);\n * }\n * ```\n */\nexport async function* paginate<T>(\n fetchPage: (cursor?: string) => Promise<PaginatedResponse<T>>,\n options: IteratorOptions = {}\n): AsyncGenerator<T, void, undefined> {\n const { maxItems } = options;\n let cursor: string | undefined;\n let totalYielded = 0;\n\n do {\n const response = await fetchPage(cursor);\n\n for (const item of response.data) {\n yield item;\n totalYielded++;\n\n if (maxItems !== undefined && totalYielded >= maxItems) {\n return;\n }\n }\n\n cursor = response.nextCursor;\n } while (cursor);\n}\n\n/**\n * Collect all items from an async generator into an array.\n *\n * @param generator - Async generator to collect from\n * @returns Array of all yielded items\n *\n * @example\n * ```typescript\n * const tweets = await collectAll(client.twitter.tweets.searchAll(\"query\", { maxItems: 100 }));\n * console.log(`Fetched ${tweets.length} tweets`);\n * ```\n */\nexport async function collectAll<T>(generator: AsyncGenerator<T, void, undefined>): Promise<T[]> {\n const items: T[] = [];\n for await (const item of generator) {\n items.push(item);\n }\n return items;\n}\n","/**\n * Twitter Tweets API client.\n *\n * Provides methods for fetching tweets, searching, and getting tweet metadata.\n */\n\nimport type { BaseClient } from \"../internal/client.js\";\nimport type {\n PaginatedResponse,\n PaginationOptions,\n IteratorOptions,\n} from \"../internal/pagination.js\";\nimport { createPaginatedResponse, paginate } from \"../internal/pagination.js\";\nimport type { Tweet, User, QueryType } from \"./types.js\";\n\n/**\n * Client for Twitter tweets endpoints.\n *\n * Provides async methods for fetching individual tweets, searching tweets,\n * and getting tweet engagement data (retweeters, favoriters, replies).\n *\n * @example\n * ```typescript\n * const client = new ScrapeBadger({ apiKey: \"key\" });\n *\n * // Get single tweet\n * const tweet = await client.twitter.tweets.getById(\"1234567890\");\n *\n * // Search tweets\n * const results = await client.twitter.tweets.search(\"python programming\");\n * for (const tweet of results.data) {\n * console.log(tweet.text);\n * }\n *\n * // Iterate through all results\n * for await (const tweet of client.twitter.tweets.searchAll(\"python\")) {\n * console.log(tweet.text);\n * }\n * ```\n */\nexport class TweetsClient {\n private readonly client: BaseClient;\n\n constructor(client: BaseClient) {\n this.client = client;\n }\n\n /**\n * Get a single tweet by ID.\n *\n * @param tweetId - The tweet ID to fetch.\n * @returns The tweet data.\n * @throws NotFoundError - If the tweet doesn't exist.\n * @throws AuthenticationError - If the API key is invalid.\n *\n * @example\n * ```typescript\n * const tweet = await client.twitter.tweets.getById(\"1234567890\");\n * console.log(`@${tweet.username}: ${tweet.text}`);\n * ```\n */\n async getById(tweetId: string): Promise<Tweet> {\n return this.client.request<Tweet>(`/v1/twitter/tweets/tweet/${tweetId}`);\n }\n\n /**\n * Get multiple tweets by their IDs.\n *\n * @param tweetIds - List of tweet IDs to fetch.\n * @returns Paginated response containing the tweets.\n *\n * @example\n * ```typescript\n * const tweets = await client.twitter.tweets.getByIds([\n * \"1234567890\",\n * \"0987654321\"\n * ]);\n * for (const tweet of tweets.data) {\n * console.log(tweet.text);\n * }\n * ```\n */\n async getByIds(tweetIds: string[]): Promise<PaginatedResponse<Tweet>> {\n const tweetsParam = tweetIds.join(\",\");\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n \"/v1/twitter/tweets/\",\n { params: { tweets: tweetsParam } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get replies to a tweet.\n *\n * @param tweetId - The tweet ID to get replies for.\n * @param options - Pagination options.\n * @returns Paginated response containing reply tweets.\n *\n * @example\n * ```typescript\n * const replies = await client.twitter.tweets.getReplies(\"1234567890\");\n * for (const reply of replies.data) {\n * console.log(`@${reply.username}: ${reply.text}`);\n * }\n *\n * // Get next page\n * if (replies.hasMore) {\n * const more = await client.twitter.tweets.getReplies(\"1234567890\", {\n * cursor: replies.nextCursor\n * });\n * }\n * ```\n */\n async getReplies(\n tweetId: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n `/v1/twitter/tweets/tweet/${tweetId}/replies`,\n { params: { cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get users who retweeted a tweet.\n *\n * @param tweetId - The tweet ID to get retweeters for.\n * @param options - Pagination options.\n * @returns Paginated response containing users who retweeted.\n *\n * @example\n * ```typescript\n * const retweeters = await client.twitter.tweets.getRetweeters(\"1234567890\");\n * for (const user of retweeters.data) {\n * console.log(`@${user.username} retweeted`);\n * }\n * ```\n */\n async getRetweeters(\n tweetId: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/tweets/tweet/${tweetId}/retweeters`,\n { params: { cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get users who liked/favorited a tweet.\n *\n * @param tweetId - The tweet ID to get favoriters for.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing users who liked.\n *\n * @example\n * ```typescript\n * const likers = await client.twitter.tweets.getFavoriters(\"1234567890\");\n * console.log(`${likers.data.length} users liked this tweet`);\n * ```\n */\n async getFavoriters(\n tweetId: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/tweets/tweet/${tweetId}/favoriters`,\n { params: { count: options.count ?? 40, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get tweets similar to a given tweet.\n *\n * @param tweetId - The tweet ID to find similar tweets for.\n * @returns Paginated response containing similar tweets.\n *\n * @example\n * ```typescript\n * const similar = await client.twitter.tweets.getSimilar(\"1234567890\");\n * for (const tweet of similar.data) {\n * console.log(`Similar: ${tweet.text.slice(0, 100)}...`);\n * }\n * ```\n */\n async getSimilar(tweetId: string): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n `/v1/twitter/tweets/tweet/${tweetId}/similar`\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Search for tweets.\n *\n * @param query - Search query string. Supports Twitter advanced search operators.\n * @param options - Search options including query type and pagination.\n * @returns Paginated response containing matching tweets.\n *\n * @example\n * ```typescript\n * // Basic search\n * const results = await client.twitter.tweets.search(\"python programming\");\n *\n * // Latest tweets only\n * const latest = await client.twitter.tweets.search(\"python\", {\n * queryType: \"Latest\"\n * });\n *\n * // Advanced search operators\n * const fromUser = await client.twitter.tweets.search(\"from:elonmusk lang:en\");\n * ```\n */\n async search(\n query: string,\n options: PaginationOptions & { queryType?: QueryType } = {}\n ): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n \"/v1/twitter/tweets/advanced_search\",\n {\n params: {\n query,\n query_type: options.queryType ?? \"Top\",\n cursor: options.cursor,\n },\n }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Iterate through all search results with automatic pagination.\n *\n * This is a convenience method that automatically handles pagination,\n * yielding tweets one at a time.\n *\n * @param query - Search query string.\n * @param options - Search and iteration options.\n * @yields Tweet objects matching the search query.\n *\n * @example\n * ```typescript\n * // Get up to 1000 tweets\n * for await (const tweet of client.twitter.tweets.searchAll(\"python\", {\n * maxItems: 1000\n * })) {\n * console.log(tweet.text);\n * }\n *\n * // Collect into an array\n * import { collectAll } from \"scrapebadger\";\n * const tweets = await collectAll(\n * client.twitter.tweets.searchAll(\"python\", { maxItems: 100 })\n * );\n * ```\n */\n async *searchAll(\n query: string,\n options: IteratorOptions & { queryType?: QueryType } = {}\n ): AsyncGenerator<Tweet, void, undefined> {\n const fetchPage = async (cursor?: string) => {\n return this.search(query, { ...options, cursor });\n };\n yield* paginate(fetchPage, options);\n }\n\n /**\n * Get tweets from a user's timeline.\n *\n * @param username - Twitter username (without @).\n * @param options - Pagination options.\n * @returns Paginated response containing the user's tweets.\n *\n * @example\n * ```typescript\n * const tweets = await client.twitter.tweets.getUserTweets(\"elonmusk\");\n * for (const tweet of tweets.data) {\n * console.log(`${tweet.created_at}: ${tweet.text.slice(0, 100)}...`);\n * }\n * ```\n */\n async getUserTweets(\n username: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n `/v1/twitter/users/${username}/latest_tweets`,\n { params: { cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Iterate through all tweets from a user with automatic pagination.\n *\n * @param username - Twitter username (without @).\n * @param options - Iteration options.\n * @yields Tweet objects from the user's timeline.\n *\n * @example\n * ```typescript\n * for await (const tweet of client.twitter.tweets.getUserTweetsAll(\"elonmusk\", {\n * maxItems: 500\n * })) {\n * console.log(tweet.text);\n * }\n * ```\n */\n async *getUserTweetsAll(\n username: string,\n options: IteratorOptions = {}\n ): AsyncGenerator<Tweet, void, undefined> {\n const fetchPage = async (cursor?: string) => {\n return this.getUserTweets(username, { ...options, cursor });\n };\n yield* paginate(fetchPage, options);\n }\n}\n","/**\n * Twitter Users API client.\n *\n * Provides methods for fetching user profiles, followers, following, and related data.\n */\n\nimport type { BaseClient } from \"../internal/client.js\";\nimport type {\n PaginatedResponse,\n PaginationOptions,\n IteratorOptions,\n} from \"../internal/pagination.js\";\nimport { createPaginatedResponse, paginate } from \"../internal/pagination.js\";\nimport type { User, UserAbout, UserIds, Tweet } from \"./types.js\";\n\n/**\n * Client for Twitter users endpoints.\n *\n * Provides async methods for fetching user profiles, followers, following,\n * and other user-related data.\n *\n * @example\n * ```typescript\n * const client = new ScrapeBadger({ apiKey: \"key\" });\n *\n * // Get user profile\n * const user = await client.twitter.users.getByUsername(\"elonmusk\");\n * console.log(`${user.name}: ${user.followers_count.toLocaleString()} followers`);\n *\n * // Get followers\n * const followers = await client.twitter.users.getFollowers(\"elonmusk\");\n *\n * // Iterate through all followers\n * for await (const follower of client.twitter.users.getFollowersAll(\"elonmusk\")) {\n * console.log(follower.username);\n * }\n * ```\n */\nexport class UsersClient {\n private readonly client: BaseClient;\n\n constructor(client: BaseClient) {\n this.client = client;\n }\n\n /**\n * Get a user by their numeric ID.\n *\n * @param userId - The user's numeric ID.\n * @returns The user profile.\n * @throws NotFoundError - If the user doesn't exist.\n *\n * @example\n * ```typescript\n * const user = await client.twitter.users.getById(\"44196397\");\n * console.log(`@${user.username}`);\n * ```\n */\n async getById(userId: string): Promise<User> {\n return this.client.request<User>(`/v1/twitter/users/${userId}/by_id`);\n }\n\n /**\n * Get a user by their username.\n *\n * @param username - The user's username (without @).\n * @returns The user profile.\n * @throws NotFoundError - If the user doesn't exist.\n *\n * @example\n * ```typescript\n * const user = await client.twitter.users.getByUsername(\"elonmusk\");\n * console.log(`${user.name} has ${user.followers_count.toLocaleString()} followers`);\n * ```\n */\n async getByUsername(username: string): Promise<User> {\n return this.client.request<User>(`/v1/twitter/users/${username}/by_username`);\n }\n\n /**\n * Get extended \"About\" information for a user.\n *\n * Returns additional metadata including account location,\n * username change history, and verification details.\n *\n * @param username - The user's username (without @).\n * @returns Extended user information.\n *\n * @example\n * ```typescript\n * const about = await client.twitter.users.getAbout(\"elonmusk\");\n * console.log(`Account based in: ${about.account_based_in}`);\n * console.log(`Username changes: ${about.username_changes}`);\n * ```\n */\n async getAbout(username: string): Promise<UserAbout> {\n return this.client.request<UserAbout>(`/v1/twitter/users/${username}/about`);\n }\n\n /**\n * Get a user's followers.\n *\n * @param username - The user's username (without @).\n * @param options - Pagination options.\n * @returns Paginated response containing follower users.\n *\n * @example\n * ```typescript\n * const followers = await client.twitter.users.getFollowers(\"elonmusk\");\n * for (const user of followers.data) {\n * console.log(`@${user.username}`);\n * }\n *\n * // Get next page\n * if (followers.hasMore) {\n * const more = await client.twitter.users.getFollowers(\"elonmusk\", {\n * cursor: followers.nextCursor\n * });\n * }\n * ```\n */\n async getFollowers(\n username: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/users/${username}/followers`,\n { params: { cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Iterate through all followers with automatic pagination.\n *\n * @param username - The user's username (without @).\n * @param options - Iteration options.\n * @yields User objects for each follower.\n *\n * @example\n * ```typescript\n * for await (const follower of client.twitter.users.getFollowersAll(\"elonmusk\", {\n * maxItems: 1000\n * })) {\n * console.log(follower.username);\n * }\n * ```\n */\n async *getFollowersAll(\n username: string,\n options: IteratorOptions = {}\n ): AsyncGenerator<User, void, undefined> {\n const fetchPage = async (cursor?: string) => {\n return this.getFollowers(username, { ...options, cursor });\n };\n yield* paginate(fetchPage, options);\n }\n\n /**\n * Get users that a user is following.\n *\n * @param username - The user's username (without @).\n * @param options - Pagination options.\n * @returns Paginated response containing followed users.\n *\n * @example\n * ```typescript\n * const following = await client.twitter.users.getFollowing(\"elonmusk\");\n * for (const user of following.data) {\n * console.log(`Follows @${user.username}`);\n * }\n * ```\n */\n async getFollowing(\n username: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/users/${username}/followings`,\n { params: { cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Iterate through all following with automatic pagination.\n *\n * @param username - The user's username (without @).\n * @param options - Iteration options.\n * @yields User objects for each followed account.\n */\n async *getFollowingAll(\n username: string,\n options: IteratorOptions = {}\n ): AsyncGenerator<User, void, undefined> {\n const fetchPage = async (cursor?: string) => {\n return this.getFollowing(username, { ...options, cursor });\n };\n yield* paginate(fetchPage, options);\n }\n\n /**\n * Get a user's most recent followers.\n *\n * @param username - The user's username (without @).\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing recent followers.\n */\n async getLatestFollowers(\n username: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/users/${username}/latest_followers`,\n { params: { count: options.count ?? 200, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get accounts a user most recently followed.\n *\n * @param username - The user's username (without @).\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing recently followed users.\n */\n async getLatestFollowing(\n username: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/users/${username}/latest_following`,\n { params: { count: options.count ?? 200, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get follower IDs for a user.\n *\n * More efficient than getFollowers when you only need IDs.\n *\n * @param username - The user's username (without @).\n * @param options - Pagination options with optional count.\n * @returns UserIds containing list of follower IDs.\n *\n * @example\n * ```typescript\n * const ids = await client.twitter.users.getFollowerIds(\"elonmusk\");\n * console.log(`Found ${ids.ids.length.toLocaleString()} follower IDs`);\n * ```\n */\n async getFollowerIds(\n username: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<UserIds> {\n const response = await this.client.request<{ data?: { ids?: number[]; next_cursor?: string } }>(\n `/v1/twitter/users/${username}/follower_ids`,\n { params: { count: options.count ?? 5000, cursor: options.cursor } }\n );\n return {\n ids: response.data?.ids ?? [],\n next_cursor: response.data?.next_cursor,\n };\n }\n\n /**\n * Get following IDs for a user.\n *\n * More efficient than getFollowing when you only need IDs.\n *\n * @param username - The user's username (without @).\n * @param options - Pagination options with optional count.\n * @returns UserIds containing list of following IDs.\n */\n async getFollowingIds(\n username: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<UserIds> {\n const response = await this.client.request<{ data?: { ids?: number[]; next_cursor?: string } }>(\n `/v1/twitter/users/${username}/following_ids`,\n { params: { count: options.count ?? 5000, cursor: options.cursor } }\n );\n return {\n ids: response.data?.ids ?? [],\n next_cursor: response.data?.next_cursor,\n };\n }\n\n /**\n * Get verified followers for a user.\n *\n * @param userId - The user's numeric ID.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing verified followers.\n */\n async getVerifiedFollowers(\n userId: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/users/${userId}/verified_followers`,\n { params: { count: options.count ?? 20, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get followers that the authenticated user also follows.\n *\n * @param userId - The user's numeric ID.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing mutual connections.\n */\n async getFollowersYouKnow(\n userId: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/users/${userId}/followers_you_know`,\n { params: { count: options.count ?? 20, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get premium accounts that a user subscribes to.\n *\n * @param userId - The user's numeric ID.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing subscribed accounts.\n */\n async getSubscriptions(\n userId: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/users/${userId}/subscriptions`,\n { params: { count: options.count ?? 20, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get a user's highlighted tweets.\n *\n * @param userId - The user's numeric ID.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing highlighted tweets.\n */\n async getHighlights(\n userId: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n `/v1/twitter/users/${userId}/highlights`,\n { params: { count: options.count ?? 20, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Search for users.\n *\n * @param query - Search query string.\n * @param options - Pagination options.\n * @returns Paginated response containing matching users.\n *\n * @example\n * ```typescript\n * const results = await client.twitter.users.search(\"python developer\");\n * for (const user of results.data) {\n * console.log(`@${user.username}: ${user.description}`);\n * }\n * ```\n */\n async search(\n query: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n \"/v1/twitter/users/search_users\",\n { params: { query, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Iterate through all search results with automatic pagination.\n *\n * @param query - Search query string.\n * @param options - Iteration options.\n * @yields User objects matching the search query.\n */\n async *searchAll(\n query: string,\n options: IteratorOptions = {}\n ): AsyncGenerator<User, void, undefined> {\n const fetchPage = async (cursor?: string) => {\n return this.search(query, { ...options, cursor });\n };\n yield* paginate(fetchPage, options);\n }\n}\n","/**\n * Twitter Lists API client.\n *\n * Provides methods for fetching Twitter lists, list members, and list tweets.\n */\n\nimport type { BaseClient } from \"../internal/client.js\";\nimport type {\n PaginatedResponse,\n PaginationOptions,\n IteratorOptions,\n} from \"../internal/pagination.js\";\nimport { createPaginatedResponse, paginate } from \"../internal/pagination.js\";\nimport type { List, Tweet, User } from \"./types.js\";\n\n/**\n * Client for Twitter lists endpoints.\n *\n * Provides async methods for fetching list details, members, subscribers,\n * and tweets from lists.\n *\n * @example\n * ```typescript\n * const client = new ScrapeBadger({ apiKey: \"key\" });\n *\n * // Search for lists\n * const lists = await client.twitter.lists.search(\"tech leaders\");\n *\n * // Get list details\n * const list = await client.twitter.lists.getDetail(\"123456\");\n * console.log(`${list.name}: ${list.member_count} members`);\n *\n * // Get list tweets\n * const tweets = await client.twitter.lists.getTweets(\"123456\");\n * ```\n */\nexport class ListsClient {\n private readonly client: BaseClient;\n\n constructor(client: BaseClient) {\n this.client = client;\n }\n\n /**\n * Get details for a specific list.\n *\n * @param listId - The list ID.\n * @returns The list details.\n * @throws NotFoundError - If the list doesn't exist.\n *\n * @example\n * ```typescript\n * const list = await client.twitter.lists.getDetail(\"123456\");\n * console.log(`${list.name} by @${list.username}`);\n * console.log(`${list.member_count} members, ${list.subscriber_count} subscribers`);\n * ```\n */\n async getDetail(listId: string): Promise<List> {\n return this.client.request<List>(`/v1/twitter/lists/${listId}/detail`);\n }\n\n /**\n * Get tweets from a list's timeline.\n *\n * @param listId - The list ID.\n * @param options - Pagination options.\n * @returns Paginated response containing tweets from list members.\n *\n * @example\n * ```typescript\n * const tweets = await client.twitter.lists.getTweets(\"123456\");\n * for (const tweet of tweets.data) {\n * console.log(`@${tweet.username}: ${tweet.text.slice(0, 100)}...`);\n * }\n * ```\n */\n async getTweets(\n listId: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n `/v1/twitter/lists/${listId}/tweets`,\n { params: { cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Iterate through all list tweets with automatic pagination.\n *\n * @param listId - The list ID.\n * @param options - Iteration options.\n * @yields Tweet objects from the list timeline.\n */\n async *getTweetsAll(\n listId: string,\n options: IteratorOptions = {}\n ): AsyncGenerator<Tweet, void, undefined> {\n const fetchPage = async (cursor?: string) => {\n return this.getTweets(listId, { ...options, cursor });\n };\n yield* paginate(fetchPage, options);\n }\n\n /**\n * Get members of a list.\n *\n * @param listId - The list ID.\n * @param options - Pagination options.\n * @returns Paginated response containing list members.\n *\n * @example\n * ```typescript\n * const members = await client.twitter.lists.getMembers(\"123456\");\n * for (const user of members.data) {\n * console.log(`@${user.username}`);\n * }\n * ```\n */\n async getMembers(\n listId: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/lists/${listId}/members`,\n { params: { cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Iterate through all list members with automatic pagination.\n *\n * @param listId - The list ID.\n * @param options - Iteration options.\n * @yields User objects for each list member.\n */\n async *getMembersAll(\n listId: string,\n options: IteratorOptions = {}\n ): AsyncGenerator<User, void, undefined> {\n const fetchPage = async (cursor?: string) => {\n return this.getMembers(listId, { ...options, cursor });\n };\n yield* paginate(fetchPage, options);\n }\n\n /**\n * Get subscribers of a list.\n *\n * @param listId - The list ID.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing list subscribers.\n */\n async getSubscribers(\n listId: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<User>> {\n const response = await this.client.request<{ data?: User[]; next_cursor?: string }>(\n `/v1/twitter/lists/${listId}/subscribers`,\n { params: { count: options.count ?? 20, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Search for lists.\n *\n * @param query - Search query string.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing matching lists.\n *\n * @example\n * ```typescript\n * const results = await client.twitter.lists.search(\"tech leaders\");\n * for (const list of results.data) {\n * console.log(`${list.name}: ${list.member_count} members`);\n * }\n * ```\n */\n async search(\n query: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<List>> {\n const response = await this.client.request<{ data?: List[]; next_cursor?: string }>(\n \"/v1/twitter/lists/search\",\n { params: { query, count: options.count ?? 20, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get lists owned by the authenticated user.\n *\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing the user's lists.\n */\n async getMyLists(\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<List>> {\n const response = await this.client.request<{ data?: List[]; next_cursor?: string }>(\n \"/v1/twitter/lists/my_lists\",\n { params: { count: options.count ?? 100, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n}\n","/**\n * Twitter Communities API client.\n *\n * Provides methods for fetching Twitter communities, members, and tweets.\n */\n\nimport type { BaseClient } from \"../internal/client.js\";\nimport type {\n PaginatedResponse,\n PaginationOptions,\n IteratorOptions,\n} from \"../internal/pagination.js\";\nimport { createPaginatedResponse, paginate } from \"../internal/pagination.js\";\nimport type { Community, CommunityMember, CommunityTweetType, Tweet, User } from \"./types.js\";\n\n/**\n * Client for Twitter communities endpoints.\n *\n * Provides async methods for fetching community details, members,\n * moderators, and tweets.\n *\n * @example\n * ```typescript\n * const client = new ScrapeBadger({ apiKey: \"key\" });\n *\n * // Search communities\n * const communities = await client.twitter.communities.search(\"python\");\n *\n * // Get community details\n * const community = await client.twitter.communities.getDetail(\"123456\");\n * console.log(`${community.name}: ${community.member_count} members`);\n *\n * // Get community tweets\n * const tweets = await client.twitter.communities.getTweets(\"123456\");\n * ```\n */\nexport class CommunitiesClient {\n private readonly client: BaseClient;\n\n constructor(client: BaseClient) {\n this.client = client;\n }\n\n /**\n * Get details for a specific community.\n *\n * @param communityId - The community ID.\n * @returns The community details including rules and admin info.\n * @throws NotFoundError - If the community doesn't exist.\n *\n * @example\n * ```typescript\n * const community = await client.twitter.communities.getDetail(\"123456\");\n * console.log(`${community.name}`);\n * console.log(`Members: ${community.member_count?.toLocaleString()}`);\n * console.log(`Join policy: ${community.join_policy}`);\n *\n * if (community.rules) {\n * console.log(\"Rules:\");\n * for (const rule of community.rules) {\n * console.log(` - ${rule.name}`);\n * }\n * }\n * ```\n */\n async getDetail(communityId: string): Promise<Community> {\n return this.client.request<Community>(`/v1/twitter/communities/${communityId}`);\n }\n\n /**\n * Get tweets from a community.\n *\n * @param communityId - The community ID.\n * @param options - Options including tweet type, count, and pagination.\n * @returns Paginated response containing community tweets.\n *\n * @example\n * ```typescript\n * // Get top tweets\n * const tweets = await client.twitter.communities.getTweets(\"123456\");\n *\n * // Get latest tweets\n * const latest = await client.twitter.communities.getTweets(\"123456\", {\n * tweetType: \"Latest\"\n * });\n * ```\n */\n async getTweets(\n communityId: string,\n options: PaginationOptions & { tweetType?: CommunityTweetType; count?: number } = {}\n ): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n `/v1/twitter/communities/${communityId}/tweets`,\n {\n params: {\n tweet_type: options.tweetType ?? \"Top\",\n count: options.count ?? 40,\n cursor: options.cursor,\n },\n }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Iterate through all community tweets with automatic pagination.\n *\n * @param communityId - The community ID.\n * @param options - Options including tweet type and iteration limits.\n * @yields Tweet objects from the community.\n */\n async *getTweetsAll(\n communityId: string,\n options: IteratorOptions & { tweetType?: CommunityTweetType } = {}\n ): AsyncGenerator<Tweet, void, undefined> {\n const fetchPage = async (cursor?: string) => {\n return this.getTweets(communityId, { ...options, cursor });\n };\n yield* paginate(fetchPage, options);\n }\n\n /**\n * Get members of a community.\n *\n * @param communityId - The community ID.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing community members.\n *\n * @example\n * ```typescript\n * const members = await client.twitter.communities.getMembers(\"123456\");\n * for (const member of members.data) {\n * console.log(`@${member.user.username} (${member.role})`);\n * }\n * ```\n */\n async getMembers(\n communityId: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<CommunityMember>> {\n const response = await this.client.request<{\n data?: (CommunityMember | User)[];\n next_cursor?: string;\n }>(`/v1/twitter/communities/${communityId}/members`, {\n params: { count: options.count ?? 20, cursor: options.cursor },\n });\n\n // Handle both nested and direct user structures\n const data: CommunityMember[] = (response.data ?? []).map((item) => {\n if (\"user\" in item && item.user) {\n return item as CommunityMember;\n }\n // Wrap User in CommunityMember\n const userItem = item as User & { role?: string; joined_at?: string };\n return {\n user: item as User,\n role: userItem.role,\n joined_at: userItem.joined_at,\n };\n });\n\n return createPaginatedResponse(data, response.next_cursor);\n }\n\n /**\n * Get moderators of a community.\n *\n * @param communityId - The community ID.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing community moderators.\n */\n async getModerators(\n communityId: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<CommunityMember>> {\n const response = await this.client.request<{\n data?: (CommunityMember | User)[];\n next_cursor?: string;\n }>(`/v1/twitter/communities/${communityId}/moderators`, {\n params: { count: options.count ?? 20, cursor: options.cursor },\n });\n\n // Handle both nested and direct user structures\n const data: CommunityMember[] = (response.data ?? []).map((item) => {\n if (\"user\" in item && item.user) {\n return item as CommunityMember;\n }\n // Wrap User in CommunityMember\n const userItem = item as User & { joined_at?: string };\n return {\n user: item as User,\n role: \"moderator\",\n joined_at: userItem.joined_at,\n };\n });\n\n return createPaginatedResponse(data, response.next_cursor);\n }\n\n /**\n * Search for communities.\n *\n * @param query - Search query string.\n * @param options - Pagination options.\n * @returns Paginated response containing matching communities.\n *\n * @example\n * ```typescript\n * const results = await client.twitter.communities.search(\"python developers\");\n * for (const community of results.data) {\n * console.log(`${community.name}: ${community.member_count} members`);\n * }\n * ```\n */\n async search(\n query: string,\n options: PaginationOptions = {}\n ): Promise<PaginatedResponse<Community>> {\n const response = await this.client.request<{ data?: Community[]; next_cursor?: string }>(\n \"/v1/twitter/communities/search\",\n { params: { query, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Search for tweets within a community.\n *\n * @param communityId - The community ID.\n * @param query - Search query string.\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing matching tweets.\n */\n async searchTweets(\n communityId: string,\n query: string,\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n `/v1/twitter/communities/${communityId}/search_tweets`,\n { params: { query, count: options.count ?? 20, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n\n /**\n * Get the community timeline (tweets from communities you're in).\n *\n * @param options - Pagination options with optional count.\n * @returns Paginated response containing community timeline tweets.\n */\n async getTimeline(\n options: PaginationOptions & { count?: number } = {}\n ): Promise<PaginatedResponse<Tweet>> {\n const response = await this.client.request<{ data?: Tweet[]; next_cursor?: string }>(\n \"/v1/twitter/communities/timeline\",\n { params: { count: options.count ?? 20, cursor: options.cursor } }\n );\n return createPaginatedResponse(response.data ?? [], response.next_cursor);\n }\n}\n","/**\n * Twitter Trends API client.\n *\n * Provides methods for fetching trending topics and trend locations.\n */\n\nimport type { BaseClient } from \"../internal/client.js\";\nimport type { PaginatedResponse } from \"../internal/pagination.js\";\nimport { createPaginatedResponse } from \"../internal/pagination.js\";\nimport type { Trend, TrendCategory, Location, PlaceTrends } from \"./types.js\";\n\n/**\n * Client for Twitter trends endpoints.\n *\n * Provides async methods for fetching trending topics, place-specific trends,\n * and available trend locations.\n *\n * @example\n * ```typescript\n * const client = new ScrapeBadger({ apiKey: \"key\" });\n *\n * // Get global trends\n * const trends = await client.twitter.trends.getTrends();\n * for (const trend of trends.data) {\n * console.log(`${trend.name}: ${trend.tweet_count || 'N/A'} tweets`);\n * }\n *\n * // Get trends for a specific location\n * const usTrends = await client.twitter.trends.getPlaceTrends(23424977);\n *\n * // Get available locations\n * const locations = await client.twitter.trends.getAvailableLocations();\n * ```\n */\nexport class TrendsClient {\n private readonly client: BaseClient;\n\n constructor(client: BaseClient) {\n this.client = client;\n }\n\n /**\n * Get trending topics.\n *\n * @param options - Options for filtering trends.\n * @returns Paginated response containing trending topics.\n *\n * @example\n * ```typescript\n * // Get general trending topics\n * const trends = await client.twitter.trends.getTrends();\n *\n * // Get news trends\n * const newsTrends = await client.twitter.trends.getTrends({\n * category: \"news\"\n * });\n *\n * for (const trend of trends.data) {\n * const count = trend.tweet_count?.toLocaleString() || \"N/A\";\n * console.log(`${trend.name}: ${count} tweets`);\n * }\n * ```\n */\n async getTrends(\n options: { category?: TrendCategory; count?: number } = {}\n ): Promise<PaginatedResponse<Trend>> {\n const response = await this.client.request<{ data?: Trend[] }>(\"/v1/twitter/trends/\", {\n params: {\n category: options.category ?? \"trending\",\n count: options.count ?? 20,\n },\n });\n return createPaginatedResponse(response.data ?? []);\n }\n\n /**\n * Get trends for a specific location.\n *\n * @param woeid - Where On Earth ID for the location.\n * Common WOEIDs:\n * - 1: Worldwide\n * - 23424977: United States\n * - 23424975: United Kingdom\n * - 23424856: Japan\n * - 23424829: Germany\n * @returns PlaceTrends containing location info and trends.\n * @throws NotFoundError - If the WOEID is invalid.\n *\n * @example\n * ```typescript\n * // Get US trends\n * const usTrends = await client.twitter.trends.getPlaceTrends(23424977);\n * console.log(`Trends in ${usTrends.name}:`);\n * for (const trend of usTrends.trends) {\n * console.log(` - ${trend.name}`);\n * }\n *\n * // Get worldwide trends\n * const globalTrends = await client.twitter.trends.getPlaceTrends(1);\n * ```\n */\n async getPlaceTrends(woeid: number): Promise<PlaceTrends> {\n return this.client.request<PlaceTrends>(`/v1/twitter/trends/place/${woeid}`);\n }\n\n /**\n * Get all locations where trends are available.\n *\n * @returns Paginated response containing available trend locations.\n *\n * @example\n * ```typescript\n * const locations = await client.twitter.trends.getAvailableLocations();\n *\n * // Filter by country\n * const usLocations = locations.data.filter(\n * loc => loc.country_code === \"US\"\n * );\n * console.log(`Found ${usLocations.length} US locations`);\n *\n * // Get countries only\n * const countries = locations.data.filter(\n * loc => loc.place_type === \"Country\"\n * );\n * ```\n */\n async getAvailableLocations(): Promise<PaginatedResponse<Location>> {\n const response = await this.client.request<{ data?: Location[] }>(\n \"/v1/twitter/trends/locations\"\n );\n return createPaginatedResponse(response.data ?? []);\n }\n}\n","/**\n * Twitter Geo API client.\n *\n * Provides methods for fetching geographic place information.\n */\n\nimport type { BaseClient } from \"../internal/client.js\";\nimport type { PaginatedResponse } from \"../internal/pagination.js\";\nimport { createPaginatedResponse } from \"../internal/pagination.js\";\nimport type { Place } from \"./types.js\";\n\n/**\n * Options for searching places.\n */\nexport interface GeoSearchOptions {\n /** Latitude coordinate */\n lat?: number;\n /** Longitude coordinate */\n long?: number;\n /** Free-form text search query (e.g., \"San Francisco\") */\n query?: string;\n /** IP address for location lookup */\n ip?: string;\n /** Result granularity (\"neighborhood\", \"city\", \"admin\", \"country\") */\n granularity?: string;\n /** Maximum number of results (1-100) */\n maxResults?: number;\n}\n\n/**\n * Client for Twitter geo/places endpoints.\n *\n * Provides async methods for fetching place details and searching\n * for geographic locations.\n *\n * @example\n * ```typescript\n * const client = new ScrapeBadger({ apiKey: \"key\" });\n *\n * // Search for places\n * const places = await client.twitter.geo.search({ query: \"San Francisco\" });\n *\n * // Search by coordinates\n * const nearby = await client.twitter.geo.search({ lat: 37.7749, long: -122.4194 });\n *\n * // Get place details\n * const place = await client.twitter.geo.getDetail(\"5a110d312052166f\");\n * ```\n */\nexport class GeoClient {\n private readonly client: BaseClient;\n\n constructor(client: BaseClient) {\n this.client = client;\n }\n\n /**\n * Get details for a specific place.\n *\n * @param placeId - The Twitter place ID.\n * @returns The place details.\n * @throws NotFoundError - If the place doesn't exist.\n *\n * @example\n * ```typescript\n * const place = await client.twitter.geo.getDetail(\"5a110d312052166f\");\n * console.log(`${place.full_name}`);\n * console.log(`Type: ${place.place_type}`);\n * console.log(`Country: ${place.country}`);\n * ```\n */\n async getDetail(placeId: string): Promise<Place> {\n return this.client.request<Place>(`/v1/twitter/geo/places/${placeId}`);\n }\n\n /**\n * Search for geographic places.\n *\n * At least one of lat/long, query, or ip must be provided.\n *\n * @param options - Search options.\n * @returns Paginated response containing matching places.\n * @throws ValidationError - If no search parameters are provided.\n *\n * @example\n * ```typescript\n * // Search by name\n * const places = await client.twitter.geo.search({ query: \"San Francisco\" });\n * for (const place of places.data) {\n * console.log(`${place.full_name} (${place.place_type})`);\n * }\n *\n * // Search by coordinates\n * const nearby = await client.twitter.geo.search({\n * lat: 37.7749,\n * long: -122.4194,\n * granularity: \"city\"\n * });\n *\n * // Search by IP\n * const ipPlaces = await client.twitter.geo.search({ ip: \"8.8.8.8\" });\n * ```\n */\n async search(options: GeoSearchOptions = {}): Promise<PaginatedResponse<Place>> {\n const response = await this.client.request<{ data?: Place[] }>(\"/v1/twitter/geo/search\", {\n params: {\n lat: options.lat,\n long: options.long,\n query: options.query,\n ip: options.ip,\n granularity: options.granularity,\n max_results: options.maxResults,\n },\n });\n return createPaginatedResponse(response.data ?? []);\n }\n}\n","/**\n * Twitter API client.\n *\n * Provides access to all Twitter API endpoints through specialized sub-clients.\n */\n\nimport type { BaseClient } from \"../internal/client.js\";\nimport { TweetsClient } from \"./tweets.js\";\nimport { UsersClient } from \"./users.js\";\nimport { ListsClient } from \"./lists.js\";\nimport { CommunitiesClient } from \"./communities.js\";\nimport { TrendsClient } from \"./trends.js\";\nimport { GeoClient } from \"./geo.js\";\n\n/**\n * Twitter API client with access to all Twitter endpoints.\n *\n * Provides sub-clients for different resource types:\n * - `tweets` - Tweet operations (get, search, replies, retweeters, etc.)\n * - `users` - User operations (profiles, followers, following, search, etc.)\n * - `lists` - List operations (details, members, tweets, search, etc.)\n * - `communities` - Community operations (details, members, tweets, search, etc.)\n * - `trends` - Trending topics and locations\n * - `geo` - Geographic place information\n *\n * @example\n * ```typescript\n * const client = new ScrapeBadger({ apiKey: \"key\" });\n *\n * // Access tweets\n * const tweet = await client.twitter.tweets.getById(\"1234567890\");\n *\n * // Access users\n * const user = await client.twitter.users.getByUsername(\"elonmusk\");\n *\n * // Access trends\n * const trends = await client.twitter.trends.getTrends();\n *\n * // Search with automatic pagination\n * for await (const tweet of client.twitter.tweets.searchAll(\"python\")) {\n * console.log(tweet.text);\n * }\n * ```\n */\nexport class TwitterClient {\n /** Client for tweet operations */\n readonly tweets: TweetsClient;\n\n /** Client for user operations */\n readonly users: UsersClient;\n\n /** Client for list operations */\n readonly lists: ListsClient;\n\n /** Client for community operations */\n readonly communities: CommunitiesClient;\n\n /** Client for trends operations */\n readonly trends: TrendsClient;\n\n /** Client for geo/places operations */\n readonly geo: GeoClient;\n\n /**\n * Create a new Twitter client.\n *\n * @param client - The base HTTP client for making requests.\n */\n constructor(client: BaseClient) {\n this.tweets = new TweetsClient(client);\n this.users = new UsersClient(client);\n this.lists = new ListsClient(client);\n this.communities = new CommunitiesClient(client);\n this.trends = new TrendsClient(client);\n this.geo = new GeoClient(client);\n }\n}\n","/**\n * Main ScrapeBadger client.\n *\n * This is the primary entry point for the ScrapeBadger SDK.\n */\n\nimport { BaseClient } from \"./internal/client.js\";\nimport {\n type ScrapeBadgerConfig,\n resolveConfig,\n getApiKeyFromEnv,\n} from \"./internal/config.js\";\nimport { TwitterClient } from \"./twitter/client.js\";\n\n/**\n * ScrapeBadger API client.\n *\n * The main client for interacting with the ScrapeBadger API.\n * Provides access to all available scrapers through typed sub-clients.\n *\n * @example\n * ```typescript\n * import { ScrapeBadger } from \"scrapebadger\";\n *\n * // Create client with API key\n * const client = new ScrapeBadger({ apiKey: \"your-api-key\" });\n *\n * // Or use environment variable (SCRAPEBADGER_API_KEY)\n * const client = new ScrapeBadger();\n *\n * // Access Twitter API\n * const tweet = await client.twitter.tweets.getById(\"1234567890\");\n * const user = await client.twitter.users.getByUsername(\"elonmusk\");\n *\n * // Search with automatic pagination\n * for await (const tweet of client.twitter.tweets.searchAll(\"python\")) {\n * console.log(tweet.text);\n * }\n *\n * // Collect all results into an array\n * import { collectAll } from \"scrapebadger\";\n * const tweets = await collectAll(\n * client.twitter.tweets.searchAll(\"python\", { maxItems: 100 })\n * );\n * ```\n */\nexport class ScrapeBadger {\n private readonly baseClient: BaseClient;\n\n /** Twitter API client */\n readonly twitter: TwitterClient;\n\n /**\n * Create a new ScrapeBadger client.\n *\n * @param config - Configuration options. If apiKey is not provided,\n * it will be read from the SCRAPEBADGER_API_KEY environment variable.\n * @throws Error if no API key is provided or found in environment.\n *\n * @example\n * ```typescript\n * // With explicit API key\n * const client = new ScrapeBadger({ apiKey: \"your-api-key\" });\n *\n * // With custom options\n * const client = new ScrapeBadger({\n * apiKey: \"your-api-key\",\n * baseUrl: \"https://custom.api.com\",\n * timeout: 60000,\n * maxRetries: 5\n * });\n *\n * // Using environment variable\n * // Set SCRAPEBADGER_API_KEY=your-api-key\n * const client = new ScrapeBadger();\n * ```\n */\n constructor(config: Partial<ScrapeBadgerConfig> = {}) {\n // Use provided API key or fall back to environment variable\n const apiKey = config.apiKey ?? getApiKeyFromEnv();\n\n if (!apiKey) {\n throw new Error(\n \"API key is required. Pass it in the config or set SCRAPEBADGER_API_KEY environment variable.\"\n );\n }\n\n const resolvedConfig = resolveConfig({ ...config, apiKey });\n this.baseClient = new BaseClient(resolvedConfig);\n\n // Initialize sub-clients\n this.twitter = new TwitterClient(this.baseClient);\n }\n}\n"]}