import type { MemobirdConfig, BindUserResponse, PrintResponse, PrintStatusResponse, ConvertImageResponse } from './types/index.js'; /** * Main Memobird SDK client for interacting with the Memobird API * * This class provides a convenient interface for all Memobird operations including * user binding, printing text/images, checking print status, and converting images. * * @example * ```typescript * const client = new MemobirdClient({ * ak: 'your-access-key-from-open.memobird.cn' * }); * * // Bind user to device * const bindResult = await client.bindUser('device-id', 'user-123'); * * // Print text (auto-converts to GBK) * await client.printText('Hello World!', 'device-id', bindResult.showapi_userid!); * ``` */ export declare class MemobirdClient { private config; private httpClient; private retryStrategy; /** * Creates a new MemobirdClient instance * * @param config - SDK configuration options * @param config.ak - Access Key from open.memobird.cn (required) * @param config.baseUrl - Base URL for API (default: 'http://open.memobird.cn/home') * @param config.timeout - Request timeout in ms (default: 30000) * @param config.retry - Retry configuration * @param config.httpOptions - Additional got HTTP client options * * @example * ```typescript * const client = new MemobirdClient({ * ak: 'your-access-key', * timeout: 60000, * retry: { * maxRetries: 5, * initialDelay: 2000 * } * }); * ``` */ constructor(config: MemobirdConfig); /** * Binds a user identifier to a Memobird device * * This creates an association between your user ID and a physical device. * The device ID can be obtained by double-clicking the physical device, * which will print out the device ID. * * @param memobirdID - Device ID from the physical device * @param useridentifying - Your unique user identifier * @returns Promise resolving to binding response with showapi_userid * * @example * ```typescript * const response = await client.bindUser('fb93bfff504c020a', 'user-123'); * console.log('User ID:', response.showapi_userid); * ``` */ bindUser(memobirdID: string, useridentifying: string): Promise; /** * Prints text content to a Memobird device * * Text is automatically converted from UTF-8 to GBK Base64 encoding as required by the API. * Supports Chinese characters and other multi-byte text. * * @param text - Text content to print * @param memobirdID - Device ID * @param userID - User ID from binding response * @returns Promise resolving to print response with printcontentid * * @example * ```typescript * const response = await client.printText( * '你好世界!Hello World!', * 'device-id', * 123 * ); * console.log('Print ID:', response.printcontentid); * ``` */ printText(text: string, memobirdID: string, userID: number): Promise; /** * Prints image content to a Memobird device * * The image must be in monochrome bitmap format. Use {@link convertImageToMonochrome} * to convert JPG/PNG images to the required format first. * * @param base64Image - Monochrome bitmap Base64 string * @param memobirdID - Device ID * @param userID - User ID from binding response * @returns Promise resolving to print response * * @example * ```typescript * // First convert image * const converted = await client.convertImageToMonochrome(jpgBase64); * * // Then print * const response = await client.printImage( * converted.result!, * 'device-id', * 123 * ); * ``` */ printImage(base64Image: string, memobirdID: string, userID: number): Promise; /** * Prints content from a web URL * * Note: This works best with static or server-rendered pages. Pages rendered * with AJAX may not work properly. Images must use complete URLs and CSS should * be inline for best results. * * @param url - URL of the web page to print * @param memobirdID - Device ID * @param userID - User ID from binding response * @returns Promise resolving to print response * * @example * ```typescript * const response = await client.printFromUrl( * 'https://example.com/page', * 'device-id', * 123 * ); * ``` */ printFromUrl(url: string, memobirdID: string, userID: number): Promise; /** * Prints content from HTML source * * The HTML is automatically converted to GBK Base64 and URL encoded. * For best results: * - Use inline CSS (no external stylesheets) * - Use complete URLs for images (not relative paths) * - Keep content size reasonable * * @param html - HTML source code * @param memobirdID - Device ID * @param userID - User ID from binding response * @returns Promise resolving to print response * * @example * ```typescript * const html = ` * * *

Hello World

*

This is a test.

* * * `; * const response = await client.printFromHtml(html, 'device-id', 123); * ``` */ printFromHtml(html: string, memobirdID: string, userID: number): Promise; /** * Gets the print status of a submitted print job * * @param printcontentid - Print content ID from print response (can be string or number) * @returns Promise resolving to print status response * * @example * ```typescript * const printResponse = await client.printText('Hello', 'device-id', 123); * const status = await client.getPrintStatus(printResponse.printcontentid!); * * if (status.printflag === 1) { * console.log('Print completed successfully'); * } else { * console.log('Print pending or failed'); * } * ``` */ getPrintStatus(printcontentid: string | number): Promise; /** * Converts a JPG or PNG image to monochrome bitmap format * * The Memobird printer requires images in monochrome bitmap format. * Use this method to convert standard images before printing. * For best results, images should be 384px wide (the printer paper width). * * @param base64Image - JPG or PNG image as Base64 string * @returns Promise resolving to converted image response with monochrome bitmap * * @example * ```typescript * const jpgBase64 = '...'; // Your JPG image * const response = await client.convertImageToMonochrome(jpgBase64); * const monochromeBase64 = response.result!; * * // Now print the converted image * await client.printImage(monochromeBase64, 'device-id', 123); * ``` */ convertImageToMonochrome(base64Image: string): Promise; } //# sourceMappingURL=client.d.ts.map