feat(v2): add multiple extra features from the pdf slides
This commit is contained in:
@@ -18,6 +18,39 @@ export async function uploadImage(file) {
|
||||
return parseResponse(response);
|
||||
}
|
||||
|
||||
export async function getOperations() {
|
||||
const response = await fetch(`${API_BASE}/api/operations/`);
|
||||
return parseResponse(response);
|
||||
}
|
||||
|
||||
export async function listStates(sessionId) {
|
||||
const response = await fetch(`${API_BASE}/api/sessions/${sessionId}/states/`);
|
||||
return parseResponse(response);
|
||||
}
|
||||
|
||||
export async function applyStateOperation(stateId, operation, params = {}) {
|
||||
const response = await fetch(`${API_BASE}/api/states/${stateId}/operations/`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ operation, params })
|
||||
});
|
||||
return parseResponse(response);
|
||||
}
|
||||
|
||||
export async function combineStates(operation, stateIds, params = {}) {
|
||||
const response = await fetch(`${API_BASE}/api/states/combine/`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ operation, state_ids: stateIds, params })
|
||||
});
|
||||
return parseResponse(response);
|
||||
}
|
||||
|
||||
export async function getStateHistogram(stateId) {
|
||||
const response = await fetch(`${API_BASE}/api/states/${stateId}/histogram/`);
|
||||
return parseResponse(response);
|
||||
}
|
||||
|
||||
export async function processImage(sessionId, operation, params) {
|
||||
const response = await fetch(`${API_BASE}/api/process/`, {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user