frappe-js-sdk
Version:
TypeScript/JavaScript client for Frappe Framework REST API
24 lines (23 loc) • 1.02 kB
TypeScript
import { AxiosInstance } from 'axios';
import { AuthCredentials, AuthResponse } from './types';
export declare class FrappeAuth {
/** 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');
/** Logs in the user using username and password */
loginWithUsernamePassword(credentials: AuthCredentials): Promise<AuthResponse>;
/** Gets the currently logged in user */
getLoggedInUser(): Promise<string>;
/** Logs the user out */
logout(): Promise<void>;
/** Sends password reset email */
forgetPassword(user: string): Promise<void>;
}