import { Axios, AxiosRequestConfig } from 'axios' declare module 'tsraw' export class TSRAW { private rAxios: Axios constructor(token: string) static init(credentials: TSRAWCredentials): Promise private rq(request: AxiosRequestConfig, raw?: boolean): Promise submit (submission: SubmitArgs): Promise edit (post: EditArgs): Promise sticky (id: string): Promise // Returns 500 (https://redd.it/1h41n06) getSettings (subreddit: string): Promise getMe (): Promise updateSidebar (subreddit: string, description: string): Promise threads (params: ThreadsReq): Promise comments (params: CommentsReq): Promise } export type TSRAWCredentials = { user_agent: string client_id: string client_secret: string password: string username: string } export interface OAuthResp { access_token: string, token_type: string, expires_in: number, scope: string } export interface RedditRes { errors: string[] } export type SubmitArgs = { kind: 'link' | 'self' | 'image' | 'video' | 'videogif' sendreplies: boolean sr: string title: string text?: string url?: string } export type EditArgs = { text: string id: string } export interface SettingsResp extends RedditRes { data: { id: string data: { description: string subreddit_id: string } } } export interface AboutResp { kind: "t2", data: { modhash: string } errors: string[] } export interface SubmitResp extends RedditRes { data: { id: string name: string url: string } } export interface ThreadsReq { limit?: number, sort?: 'new' | 'hot' | 'rising' | 'controversial' | 'top' time?: 'hour' | 'day' | 'week' | 'month' | 'all' subreddit: string after?: string } export interface ThreadsResp { errors: string[] data: { kind: 'Listing' data: { before: null | string after: string dist: number children: Thread[] } } } export interface Thread { kind: string data: { id: string author: string title: string url: string subreddit: string created_utc: number } } export interface CommentsReq { thread_id: string limit?: number, sort?: 'new' | 'best' | 'controversial' | 'top' after?: string } export interface CommentsResp { errors: string[] data: { kind: 'Listing' data: { before: null | string after: string dist: number children: Comment[] } }[] } export interface Comment { kind: string data: { id: string author: string body: string permalink: string subreddit: string subreddit_id: string replies: { data: { children: Comment[] } } } }