import { RedditPost, RedditPostParams, RedditPostResponse, RedditReplyParams, RedditReplyResponse, FetchPostsOptions, RedditPostWithComments, RedditNotification as ApiRedditNotification, FetchNotificationsOptions, FetchSubscribedSubredditsOptions, SubscribedSubreddit, RedditComment, RedditCommentThread, SubredditFlair } from "../../types/reddit.js"; import type { RedditConfigData } from "../../types/config.js"; export interface RedditCommentParams { id: string; text: string; sendreplies?: boolean; } export interface RedditCommentResponse { id: string; text: string; permalink: string; } export interface RedditMessageParams { recipient: string; subject: string; content: string; } export interface RedditMessageResponse { id: string; recipient: string; subject: string; body: string; } /** * Main service for interacting with the Reddit API * Implements facade pattern to coordinate between specialized services */ export declare class RedditService { private static instance; private readonly baseUrl; private readonly rateLimitDelay; private initialized; private authService; private postService; private subredditService; private constructor(); static getInstance(): RedditService; /** * Loads configuration from environment variables * @throws {RedditError} if required environment variables are missing */ private loadConfig; /** * Initialize the service and authenticate * @throws {RedditError} if initialization fails */ initialize(): Promise; /** * Fetches posts based on provided options */ fetchPosts(options: FetchPostsOptions): Promise; /** * Creates a new post on Reddit * @throws {RedditError} if post creation fails or validation fails */ createPost(params: RedditPostParams): Promise; /** * Fetches subreddit information and rules */ getSubredditInfo(subreddit: string): Promise; /** * Fetches a single Reddit post by its ID * @param id The ID of the post to fetch * @returns The fetched post with comments */ fetchPostById(id: string): Promise; /** * Fetches user notifications (inbox items) from Reddit * @param options Options for fetching notifications * @returns Array of notifications */ fetchNotifications(options?: FetchNotificationsOptions): Promise; /** * Fetches the list of subreddits the authenticated user is subscribed to * @param options Options for fetching subscribed subreddits * @returns Array of subscribed subreddits */ fetchSubscribedSubreddits(options?: FetchSubscribedSubredditsOptions): Promise; fetchUserInfo(): Promise<{ id: any; name: any; created_utc: any; comment_karma: any; link_karma: any; is_gold: any; is_mod: any; has_verified_email: any; }>; fetchUserPreferences(): Promise<{ enable_notifications: any; show_nsfw: any; default_comment_sort: any; theme: any; language: any; }>; /** * Formats a notification for the config response */ private formatNotification; /** * Formats subreddit info for the config response */ private formatSubredditInfo; /** * Gets the complete Reddit configuration including user info, notifications, * and subscribed subreddits */ getRedditConfig(): Promise; /** * Search Reddit posts */ searchReddit(options: { query: string; subreddit?: string; sort?: "relevance" | "hot" | "new" | "top"; time?: "hour" | "day" | "week" | "month" | "year" | "all"; limit?: number; }): Promise; /** * Fetches a single comment by its ID * @param id The ID of the comment to fetch * @returns The fetched comment */ fetchCommentById(id: string): Promise; /** * Fetches a comment thread (comment with all its replies) * @param id The ID of the post containing the comment * @param id The ID of the comment to fetch * @returns The comment thread with all replies */ fetchCommentThread(parentId: string, id: string): Promise; /** * Sends a reply to a post or comment * @param params Reply parameters including parent ID and text * @throws {RedditError} if reply fails or validation fails */ sendReply(params: RedditReplyParams): Promise; /** * Fetches available post flairs for a subreddit * @param subreddit The subreddit name (without r/ prefix) * @returns Array of available flairs */ getSubredditFlairs(subreddit: string): Promise; sendComment(params: RedditCommentParams): Promise; sendMessage(params: RedditMessageParams): Promise; private checkInitialized; }