equalweb-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +227 -0
- package/dist/index.d.mts +381 -0
- package/dist/index.d.ts +381 -0
- package/dist/index.js +568 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +532 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# equalweb-api
|
|
2
|
+
|
|
3
|
+
Official SDK for the EqualWeb V2 API - Document accessibility auditing and PDF remediation.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js >= 18.0.0
|
|
8
|
+
- TypeScript 5.x (for TypeScript projects)
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install equalweb-api
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { EqualWeb } from "equalweb-api";
|
|
20
|
+
|
|
21
|
+
const client = new EqualWeb({ apiKey: "your-api-key" });
|
|
22
|
+
|
|
23
|
+
// Check your credit balance
|
|
24
|
+
const balance = await client.info.getBalance();
|
|
25
|
+
console.log(`Credits remaining: ${balance}`);
|
|
26
|
+
|
|
27
|
+
// Upload a document
|
|
28
|
+
const file = new File([buffer], "document.pdf", { type: "application/pdf" });
|
|
29
|
+
const upload = await client.documents.upload(file);
|
|
30
|
+
console.log(`Uploaded: ${upload.id}`);
|
|
31
|
+
|
|
32
|
+
// Start an accessibility audit
|
|
33
|
+
await client.audit.audit([upload.id]);
|
|
34
|
+
|
|
35
|
+
// Check status (audit is async)
|
|
36
|
+
const status = await client.documents.getStatus(upload.id);
|
|
37
|
+
console.log(`Status: ${status}`);
|
|
38
|
+
|
|
39
|
+
// Download the audited file when done
|
|
40
|
+
if (status === "done") {
|
|
41
|
+
const blob = await client.downloads.audited(upload.id);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API Reference
|
|
46
|
+
|
|
47
|
+
### Configuration
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const client = new EqualWeb({
|
|
51
|
+
apiKey: "your-api-key", // Required
|
|
52
|
+
baseUrl: "https://login.equalweb.com/api/v2", // Optional
|
|
53
|
+
timeout: 30000, // Optional, in milliseconds
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Info
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// Get credit balance
|
|
61
|
+
const balance = await client.info.getBalance();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Documents
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// Get all documents
|
|
68
|
+
const docs = await client.documents.getAll();
|
|
69
|
+
|
|
70
|
+
// Get documents with filters
|
|
71
|
+
const filtered = await client.documents.getAll({
|
|
72
|
+
groupID: "123",
|
|
73
|
+
archived: false,
|
|
74
|
+
type: "pdf",
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Get document status
|
|
78
|
+
const status = await client.documents.getStatus("reportID");
|
|
79
|
+
|
|
80
|
+
// Upload a document (supports PDF, XLSX, DOCX, PPTX)
|
|
81
|
+
const upload = await client.documents.upload(file);
|
|
82
|
+
|
|
83
|
+
// Delete documents
|
|
84
|
+
const result = await client.documents.delete(["id1", "id2"]);
|
|
85
|
+
|
|
86
|
+
// Archive documents
|
|
87
|
+
await client.documents.archive(["id1", "id2"]);
|
|
88
|
+
|
|
89
|
+
// Restore archived documents
|
|
90
|
+
await client.documents.restore(["id1", "id2"]);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Groups
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
// Get all groups
|
|
97
|
+
const groups = await client.groups.getAll();
|
|
98
|
+
|
|
99
|
+
// Create a new group with documents
|
|
100
|
+
await client.groups.createGroup(["doc1", "doc2"], "My Group");
|
|
101
|
+
|
|
102
|
+
// Add documents to existing group
|
|
103
|
+
await client.groups.addToGroup(["doc3"], "groupID");
|
|
104
|
+
|
|
105
|
+
// Rename a group
|
|
106
|
+
await client.groups.rename("groupID", "New Name");
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Audit
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// Full audit (accessibility remediation)
|
|
113
|
+
await client.audit.audit(["doc1", "doc2"]);
|
|
114
|
+
|
|
115
|
+
// Quick check (no remediation)
|
|
116
|
+
await client.audit.check(["doc1", "doc2"]);
|
|
117
|
+
|
|
118
|
+
// Custom audit type
|
|
119
|
+
await client.audit.process(["doc1", "doc2"], "audit");
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Reports
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// Get audited report (default)
|
|
126
|
+
const report = await client.reports.get("reportID");
|
|
127
|
+
|
|
128
|
+
// Get original report
|
|
129
|
+
const original = await client.reports.getOriginal("reportID");
|
|
130
|
+
|
|
131
|
+
// Get both reports
|
|
132
|
+
const both = await client.reports.getBoth("reportID");
|
|
133
|
+
|
|
134
|
+
// Get browser-viewable URL (no auth required)
|
|
135
|
+
const url = client.reports.getBrowserUrl("reportID");
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Downloads
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// Download audited file
|
|
142
|
+
const audited = await client.downloads.audited("reportID");
|
|
143
|
+
|
|
144
|
+
// Download original file
|
|
145
|
+
const original = await client.downloads.original("reportID");
|
|
146
|
+
|
|
147
|
+
// Download with options (file type and original flag)
|
|
148
|
+
const file = await client.downloads.file("reportID", {
|
|
149
|
+
original: false,
|
|
150
|
+
type: "pdf",
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Download as XLSX
|
|
154
|
+
const xlsx = await client.downloads.audited("reportID", "xlsx");
|
|
155
|
+
|
|
156
|
+
// Download multiple as ZIP
|
|
157
|
+
const zip = await client.downloads.zipped(["id1", "id2", "id3"]);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Error Handling
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
import { EqualWeb, EqualWebError, RateLimitError, AuthenticationError } from "equalweb-api";
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
await client.documents.getAll();
|
|
167
|
+
} catch (error) {
|
|
168
|
+
if (error instanceof AuthenticationError) {
|
|
169
|
+
console.error("Invalid API key");
|
|
170
|
+
} else if (error instanceof RateLimitError) {
|
|
171
|
+
console.error(`Rate limited. Retry after: ${error.retryAfter}s`);
|
|
172
|
+
} else if (error instanceof EqualWebError) {
|
|
173
|
+
console.error(`API error ${error.statusCode}: ${error.message}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## TypeScript Support
|
|
179
|
+
|
|
180
|
+
Full TypeScript support with exported types:
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
import type {
|
|
184
|
+
Document,
|
|
185
|
+
DocumentGroup,
|
|
186
|
+
ReportResponse,
|
|
187
|
+
UploadResponse,
|
|
188
|
+
EqualWebConfig,
|
|
189
|
+
} from "equalweb-api";
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Supported File Formats
|
|
193
|
+
|
|
194
|
+
The SDK supports uploading and processing the following document formats:
|
|
195
|
+
|
|
196
|
+
- **PDF** - Portable Document Format
|
|
197
|
+
- **XLSX** - Microsoft Excel
|
|
198
|
+
- **DOCX** - Microsoft Word
|
|
199
|
+
- **PPTX** - Microsoft PowerPoint
|
|
200
|
+
|
|
201
|
+
All documents are processed for accessibility compliance according to WCAG and ADA standards.
|
|
202
|
+
|
|
203
|
+
## Rate Limiting
|
|
204
|
+
|
|
205
|
+
The API has a rate limit of 100 requests per minute per API key. The SDK throws a `RateLimitError` when the limit is exceeded. Implement retry logic with exponential backoff:
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
async function withRetry<T>(fn: () => Promise<T>, maxRetries = 3): Promise<T> {
|
|
209
|
+
for (let i = 0; i < maxRetries; i++) {
|
|
210
|
+
try {
|
|
211
|
+
return await fn();
|
|
212
|
+
} catch (error) {
|
|
213
|
+
if (error instanceof RateLimitError && i < maxRetries - 1) {
|
|
214
|
+
const delay = (error.retryAfter ?? 60) * 1000;
|
|
215
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
throw new Error("Max retries exceeded");
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
interface EqualWebConfig {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
timeout?: number;
|
|
5
|
+
}
|
|
6
|
+
type DocumentStatus = "done" | "pending" | "processing" | string;
|
|
7
|
+
type AuditType = "audit" | "check";
|
|
8
|
+
type ReportType = "audited" | "original" | "both";
|
|
9
|
+
type DownloadFileType = "pdf" | "xlsx";
|
|
10
|
+
interface BalanceResponse {
|
|
11
|
+
results: number;
|
|
12
|
+
}
|
|
13
|
+
interface Document {
|
|
14
|
+
numberOfPages: number;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
group: number | null;
|
|
17
|
+
archived: boolean;
|
|
18
|
+
reportID: string;
|
|
19
|
+
status: DocumentStatus;
|
|
20
|
+
}
|
|
21
|
+
interface GetDocumentsParams {
|
|
22
|
+
groupID?: string;
|
|
23
|
+
archived?: boolean;
|
|
24
|
+
type?: string;
|
|
25
|
+
}
|
|
26
|
+
interface DocumentStatusResponse {
|
|
27
|
+
status: DocumentStatus;
|
|
28
|
+
}
|
|
29
|
+
interface UploadResponse {
|
|
30
|
+
id: string;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
numberOfPages: number;
|
|
33
|
+
}
|
|
34
|
+
interface DeleteDocumentsParams {
|
|
35
|
+
files: string[];
|
|
36
|
+
}
|
|
37
|
+
interface DeleteDocumentsResponse {
|
|
38
|
+
results: Record<string, boolean | {
|
|
39
|
+
error: string;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
interface ArchiveDocumentsParams {
|
|
43
|
+
files: string[];
|
|
44
|
+
archive?: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface ArchiveDocumentsResponse {
|
|
47
|
+
results: "ok";
|
|
48
|
+
}
|
|
49
|
+
interface DocumentGroup {
|
|
50
|
+
id: number;
|
|
51
|
+
name: string;
|
|
52
|
+
createdAt: string;
|
|
53
|
+
}
|
|
54
|
+
interface GroupDocumentsParams {
|
|
55
|
+
files: string[];
|
|
56
|
+
newGroup?: string;
|
|
57
|
+
selectedGroup?: string;
|
|
58
|
+
}
|
|
59
|
+
interface GroupDocumentsResponse {
|
|
60
|
+
results: "ok";
|
|
61
|
+
}
|
|
62
|
+
interface RenameGroupParams {
|
|
63
|
+
groupID: string;
|
|
64
|
+
groupName: string;
|
|
65
|
+
}
|
|
66
|
+
interface RenameGroupResponse {
|
|
67
|
+
results: "ok";
|
|
68
|
+
}
|
|
69
|
+
interface AuditDocumentsParams {
|
|
70
|
+
files: string[];
|
|
71
|
+
type?: AuditType;
|
|
72
|
+
}
|
|
73
|
+
interface AuditDocumentsResponse {
|
|
74
|
+
results: "ok";
|
|
75
|
+
}
|
|
76
|
+
interface ReportRule {
|
|
77
|
+
Rule: string;
|
|
78
|
+
Status: "Passed" | "Failed" | "Needs manual check" | string;
|
|
79
|
+
Description: string;
|
|
80
|
+
}
|
|
81
|
+
interface ReportSummary {
|
|
82
|
+
"Passed"?: number;
|
|
83
|
+
"Failed"?: number;
|
|
84
|
+
"Needs manual check"?: number;
|
|
85
|
+
Description?: string;
|
|
86
|
+
}
|
|
87
|
+
interface DetailedReport {
|
|
88
|
+
Document?: ReportRule[];
|
|
89
|
+
"Page Content"?: ReportRule[];
|
|
90
|
+
Forms?: ReportRule[];
|
|
91
|
+
"Alternate Text"?: ReportRule[];
|
|
92
|
+
Tables?: ReportRule[];
|
|
93
|
+
Lists?: ReportRule[];
|
|
94
|
+
Headings?: ReportRule[];
|
|
95
|
+
}
|
|
96
|
+
interface ReportCustomData {
|
|
97
|
+
fileName?: string;
|
|
98
|
+
fileSize?: number;
|
|
99
|
+
numberOfPages?: number;
|
|
100
|
+
tags?: Record<string, number>;
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
interface AuditedReport {
|
|
104
|
+
Summary?: ReportSummary;
|
|
105
|
+
"Detailed Report"?: DetailedReport;
|
|
106
|
+
customData?: ReportCustomData;
|
|
107
|
+
}
|
|
108
|
+
interface OriginalReport {
|
|
109
|
+
Summary?: ReportSummary;
|
|
110
|
+
"Detailed Report"?: DetailedReport;
|
|
111
|
+
customData?: ReportCustomData;
|
|
112
|
+
}
|
|
113
|
+
interface GetReportParams {
|
|
114
|
+
type?: ReportType;
|
|
115
|
+
}
|
|
116
|
+
interface ReportResponse {
|
|
117
|
+
original?: OriginalReport;
|
|
118
|
+
audited?: AuditedReport;
|
|
119
|
+
}
|
|
120
|
+
interface DownloadFileParams {
|
|
121
|
+
original?: boolean;
|
|
122
|
+
type?: DownloadFileType;
|
|
123
|
+
}
|
|
124
|
+
interface DownloadZippedParams {
|
|
125
|
+
files: string[];
|
|
126
|
+
}
|
|
127
|
+
interface EqualWebErrorResponse {
|
|
128
|
+
error?: string;
|
|
129
|
+
message?: string;
|
|
130
|
+
statusCode?: number;
|
|
131
|
+
}
|
|
132
|
+
declare class EqualWebError extends Error {
|
|
133
|
+
readonly statusCode: number;
|
|
134
|
+
readonly response?: EqualWebErrorResponse;
|
|
135
|
+
constructor(message: string, statusCode: number, response?: EqualWebErrorResponse);
|
|
136
|
+
}
|
|
137
|
+
declare class RateLimitError extends EqualWebError {
|
|
138
|
+
readonly retryAfter?: number;
|
|
139
|
+
constructor(message: string, retryAfter?: number);
|
|
140
|
+
}
|
|
141
|
+
declare class AuthenticationError extends EqualWebError {
|
|
142
|
+
constructor(message?: string);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface RequestOptions {
|
|
146
|
+
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
147
|
+
path: string;
|
|
148
|
+
query?: Record<string, string | boolean | undefined>;
|
|
149
|
+
body?: unknown;
|
|
150
|
+
isFormData?: boolean;
|
|
151
|
+
responseType?: "json" | "blob";
|
|
152
|
+
}
|
|
153
|
+
declare class HttpClient {
|
|
154
|
+
private readonly apiKey;
|
|
155
|
+
private readonly baseUrl;
|
|
156
|
+
private readonly timeout;
|
|
157
|
+
constructor(config: EqualWebConfig);
|
|
158
|
+
request<T>(options: RequestOptions): Promise<T>;
|
|
159
|
+
private handleErrorResponse;
|
|
160
|
+
get<T>(path: string, query?: Record<string, string | boolean | undefined>): Promise<T>;
|
|
161
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
162
|
+
put<T>(path: string, body?: unknown, isFormData?: boolean): Promise<T>;
|
|
163
|
+
delete<T>(path: string, body?: unknown): Promise<T>;
|
|
164
|
+
getBlob(path: string, query?: Record<string, string | boolean | undefined>): Promise<Blob>;
|
|
165
|
+
postBlob(path: string, body?: unknown): Promise<Blob>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
declare class InfoApi {
|
|
169
|
+
private readonly client;
|
|
170
|
+
constructor(client: HttpClient);
|
|
171
|
+
/**
|
|
172
|
+
* Get the current credit balance for your account
|
|
173
|
+
* @returns The current credit balance
|
|
174
|
+
*/
|
|
175
|
+
getBalance(): Promise<number>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare class DocumentsApi {
|
|
179
|
+
private readonly client;
|
|
180
|
+
constructor(client: HttpClient);
|
|
181
|
+
/**
|
|
182
|
+
* Get all documents
|
|
183
|
+
* @param params - Optional filters for groupID, archived status, and document type
|
|
184
|
+
* @returns Array of documents
|
|
185
|
+
*/
|
|
186
|
+
getAll(params?: GetDocumentsParams): Promise<Document[]>;
|
|
187
|
+
/**
|
|
188
|
+
* Get the status of a specific document
|
|
189
|
+
* @param reportID - The report ID of the document
|
|
190
|
+
* @returns The document status
|
|
191
|
+
*/
|
|
192
|
+
getStatus(reportID: string): Promise<string>;
|
|
193
|
+
/**
|
|
194
|
+
* Upload a document for processing
|
|
195
|
+
* Supported formats: PDF, XLSX, DOCX, PPTX
|
|
196
|
+
* @param file - The file to upload (File, Blob, ArrayBuffer, or Uint8Array)
|
|
197
|
+
* @param filename - Optional filename (required if file is an ArrayBuffer or Uint8Array)
|
|
198
|
+
* @returns Upload response with document ID and metadata
|
|
199
|
+
*/
|
|
200
|
+
upload(file: File | Blob | ArrayBuffer | Uint8Array, filename?: string): Promise<UploadResponse>;
|
|
201
|
+
/**
|
|
202
|
+
* Delete multiple documents
|
|
203
|
+
* @param files - Array of document IDs to delete
|
|
204
|
+
* @returns Results indicating success/failure for each document
|
|
205
|
+
*/
|
|
206
|
+
delete(files: string[]): Promise<DeleteDocumentsResponse>;
|
|
207
|
+
/**
|
|
208
|
+
* Archive documents
|
|
209
|
+
* @param files - Array of document IDs to archive
|
|
210
|
+
* @returns Result of the operation
|
|
211
|
+
*/
|
|
212
|
+
archive(files: string[]): Promise<ArchiveDocumentsResponse>;
|
|
213
|
+
/**
|
|
214
|
+
* Restore archived documents
|
|
215
|
+
* @param files - Array of document IDs to restore
|
|
216
|
+
* @returns Result of the operation
|
|
217
|
+
*/
|
|
218
|
+
restore(files: string[]): Promise<ArchiveDocumentsResponse>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
declare class GroupsApi {
|
|
222
|
+
private readonly client;
|
|
223
|
+
constructor(client: HttpClient);
|
|
224
|
+
/**
|
|
225
|
+
* Get all document groups
|
|
226
|
+
* @returns Array of document groups
|
|
227
|
+
*/
|
|
228
|
+
getAll(): Promise<DocumentGroup[]>;
|
|
229
|
+
/**
|
|
230
|
+
* Add documents to a new group
|
|
231
|
+
* @param files - Array of document IDs to group
|
|
232
|
+
* @param groupName - Name of the new group to create
|
|
233
|
+
* @returns Result of the operation
|
|
234
|
+
*/
|
|
235
|
+
createGroup(files: string[], groupName: string): Promise<GroupDocumentsResponse>;
|
|
236
|
+
/**
|
|
237
|
+
* Add documents to an existing group
|
|
238
|
+
* @param files - Array of document IDs to group
|
|
239
|
+
* @param groupID - ID of the existing group
|
|
240
|
+
* @returns Result of the operation
|
|
241
|
+
*/
|
|
242
|
+
addToGroup(files: string[], groupID: string): Promise<GroupDocumentsResponse>;
|
|
243
|
+
/**
|
|
244
|
+
* Rename a document group
|
|
245
|
+
* @param groupID - ID of the group to rename
|
|
246
|
+
* @param groupName - New name for the group
|
|
247
|
+
* @returns Result of the operation
|
|
248
|
+
*/
|
|
249
|
+
rename(groupID: string, groupName: string): Promise<RenameGroupResponse>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
declare class AuditApi {
|
|
253
|
+
private readonly client;
|
|
254
|
+
constructor(client: HttpClient);
|
|
255
|
+
/**
|
|
256
|
+
* Start a full audit on documents
|
|
257
|
+
* This performs accessibility remediation and generates detailed reports
|
|
258
|
+
* @param files - Array of document IDs to audit
|
|
259
|
+
* @returns Result of the operation (202 Accepted - processing is async)
|
|
260
|
+
*/
|
|
261
|
+
audit(files: string[]): Promise<AuditDocumentsResponse>;
|
|
262
|
+
/**
|
|
263
|
+
* Perform a quick check on documents without full remediation
|
|
264
|
+
* @param files - Array of document IDs to check
|
|
265
|
+
* @returns Result of the operation (202 Accepted - processing is async)
|
|
266
|
+
*/
|
|
267
|
+
check(files: string[]): Promise<AuditDocumentsResponse>;
|
|
268
|
+
/**
|
|
269
|
+
* Start an audit with custom type
|
|
270
|
+
* @param files - Array of document IDs to process
|
|
271
|
+
* @param type - Type of audit: "audit" for full audit, "check" for quick check
|
|
272
|
+
* @returns Result of the operation (202 Accepted - processing is async)
|
|
273
|
+
*/
|
|
274
|
+
process(files: string[], type: AuditType): Promise<AuditDocumentsResponse>;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
declare class ReportsApi {
|
|
278
|
+
private readonly client;
|
|
279
|
+
constructor(client: HttpClient);
|
|
280
|
+
/**
|
|
281
|
+
* Get the JSON report for a document
|
|
282
|
+
* @param reportID - The report ID
|
|
283
|
+
* @param type - Which report to retrieve: "audited", "original", or "both"
|
|
284
|
+
* @returns The report data
|
|
285
|
+
*/
|
|
286
|
+
get(reportID: string, type?: ReportType): Promise<ReportResponse>;
|
|
287
|
+
/**
|
|
288
|
+
* Get the audited report for a document
|
|
289
|
+
* @param reportID - The report ID
|
|
290
|
+
* @returns The audited report data
|
|
291
|
+
*/
|
|
292
|
+
getAudited(reportID: string): Promise<ReportResponse>;
|
|
293
|
+
/**
|
|
294
|
+
* Get the original report for a document
|
|
295
|
+
* @param reportID - The report ID
|
|
296
|
+
* @returns The original report data
|
|
297
|
+
*/
|
|
298
|
+
getOriginal(reportID: string): Promise<ReportResponse>;
|
|
299
|
+
/**
|
|
300
|
+
* Get both audited and original reports for a document
|
|
301
|
+
* @param reportID - The report ID
|
|
302
|
+
* @returns Both report data
|
|
303
|
+
*/
|
|
304
|
+
getBoth(reportID: string): Promise<ReportResponse>;
|
|
305
|
+
/**
|
|
306
|
+
* Get the URL to view the report in a browser
|
|
307
|
+
* Note: This URL does not require authentication
|
|
308
|
+
* @param reportID - The report ID
|
|
309
|
+
* @returns The browser-viewable URL
|
|
310
|
+
*/
|
|
311
|
+
getBrowserUrl(reportID: string): string;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
declare class DownloadsApi {
|
|
315
|
+
private readonly client;
|
|
316
|
+
constructor(client: HttpClient);
|
|
317
|
+
/**
|
|
318
|
+
* Download a single document file
|
|
319
|
+
* @param reportID - The report ID of the document
|
|
320
|
+
* @param options - Download options (original file, file type)
|
|
321
|
+
* @returns The file as a Blob
|
|
322
|
+
*/
|
|
323
|
+
file(reportID: string, options?: DownloadFileParams): Promise<Blob>;
|
|
324
|
+
/**
|
|
325
|
+
* Download the audited/processed version of a document
|
|
326
|
+
* @param reportID - The report ID of the document
|
|
327
|
+
* @param type - File type to download (pdf or xlsx)
|
|
328
|
+
* @returns The processed file as a Blob
|
|
329
|
+
*/
|
|
330
|
+
audited(reportID: string, type?: DownloadFileType): Promise<Blob>;
|
|
331
|
+
/**
|
|
332
|
+
* Download the original version of a document
|
|
333
|
+
* @param reportID - The report ID of the document
|
|
334
|
+
* @param type - File type to download (pdf or xlsx)
|
|
335
|
+
* @returns The original file as a Blob
|
|
336
|
+
*/
|
|
337
|
+
original(reportID: string, type?: DownloadFileType): Promise<Blob>;
|
|
338
|
+
/**
|
|
339
|
+
* Download multiple documents as a ZIP file
|
|
340
|
+
* @param files - Array of document IDs to include in the ZIP
|
|
341
|
+
* @returns The ZIP file as a Blob
|
|
342
|
+
*/
|
|
343
|
+
zipped(files: string[]): Promise<Blob>;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
declare class EqualWeb {
|
|
347
|
+
private readonly client;
|
|
348
|
+
readonly info: InfoApi;
|
|
349
|
+
readonly documents: DocumentsApi;
|
|
350
|
+
readonly groups: GroupsApi;
|
|
351
|
+
readonly audit: AuditApi;
|
|
352
|
+
readonly reports: ReportsApi;
|
|
353
|
+
readonly downloads: DownloadsApi;
|
|
354
|
+
/**
|
|
355
|
+
* Create a new EqualWeb API client
|
|
356
|
+
* @param config - Configuration object with API key and optional settings
|
|
357
|
+
* @example
|
|
358
|
+
* ```typescript
|
|
359
|
+
* const client = new EqualWeb({ apiKey: 'your-api-key' });
|
|
360
|
+
*
|
|
361
|
+
* // Get credit balance
|
|
362
|
+
* const balance = await client.info.getBalance();
|
|
363
|
+
*
|
|
364
|
+
* // Upload a document
|
|
365
|
+
* const file = new File([...], 'document.pdf');
|
|
366
|
+
* const upload = await client.documents.upload(file);
|
|
367
|
+
*
|
|
368
|
+
* // Start an audit
|
|
369
|
+
* await client.audit.audit([upload.id]);
|
|
370
|
+
*
|
|
371
|
+
* // Check status
|
|
372
|
+
* const status = await client.documents.getStatus(upload.id);
|
|
373
|
+
*
|
|
374
|
+
* // Download the audited file
|
|
375
|
+
* const blob = await client.downloads.audited(upload.id);
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
constructor(config: EqualWebConfig);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export { type ArchiveDocumentsParams, type ArchiveDocumentsResponse, AuditApi, type AuditDocumentsParams, type AuditDocumentsResponse, type AuditType, type AuditedReport, AuthenticationError, type BalanceResponse, type DeleteDocumentsParams, type DeleteDocumentsResponse, type DetailedReport, type Document, type DocumentGroup, type DocumentStatus, type DocumentStatusResponse, DocumentsApi, type DownloadFileParams, type DownloadFileType, type DownloadZippedParams, DownloadsApi, EqualWeb, type EqualWebConfig, EqualWebError, type EqualWebErrorResponse, type GetDocumentsParams, type GetReportParams, type GroupDocumentsParams, type GroupDocumentsResponse, GroupsApi, InfoApi, type OriginalReport, RateLimitError, type RenameGroupParams, type RenameGroupResponse, type ReportCustomData, type ReportResponse, type ReportRule, type ReportSummary, type ReportType, ReportsApi, type UploadResponse };
|