UNPKG

@persian-caesar/aparat.js

Version:

The aparat website services for npm package.

30 lines (29 loc) 1.22 kB
import { BaseApiUrlTypes } from "../types/enums"; export declare class ApiService { private rateLimit; private lastRequestTime; constructor(); /** * Makes a fetch request to the specified API endpoint with rate limiting. * @param baseURL - The base URL type of the API. * @param endpoint - The specific API endpoint to call. * @param init - Optional fetch initialization parameters. * @returns A promise resolving to the response data of type T. * @throws {APIError} Throws an APIError if the request fails or the response is not OK. */ fetch<T>(baseURL: BaseApiUrlTypes, endpoint: string, init?: RequestInit): Promise<T>; /** * Handles errors by wrapping them in an APIError if necessary. * @param error - The error to handle. * @returns An instance of APIError. */ private handleError; } /** * @copyright * Code by Sobhan-SRZA (mr.sinre) | https://github.com/Sobhan-SRZA * Developed for Persian Caesar | https://github.com/Persian-Caesar | https://dsc.gg/persian-caesar * * If you encounter any issues or need assistance with this code, * please make sure to credit "Persian Caesar" in your documentation or communications. */