Skip to content
This repository was archived by the owner on Mar 28, 2025. It is now read-only.

Commit 1994ba2

Browse files
authored
add schemas to client (#12)
1 parent 963597c commit 1994ba2

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "getindexify",
3-
"version": "0.0.18",
3+
"version": "0.0.19",
44
"description": "This is the TypeScript client for interacting with the Indexify service.",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

src/client.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
ISearchIndexResponse,
1313
IBaseContentMetadata,
1414
IExtractedMetadata,
15+
ISchema,
1516
} from "./types";
1617

1718
const DEFAULT_SERVICE_URL = "http://localhost:8900"; // Set your default service URL
@@ -223,7 +224,7 @@ class IndexifyClient {
223224

224225
async getExtractedMetadata(id: string): Promise<IExtractedMetadata[]> {
225226
const resp = await this.client.get(`content/${id}/metadata`);
226-
return resp.data.metadata
227+
return resp.data.metadata;
227228
}
228229

229230
async downloadContent<T>(id: string): Promise<T> {
@@ -243,6 +244,11 @@ class IndexifyClient {
243244
return resp.data.tasks;
244245
}
245246

247+
async getSchemas(): Promise<ISchema[]> {
248+
const resp = await this.client.get("schemas");
249+
return resp.data.schemas;
250+
}
251+
246252
async uploadFile(fileInput: string | Blob): Promise<any> {
247253
function isBlob(input: any): input is Blob {
248254
return input instanceof Blob;

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
ISearchIndexResponse,
1313
ITask,
1414
IDocument,
15+
ISchema,
1516
} from "./types";
1617

1718
export {
@@ -20,6 +21,7 @@ export {
2021
INamespace,
2122
IEmbeddingSchema,
2223
IExtractorSchema,
24+
ISchema,
2325
IExtractor,
2426
IIndex,
2527
IContentMetadata,

src/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ export interface IExtractor {
1919
outputs: IExtractorSchema;
2020
}
2121

22+
export interface ISchema {
23+
columns: Record<string, string | number | boolean>;
24+
content_source: string;
25+
namespace: string;
26+
}
2227
export interface IIndex {
2328
name: string;
24-
schema: Record<string, string | number>;
29+
schema: Record<string, string | number | boolean>;
2530
}
2631

2732
export interface IBaseContentMetadata {

0 commit comments

Comments
 (0)