UNPKG

@georgemiao/qbit.js

Version:

a qBittorrent library made with typescript

728 lines 23 kB
/// <reference types="node" /> import type { QBittorrent } from "./QBittorrent"; export interface RawBuildInfo { bitness: number; boost: string; libtorrent: string; openssl: string; qt: string; zlib: string; } export declare enum RawScanDirTarget { monitoredFolder = 0, defaultSavePath = 1 } export declare enum RawMaxRatioAction { pause = 0, remove = 1 } export declare enum RawBittorrentProtocol { both = 0, TCP = 1, uTP = 2 } export declare enum RawSchedulerDays { everyDay = 0, everyWeekday = 1, everyWeekend = 2, everyMonday = 3, everyTuesday = 4, everyWednesday = 5, everyThursday = 6, everyFriday = 7, everySaturday = 8, everySunday = 9 } export declare enum RawEncryptionOption { prefer = 0, on = 1, off = 2 } export declare enum RawProxyType { disabled = -1, httpWithouAuthentication = 1, socks5WithoutAuthentication = 2, httpWithAuthentication = 3, socks5WithAuthentication = 4, socks4WithoutAuthentication = 5 } export declare enum RawDynDnsService { DyDNS = 0, NOIP = 1 } export declare enum RawUploadChokingAlgorithm { roundRobin = 0, fastestUpload = 1, antiLeech = 2 } export declare enum RawUploadSlotsBehavior { fixedSlots = 0, uploadRateBased = 1 } export declare enum RawUtpTcpMixedMode { preferTcp = 0, peerProportional = 1 } export interface RawPreference { locale: string; create_subfolder_enabled: boolean; start_paused_enabled: boolean; auto_delete_mode: number; preallocate_all: boolean; incomplete_files_ext: boolean; auto_tmm_enabled: boolean; torrent_changed_tmm_enabled: boolean; save_path_changed_tmm_enabled: boolean; category_changed_tmm_enabled: boolean; save_path: string; temp_path_enabled: boolean; temp_path: string; scan_dirs: Record<string, string | RawScanDirTarget>; export_dir: string; export_dir_fin: string; mail_notification_enabled: boolean; mail_notification_sender: string; mail_notification_email: string; mail_notification_smtp: string; mail_notification_ssl_enabled: boolean; mail_notification_auth_enabled: boolean; mail_notification_username: string; mail_notification_password: string; autorun_enabled: boolean; autorun_program: string; queueing_enabled: boolean; max_active_downloads: number; max_active_torrents: number; max_active_uploads: number; dont_count_slow_torrents: boolean; slow_torrent_dl_rate_threshold: number; slow_torrent_ul_rate_threshold: number; slow_torrent_inactive_timer: number; max_ratio_enabled: boolean; max_ratio: number; max_ratio_act: RawMaxRatioAction; listen_port: number; upnp: boolean; random_port: boolean; dl_limit: number; up_limit: number; max_connec: number; max_connec_per_torrent: number; max_uploads: number; max_uploads_per_torrent: number; stop_tracker_timeout: number; enable_piece_extent_affinity: boolean; bittorrent_protocol: RawBittorrentProtocol; limit_utp_rate: boolean; limit_tcp_overhead: boolean; limit_lan_peers: boolean; alt_dl_limit: number; alt_up_limit: number; scheduler_enabled: boolean; schedule_from_hour: number; schedule_from_min: number; schedule_to_hour: number; schedule_to_min: number; scheduler_days: RawSchedulerDays; dht: boolean; pex: boolean; lsd: boolean; encryption: RawEncryptionOption; anonymous_mode: boolean; proxy_type: RawProxyType; proxy_ip: string; proxy_port: number; proxy_peer_connections: boolean; proxy_auth_enabled: boolean; proxy_username: string; proxy_password: string; proxy_torrents_only: boolean; ip_filter_enabled: boolean; ip_filter_path: string; ip_filter_trackers: boolean; web_ui_domain_list: string; web_ui_address: string; web_ui_port: number; web_ui_upnp: boolean; web_ui_username: string; web_ui_password: string; web_ui_csrf_protection_enabled: boolean; web_ui_clickjacking_protection_enabled: boolean; web_ui_secure_cookie_enabled: boolean; web_ui_max_auth_fail_count: number; web_ui_ban_duration: number; web_ui_session_timeout: number; web_ui_host_header_validation_enabled: boolean; bypass_local_auth: boolean; bypass_auth_subnet_whitelist_enabled: boolean; bypass_auth_subnet_whitelist: string; alternative_webui_enabled: boolean; alternative_webui_path: string; use_https: boolean; ssl_key: string; ssl_cert: string; web_ui_https_key_path: string; web_ui_https_cert_path: string; dyndns_enabled: boolean; dyndns_service: RawDynDnsService; dyndns_username: string; dyndns_password: string; dyndns_domain: string; rss_refresh_interval: number; rss_max_articles_per_feed: number; rss_processing_enabled: boolean; rss_auto_downloading_enabled: boolean; rss_download_repack_proper_episodes: boolean; rss_smart_episode_filters: string; add_trackers_enabled: boolean; add_trackers: string; web_ui_use_custom_http_headers_enabled: boolean; web_ui_custom_http_headers: string; max_seeding_time_enabled: boolean; max_seeding_time: number; announce_ip: string; announce_to_all_tiers: boolean; announce_to_all_trackers: boolean; async_io_threads: number; banned_IPs: string; checking_memory_use: number; current_interface_address: string; current_network_interface: string; disk_cache: number; disk_cache_ttl: number; embedded_tracker_port: number; enable_coalesce_read_write: boolean; enable_embedded_tracker: boolean; enable_multi_connections_from_same_ip: boolean; enable_os_cache: boolean; enable_upload_suggestions: boolean; file_pool_size: number; outgoing_ports_max: number; outgoing_ports_min: number; recheck_completed_torrents: boolean; resolve_peer_countries: boolean; save_resume_data_interval: number; send_buffer_low_watermark: number; send_buffer_watermark: number; send_buffer_watermark_factor: number; socket_backlog_size: number; upload_choking_algorithm: RawUploadChokingAlgorithm; upload_slots_behavior: RawUploadSlotsBehavior; upnp_lease_duration: number; utp_tcp_mixed_mode: RawUtpTcpMixedMode; } export interface RawLogOptions { normal: boolean; info: boolean; warning: boolean; critical: boolean; last_known_id: number; } export declare enum RawLogEntryType { normal = 1, info = 2, warning = 4, critical = 8 } export interface RawLogEntry { id: number; message: string; timestamp: number; type: RawLogEntryType; } export interface RawPeerLogEntry { id: number; ip: string; timestamp: number; blocked: boolean; reason: string; } export declare enum RawTorrentState { error = "error", missingFiles = "missingFiles", uploading = "uploading", pausedUP = "pausedUP", queuedUP = "queuedUP", stalledUP = "stalledUP", checkingUP = "checkingUP", forcedUP = "forcedUP", allocating = "allocating", downloading = "downloading", metaDL = "metaDL", pausedDL = "pausedDL", queuedDL = "queuedDL", stalledDL = "stalledDL", checkingDL = "checkingDL", forcedDL = "forcedDL", checkingResumeData = "checkingResumeData", moving = "moving", unknown = "unknown" } export interface RawTorrent { added_on: number; amount_left: number; auto_tmm: boolean; availability: number; category: string; completed: number; completion_on: number; content_path: string; dl_limit: number; dlspeed: number; download_path: string; downloaded: number; downloaded_session: number; eta: number; f_l_piece_prio: boolean; force_start: boolean; infohash_v1: string; infohash_v2: string; last_activity: number; magnet_uri: string; max_ratio: number; max_seeding_time: number; name: string; num_complete: number; num_incomplete: number; num_leechs: number; num_seeds: number; priority: number; progress: number; ratio: number; ratio_limit: number; save_path: string; seeding_time: number; seeding_time_limit: number; seen_complete: number; seq_dl: boolean; size: number; state: RawTorrentState; super_seeding: boolean; tags: string; time_active: number; total_size: number; tracker: string; trackers_count: number; up_limit: number; uploaded: number; uploaded_session: number; upspeed: number; } export interface RawCategory { name: string; savePath: string; } export declare enum RawConnectionStatus { connected = "connected", firewalled = "firewalled", disconnected = "disconnected" } export interface RawTransferInfo { connection_status: RawConnectionStatus; dht_nodes: number; dl_info_data: number; dl_info_speed: number; dl_rate_limit: number; up_info_data: number; up_info_speed: number; up_rate_limit: number; } export interface RawServerState extends RawTransferInfo { alltime_dl: number; alltime_ul: number; average_time_queue: number; free_space_on_disk: number; global_ration: string; queued_io_jobs: number; queueing: boolean; read_cache_hits: string; read_cache_overload: string; refresh_interval: number; total_buffers_size: number; total_peer_connections: number; total_queued_size: number; total_wasted_session: number; use_alt_speed_limits: boolean; write_cache_overload: string; } export interface RawMainData { rid: number; full_update: boolean; torrents?: Record<string, RawTorrent>; torrents_removed?: string[]; categories?: Record<string, RawCategory>; categories_removed?: string[]; tags?: string[]; tags_removed?: string[]; server_state?: RawServerState; trackers?: Record<string, string[]>; trackers_removed?: string[]; } export declare enum RawConnectionType { uTP = "\u03BCTP", BT = "BT" } export interface RawPeer { client: string; connection: RawConnectionType; country: string; countr_code: string; dl_speed: number; downloaded: number; files: string; flags: string; flags_desc: string; ip: string; port: number; progress: number; relevance: number; up_speed: number; uploaded: number; } export interface RawTorrentPeerData { full_update: boolean; peers: Record<string, RawPeer>; rid: number; show_flags: boolean; } export declare enum RawTorrentListFilter { all = "all", downloading = "downloading", seeding = "seeding", completed = "completed", paused = "paused", active = "active", inactive = "inactive", resumed = "resumed", stalled = "stalled", stalled_uploading = "stalled_uploading", stalled_downloading = "stalled_downloading", errored = "errored" } export declare enum RawTorrentSortKey { added_on = "added_on", amount_left = "amount_left", auto_tmm = "auto_tmm", availability = "availability", category = "category", completed = "completed", completion_on = "completion_on", content_path = "content_path", dl_limit = "dl_limit", dlspeed = "dlspeed", downloaded = "downloaded", downloaded_session = "downloaded_session", eta = "eta", f_l_piece_prio = "f_l_piece_prio", force_start = "force_start", hash = "hash", last_activity = "last_activity", magnet_uri = "magnet_uri", max_ratio = "max_ratio", max_seeding_time = "max_seeding_time", name = "name", num_complete = "num_complete", num_incomplete = "num_incomplete", num_leechs = "num_leechs", num_seeds = "num_seeds", priority = "priority", progress = "progress", ratio = "ratio", ratio_limit = "ratio_limit", save_path = "save_path", seeding_time = "seeding_time", seeding_time_limit = "seeding_time_limit", seen_complete = "seen_complete", seq_dl = "seq_dl", size = "size", state = "state", super_seeding = "super_seeding", tags = "tags", time_active = "time_active", total_size = "total_size", tracker = "tracker", up_limit = "up_limit", uploaded = "uploaded", uploaded_session = "uploaded_session", upspeed = "upspeed" } export interface TorrentListOptions { filter: RawTorrentListFilter; category: string; tag: string; sort: RawTorrentSortKey; reverse: boolean; limit: number; offset: number; hashes: string; } export interface RawTorrentProperties { save_path: string; creation_date: number; piece_size: number; comment: string; download_path: string; infohash_v1: string; infohash_v2: string; total_wasted: number; total_uploaded: number; total_uploaded_session: number; total_downloaded: number; total_downloaded_session: number; up_limit: number; dl_limit: number; time_elapsed: number; seeding_time: number; nb_connections: number; nb_connections_limit: number; share_ratio: number; addition_date: number; completion_date: number; created_by: string; dl_speed_avg: number; dl_speed: number; eta: number; last_seen: number; peers: number; peers_total: number; pieces_have: number; pieces_num: number; reannounce: number; seeds: number; seeds_total: number; total_size: number; up_speed_avg: number; up_speed: number; } export declare enum RawTrackerStatus { disabled = 0, notContacted = 1, working = 2, updating = 3, notWorking = 4 } export interface RawTracker { url: string; status: RawTrackerStatus; tier: number; num_peers: number; num_seeds: number; num_leeches: number; num_downloaded: number; msg: string; } export interface RawWebSeed { url: string; } export declare enum RawTorrentFilePriority { doNotDownload = 0, normal = 1, high = 6, maximal = 7 } export interface RawTorrentFile { index: number; name: string; size: number; progress: number; priority: RawTorrentFilePriority; is_seed: boolean; piece_range: [number, number]; availability: number; } export declare enum RawPieceState { notDownloaded = 0, nowDownloading = 1, alreadyDownloaded = 2 } export interface RawShareLimitsOptions { hashes: string[] | string | "all"; ratioLimit?: number; seedingTimeLimit?: number; } export interface RawRssFeed { uid: string; url: string; } export interface RawRssArticle { date: string; description: string; id: string; isRead: boolean; link: string; title: string; torrentUrl: string; } export interface RawRssFeedWithArticles extends RawRssFeed { hasError: boolean; isLoading: boolean; lastBuildDate: string; title: string; articles: RawRssArticle[]; } export interface RawRssRule { enabled: boolean; mustContain: string; mustNotContain: string; useRegex: boolean; episodeFilter: string; smartFilter: boolean; previouslyMatchedEpisodes: string[]; affectedFeeds: string[]; ignoreDays: number; lastMatch: string; addPaused: boolean | null; assignedCategory: string; savePath: string; } export declare enum RawSearchStatusType { Stopped = "Stopped", Running = "Running" } export interface RawSearchStatus { id: number; status: RawSearchStatusType; total: number; } export interface RawSearchResultOptions { id: number; limit?: number; offset?: number; } export interface RawSearchResult { descrLink: string; fileName: string; fileSize: number; fileUrl: string; nbLeechers: number; nbSeeders: number; siteUrl: string; } export interface RawSearchResults { results: RawSearchResult[]; status: RawSearchStatusType; total: number; } export interface RawSearchPluginCategory { id: string; name: string; } export interface RawSearchPlugin { enabled: boolean; fullName: string; name: string; supportedCategories: RawSearchPluginCategory[]; url: string; version: string; } export interface RawTorrentAddOptions { savepath: string; cookie: string; category: string; tags: string[]; skip_checking: boolean; paused: boolean; root_folder: boolean; rename: string; upLimit: number; dlLimit: number; ratioLimit: number; seedingTimeLimit: number; autoTMM: boolean; sequantialDownload: boolean; firstLastPiecePrio: boolean; } export declare class Api { private qbit; constructor(qbit: QBittorrent); login(username: string, password: string): Promise<string>; logout(): Promise<void>; getApplicationVersion(): Promise<string>; getApiVersion(): Promise<string>; getBuildInfo(): Promise<RawBuildInfo>; shutdown(): Promise<void>; getPreferences(): Promise<RawPreference>; setPreferences(preferences: Partial<RawPreference>): Promise<void>; getDefaultSavePath(): Promise<string>; getLog(opts?: Partial<RawLogOptions>): Promise<RawLogEntry[]>; getPeerLog(last_known_id?: number): Promise<RawPeerLogEntry[]>; getMainData(rid?: number): Promise<RawMainData>; getTorrentPeers(hash: string, rid?: number): Promise<RawTorrentPeerData>; getTransferInfo(): Promise<RawTransferInfo>; isAlternativeSpeedLimitEnabled(): Promise<boolean>; toggleAlternativeSpeedLimit(): Promise<void>; getGlobalDownloadLimit(): Promise<number>; setGlobalDownloadLimit(limit: number): Promise<void>; getGlobalUploadLimit(): Promise<number>; setGlobalUploadLimit(limit: number): Promise<void>; banPeers(peers: string[]): Promise<void>; getTorrents(opts?: Partial<TorrentListOptions>): Promise<RawTorrent[]>; getTorrent(hash: string): Promise<RawTorrentProperties>; getTorrentTrackers(hash: string): Promise<RawTracker[]>; getTorrentWebSeeds(hash: string): Promise<RawWebSeed[]>; getTorrentFiles(hash: string, indexes?: number[]): Promise<RawTorrentFile[]>; getTorrentPieceStates(hash: string): Promise<RawPieceState[]>; getTorrentPieceHashes(hash: string): Promise<string[]>; pauseTorrents(hashes: string[] | string | "all"): Promise<void>; resumeTorrents(hashes: string[] | string | "all"): Promise<void>; deleteTorrents(hashes: string[] | string | "all", deleteFiles?: boolean): Promise<void>; recheckTorrents(hashes: string[] | string | "all"): Promise<void>; reannounceTorrents(hashes: string[] | string | "all"): Promise<void>; addTorrent(torrent: Buffer | string | (Buffer | string)[], opts?: Partial<RawTorrentAddOptions>): Promise<void>; addTorrentTrackers(hash: string, trackers: string[] | string): Promise<void>; editTorrentTrackers(hash: string, origUrl: string, newUrl: string): Promise<void>; removeTorrentTracker(hash: string, trackers: string[] | string): Promise<void>; addTorrentPeers(hashes: string, peers: string[] | string): Promise<void>; increaseTorrentPriority(hashes: string): Promise<void>; decreaseTorrentPriority(hashes: string[] | string | "all"): Promise<void>; setTopPriority(hashes: string[] | string | "all"): Promise<void>; setBottomPriority(hashes: string[] | string | "all"): Promise<void>; setTorrentFilePriority(hash: string, files: number[], priority: RawTorrentFilePriority): Promise<void>; getTorrentDownloadLimit(hashes: string[] | string | "all"): Promise<Record<string, number>>; setTorrentDownloadLimit(hashes: string[] | string | "all", limit: number): Promise<void>; setTorrentShareLimits(opts: RawShareLimitsOptions): Promise<void>; getTorrentUploadLimit(hashes: string[] | string | "all"): Promise<Record<string, number>>; setTorrentUploadLimit(hashes: string[] | string | "all", limit: number): Promise<void>; setTorrentLocation(hashes: string[] | string | "all", location: string): Promise<void>; setTorrentName(hash: string, name: string): Promise<void>; setTorrentCategory(hashes: string[] | string | "all", category: string): Promise<void>; getCategories(): Promise<Record<string, RawCategory>>; createCategory(name: string, savePath?: string): Promise<void>; editCategory(name: string, savePath: string): Promise<void>; removeCategories(names: string[] | string): Promise<void>; addTorrentTags(hashes: string[] | string | "all", tags: string[] | string): Promise<void>; removeTorrentTags(hashes: string[] | string | "all", tags: string[] | string): Promise<void>; getTags(): Promise<string[]>; createTags(names: string[] | string): Promise<void>; deleteTags(names: string[] | string): Promise<void>; setTorrentAutoManagement(hashes: string[] | string | "all", enabled: boolean): Promise<void>; toggleTorrentSequentialDownload(hashes: string[] | string | "all"): Promise<void>; toggleTorrentFirstLastPiecePriority(hashes: string[] | string | "all"): Promise<void>; setTorrentForceStart(hashes: string[] | string | "all", enabled: boolean): Promise<void>; setTorrentSuperSeeding(hashes: string[] | string | "all", enabled: boolean): Promise<void>; renameTorrentFile(hash: string, oldPath: string, newPath: string): Promise<void>; renameTorrentFolder(hash: string, oldPath: string, newPath: string): Promise<void>; addRssFolder(path: string): Promise<void>; addRssFeed(url: string, path?: string): Promise<void>; removeRssItem(path: string): Promise<void>; moveRssItem(itemPath: string, destPath: string): Promise<void>; getRssItems(withdata?: boolean): Promise<Record<string, RawRssFeed | RawRssFeedWithArticles>>; markRssAsRead(itemPath: string, articleId?: string): Promise<void>; refreshRssItem(itemPath: string): Promise<void>; setRssRule(ruleName: string, ruleDef: RawRssRule): Promise<void>; renameRssRule(ruleName: string, newRuleName: string): Promise<void>; removeRssRule(ruleName: string): Promise<void>; getRssRules(): Promise<Record<string, RawRssRule>>; getRssRuleArticles(ruleName: string): Promise<Record<string, string[]>>; startSearch(query: string, plugins: string[] | string | "all" | "enabled", category: string | "all"): Promise<string>; stopSearch(id: string): Promise<void>; getSearchStatus(id?: string): Promise<RawSearchStatus[]>; getSearchResults(opts: RawSearchResultOptions): Promise<RawSearchResults>; deleteSearch(id: string): Promise<void>; getSearchPlugins(): Promise<RawSearchPlugin[]>; installSearchPlugin(sources: string[] | string): Promise<void>; uninstallSearchPlugin(names: string[] | string): Promise<void>; enableSearchPlugin(names: string[] | string, enable: boolean): Promise<void>; updateSearchPlugins(): Promise<void>; } //# sourceMappingURL=Api.d.ts.map