import { z } from "zod"; //#region src/categories.d.ts type CategoryIds = 101 | 102 | 103 | 104 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 499 | 600 | 601 | 602 | 603 | 604 | 605 | 699; declare const AUDIO: { readonly DEFAULT: 100; readonly MUSIC: 101; readonly AUDIO_BOOKS: 102; readonly SOUND_CLIPS: 103; readonly FLAC: 104; readonly OTHER: 199; }; declare const VIDEO: { readonly DEFAULT: 200; readonly MOVIES: 201; readonly MOVIES_DVDR: 202; readonly HD_MOVIES: 207; readonly MUSIC_VIDEOS: 203; readonly MOVIE_CLIPS: 204; readonly TV_SHOWS: 205; readonly HD_TV_SHOWS: 208; readonly HANDHELD: 206; readonly "3D": 209; readonly OTHER: 299; }; declare const APPLICATION: { readonly DEFAULT: 300; readonly WINDOWS: 301; readonly MAC: 302; readonly UNIX: 303; readonly HANDHELD: 304; readonly IOS: 305; readonly ANDROID: 306; readonly OTHER: 399; }; declare const GAMES: { readonly DEFAULT: 400; readonly PC: 401; readonly MAC: 402; readonly PSX: 403; readonly XBOX360: 404; readonly WII: 405; readonly HANDHELD: 406; readonly IOS: 407; readonly ANDROID: 408; readonly OTHER: 499; }; declare const OTHER: { readonly DEFAULT: 600; readonly EBOOKS: 601; readonly COMICS: 602; readonly PICTURES: 603; readonly COVERS: 604; readonly PHYSIBLES: 605; readonly OTHER: 699; }; //#endregion //#region src/schema.d.ts declare const torrent: z.ZodObject<{ id: z.ZodCoercedNumber; name: z.ZodString; info_hash: z.ZodString; leechers: z.ZodCoercedNumber; seeders: z.ZodCoercedNumber; num_files: z.ZodCoercedNumber; size: z.ZodCoercedNumber; username: z.ZodString; added: z.ZodPipe, z.ZodTransform>; status: z.ZodString; category: z.ZodCoercedNumber; imdb: z.ZodPipe, z.ZodTransform>; }, z.core.$strip>; declare const torrentDetails: z.ZodObject<{ id: z.ZodCoercedNumber; category: z.ZodCoercedNumber; status: z.ZodString; name: z.ZodString; num_files: z.ZodCoercedNumber; size: z.ZodCoercedNumber; seeders: z.ZodCoercedNumber; leechers: z.ZodCoercedNumber; username: z.ZodString; added: z.ZodPipe, z.ZodTransform>; descr: z.ZodString; imdb: z.ZodPipe, z.ZodTransform>; language: z.ZodOptional>>; textlanguage: z.ZodOptional>; info_hash: z.ZodString; }, z.core.$strip>; type Torrent = z.infer; type TorrentDetails = z.infer; //#endregion //#region src/apibay.d.ts type createApibayOptions = { baseUrl?: string; transform?: boolean; }; type SearchPayload = { q: string; cat?: CategoryIds; }; declare class APIBay { private baseUrl?; private transform?; /** * Create a new instance of the APIBay class with optional configuration. * * @param options An optional object containing configuration options for the APIBay instance. * - `baseUrl`: A custom base URL for the API (default is "https://apibay.org"). * - `transform`: A boolean indicating whether to validate and transform API responses using Zod schemas (default is false). */ constructor(options?: createApibayOptions); /** * Get the current base URL used for API requests. * This is the URL that the API wrapper will send requests to when fetching data from apibay.org. * * @returns The current base URL as a string. * @default "https://apibay.org" */ getBaseUrl(): string | undefined; /** * Set a custom base URL for the API. Useful if you want to use a proxy or mirror of apibay.org. * * Note: The default base URL is "https://apibay.org". * * @param baseUrl The new base URL to use for API requests. */ setBaseUrl(baseUrl: string): void; /** * Get the top 100 torrents for a specific category. * * @param category The category to fetch top 100 torrents for. Can be a specific category ID, "all" for all categories, or "recent" for recently added torrents. * @returns A promise that resolves to an array of Torrent objects. */ getTop100(category: CategoryIds | "all" | "recent"): Promise; /** * Get the top 100 recently added torrents. * * @returns A promise that resolves to an array of Torrent objects representing the most recently added torrents. */ getRecent(): Promise<{ id: number; name: string; info_hash: string; leechers: number; seeders: number; num_files: number; size: number; username: string; added: Date; status: string; category: number; imdb: string | null; }[]>; /** * Get detailed information about a specific torrent by its ID. * * @param id The ID of the torrent to fetch details for. * @returns A promise that resolves to a TorrentDetails object containing detailed information about the specified torrent. */ getDetails(id: number): Promise; /** * Get torrents uploaded by a specific user, with optional pagination. * * @param username The username of the uploader whose torrents you want to fetch. * @param page The page number for pagination (default is 0). Each page contains a set number of torrents. * @returns A promise that resolves to an array of Torrent objects uploaded by the specified user. */ getByUser(username: string, page?: number): Promise<{ id: number; name: string; info_hash: string; leechers: number; seeders: number; num_files: number; size: number; username: string; added: Date; status: string; category: number; imdb: string | null; }[]>; /** * Search for torrents based on a query string and optional category filter. * * @param payload An object containing the search query and optional category filter. * The `q` property is the search query string, and the `cat` property is an optional category ID to filter results by. * @returns A promise that resolves to an array of Torrent objects matching the search criteria. */ search(payload: SearchPayload): Promise<{ id: number; name: string; info_hash: string; leechers: number; seeders: number; num_files: number; size: number; username: string; added: Date; status: string; category: number; imdb: string | null; }[]>; /** * Make a request to the API with the specified endpoint and query parameters. * This method handles constructing the full URL, making the HTTP request, and parsing the JSON response. * It also includes error handling for network issues and non-OK HTTP responses. * * @param endpoint The API endpoint to request (e.g., "/precompiled/data_top100_all.json"). * @param params An optional object containing query parameters to include in the request URL. * @returns A promise that resolves to the parsed JSON response from the API, typed as T. */ request(endpoint: string, params?: Record): Promise; /** * Validate the received data against a Zod schema. * If the data does not match the expected format, an error is thrown with details about the validation failure. * * @param schema The Zod schema to validate the data against. * @param data The data to validate. * @returns The validated data, typed as the inferred type of the provided Zod schema. */ private validate; } //#endregion //#region src/index.d.ts declare const createApiBay: (options?: createApibayOptions | undefined) => APIBay; //#endregion export { APIBay, APPLICATION, AUDIO, type CategoryIds, GAMES, OTHER, type SearchPayload, type Torrent, type TorrentDetails, VIDEO, createApiBay, torrent, torrentDetails };