toast-pos-sdk
Version:
Node.js SDK for Toast POS API
48 lines • 1.32 kB
TypeScript
/**
* Configuration for obtaining an authentication token
*/
export interface AuthConfig {
/** The Toast API host URL */
host: string;
/** Client ID for Toast API authentication */
clientId: string;
/** Client secret for Toast API authentication */
clientSecret: string;
}
/**
* Response structure for token requests
*/
export interface TokenResponse {
'@class': string;
token: {
tokenType: string;
scope: string | null;
expiresIn: number;
accessToken: string;
idToken: string | null;
refreshToken: string | null;
};
status: string;
}
/**
* Utility class for handling Toast API authentication
*/
export declare class ToastAuth {
private config;
constructor(config: AuthConfig);
/**
* Obtain an access token using Toast API authentication
*/
getAccessToken(): Promise<string>;
/**
* Create a configured ToastAuth instance
*/
static create(config: AuthConfig): ToastAuth;
}
/**
* Convenience function to quickly get an access token
*
* Try not to call this directly from the client because it will expose your client secret to the browser. Call it from a server.
*/
export declare function getToastToken(config: AuthConfig): Promise<string>;
//# sourceMappingURL=auth.d.ts.map