frappe-js-sdk
Version:
TypeScript/JavaScript client for Frappe Framework REST API
23 lines (22 loc) • 1.08 kB
TypeScript
import { AxiosInstance } from 'axios';
export declare class FrappeCall {
/** URL of the Frappe App instance */
private readonly appURL;
/** Axios instance */
readonly axios: AxiosInstance;
/** Whether to use the token based auth */
readonly useToken: boolean;
/** Token to be used for authentication */
readonly token?: () => string;
/** Type of token to be used for authentication */
readonly tokenType?: 'Bearer' | 'token';
constructor(appURL: string, axios: AxiosInstance, useToken?: boolean, token?: () => string, tokenType?: 'Bearer' | 'token');
/** Makes a GET request to the specified endpoint */
get<T = any>(path: string, params?: Record<string, any>): Promise<T>;
/** Makes a POST request to the specified endpoint */
post<T = any>(path: string, params?: any): Promise<T>;
/** Makes a PUT request to the specified endpoint */
put<T = any>(path: string, params?: any): Promise<T>;
/** Makes a DELETE request to the specified endpoint */
delete<T = any>(path: string, params?: any): Promise<T>;
}