/** * WeCom (企业微信) self-built-app push client — the whole outbound surface is * two HTTP endpoints (push-backend-requirements §9): * * GET /cgi-bin/gettoken?corpid=&corpsecret= → {access_token, expires_in} * POST /cgi-bin/message/send?access_token= → {errcode: 0} * * Zero dependencies: platform `fetch`, injectable for tests. The access token * is cached with a 5-minute expiry margin; errcode 40014/42001 (invalid / * expired token) triggers ONE refresh + ONE send retry — a second failure is * final for that push. Callers are fire-and-forget and only warn. * * With `relay` configured both calls go through that base URL instead (with an * `x-relay-token` header) — a reverse proxy on a static-IP host, so WeCom's * 企业可信IP check (errcode 60020) only ever sees that host's egress IP. */ export interface WeComSender { sendText(content: string): Promise; } /** Minimal fetch surface — the platform fetch satisfies it; tests fake it. */ export interface WeComFetch { (url: string, init?: { method?: string; headers?: Record; body?: string; }): Promise<{ ok: boolean; status: number; json(): Promise; }>; } export declare function createWeComSender(cfg: { corpId: string; agentId: number; secret: string; toUser: string; /** Route both API calls through a static-IP relay (see file header). */ relay?: { url: string; token: string; }; }, fetchImpl?: WeComFetch): WeComSender; /** Truncate to a byte cap without splitting a UTF-8 sequence. */ export declare function truncateUtf8(s: string, maxBytes: number): string; //# sourceMappingURL=wecom.d.ts.map