Use new API

This commit is contained in:
Andras Schmelczer 2024-12-14 17:06:40 +00:00
parent 65a42a18bf
commit 570b5f9bfc
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
5 changed files with 31 additions and 19 deletions

View file

@ -5,10 +5,7 @@ import type { components, paths } from "./types"; // generated by openapi-typesc
import { Logger } from "src/logger";
import { Database } from "src/database/database";
import { SyncSettings } from "src/database/sync-settings";
import {
DocumentVersionId,
RelativePath,
} from "src/database/document-metadata.js";
import { VaultUpdateId, RelativePath } from "src/database/document-metadata.js";
export class SyncServer {
private static VAULT_ID = "default";
@ -53,7 +50,7 @@ export class SyncServer {
createdDate,
}: {
relativePath: RelativePath;
parentVersionId: DocumentVersionId | undefined;
parentVersionId: VaultUpdateId | undefined;
contentBytes: Uint8Array;
createdDate: Date;
}): Promise<components["schemas"]["DocumentVersion"]> {
@ -160,9 +157,9 @@ export class SyncServer {
return response.data;
}
public async getAll(): Promise<
components["schemas"]["DocumentVersionWithoutContent"][]
> {
public async getAll(
since?: VaultUpdateId
): Promise<components["schemas"]["FetchLatestDocumentsResponse"]> {
const response = await this.client.GET("/vaults/{vault_id}/documents", {
params: {
path: {
@ -172,6 +169,9 @@ export class SyncServer {
authorization:
"Bearer " + this.database.getSettings().token,
},
query: {
since_update_id: since,
},
},
});