import { Category } from '../../api/category/Category.js'; import { Leaderboard } from '../../api/leaderboard/Leaderboard.js'; import { ProfileUser } from '../../api/profileUser/ProfileUser.js'; import { Queue } from '../../api/queue/Queue.js'; import { SessionUser } from '../../api/sessionUser/SessionUser.js'; import { TtsModel } from '../../api/ttsModel/TtsModel.js'; import { TtsResult } from '../../api/ttsResult/TtsResult.js'; import { V2vModel } from '../../api/v2vModel/V2vModel.js'; import { Cache } from '../cache/Cache.js'; import { Rest } from '../rest/Rest.js'; import { type CacheKey, type ClientOptions } from './types.js'; /** * The FakeYou API client. This is the main entry point for the library. * It provides methods to fetch data from the FakeYou API. * * @example ```ts * import { Client } from 'fakeyou.ts'; * * const client = new Client(); * * // Optional * await client.login({ * username: 'username', * password: 'password' * }); * ``` */ export declare class Client { constructor(options?: ClientOptions); readonly rest: Rest; readonly cache: Cache; /** * Login in with your provided credentials to take advantage of any potential premium benefits. * * This uses session cookies to authenticate you. * * API token authentication is not supported due to the lack of support for it in the API and it not being available to the public. * If you work for FakeYou and can provide a token to test with and want help add support for it, please get in touch. * * @param credentials Your credentials to login with. Email is supported. * @rejects {AuthorisationError} If the credentials are invalid. */ login(credentials: { username: string; password: string; }): Promise; /** * Logout of your account. Permanently invalidates the session cookie. * Use `client.login()` to create a new session. * * @returns Whether the logout was successful. */ logout(): Promise; /** * Fetch all available TTS models. * * This method will return all models available on the website. * * @returns A map of all available models with their token as the key. */ fetchTtsModels(): Promise>; /** * Fetch a single TTS model by its token. * * @param token The token of the model to fetch. You can find this in the URL of the model page. * @returns The model. */ fetchTtsModelByToken(token: string): Promise; /** * Fetch all models created by a user. * * @param username The username of the user, this is not the display name and is case sensitive. * @returns An array of all models created by the user. Empty array if no models were found. */ fetchTtsModelsByUser(username: string): Promise; /** * Fetch a model by its display name. Case insensitive. * * This method will return the first model that contains the search string in its title. * This may not return the right model you are after if there are multiple models with the same substring, * so it is recommended to use `fetchTtsModelByToken` if you know the token of the model. * * @param search The search string (case insensitive). * @returns The model or undefined if no model was found. */ fetchTtsModelByName(search: string): Promise; /** * Fetch all available voice conversion models. * * This method will return all models available on the website. * * @returns A map of all available models with their token as the key. */ fetchV2vModels(): Promise>; /** * Fetch a voice conversion model by its token. This is tricker to locate, as it is not displayed in the UI or in the URL. * You can find the token by inspecting the network requests on the FakeYou website or by using fetchV2vModelByName and making note of the token. * * @param token The token of the model to fetch. * @returns The voice conversion model. */ fetchV2vModelByToken(token: string): Promise; /** * Fetch a voice conversion model by its display name. Case insensitive. * This method will return the first model that contains the search string in its title. * This may not return the right model you are after if there are multiple models with the same substring, * so it is recommended to use `fetchV2vModelByToken` if you know the token of the model. * * @param search The search string (case insensitive) * @returns The model or undefined if no model was found */ fetchV2vModelByName(search: string): Promise; /** * Fetch all voice-to-voice models created by a user's username. * * @param username The username of the user * @returns An array of all models created by the user */ fetchV2vModelsByUser(username: string): Promise; /** * Fetch the currently logged in user logged in via the login method. * * @returns The logged in user. Undefined if no user is logged in. */ fetchLoggedInUser(): Promise; /** * Fetch the TTS and W2L leaderboards. * * @returns The leaderboards. */ fetchLeaderboard(): Promise; /** * Fetch a user profile by their username. * * @param username The username of the user to fetch. This is not the display name and is case sensitive. * @returns The user profile, or undefined if the user does not exist. */ fetchUserProfile(username: string): Promise; /** * Fetch the current FakeYou TTS queue and other related information. * * This is the number of jobs that are currently waiting to be processed by the FakeYou TTS engine. * * The result is cached for 15 seconds. * * @returns The queue. */ fetchQueue(): Promise; /** * Fetch all available categories which hold TTS models and child categories. * * @returns A list of all available categories including their child categories. */ fetchCategories(): Promise; /** * Fetch all root categories which hold TTS models and child categories. * Root categories are categories which have no parent category. * * @returns A list of all root categories. */ fetchRootCategories(): Promise; /** * Fetch all category to model relationships. * This is used to determine which models belong to which categories. * * @returns An object where the key is the category token and the value is an array of model tokens. */ fetchCategoryToModelRelationships(): Promise>; /** * Fetch a category by its token. Categories are used to group TTS models together. * NOTE: Voice conversion models are not grouped into categories so this method will not return any voice conversion model categories. * * @param token The token of the category to fetch. * @returns The category or undefined if no category was found. */ fetchCategoryByToken(token: string): Promise; /** * Fetch an isolated TTS result by a result token. * The result token can be found in the object returned from an inference, or on the website! * * @param token The token of the result to fetch. * @returns The TTS result or undefined if no result was found. */ fetchTtsResultByToken(token: string): Promise; }