import { Network } from "../utils/Network"; import { Attachment } from "../types/Attachment"; /** * Moment 瞬间 API * * 管理临时照片/视频上传、归档到日记等操作 */ export class MomentApi { /** * 获取 moment 列表 */ static getList(): Promise { return Network.post("/journal/moment/list"); } /** * MD5 查重过滤 * * @param md5s - MD5 值数组 * @returns 未重复的 MD5 数组 */ static filterByMD5(md5s: string[]): Promise { return Network.post("/journal/moment/filter", md5s); } /** * 创建 moment 附件 * * @param tempFileIds - 临时文件 ID 数组 * @returns 创建的附件列表 */ static create(tempFileIds: string[]): Promise { return Network.post("/journal/moment/create", tempFileIds, { showLoading: true, loadingText: "正在保存.." }); } /** * 归档 moments 到日记 * * @param data - 归档数据 */ static archive(data: { id?: number; type: string; idea: string; lat?: number; lng?: number; location?: string; pusher: string; thumbIds: number[]; }): Promise { return Network.post("/journal/moment/archive", data, { showLoading: true, loadingText: "正在归档.." }); } /** * 删除 moments * * @param ids - 附件 ID 数组 */ static delete(ids: number[]): Promise { return Network.post("/journal/moment/delete", ids); } }