@knowledge-stack/ksapi 1.7.0 → 1.9.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.
Files changed (103) hide show
  1. package/.openapi-generator/FILES +14 -0
  2. package/README.md +2 -2
  3. package/dist/apis/ChunksApi.d.ts +175 -0
  4. package/dist/apis/ChunksApi.js +203 -0
  5. package/dist/apis/DocumentVersionsApi.d.ts +36 -1
  6. package/dist/apis/DocumentVersionsApi.js +41 -0
  7. package/dist/apis/FoldersApi.d.ts +38 -1
  8. package/dist/apis/FoldersApi.js +44 -0
  9. package/dist/apis/PathPartsApi.d.ts +4 -6
  10. package/dist/apis/PathPartsApi.js +2 -5
  11. package/dist/apis/index.d.ts +1 -0
  12. package/dist/apis/index.js +1 -0
  13. package/dist/esm/apis/ChunksApi.d.ts +175 -0
  14. package/dist/esm/apis/ChunksApi.js +199 -0
  15. package/dist/esm/apis/DocumentVersionsApi.d.ts +36 -1
  16. package/dist/esm/apis/DocumentVersionsApi.js +42 -1
  17. package/dist/esm/apis/FoldersApi.d.ts +38 -1
  18. package/dist/esm/apis/FoldersApi.js +45 -1
  19. package/dist/esm/apis/PathPartsApi.d.ts +4 -6
  20. package/dist/esm/apis/PathPartsApi.js +2 -5
  21. package/dist/esm/apis/index.d.ts +1 -0
  22. package/dist/esm/apis/index.js +1 -0
  23. package/dist/esm/models/ChunkMetadataInput.d.ts +48 -0
  24. package/dist/esm/models/ChunkMetadataInput.js +43 -0
  25. package/dist/esm/models/ChunkMetadataOutput.d.ts +48 -0
  26. package/dist/esm/models/ChunkMetadataOutput.js +43 -0
  27. package/dist/esm/models/ChunkResponse.d.ts +115 -0
  28. package/dist/esm/models/ChunkResponse.js +86 -0
  29. package/dist/esm/models/ChunkType.d.ts +27 -0
  30. package/dist/esm/models/ChunkType.js +45 -0
  31. package/dist/esm/models/CreateChunkRequest.d.ts +73 -0
  32. package/dist/esm/models/CreateChunkRequest.js +64 -0
  33. package/dist/esm/models/DocumentContentPathPart.d.ts +119 -0
  34. package/dist/esm/models/DocumentContentPathPart.js +83 -0
  35. package/dist/esm/models/FolderDocumentResponse.d.ts +138 -0
  36. package/dist/esm/models/FolderDocumentResponse.js +88 -0
  37. package/dist/esm/models/PaginatedResponseDocumentContentPathPart.d.ts +66 -0
  38. package/dist/esm/models/PaginatedResponseDocumentContentPathPart.js +70 -0
  39. package/dist/esm/models/PaginatedResponseFolderDocumentResponse.d.ts +66 -0
  40. package/dist/esm/models/PaginatedResponseFolderDocumentResponse.js +70 -0
  41. package/dist/esm/models/PasswordResetWithTokenRequest.d.ts +2 -8
  42. package/dist/esm/models/PasswordResetWithTokenRequest.js +3 -7
  43. package/dist/esm/models/Polygon.d.ts +65 -0
  44. package/dist/esm/models/Polygon.js +56 -0
  45. package/dist/esm/models/PolygonReference.d.ts +54 -0
  46. package/dist/esm/models/PolygonReference.js +49 -0
  47. package/dist/esm/models/UpdateChunkContentRequest.d.ts +54 -0
  48. package/dist/esm/models/UpdateChunkContentRequest.js +51 -0
  49. package/dist/esm/models/UpdateChunkMetadataRequest.d.ts +48 -0
  50. package/dist/esm/models/UpdateChunkMetadataRequest.js +45 -0
  51. package/dist/esm/models/index.d.ts +13 -0
  52. package/dist/esm/models/index.js +13 -0
  53. package/dist/models/ChunkMetadataInput.d.ts +48 -0
  54. package/dist/models/ChunkMetadataInput.js +51 -0
  55. package/dist/models/ChunkMetadataOutput.d.ts +48 -0
  56. package/dist/models/ChunkMetadataOutput.js +51 -0
  57. package/dist/models/ChunkResponse.d.ts +115 -0
  58. package/dist/models/ChunkResponse.js +94 -0
  59. package/dist/models/ChunkType.d.ts +27 -0
  60. package/dist/models/ChunkType.js +53 -0
  61. package/dist/models/CreateChunkRequest.d.ts +73 -0
  62. package/dist/models/CreateChunkRequest.js +72 -0
  63. package/dist/models/DocumentContentPathPart.d.ts +119 -0
  64. package/dist/models/DocumentContentPathPart.js +91 -0
  65. package/dist/models/FolderDocumentResponse.d.ts +138 -0
  66. package/dist/models/FolderDocumentResponse.js +96 -0
  67. package/dist/models/PaginatedResponseDocumentContentPathPart.d.ts +66 -0
  68. package/dist/models/PaginatedResponseDocumentContentPathPart.js +78 -0
  69. package/dist/models/PaginatedResponseFolderDocumentResponse.d.ts +66 -0
  70. package/dist/models/PaginatedResponseFolderDocumentResponse.js +78 -0
  71. package/dist/models/PasswordResetWithTokenRequest.d.ts +2 -8
  72. package/dist/models/PasswordResetWithTokenRequest.js +3 -7
  73. package/dist/models/Polygon.d.ts +65 -0
  74. package/dist/models/Polygon.js +64 -0
  75. package/dist/models/PolygonReference.d.ts +54 -0
  76. package/dist/models/PolygonReference.js +57 -0
  77. package/dist/models/UpdateChunkContentRequest.d.ts +54 -0
  78. package/dist/models/UpdateChunkContentRequest.js +59 -0
  79. package/dist/models/UpdateChunkMetadataRequest.d.ts +48 -0
  80. package/dist/models/UpdateChunkMetadataRequest.js +53 -0
  81. package/dist/models/index.d.ts +13 -0
  82. package/dist/models/index.js +13 -0
  83. package/package.json +1 -1
  84. package/src/apis/ChunksApi.ts +381 -0
  85. package/src/apis/DocumentVersionsApi.ts +82 -0
  86. package/src/apis/FoldersApi.ts +88 -0
  87. package/src/apis/PathPartsApi.ts +4 -10
  88. package/src/apis/index.ts +1 -0
  89. package/src/models/ChunkMetadataInput.ts +90 -0
  90. package/src/models/ChunkMetadataOutput.ts +90 -0
  91. package/src/models/ChunkResponse.ts +197 -0
  92. package/src/models/ChunkType.ts +55 -0
  93. package/src/models/CreateChunkRequest.ts +138 -0
  94. package/src/models/DocumentContentPathPart.ts +205 -0
  95. package/src/models/FolderDocumentResponse.ts +234 -0
  96. package/src/models/PaginatedResponseDocumentContentPathPart.ts +130 -0
  97. package/src/models/PaginatedResponseFolderDocumentResponse.ts +130 -0
  98. package/src/models/PasswordResetWithTokenRequest.ts +5 -14
  99. package/src/models/Polygon.ts +110 -0
  100. package/src/models/PolygonReference.ts +100 -0
  101. package/src/models/UpdateChunkContentRequest.ts +104 -0
  102. package/src/models/UpdateChunkMetadataRequest.ts +91 -0
  103. package/src/models/index.ts +13 -0
@@ -125,6 +125,50 @@ class FoldersApi extends runtime.BaseAPI {
125
125
  return yield response.value();
126
126
  });
127
127
  }
128
+ /**
129
+ * List all contents (folders and documents) under a folder. Returns enriched responses with: - Folders: basic folder metadata - Documents: full document metadata including document_type, document_origin, active_version This is the preferred way to list folder contents when you need document metadata. For generic path traversal of folders only, use GET /path-parts.
130
+ * List Folder Contents Handler
131
+ */
132
+ listFolderContentsRaw(requestParameters, initOverrides) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ if (requestParameters['folderId'] == null) {
135
+ throw new runtime.RequiredError('folderId', 'Required parameter "folderId" was null or undefined when calling listFolderContents().');
136
+ }
137
+ const queryParameters = {};
138
+ if (requestParameters['maxDepth'] != null) {
139
+ queryParameters['max_depth'] = requestParameters['maxDepth'];
140
+ }
141
+ if (requestParameters['sortOrder'] != null) {
142
+ queryParameters['sort_order'] = requestParameters['sortOrder'];
143
+ }
144
+ if (requestParameters['limit'] != null) {
145
+ queryParameters['limit'] = requestParameters['limit'];
146
+ }
147
+ if (requestParameters['offset'] != null) {
148
+ queryParameters['offset'] = requestParameters['offset'];
149
+ }
150
+ const headerParameters = {};
151
+ let urlPath = `/v1/folders/{folder_id}/contents`;
152
+ urlPath = urlPath.replace(`{${"folder_id"}}`, encodeURIComponent(String(requestParameters['folderId'])));
153
+ const response = yield this.request({
154
+ path: urlPath,
155
+ method: 'GET',
156
+ headers: headerParameters,
157
+ query: queryParameters,
158
+ }, initOverrides);
159
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedResponseFolderDocumentResponseFromJSON)(jsonValue));
160
+ });
161
+ }
162
+ /**
163
+ * List all contents (folders and documents) under a folder. Returns enriched responses with: - Folders: basic folder metadata - Documents: full document metadata including document_type, document_origin, active_version This is the preferred way to list folder contents when you need document metadata. For generic path traversal of folders only, use GET /path-parts.
164
+ * List Folder Contents Handler
165
+ */
166
+ listFolderContents(requestParameters, initOverrides) {
167
+ return __awaiter(this, void 0, void 0, function* () {
168
+ const response = yield this.listFolderContentsRaw(requestParameters, initOverrides);
169
+ return yield response.value();
170
+ });
171
+ }
128
172
  /**
129
173
  * List child folders of a parent folder. Returns only direct child folders (depth=1) of the specified parent. If parent_id is not provided, lists folders in the root folder.
130
174
  * List Folders Handler
@@ -17,7 +17,6 @@ export interface GetPathPartRequest {
17
17
  }
18
18
  export interface ListPathPartsRequest {
19
19
  parentId?: string;
20
- includeDocuments?: boolean;
21
20
  maxDepth?: number;
22
21
  sortOrder?: PathOrder;
23
22
  limit?: number;
@@ -47,10 +46,9 @@ export interface PathPartsApiInterface {
47
46
  */
48
47
  getPathPart(requestParameters: GetPathPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PathPartResponse>;
49
48
  /**
50
- * List path parts under a parent with flexible filtering and traversal. This is a generic endpoint for traversing the path hierarchy. It can return folders, documents, or both depending on the filters provided. - If parent_id is not provided, lists contents of the root folder. - If include_documents is True, includes both FOLDER and DOCUMENT types. Documents act as traversal boundaries (their children are not traversed). - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT.
49
+ * List path parts (folders) under a parent with traversal. This is a generic endpoint for traversing the folder hierarchy. It returns only FOLDER type path parts. - If parent_id is not provided, lists contents of the root folder. - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT. For listing folder contents that includes documents with enriched metadata, use GET /folders/{folder_id}/contents instead.
51
50
  * @summary List Path Parts Handler
52
51
  * @param {string} [parentId] Parent PathPart ID (defaults to root)
53
- * @param {boolean} [includeDocuments] Include documents in results (default: False, folders only)
54
52
  * @param {number} [maxDepth] Maximum depth to traverse (1 &#x3D; direct children, default: 1)
55
53
  * @param {PathOrder} [sortOrder] Sort order for results (default: LOGICAL)
56
54
  * @param {number} [limit] Number of items per page
@@ -62,7 +60,7 @@ export interface PathPartsApiInterface {
62
60
  */
63
61
  listPathPartsRaw(requestParameters: ListPathPartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponsePathPartResponse>>;
64
62
  /**
65
- * List path parts under a parent with flexible filtering and traversal. This is a generic endpoint for traversing the path hierarchy. It can return folders, documents, or both depending on the filters provided. - If parent_id is not provided, lists contents of the root folder. - If include_documents is True, includes both FOLDER and DOCUMENT types. Documents act as traversal boundaries (their children are not traversed). - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT.
63
+ * List path parts (folders) under a parent with traversal. This is a generic endpoint for traversing the folder hierarchy. It returns only FOLDER type path parts. - If parent_id is not provided, lists contents of the root folder. - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT. For listing folder contents that includes documents with enriched metadata, use GET /folders/{folder_id}/contents instead.
66
64
  * List Path Parts Handler
67
65
  */
68
66
  listPathParts(requestParameters: ListPathPartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponsePathPartResponse>;
@@ -82,12 +80,12 @@ export declare class PathPartsApi extends runtime.BaseAPI implements PathPartsAp
82
80
  */
83
81
  getPathPart(requestParameters: GetPathPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PathPartResponse>;
84
82
  /**
85
- * List path parts under a parent with flexible filtering and traversal. This is a generic endpoint for traversing the path hierarchy. It can return folders, documents, or both depending on the filters provided. - If parent_id is not provided, lists contents of the root folder. - If include_documents is True, includes both FOLDER and DOCUMENT types. Documents act as traversal boundaries (their children are not traversed). - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT.
83
+ * List path parts (folders) under a parent with traversal. This is a generic endpoint for traversing the folder hierarchy. It returns only FOLDER type path parts. - If parent_id is not provided, lists contents of the root folder. - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT. For listing folder contents that includes documents with enriched metadata, use GET /folders/{folder_id}/contents instead.
86
84
  * List Path Parts Handler
87
85
  */
88
86
  listPathPartsRaw(requestParameters: ListPathPartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponsePathPartResponse>>;
89
87
  /**
90
- * List path parts under a parent with flexible filtering and traversal. This is a generic endpoint for traversing the path hierarchy. It can return folders, documents, or both depending on the filters provided. - If parent_id is not provided, lists contents of the root folder. - If include_documents is True, includes both FOLDER and DOCUMENT types. Documents act as traversal boundaries (their children are not traversed). - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT.
88
+ * List path parts (folders) under a parent with traversal. This is a generic endpoint for traversing the folder hierarchy. It returns only FOLDER type path parts. - If parent_id is not provided, lists contents of the root folder. - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT. For listing folder contents that includes documents with enriched metadata, use GET /folders/{folder_id}/contents instead.
91
89
  * List Path Parts Handler
92
90
  */
93
91
  listPathParts(requestParameters?: ListPathPartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponsePathPartResponse>;
@@ -62,7 +62,7 @@ class PathPartsApi extends runtime.BaseAPI {
62
62
  });
63
63
  }
64
64
  /**
65
- * List path parts under a parent with flexible filtering and traversal. This is a generic endpoint for traversing the path hierarchy. It can return folders, documents, or both depending on the filters provided. - If parent_id is not provided, lists contents of the root folder. - If include_documents is True, includes both FOLDER and DOCUMENT types. Documents act as traversal boundaries (their children are not traversed). - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT.
65
+ * List path parts (folders) under a parent with traversal. This is a generic endpoint for traversing the folder hierarchy. It returns only FOLDER type path parts. - If parent_id is not provided, lists contents of the root folder. - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT. For listing folder contents that includes documents with enriched metadata, use GET /folders/{folder_id}/contents instead.
66
66
  * List Path Parts Handler
67
67
  */
68
68
  listPathPartsRaw(requestParameters, initOverrides) {
@@ -71,9 +71,6 @@ class PathPartsApi extends runtime.BaseAPI {
71
71
  if (requestParameters['parentId'] != null) {
72
72
  queryParameters['parent_id'] = requestParameters['parentId'];
73
73
  }
74
- if (requestParameters['includeDocuments'] != null) {
75
- queryParameters['include_documents'] = requestParameters['includeDocuments'];
76
- }
77
74
  if (requestParameters['maxDepth'] != null) {
78
75
  queryParameters['max_depth'] = requestParameters['maxDepth'];
79
76
  }
@@ -98,7 +95,7 @@ class PathPartsApi extends runtime.BaseAPI {
98
95
  });
99
96
  }
100
97
  /**
101
- * List path parts under a parent with flexible filtering and traversal. This is a generic endpoint for traversing the path hierarchy. It can return folders, documents, or both depending on the filters provided. - If parent_id is not provided, lists contents of the root folder. - If include_documents is True, includes both FOLDER and DOCUMENT types. Documents act as traversal boundaries (their children are not traversed). - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT.
98
+ * List path parts (folders) under a parent with traversal. This is a generic endpoint for traversing the folder hierarchy. It returns only FOLDER type path parts. - If parent_id is not provided, lists contents of the root folder. - max_depth controls how deep to traverse (1 = direct children only). - sort_order controls the ordering: LOGICAL (linked-list), NAME, UPDATED_AT, CREATED_AT. For listing folder contents that includes documents with enriched metadata, use GET /folders/{folder_id}/contents instead.
102
99
  * List Path Parts Handler
103
100
  */
104
101
  listPathParts() {
@@ -1,4 +1,5 @@
1
1
  export * from './AuthApi';
2
+ export * from './ChunksApi';
2
3
  export * from './DefaultApi';
3
4
  export * from './DocumentVersionsApi';
4
5
  export * from './DocumentsApi';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /* tslint:disable */
18
18
  /* eslint-disable */
19
19
  __exportStar(require("./AuthApi"), exports);
20
+ __exportStar(require("./ChunksApi"), exports);
20
21
  __exportStar(require("./DefaultApi"), exports);
21
22
  __exportStar(require("./DocumentVersionsApi"), exports);
22
23
  __exportStar(require("./DocumentsApi"), exports);
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * Knowledge Stack backend API for authentication and knowledge management
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import type { ChunkResponse, CreateChunkRequest, UpdateChunkContentRequest, UpdateChunkMetadataRequest } from '../models/index';
14
+ export interface CreateChunkOperationRequest {
15
+ createChunkRequest: CreateChunkRequest;
16
+ ksUat?: string;
17
+ }
18
+ export interface DeleteChunkRequest {
19
+ chunkId: string;
20
+ ksUat?: string;
21
+ }
22
+ export interface GetChunkRequest {
23
+ chunkId: string;
24
+ ksUat?: string;
25
+ }
26
+ export interface UpdateChunkContentOperationRequest {
27
+ chunkId: string;
28
+ updateChunkContentRequest: UpdateChunkContentRequest;
29
+ ksUat?: string;
30
+ }
31
+ export interface UpdateChunkMetadataOperationRequest {
32
+ chunkId: string;
33
+ updateChunkMetadataRequest: UpdateChunkMetadataRequest;
34
+ ksUat?: string;
35
+ }
36
+ /**
37
+ * ChunksApi - interface
38
+ *
39
+ * @export
40
+ * @interface ChunksApiInterface
41
+ */
42
+ export interface ChunksApiInterface {
43
+ /**
44
+ * Create a new chunk with content. The chunk is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). Content is deduplicated by SHA256 hash.
45
+ * @summary Create Chunk Handler
46
+ * @param {CreateChunkRequest} createChunkRequest
47
+ * @param {string} [ksUat]
48
+ * @param {*} [options] Override http request option.
49
+ * @throws {RequiredError}
50
+ * @memberof ChunksApiInterface
51
+ */
52
+ createChunkRaw(requestParameters: CreateChunkOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChunkResponse>>;
53
+ /**
54
+ * Create a new chunk with content. The chunk is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). Content is deduplicated by SHA256 hash.
55
+ * Create Chunk Handler
56
+ */
57
+ createChunk(requestParameters: CreateChunkOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
58
+ /**
59
+ * Delete a chunk. The chunk is deleted via its PathPart (cascading delete). The associated ChunkContent may remain if shared by other chunks.
60
+ * @summary Delete Chunk Handler
61
+ * @param {string} chunkId
62
+ * @param {string} [ksUat]
63
+ * @param {*} [options] Override http request option.
64
+ * @throws {RequiredError}
65
+ * @memberof ChunksApiInterface
66
+ */
67
+ deleteChunkRaw(requestParameters: DeleteChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
68
+ /**
69
+ * Delete a chunk. The chunk is deleted via its PathPart (cascading delete). The associated ChunkContent may remain if shared by other chunks.
70
+ * Delete Chunk Handler
71
+ */
72
+ deleteChunk(requestParameters: DeleteChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
73
+ /**
74
+ * Get a chunk by its ID, including content.
75
+ * @summary Get Chunk Handler
76
+ * @param {string} chunkId
77
+ * @param {string} [ksUat]
78
+ * @param {*} [options] Override http request option.
79
+ * @throws {RequiredError}
80
+ * @memberof ChunksApiInterface
81
+ */
82
+ getChunkRaw(requestParameters: GetChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChunkResponse>>;
83
+ /**
84
+ * Get a chunk by its ID, including content.
85
+ * Get Chunk Handler
86
+ */
87
+ getChunk(requestParameters: GetChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
88
+ /**
89
+ * Update chunk content by creating a new content row. The old content row is preserved (not deleted). If the new content matches an existing content hash, it will be deduplicated.
90
+ * @summary Update Chunk Content Handler
91
+ * @param {string} chunkId
92
+ * @param {UpdateChunkContentRequest} updateChunkContentRequest
93
+ * @param {string} [ksUat]
94
+ * @param {*} [options] Override http request option.
95
+ * @throws {RequiredError}
96
+ * @memberof ChunksApiInterface
97
+ */
98
+ updateChunkContentRaw(requestParameters: UpdateChunkContentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChunkResponse>>;
99
+ /**
100
+ * Update chunk content by creating a new content row. The old content row is preserved (not deleted). If the new content matches an existing content hash, it will be deduplicated.
101
+ * Update Chunk Content Handler
102
+ */
103
+ updateChunkContent(requestParameters: UpdateChunkContentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
104
+ /**
105
+ * Update chunk metadata by merging with existing metadata. The provided metadata is shallow-merged into the existing chunk_metadata.
106
+ * @summary Update Chunk Metadata Handler
107
+ * @param {string} chunkId
108
+ * @param {UpdateChunkMetadataRequest} updateChunkMetadataRequest
109
+ * @param {string} [ksUat]
110
+ * @param {*} [options] Override http request option.
111
+ * @throws {RequiredError}
112
+ * @memberof ChunksApiInterface
113
+ */
114
+ updateChunkMetadataRaw(requestParameters: UpdateChunkMetadataOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChunkResponse>>;
115
+ /**
116
+ * Update chunk metadata by merging with existing metadata. The provided metadata is shallow-merged into the existing chunk_metadata.
117
+ * Update Chunk Metadata Handler
118
+ */
119
+ updateChunkMetadata(requestParameters: UpdateChunkMetadataOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
120
+ }
121
+ /**
122
+ *
123
+ */
124
+ export declare class ChunksApi extends runtime.BaseAPI implements ChunksApiInterface {
125
+ /**
126
+ * Create a new chunk with content. The chunk is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). Content is deduplicated by SHA256 hash.
127
+ * Create Chunk Handler
128
+ */
129
+ createChunkRaw(requestParameters: CreateChunkOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChunkResponse>>;
130
+ /**
131
+ * Create a new chunk with content. The chunk is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). Content is deduplicated by SHA256 hash.
132
+ * Create Chunk Handler
133
+ */
134
+ createChunk(requestParameters: CreateChunkOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
135
+ /**
136
+ * Delete a chunk. The chunk is deleted via its PathPart (cascading delete). The associated ChunkContent may remain if shared by other chunks.
137
+ * Delete Chunk Handler
138
+ */
139
+ deleteChunkRaw(requestParameters: DeleteChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
140
+ /**
141
+ * Delete a chunk. The chunk is deleted via its PathPart (cascading delete). The associated ChunkContent may remain if shared by other chunks.
142
+ * Delete Chunk Handler
143
+ */
144
+ deleteChunk(requestParameters: DeleteChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
145
+ /**
146
+ * Get a chunk by its ID, including content.
147
+ * Get Chunk Handler
148
+ */
149
+ getChunkRaw(requestParameters: GetChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChunkResponse>>;
150
+ /**
151
+ * Get a chunk by its ID, including content.
152
+ * Get Chunk Handler
153
+ */
154
+ getChunk(requestParameters: GetChunkRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
155
+ /**
156
+ * Update chunk content by creating a new content row. The old content row is preserved (not deleted). If the new content matches an existing content hash, it will be deduplicated.
157
+ * Update Chunk Content Handler
158
+ */
159
+ updateChunkContentRaw(requestParameters: UpdateChunkContentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChunkResponse>>;
160
+ /**
161
+ * Update chunk content by creating a new content row. The old content row is preserved (not deleted). If the new content matches an existing content hash, it will be deduplicated.
162
+ * Update Chunk Content Handler
163
+ */
164
+ updateChunkContent(requestParameters: UpdateChunkContentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
165
+ /**
166
+ * Update chunk metadata by merging with existing metadata. The provided metadata is shallow-merged into the existing chunk_metadata.
167
+ * Update Chunk Metadata Handler
168
+ */
169
+ updateChunkMetadataRaw(requestParameters: UpdateChunkMetadataOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ChunkResponse>>;
170
+ /**
171
+ * Update chunk metadata by merging with existing metadata. The provided metadata is shallow-merged into the existing chunk_metadata.
172
+ * Update Chunk Metadata Handler
173
+ */
174
+ updateChunkMetadata(requestParameters: UpdateChunkMetadataOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ChunkResponse>;
175
+ }
@@ -0,0 +1,199 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ import * as runtime from '../runtime';
24
+ import { ChunkResponseFromJSON, CreateChunkRequestToJSON, UpdateChunkContentRequestToJSON, UpdateChunkMetadataRequestToJSON, } from '../models/index';
25
+ /**
26
+ *
27
+ */
28
+ export class ChunksApi extends runtime.BaseAPI {
29
+ /**
30
+ * Create a new chunk with content. The chunk is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). Content is deduplicated by SHA256 hash.
31
+ * Create Chunk Handler
32
+ */
33
+ createChunkRaw(requestParameters, initOverrides) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ if (requestParameters['createChunkRequest'] == null) {
36
+ throw new runtime.RequiredError('createChunkRequest', 'Required parameter "createChunkRequest" was null or undefined when calling createChunk().');
37
+ }
38
+ const queryParameters = {};
39
+ const headerParameters = {};
40
+ headerParameters['Content-Type'] = 'application/json';
41
+ let urlPath = `/v1/chunks`;
42
+ const response = yield this.request({
43
+ path: urlPath,
44
+ method: 'POST',
45
+ headers: headerParameters,
46
+ query: queryParameters,
47
+ body: CreateChunkRequestToJSON(requestParameters['createChunkRequest']),
48
+ }, initOverrides);
49
+ return new runtime.JSONApiResponse(response, (jsonValue) => ChunkResponseFromJSON(jsonValue));
50
+ });
51
+ }
52
+ /**
53
+ * Create a new chunk with content. The chunk is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). Content is deduplicated by SHA256 hash.
54
+ * Create Chunk Handler
55
+ */
56
+ createChunk(requestParameters, initOverrides) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const response = yield this.createChunkRaw(requestParameters, initOverrides);
59
+ return yield response.value();
60
+ });
61
+ }
62
+ /**
63
+ * Delete a chunk. The chunk is deleted via its PathPart (cascading delete). The associated ChunkContent may remain if shared by other chunks.
64
+ * Delete Chunk Handler
65
+ */
66
+ deleteChunkRaw(requestParameters, initOverrides) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ if (requestParameters['chunkId'] == null) {
69
+ throw new runtime.RequiredError('chunkId', 'Required parameter "chunkId" was null or undefined when calling deleteChunk().');
70
+ }
71
+ const queryParameters = {};
72
+ const headerParameters = {};
73
+ let urlPath = `/v1/chunks/{chunk_id}`;
74
+ urlPath = urlPath.replace(`{${"chunk_id"}}`, encodeURIComponent(String(requestParameters['chunkId'])));
75
+ const response = yield this.request({
76
+ path: urlPath,
77
+ method: 'DELETE',
78
+ headers: headerParameters,
79
+ query: queryParameters,
80
+ }, initOverrides);
81
+ return new runtime.VoidApiResponse(response);
82
+ });
83
+ }
84
+ /**
85
+ * Delete a chunk. The chunk is deleted via its PathPart (cascading delete). The associated ChunkContent may remain if shared by other chunks.
86
+ * Delete Chunk Handler
87
+ */
88
+ deleteChunk(requestParameters, initOverrides) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ yield this.deleteChunkRaw(requestParameters, initOverrides);
91
+ });
92
+ }
93
+ /**
94
+ * Get a chunk by its ID, including content.
95
+ * Get Chunk Handler
96
+ */
97
+ getChunkRaw(requestParameters, initOverrides) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ if (requestParameters['chunkId'] == null) {
100
+ throw new runtime.RequiredError('chunkId', 'Required parameter "chunkId" was null or undefined when calling getChunk().');
101
+ }
102
+ const queryParameters = {};
103
+ const headerParameters = {};
104
+ let urlPath = `/v1/chunks/{chunk_id}`;
105
+ urlPath = urlPath.replace(`{${"chunk_id"}}`, encodeURIComponent(String(requestParameters['chunkId'])));
106
+ const response = yield this.request({
107
+ path: urlPath,
108
+ method: 'GET',
109
+ headers: headerParameters,
110
+ query: queryParameters,
111
+ }, initOverrides);
112
+ return new runtime.JSONApiResponse(response, (jsonValue) => ChunkResponseFromJSON(jsonValue));
113
+ });
114
+ }
115
+ /**
116
+ * Get a chunk by its ID, including content.
117
+ * Get Chunk Handler
118
+ */
119
+ getChunk(requestParameters, initOverrides) {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ const response = yield this.getChunkRaw(requestParameters, initOverrides);
122
+ return yield response.value();
123
+ });
124
+ }
125
+ /**
126
+ * Update chunk content by creating a new content row. The old content row is preserved (not deleted). If the new content matches an existing content hash, it will be deduplicated.
127
+ * Update Chunk Content Handler
128
+ */
129
+ updateChunkContentRaw(requestParameters, initOverrides) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ if (requestParameters['chunkId'] == null) {
132
+ throw new runtime.RequiredError('chunkId', 'Required parameter "chunkId" was null or undefined when calling updateChunkContent().');
133
+ }
134
+ if (requestParameters['updateChunkContentRequest'] == null) {
135
+ throw new runtime.RequiredError('updateChunkContentRequest', 'Required parameter "updateChunkContentRequest" was null or undefined when calling updateChunkContent().');
136
+ }
137
+ const queryParameters = {};
138
+ const headerParameters = {};
139
+ headerParameters['Content-Type'] = 'application/json';
140
+ let urlPath = `/v1/chunks/{chunk_id}/content`;
141
+ urlPath = urlPath.replace(`{${"chunk_id"}}`, encodeURIComponent(String(requestParameters['chunkId'])));
142
+ const response = yield this.request({
143
+ path: urlPath,
144
+ method: 'PATCH',
145
+ headers: headerParameters,
146
+ query: queryParameters,
147
+ body: UpdateChunkContentRequestToJSON(requestParameters['updateChunkContentRequest']),
148
+ }, initOverrides);
149
+ return new runtime.JSONApiResponse(response, (jsonValue) => ChunkResponseFromJSON(jsonValue));
150
+ });
151
+ }
152
+ /**
153
+ * Update chunk content by creating a new content row. The old content row is preserved (not deleted). If the new content matches an existing content hash, it will be deduplicated.
154
+ * Update Chunk Content Handler
155
+ */
156
+ updateChunkContent(requestParameters, initOverrides) {
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ const response = yield this.updateChunkContentRaw(requestParameters, initOverrides);
159
+ return yield response.value();
160
+ });
161
+ }
162
+ /**
163
+ * Update chunk metadata by merging with existing metadata. The provided metadata is shallow-merged into the existing chunk_metadata.
164
+ * Update Chunk Metadata Handler
165
+ */
166
+ updateChunkMetadataRaw(requestParameters, initOverrides) {
167
+ return __awaiter(this, void 0, void 0, function* () {
168
+ if (requestParameters['chunkId'] == null) {
169
+ throw new runtime.RequiredError('chunkId', 'Required parameter "chunkId" was null or undefined when calling updateChunkMetadata().');
170
+ }
171
+ if (requestParameters['updateChunkMetadataRequest'] == null) {
172
+ throw new runtime.RequiredError('updateChunkMetadataRequest', 'Required parameter "updateChunkMetadataRequest" was null or undefined when calling updateChunkMetadata().');
173
+ }
174
+ const queryParameters = {};
175
+ const headerParameters = {};
176
+ headerParameters['Content-Type'] = 'application/json';
177
+ let urlPath = `/v1/chunks/{chunk_id}/metadata`;
178
+ urlPath = urlPath.replace(`{${"chunk_id"}}`, encodeURIComponent(String(requestParameters['chunkId'])));
179
+ const response = yield this.request({
180
+ path: urlPath,
181
+ method: 'PATCH',
182
+ headers: headerParameters,
183
+ query: queryParameters,
184
+ body: UpdateChunkMetadataRequestToJSON(requestParameters['updateChunkMetadataRequest']),
185
+ }, initOverrides);
186
+ return new runtime.JSONApiResponse(response, (jsonValue) => ChunkResponseFromJSON(jsonValue));
187
+ });
188
+ }
189
+ /**
190
+ * Update chunk metadata by merging with existing metadata. The provided metadata is shallow-merged into the existing chunk_metadata.
191
+ * Update Chunk Metadata Handler
192
+ */
193
+ updateChunkMetadata(requestParameters, initOverrides) {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ const response = yield this.updateChunkMetadataRaw(requestParameters, initOverrides);
196
+ return yield response.value();
197
+ });
198
+ }
199
+ }
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { DocumentVersionResponse, PaginatedResponseDocumentVersionResponse } from '../models/index';
13
+ import type { DocumentVersionResponse, PaginatedResponseDocumentContentPathPart, PaginatedResponseDocumentVersionResponse } from '../models/index';
14
14
  export interface CreateDocumentVersionRequest {
15
15
  documentId: string;
16
16
  ksUat?: string;
@@ -23,6 +23,13 @@ export interface GetDocumentVersionRequest {
23
23
  versionId: string;
24
24
  ksUat?: string;
25
25
  }
26
+ export interface GetDocumentVersionContentsRequest {
27
+ versionId: string;
28
+ sectionId?: string;
29
+ limit?: number;
30
+ offset?: number;
31
+ ksUat?: string;
32
+ }
26
33
  export interface ListDocumentVersionsRequest {
27
34
  documentId: string;
28
35
  limit?: number;
@@ -81,6 +88,24 @@ export interface DocumentVersionsApiInterface {
81
88
  * Get Document Version Handler
82
89
  */
83
90
  getDocumentVersion(requestParameters: GetDocumentVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentVersionResponse>;
91
+ /**
92
+ * List all sections and chunks for a document version in depth-first logical order. Returns a flat paginated list that can be used to reconstruct the section/chunk hierarchy with content. Sections include page_number; chunks include content, chunk_type, and chunk_metadata.
93
+ * @summary Get Document Version Contents Handler
94
+ * @param {string} versionId DocumentVersion ID
95
+ * @param {string} [sectionId] Optional section ID to scope traversal to a subtree
96
+ * @param {number} [limit] Number of items per page
97
+ * @param {number} [offset] Number of items to skip
98
+ * @param {string} [ksUat]
99
+ * @param {*} [options] Override http request option.
100
+ * @throws {RequiredError}
101
+ * @memberof DocumentVersionsApiInterface
102
+ */
103
+ getDocumentVersionContentsRaw(requestParameters: GetDocumentVersionContentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseDocumentContentPathPart>>;
104
+ /**
105
+ * List all sections and chunks for a document version in depth-first logical order. Returns a flat paginated list that can be used to reconstruct the section/chunk hierarchy with content. Sections include page_number; chunks include content, chunk_type, and chunk_metadata.
106
+ * Get Document Version Contents Handler
107
+ */
108
+ getDocumentVersionContents(requestParameters: GetDocumentVersionContentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentContentPathPart>;
84
109
  /**
85
110
  * List all versions for a document. Returns versions ordered by version number ascending (v0, v1, v2...).
86
111
  * @summary List Document Versions Handler
@@ -133,6 +158,16 @@ export declare class DocumentVersionsApi extends runtime.BaseAPI implements Docu
133
158
  * Get Document Version Handler
134
159
  */
135
160
  getDocumentVersion(requestParameters: GetDocumentVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentVersionResponse>;
161
+ /**
162
+ * List all sections and chunks for a document version in depth-first logical order. Returns a flat paginated list that can be used to reconstruct the section/chunk hierarchy with content. Sections include page_number; chunks include content, chunk_type, and chunk_metadata.
163
+ * Get Document Version Contents Handler
164
+ */
165
+ getDocumentVersionContentsRaw(requestParameters: GetDocumentVersionContentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseDocumentContentPathPart>>;
166
+ /**
167
+ * List all sections and chunks for a document version in depth-first logical order. Returns a flat paginated list that can be used to reconstruct the section/chunk hierarchy with content. Sections include page_number; chunks include content, chunk_type, and chunk_metadata.
168
+ * Get Document Version Contents Handler
169
+ */
170
+ getDocumentVersionContents(requestParameters: GetDocumentVersionContentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentContentPathPart>;
136
171
  /**
137
172
  * List all versions for a document. Returns versions ordered by version number ascending (v0, v1, v2...).
138
173
  * List Document Versions Handler
@@ -21,7 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  });
22
22
  };
23
23
  import * as runtime from '../runtime';
24
- import { DocumentVersionResponseFromJSON, PaginatedResponseDocumentVersionResponseFromJSON, } from '../models/index';
24
+ import { DocumentVersionResponseFromJSON, PaginatedResponseDocumentContentPathPartFromJSON, PaginatedResponseDocumentVersionResponseFromJSON, } from '../models/index';
25
25
  /**
26
26
  *
27
27
  */
@@ -121,6 +121,47 @@ export class DocumentVersionsApi extends runtime.BaseAPI {
121
121
  return yield response.value();
122
122
  });
123
123
  }
124
+ /**
125
+ * List all sections and chunks for a document version in depth-first logical order. Returns a flat paginated list that can be used to reconstruct the section/chunk hierarchy with content. Sections include page_number; chunks include content, chunk_type, and chunk_metadata.
126
+ * Get Document Version Contents Handler
127
+ */
128
+ getDocumentVersionContentsRaw(requestParameters, initOverrides) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ if (requestParameters['versionId'] == null) {
131
+ throw new runtime.RequiredError('versionId', 'Required parameter "versionId" was null or undefined when calling getDocumentVersionContents().');
132
+ }
133
+ const queryParameters = {};
134
+ if (requestParameters['sectionId'] != null) {
135
+ queryParameters['section_id'] = requestParameters['sectionId'];
136
+ }
137
+ if (requestParameters['limit'] != null) {
138
+ queryParameters['limit'] = requestParameters['limit'];
139
+ }
140
+ if (requestParameters['offset'] != null) {
141
+ queryParameters['offset'] = requestParameters['offset'];
142
+ }
143
+ const headerParameters = {};
144
+ let urlPath = `/v1/document_versions/{version_id}/contents`;
145
+ urlPath = urlPath.replace(`{${"version_id"}}`, encodeURIComponent(String(requestParameters['versionId'])));
146
+ const response = yield this.request({
147
+ path: urlPath,
148
+ method: 'GET',
149
+ headers: headerParameters,
150
+ query: queryParameters,
151
+ }, initOverrides);
152
+ return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResponseDocumentContentPathPartFromJSON(jsonValue));
153
+ });
154
+ }
155
+ /**
156
+ * List all sections and chunks for a document version in depth-first logical order. Returns a flat paginated list that can be used to reconstruct the section/chunk hierarchy with content. Sections include page_number; chunks include content, chunk_type, and chunk_metadata.
157
+ * Get Document Version Contents Handler
158
+ */
159
+ getDocumentVersionContents(requestParameters, initOverrides) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ const response = yield this.getDocumentVersionContentsRaw(requestParameters, initOverrides);
162
+ return yield response.value();
163
+ });
164
+ }
124
165
  /**
125
166
  * List all versions for a document. Returns versions ordered by version number ascending (v0, v1, v2...).
126
167
  * List Document Versions Handler