/** * 平台适配器基类 * 使用模板方法模式定义发布流程骨架 */ import type { IPlatformAdapter, Article, SyncResult, AuthResult, PlatformMeta } from './interface.js'; import type { RuntimeInterface } from '../runtime/index.js'; export declare abstract class BaseAdapter implements IPlatformAdapter { abstract readonly meta: PlatformMeta; protected runtime: RuntimeInterface; abstract init(runtime: RuntimeInterface): Promise; abstract checkAuth(): Promise; abstract publish(article: Article): Promise; /** * 获取 Cookie 配置键名(子类覆盖) */ protected abstract getCookieConfigKey(): string; /** * 构建 Cookie 字符串 */ protected buildCookieString(cookies: Record): string; /** * 加载平台 Cookie */ protected loadCookies(): Promise | null>; /** * 默认的内容转换(子类可覆盖) */ protected transformContent(content: string): string; /** * 默认的通用 HTTP headers */ protected getCommonHeaders(): Record; /** * 通用错误处理 */ protected createErrorResult(error: string, start?: number): SyncResult; /** * 通用成功结果 */ protected createSuccessResult(postId: string, postUrl: string, draftOnly?: boolean, start?: number): SyncResult; }