mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-15 04:52:31 +08:00
feat: extend api_client with style and paper asset APIs
This commit is contained in:
parent
6e94c13035
commit
df5e677ebf
@ -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();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user