1 export enum DocsApiErrorCode {
2 CommitIdOutOfSync = 250_000,
5 export const getDocumentMeta = (volumeId: string, linkId: string) => ({
7 url: `docs/volumes/${volumeId}/documents/${linkId}/meta`,
10 export const getCommitData = (volumeId: string, linkId: string, commitId: string) => ({
12 url: `docs/volumes/${volumeId}/documents/${linkId}/commits/${commitId}`,
16 export const seedInitialCommit = (volumeId: string, linkId: string, data: Uint8Array) => ({
18 url: `docs/volumes/${volumeId}/documents/${linkId}/seed-initial-commit`,
23 export const lockDocument = (volumeId: string, linkId: string, fetchCommitId?: string) => ({
25 url: `docs/volumes/${volumeId}/documents/${linkId}/lock`,
27 FetchCommitID: fetchCommitId,
33 export const squashCommit = (volumeId: string, linkId: string, commitId: string, data: Uint8Array) => ({
35 url: `docs/volumes/${volumeId}/documents/${linkId}/commits/${commitId}/squash`,
40 export const createDocument = (volumeId: string, linkId: string) => ({
42 url: `docs/volumes/${volumeId}/documents/${linkId}`,
46 export const getAllCommentThreadsInDocument = (volumeId: string, linkId: string) => ({
48 url: `docs/volumes/${volumeId}/documents/${linkId}/threads`,
51 export const getCommentThreadInDocument = (volumeId: string, linkId: string, threadId: string) => ({
53 url: `docs/volumes/${volumeId}/documents/${linkId}/threads/${threadId}`,
56 type CommonCommentData = {
61 export const createThreadInDocument = (
64 data: { Mark: string; Comment: CommonCommentData }
67 url: `docs/volumes/${volumeId}/documents/${linkId}/threads`,
71 export const deleteThreadInDocument = (volumeId: string, linkId: string, threadId: string) => ({
73 url: `docs/volumes/${volumeId}/documents/${linkId}/threads/${threadId}`,
76 export const resolveThreadInDocument = (volumeId: string, linkId: string, threadId: string) => ({
78 url: `docs/volumes/${volumeId}/documents/${linkId}/threads/${threadId}/resolve`,
81 export const unresolveThreadInDocument = (volumeId: string, linkId: string, threadId: string) => ({
83 url: `docs/volumes/${volumeId}/documents/${linkId}/threads/${threadId}/unresolve`,
86 export const addCommentToThreadInDocument = (
90 data: CommonCommentData & { ParentCommentId: string | null }
93 url: `docs/volumes/${volumeId}/documents/${linkId}/threads/${threadId}`,
97 export const editCommentInThreadInDocument = (
102 data: CommonCommentData
105 url: `docs/volumes/${volumeId}/documents/${linkId}/threads/${threadId}/comments/${commentId}`,
109 export const deleteCommentInThreadInDocument = (
116 url: `docs/volumes/${volumeId}/documents/${linkId}/threads/${threadId}/comments/${commentId}`,
119 export const createRealtimeValetToken = (volumeId: string, linkId: string, commitId?: string) => ({
121 url: `docs/volumes/${volumeId}/documents/${linkId}/tokens`,
124 LastCommitID: commitId ?? null,