File size: 641 Bytes
fcacf10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { apiRequest } from "./client";

export async function listKnowledge(workspaceId, { status, type } = {}) {
    let url = `/knowledge?workspace_id=${encodeURIComponent(workspaceId)}`;
    if (status) url += `&status=${encodeURIComponent(status)}`;
    if (type) url += `&type=${encodeURIComponent(type)}`;
    return apiRequest(url);
}

export async function searchKnowledge(workspaceId, query) {
    return apiRequest(
        `/knowledge/search?workspace_id=${encodeURIComponent(workspaceId)}&q=${encodeURIComponent(query)}`
    );
}

export async function getKnowledgeItem(itemId) {
    return apiRequest(`/knowledge/${itemId}`);
}