import { type RawMessageItem, type GetUpdatesResp, type GetUploadUrlResp, type GetConfigResp, type QrCodeResponse, type QrStatusResponse } from './types.js'; export declare class ApiError extends Error { readonly status: number; readonly code?: number; constructor(message: string, options: { status: number; code?: number; }); } export declare function isSessionExpired(error: unknown): boolean; export declare function fetchQrCode(baseUrl: string): Promise; export declare function pollQrStatus(baseUrl: string, qrcode: string): Promise; export declare function getUpdates(baseUrl: string, token: string, buf: string, signal?: AbortSignal): Promise; export declare function sendMessage(baseUrl: string, token: string, toUserId: string, contextToken: string, itemList: RawMessageItem[]): Promise; export declare function getConfig(baseUrl: string, token: string, userId: string, contextToken: string): Promise; export declare function sendTyping(baseUrl: string, token: string, userId: string, ticket: string, status: 1 | 2): Promise; /** * Step 1 of upload: get CDN upload URL. * media_type: 1=IMAGE, 2=VIDEO, 3=FILE, 4=VOICE */ export declare function getUploadUrl(baseUrl: string, token: string, opts: { filekey: string; mediaType: 1 | 2 | 3 | 4; toUserId: string; rawSize: number; rawMd5: string; aesKeyHex: string; }): Promise; /** * Step 3 of upload: POST encrypted bytes to CDN. * Returns x-encrypted-param header value (= CDNMedia.encrypt_query_param for download). */ export declare function uploadToCdn(encryptedBytes: Buffer, uploadParam: string, filekey: string): Promise; /** * Download encrypted bytes from CDN. Caller must decrypt with AES-128-ECB. */ export declare function downloadFromCdn(encryptQueryParam: string): Promise; /** * Encrypt + upload a file buffer to WeChat CDN. * Returns { encryptQueryParam, aesKeyHex } for building CDNMedia in sendmessage. */ export declare function uploadMedia(baseUrl: string, token: string, toUserId: string, fileBuffer: Buffer, mediaType: 1 | 2 | 3 | 4, fileName: string): Promise<{ encryptQueryParam: string; aesKeyHex: string; encryptedSize: number; }>; //# sourceMappingURL=weixin-api.d.ts.map