From df5e677ebf336c9d16cb2eeebd037cce6a6bead1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AF=BA=E6=96=AF=E8=B4=B9=E6=8B=89=E5=9B=BE?= <1132505822@qq.com> Date: Sun, 12 Apr 2026 17:38:20 +0800 Subject: [PATCH] feat: extend api_client with style and paper asset APIs --- research_web/js/api_client.js | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/research_web/js/api_client.js b/research_web/js/api_client.js index 295b7aa35..2e4430235 100644 --- a/research_web/js/api_client.js +++ b/research_web/js/api_client.js @@ -68,6 +68,11 @@ export async function createPaper(data) { return res.json(); } +export async function getPaper(paperId) { + const res = await fetch(`${API_BASE}/papers/${paperId}`); + return res.json(); +} + export async function updatePaper(paperId, data) { const res = await fetch(`${API_BASE}/papers/${paperId}`, { method: "PATCH", @@ -77,6 +82,13 @@ export async function updatePaper(paperId, data) { return res.json(); } +export async function deletePaper(paperId) { + const res = await fetch(`${API_BASE}/papers/${paperId}`, { + method: "DELETE", + }); + return res.json(); +} + export async function listClaims(params = {}) { const qs = new URLSearchParams(params).toString(); const res = await fetch(`${API_BASE}/claims/${qs ? "?" + qs : ""}`); @@ -119,3 +131,39 @@ export async function createSource(data) { }); return res.json(); } + +// Style Asset APIs +export async function listStyles() { + const res = await fetch(`${API_BASE}/assets/styles/`); + return res.json(); +} + +export async function createStyle(data) { + const res = await fetch(`${API_BASE}/assets/styles/`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data), + }); + return res.json(); +} + +export async function getStyle(styleId) { + const res = await fetch(`${API_BASE}/assets/styles/${styleId}`); + return res.json(); +} + +export async function updateStyle(styleId, data) { + const res = await fetch(`${API_BASE}/assets/styles/${styleId}`, { + method: "PATCH", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data), + }); + return res.json(); +} + +export async function deleteStyle(styleId) { + const res = await fetch(`${API_BASE}/assets/styles/${styleId}`, { + method: "DELETE", + }); + return res.json(); +}