Initial commit: Paperclip plugin for Legal AI integration
16 agent tools, event handler for auto-linking, sync job every 15m. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
63
dist/legal-api.js
vendored
Normal file
63
dist/legal-api.js
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* HTTP client for Ezer Mishpati legal-ai REST API.
|
||||
*/
|
||||
export class LegalApi {
|
||||
baseUrl;
|
||||
constructor(baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
async request(path, init) {
|
||||
const res = await fetch(`${this.baseUrl}${path}`, {
|
||||
...init,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...init?.headers,
|
||||
},
|
||||
});
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(`Legal API ${res.status}: ${text}`);
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
async listCases() {
|
||||
return this.request("/api/cases");
|
||||
}
|
||||
async getCase(caseNumber) {
|
||||
return this.request(`/api/cases/${encodeURIComponent(caseNumber)}/details`);
|
||||
}
|
||||
async createCase(data) {
|
||||
return this.request("/api/cases/create", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
async updateCase(caseNumber, data) {
|
||||
return this.request(`/api/cases/${encodeURIComponent(caseNumber)}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
async getCaseStatus(caseNumber) {
|
||||
return this.request(`/api/cases/${encodeURIComponent(caseNumber)}/status`);
|
||||
}
|
||||
async search(query, limit = 10, sectionType = "") {
|
||||
const params = new URLSearchParams({ query, limit: String(limit) });
|
||||
if (sectionType)
|
||||
params.set("section_type", sectionType);
|
||||
return this.request(`/api/search?${params}`);
|
||||
}
|
||||
async searchCase(caseNumber, query, limit = 10) {
|
||||
const params = new URLSearchParams({ query, limit: String(limit) });
|
||||
return this.request(`/api/cases/${encodeURIComponent(caseNumber)}/search?${params}`);
|
||||
}
|
||||
async getTemplate(caseNumber) {
|
||||
return this.request(`/api/cases/${encodeURIComponent(caseNumber)}/template`);
|
||||
}
|
||||
async getProcessingStatus() {
|
||||
return this.request("/api/processing-status");
|
||||
}
|
||||
async health() {
|
||||
return this.request("/health");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user