Refactor & update API
This commit is contained in:
parent
5f1075879f
commit
3065edba37
6 changed files with 42 additions and 33 deletions
|
|
@ -1,14 +1,14 @@
|
|||
import * as plugin from "../../../backend/sync_lib/pkg/sync_lib.js";
|
||||
|
||||
import createClient, { Client } from "openapi-fetch";
|
||||
import type { components, paths } from "./types.js"; // generated by openapi-typescript
|
||||
import { Logger } from "src/logger.js";
|
||||
import type { components, paths } from "./types"; // generated by openapi-typescript
|
||||
import { Logger } from "src/logger";
|
||||
import { Database } from "src/database/database";
|
||||
import { SyncSettings } from "src/database/sync-settings";
|
||||
import {
|
||||
Database,
|
||||
DocumentId,
|
||||
DocumentVersionId,
|
||||
SyncSettings,
|
||||
} from "src/database/database.js";
|
||||
} from "src/database/document-metadata.js";
|
||||
|
||||
export class SyncServer {
|
||||
private static VAULT_ID = "default";
|
||||
|
|
@ -47,7 +47,7 @@ export class SyncServer {
|
|||
content: ArrayBuffer;
|
||||
relativePath: string;
|
||||
createdDate: Date;
|
||||
}): Promise<components["schemas"]["DocumentVersionWithoutContent"]> {
|
||||
}): Promise<components["schemas"]["DocumentVersion"]> {
|
||||
let contentBytes = new Uint8Array(content);
|
||||
let response = await this.client.POST("/vaults/{vault_id}/documents", {
|
||||
params: {
|
||||
|
|
@ -88,7 +88,7 @@ export class SyncServer {
|
|||
relativePath: string;
|
||||
content: ArrayBuffer;
|
||||
createdDate: Date;
|
||||
}): Promise<components["schemas"]["DocumentVersionWithoutContent"]> {
|
||||
}): Promise<components["schemas"]["DocumentVersion"]> {
|
||||
let contentBytes = new Uint8Array(content);
|
||||
|
||||
let response = await this.client.PUT(
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export interface paths {
|
|||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["DocumentVersionWithoutContent"];
|
||||
"application/json": components["schemas"]["DocumentVersion"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -156,7 +156,7 @@ export interface paths {
|
|||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["DocumentVersionWithoutContent"];
|
||||
"application/json": components["schemas"]["DocumentVersion"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue