p4u-client-ai
Version:
Empower Your Apps with AI: Access Multiple Models, Automate Tasks, Create AI Agents Easily
40 lines • 1.66 kB
TypeScript
import { AxiosResponse } from 'axios';
import { IRequest } from './interfaces/request.interface';
import { IInsert } from './interfaces/insert.interface';
import { IDelete } from './interfaces/delete.interface';
/**
* AIClient class for interacting with the API at https://app.apihub4ai.com/doc
* Manages user authentication, task operations requests.
*/
export default class AIClient {
private headers;
private apiUrl;
private debugUrl;
constructor();
/**
* Asynchronous method to log in with the provided username and password.
*
* @param userName The username of the user.
* @param password The password of the user.
* @returns A Promise that resolves with void.
* @throws Error if the login request fails with a status other than 200.
*/
login(userName: string, password: string): Promise<void>;
/**
* Asynchronous method to make a request to a specified endpoint with optional data.
*
* @param method The HTTP method for the request.
* @param endpoint The endpoint to send the request to.
* @param data Optional data to be sent with the request.
* @returns A Promise that resolves with the AxiosResponse containing the response data.
* @throws Error if the request fails.
*/
private makeRequest;
pingPong(): Promise<AxiosResponse<any>>;
listTasks(): Promise<AxiosResponse<any>>;
runTask(request: IRequest): Promise<AxiosResponse<any>>;
deleteTask(request: IDelete): Promise<AxiosResponse<any>>;
createTask(request: IInsert): Promise<AxiosResponse<any>>;
setLocalUrl(url: string): void;
}
//# sourceMappingURL=index.d.ts.map