@knowledge-stack/ksapi 1.4.0 → 1.6.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.
- package/.openapi-generator/FILES +10 -0
- package/README.md +2 -2
- package/dist/apis/DocumentVersionsApi.d.ts +146 -0
- package/dist/apis/DocumentVersionsApi.js +168 -0
- package/dist/apis/DocumentsApi.d.ts +179 -0
- package/dist/apis/DocumentsApi.js +206 -0
- package/dist/apis/index.d.ts +2 -0
- package/dist/apis/index.js +2 -0
- package/dist/esm/apis/DocumentVersionsApi.d.ts +146 -0
- package/dist/esm/apis/DocumentVersionsApi.js +164 -0
- package/dist/esm/apis/DocumentsApi.d.ts +179 -0
- package/dist/esm/apis/DocumentsApi.js +202 -0
- package/dist/esm/apis/index.d.ts +2 -0
- package/dist/esm/apis/index.js +2 -0
- package/dist/esm/models/CreateDocumentRequest.d.ts +67 -0
- package/dist/esm/models/CreateDocumentRequest.js +63 -0
- package/dist/esm/models/DocumentOrigin.d.ts +25 -0
- package/dist/esm/models/DocumentOrigin.js +43 -0
- package/dist/esm/models/DocumentResponse.d.ts +110 -0
- package/dist/esm/models/DocumentResponse.js +87 -0
- package/dist/esm/models/DocumentType.d.ts +25 -0
- package/dist/esm/models/DocumentType.js +43 -0
- package/dist/esm/models/DocumentVersionResponse.d.ts +92 -0
- package/dist/esm/models/DocumentVersionResponse.js +72 -0
- package/dist/esm/models/PaginatedResponseDocumentResponse.d.ts +66 -0
- package/dist/esm/models/PaginatedResponseDocumentResponse.js +70 -0
- package/dist/esm/models/PaginatedResponseDocumentVersionResponse.d.ts +66 -0
- package/dist/esm/models/PaginatedResponseDocumentVersionResponse.js +70 -0
- package/dist/esm/models/UpdateDocumentRequest.d.ts +59 -0
- package/dist/esm/models/UpdateDocumentRequest.js +51 -0
- package/dist/esm/models/index.d.ts +8 -0
- package/dist/esm/models/index.js +8 -0
- package/dist/models/CreateDocumentRequest.d.ts +67 -0
- package/dist/models/CreateDocumentRequest.js +71 -0
- package/dist/models/DocumentOrigin.d.ts +25 -0
- package/dist/models/DocumentOrigin.js +51 -0
- package/dist/models/DocumentResponse.d.ts +110 -0
- package/dist/models/DocumentResponse.js +95 -0
- package/dist/models/DocumentType.d.ts +25 -0
- package/dist/models/DocumentType.js +51 -0
- package/dist/models/DocumentVersionResponse.d.ts +92 -0
- package/dist/models/DocumentVersionResponse.js +80 -0
- package/dist/models/PaginatedResponseDocumentResponse.d.ts +66 -0
- package/dist/models/PaginatedResponseDocumentResponse.js +78 -0
- package/dist/models/PaginatedResponseDocumentVersionResponse.d.ts +66 -0
- package/dist/models/PaginatedResponseDocumentVersionResponse.js +78 -0
- package/dist/models/UpdateDocumentRequest.d.ts +59 -0
- package/dist/models/UpdateDocumentRequest.js +59 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +8 -0
- package/package.json +1 -1
- package/src/apis/DocumentVersionsApi.ts +303 -0
- package/src/apis/DocumentsApi.ts +386 -0
- package/src/apis/index.ts +2 -0
- package/src/models/CreateDocumentRequest.ts +131 -0
- package/src/models/DocumentOrigin.ts +53 -0
- package/src/models/DocumentResponse.ts +197 -0
- package/src/models/DocumentType.ts +53 -0
- package/src/models/DocumentVersionResponse.ts +149 -0
- package/src/models/PaginatedResponseDocumentResponse.ts +130 -0
- package/src/models/PaginatedResponseDocumentVersionResponse.ts +130 -0
- package/src/models/UpdateDocumentRequest.ts +102 -0
- package/src/models/index.ts +8 -0
|
@@ -0,0 +1,179 @@
|
|
|
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 { CreateDocumentRequest, DocumentResponse, PaginatedResponseDocumentResponse, PathOrder, UpdateDocumentRequest } from '../models/index';
|
|
14
|
+
export interface CreateDocumentOperationRequest {
|
|
15
|
+
createDocumentRequest: CreateDocumentRequest;
|
|
16
|
+
ksUat?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DeleteDocumentRequest {
|
|
19
|
+
documentId: string;
|
|
20
|
+
ksUat?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface GetDocumentRequest {
|
|
23
|
+
documentId: string;
|
|
24
|
+
ksUat?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ListDocumentsRequest {
|
|
27
|
+
parentId?: string;
|
|
28
|
+
sortOrder?: PathOrder;
|
|
29
|
+
limit?: number;
|
|
30
|
+
offset?: number;
|
|
31
|
+
ksUat?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface UpdateDocumentOperationRequest {
|
|
34
|
+
documentId: string;
|
|
35
|
+
updateDocumentRequest: UpdateDocumentRequest;
|
|
36
|
+
ksUat?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* DocumentsApi - interface
|
|
40
|
+
*
|
|
41
|
+
* @export
|
|
42
|
+
* @interface DocumentsApiInterface
|
|
43
|
+
*/
|
|
44
|
+
export interface DocumentsApiInterface {
|
|
45
|
+
/**
|
|
46
|
+
* Create a new document with initial v0 version. The document is created as a child of the specified parent folder. An initial version (v0) is automatically created.
|
|
47
|
+
* @summary Create Document Handler
|
|
48
|
+
* @param {CreateDocumentRequest} createDocumentRequest
|
|
49
|
+
* @param {string} [ksUat]
|
|
50
|
+
* @param {*} [options] Override http request option.
|
|
51
|
+
* @throws {RequiredError}
|
|
52
|
+
* @memberof DocumentsApiInterface
|
|
53
|
+
*/
|
|
54
|
+
createDocumentRaw(requestParameters: CreateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
55
|
+
/**
|
|
56
|
+
* Create a new document with initial v0 version. The document is created as a child of the specified parent folder. An initial version (v0) is automatically created.
|
|
57
|
+
* Create Document Handler
|
|
58
|
+
*/
|
|
59
|
+
createDocument(requestParameters: CreateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
62
|
+
* @summary Delete Document Handler
|
|
63
|
+
* @param {string} documentId
|
|
64
|
+
* @param {string} [ksUat]
|
|
65
|
+
* @param {*} [options] Override http request option.
|
|
66
|
+
* @throws {RequiredError}
|
|
67
|
+
* @memberof DocumentsApiInterface
|
|
68
|
+
*/
|
|
69
|
+
deleteDocumentRaw(requestParameters: DeleteDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
70
|
+
/**
|
|
71
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
72
|
+
* Delete Document Handler
|
|
73
|
+
*/
|
|
74
|
+
deleteDocument(requestParameters: DeleteDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Get a document by its document ID.
|
|
77
|
+
* @summary Get Document Handler
|
|
78
|
+
* @param {string} documentId
|
|
79
|
+
* @param {string} [ksUat]
|
|
80
|
+
* @param {*} [options] Override http request option.
|
|
81
|
+
* @throws {RequiredError}
|
|
82
|
+
* @memberof DocumentsApiInterface
|
|
83
|
+
*/
|
|
84
|
+
getDocumentRaw(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
85
|
+
/**
|
|
86
|
+
* Get a document by its document ID.
|
|
87
|
+
* Get Document Handler
|
|
88
|
+
*/
|
|
89
|
+
getDocument(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
|
|
92
|
+
* @summary List Documents Handler
|
|
93
|
+
* @param {string} [parentId] Parent folder PathPart ID (defaults to root)
|
|
94
|
+
* @param {PathOrder} [sortOrder] Sort order for results (default: LOGICAL)
|
|
95
|
+
* @param {number} [limit] Number of items per page
|
|
96
|
+
* @param {number} [offset] Number of items to skip
|
|
97
|
+
* @param {string} [ksUat]
|
|
98
|
+
* @param {*} [options] Override http request option.
|
|
99
|
+
* @throws {RequiredError}
|
|
100
|
+
* @memberof DocumentsApiInterface
|
|
101
|
+
*/
|
|
102
|
+
listDocumentsRaw(requestParameters: ListDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseDocumentResponse>>;
|
|
103
|
+
/**
|
|
104
|
+
* List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
|
|
105
|
+
* List Documents Handler
|
|
106
|
+
*/
|
|
107
|
+
listDocuments(requestParameters: ListDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Update a document (rename, move, and/or change active version). To rename: provide `name` field. To move: provide `parent_id` field. To change active version: provide `active_version_id` field. All can be done in a single request.
|
|
110
|
+
* @summary Update Document Handler
|
|
111
|
+
* @param {string} documentId
|
|
112
|
+
* @param {UpdateDocumentRequest} updateDocumentRequest
|
|
113
|
+
* @param {string} [ksUat]
|
|
114
|
+
* @param {*} [options] Override http request option.
|
|
115
|
+
* @throws {RequiredError}
|
|
116
|
+
* @memberof DocumentsApiInterface
|
|
117
|
+
*/
|
|
118
|
+
updateDocumentRaw(requestParameters: UpdateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
119
|
+
/**
|
|
120
|
+
* Update a document (rename, move, and/or change active version). To rename: provide `name` field. To move: provide `parent_id` field. To change active version: provide `active_version_id` field. All can be done in a single request.
|
|
121
|
+
* Update Document Handler
|
|
122
|
+
*/
|
|
123
|
+
updateDocument(requestParameters: UpdateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
*
|
|
127
|
+
*/
|
|
128
|
+
export declare class DocumentsApi extends runtime.BaseAPI implements DocumentsApiInterface {
|
|
129
|
+
/**
|
|
130
|
+
* Create a new document with initial v0 version. The document is created as a child of the specified parent folder. An initial version (v0) is automatically created.
|
|
131
|
+
* Create Document Handler
|
|
132
|
+
*/
|
|
133
|
+
createDocumentRaw(requestParameters: CreateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
134
|
+
/**
|
|
135
|
+
* Create a new document with initial v0 version. The document is created as a child of the specified parent folder. An initial version (v0) is automatically created.
|
|
136
|
+
* Create Document Handler
|
|
137
|
+
*/
|
|
138
|
+
createDocument(requestParameters: CreateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
139
|
+
/**
|
|
140
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
141
|
+
* Delete Document Handler
|
|
142
|
+
*/
|
|
143
|
+
deleteDocumentRaw(requestParameters: DeleteDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
144
|
+
/**
|
|
145
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
146
|
+
* Delete Document Handler
|
|
147
|
+
*/
|
|
148
|
+
deleteDocument(requestParameters: DeleteDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Get a document by its document ID.
|
|
151
|
+
* Get Document Handler
|
|
152
|
+
*/
|
|
153
|
+
getDocumentRaw(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
154
|
+
/**
|
|
155
|
+
* Get a document by its document ID.
|
|
156
|
+
* Get Document Handler
|
|
157
|
+
*/
|
|
158
|
+
getDocument(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
|
|
161
|
+
* List Documents Handler
|
|
162
|
+
*/
|
|
163
|
+
listDocumentsRaw(requestParameters: ListDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseDocumentResponse>>;
|
|
164
|
+
/**
|
|
165
|
+
* List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
|
|
166
|
+
* List Documents Handler
|
|
167
|
+
*/
|
|
168
|
+
listDocuments(requestParameters?: ListDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentResponse>;
|
|
169
|
+
/**
|
|
170
|
+
* Update a document (rename, move, and/or change active version). To rename: provide `name` field. To move: provide `parent_id` field. To change active version: provide `active_version_id` field. All can be done in a single request.
|
|
171
|
+
* Update Document Handler
|
|
172
|
+
*/
|
|
173
|
+
updateDocumentRaw(requestParameters: UpdateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
174
|
+
/**
|
|
175
|
+
* Update a document (rename, move, and/or change active version). To rename: provide `name` field. To move: provide `parent_id` field. To change active version: provide `active_version_id` field. All can be done in a single request.
|
|
176
|
+
* Update Document Handler
|
|
177
|
+
*/
|
|
178
|
+
updateDocument(requestParameters: UpdateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
179
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
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 { CreateDocumentRequestToJSON, DocumentResponseFromJSON, PaginatedResponseDocumentResponseFromJSON, UpdateDocumentRequestToJSON, } from '../models/index';
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export class DocumentsApi extends runtime.BaseAPI {
|
|
29
|
+
/**
|
|
30
|
+
* Create a new document with initial v0 version. The document is created as a child of the specified parent folder. An initial version (v0) is automatically created.
|
|
31
|
+
* Create Document Handler
|
|
32
|
+
*/
|
|
33
|
+
createDocumentRaw(requestParameters, initOverrides) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (requestParameters['createDocumentRequest'] == null) {
|
|
36
|
+
throw new runtime.RequiredError('createDocumentRequest', 'Required parameter "createDocumentRequest" was null or undefined when calling createDocument().');
|
|
37
|
+
}
|
|
38
|
+
const queryParameters = {};
|
|
39
|
+
const headerParameters = {};
|
|
40
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
41
|
+
let urlPath = `/v1/documents`;
|
|
42
|
+
const response = yield this.request({
|
|
43
|
+
path: urlPath,
|
|
44
|
+
method: 'POST',
|
|
45
|
+
headers: headerParameters,
|
|
46
|
+
query: queryParameters,
|
|
47
|
+
body: CreateDocumentRequestToJSON(requestParameters['createDocumentRequest']),
|
|
48
|
+
}, initOverrides);
|
|
49
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DocumentResponseFromJSON(jsonValue));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a new document with initial v0 version. The document is created as a child of the specified parent folder. An initial version (v0) is automatically created.
|
|
54
|
+
* Create Document Handler
|
|
55
|
+
*/
|
|
56
|
+
createDocument(requestParameters, initOverrides) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const response = yield this.createDocumentRaw(requestParameters, initOverrides);
|
|
59
|
+
return yield response.value();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
64
|
+
* Delete Document Handler
|
|
65
|
+
*/
|
|
66
|
+
deleteDocumentRaw(requestParameters, initOverrides) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
if (requestParameters['documentId'] == null) {
|
|
69
|
+
throw new runtime.RequiredError('documentId', 'Required parameter "documentId" was null or undefined when calling deleteDocument().');
|
|
70
|
+
}
|
|
71
|
+
const queryParameters = {};
|
|
72
|
+
const headerParameters = {};
|
|
73
|
+
let urlPath = `/v1/documents/{document_id}`;
|
|
74
|
+
urlPath = urlPath.replace(`{${"document_id"}}`, encodeURIComponent(String(requestParameters['documentId'])));
|
|
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 document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
86
|
+
* Delete Document Handler
|
|
87
|
+
*/
|
|
88
|
+
deleteDocument(requestParameters, initOverrides) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
yield this.deleteDocumentRaw(requestParameters, initOverrides);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get a document by its document ID.
|
|
95
|
+
* Get Document Handler
|
|
96
|
+
*/
|
|
97
|
+
getDocumentRaw(requestParameters, initOverrides) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
if (requestParameters['documentId'] == null) {
|
|
100
|
+
throw new runtime.RequiredError('documentId', 'Required parameter "documentId" was null or undefined when calling getDocument().');
|
|
101
|
+
}
|
|
102
|
+
const queryParameters = {};
|
|
103
|
+
const headerParameters = {};
|
|
104
|
+
let urlPath = `/v1/documents/{document_id}`;
|
|
105
|
+
urlPath = urlPath.replace(`{${"document_id"}}`, encodeURIComponent(String(requestParameters['documentId'])));
|
|
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) => DocumentResponseFromJSON(jsonValue));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get a document by its document ID.
|
|
117
|
+
* Get Document Handler
|
|
118
|
+
*/
|
|
119
|
+
getDocument(requestParameters, initOverrides) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const response = yield this.getDocumentRaw(requestParameters, initOverrides);
|
|
122
|
+
return yield response.value();
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
|
|
127
|
+
* List Documents Handler
|
|
128
|
+
*/
|
|
129
|
+
listDocumentsRaw(requestParameters, initOverrides) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const queryParameters = {};
|
|
132
|
+
if (requestParameters['parentId'] != null) {
|
|
133
|
+
queryParameters['parent_id'] = requestParameters['parentId'];
|
|
134
|
+
}
|
|
135
|
+
if (requestParameters['sortOrder'] != null) {
|
|
136
|
+
queryParameters['sort_order'] = requestParameters['sortOrder'];
|
|
137
|
+
}
|
|
138
|
+
if (requestParameters['limit'] != null) {
|
|
139
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
140
|
+
}
|
|
141
|
+
if (requestParameters['offset'] != null) {
|
|
142
|
+
queryParameters['offset'] = requestParameters['offset'];
|
|
143
|
+
}
|
|
144
|
+
const headerParameters = {};
|
|
145
|
+
let urlPath = `/v1/documents`;
|
|
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) => PaginatedResponseDocumentResponseFromJSON(jsonValue));
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* List documents in a folder. Returns only direct child documents (depth=1) of the specified parent folder. If parent_id is not provided, lists documents in the root folder.
|
|
157
|
+
* List Documents Handler
|
|
158
|
+
*/
|
|
159
|
+
listDocuments() {
|
|
160
|
+
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
|
|
161
|
+
const response = yield this.listDocumentsRaw(requestParameters, initOverrides);
|
|
162
|
+
return yield response.value();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Update a document (rename, move, and/or change active version). To rename: provide `name` field. To move: provide `parent_id` field. To change active version: provide `active_version_id` field. All can be done in a single request.
|
|
167
|
+
* Update Document Handler
|
|
168
|
+
*/
|
|
169
|
+
updateDocumentRaw(requestParameters, initOverrides) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
if (requestParameters['documentId'] == null) {
|
|
172
|
+
throw new runtime.RequiredError('documentId', 'Required parameter "documentId" was null or undefined when calling updateDocument().');
|
|
173
|
+
}
|
|
174
|
+
if (requestParameters['updateDocumentRequest'] == null) {
|
|
175
|
+
throw new runtime.RequiredError('updateDocumentRequest', 'Required parameter "updateDocumentRequest" was null or undefined when calling updateDocument().');
|
|
176
|
+
}
|
|
177
|
+
const queryParameters = {};
|
|
178
|
+
const headerParameters = {};
|
|
179
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
180
|
+
let urlPath = `/v1/documents/{document_id}`;
|
|
181
|
+
urlPath = urlPath.replace(`{${"document_id"}}`, encodeURIComponent(String(requestParameters['documentId'])));
|
|
182
|
+
const response = yield this.request({
|
|
183
|
+
path: urlPath,
|
|
184
|
+
method: 'PATCH',
|
|
185
|
+
headers: headerParameters,
|
|
186
|
+
query: queryParameters,
|
|
187
|
+
body: UpdateDocumentRequestToJSON(requestParameters['updateDocumentRequest']),
|
|
188
|
+
}, initOverrides);
|
|
189
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DocumentResponseFromJSON(jsonValue));
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Update a document (rename, move, and/or change active version). To rename: provide `name` field. To move: provide `parent_id` field. To change active version: provide `active_version_id` field. All can be done in a single request.
|
|
194
|
+
* Update Document Handler
|
|
195
|
+
*/
|
|
196
|
+
updateDocument(requestParameters, initOverrides) {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
const response = yield this.updateDocumentRaw(requestParameters, initOverrides);
|
|
199
|
+
return yield response.value();
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
package/dist/esm/apis/index.d.ts
CHANGED
package/dist/esm/apis/index.js
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
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 type { DocumentOrigin } from './DocumentOrigin';
|
|
13
|
+
import type { DocumentType } from './DocumentType';
|
|
14
|
+
/**
|
|
15
|
+
* Request to create a new document.
|
|
16
|
+
* @export
|
|
17
|
+
* @interface CreateDocumentRequest
|
|
18
|
+
*/
|
|
19
|
+
export interface CreateDocumentRequest {
|
|
20
|
+
/**
|
|
21
|
+
* Document name
|
|
22
|
+
* @type {string}
|
|
23
|
+
* @memberof CreateDocumentRequest
|
|
24
|
+
*/
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* Parent folder PathPart ID
|
|
28
|
+
* @type {string}
|
|
29
|
+
* @memberof CreateDocumentRequest
|
|
30
|
+
*/
|
|
31
|
+
parentId: string;
|
|
32
|
+
/**
|
|
33
|
+
* Type of document (PDF, UNKNOWN, etc.)
|
|
34
|
+
* @type {DocumentType}
|
|
35
|
+
* @memberof CreateDocumentRequest
|
|
36
|
+
*/
|
|
37
|
+
documentType: DocumentType;
|
|
38
|
+
/**
|
|
39
|
+
* Origin of document (SOURCE, GENERATED)
|
|
40
|
+
* @type {DocumentOrigin}
|
|
41
|
+
* @memberof CreateDocumentRequest
|
|
42
|
+
*/
|
|
43
|
+
documentOrigin: DocumentOrigin;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if a given object implements the CreateDocumentRequest interface.
|
|
47
|
+
*/
|
|
48
|
+
export declare function instanceOfCreateDocumentRequest(value: object): value is CreateDocumentRequest;
|
|
49
|
+
export declare function CreateDocumentRequestFromJSON(json: any): CreateDocumentRequest;
|
|
50
|
+
export declare function CreateDocumentRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateDocumentRequest;
|
|
51
|
+
export declare function CreateDocumentRequestToJSON(json: any): CreateDocumentRequest;
|
|
52
|
+
export declare function CreateDocumentRequestToJSONTyped(value?: CreateDocumentRequest | null, ignoreDiscriminator?: boolean): any;
|
|
53
|
+
export declare const CreateDocumentRequestPropertyValidationAttributesMap: {
|
|
54
|
+
[property: string]: {
|
|
55
|
+
maxLength?: number;
|
|
56
|
+
minLength?: number;
|
|
57
|
+
pattern?: string;
|
|
58
|
+
maximum?: number;
|
|
59
|
+
exclusiveMaximum?: boolean;
|
|
60
|
+
minimum?: number;
|
|
61
|
+
exclusiveMinimum?: boolean;
|
|
62
|
+
multipleOf?: number;
|
|
63
|
+
maxItems?: number;
|
|
64
|
+
minItems?: number;
|
|
65
|
+
uniqueItems?: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
import { DocumentOriginFromJSON, DocumentOriginToJSON, } from './DocumentOrigin';
|
|
15
|
+
import { DocumentTypeFromJSON, DocumentTypeToJSON, } from './DocumentType';
|
|
16
|
+
/**
|
|
17
|
+
* Check if a given object implements the CreateDocumentRequest interface.
|
|
18
|
+
*/
|
|
19
|
+
export function instanceOfCreateDocumentRequest(value) {
|
|
20
|
+
if (!('name' in value) || value['name'] === undefined)
|
|
21
|
+
return false;
|
|
22
|
+
if (!('parentId' in value) || value['parentId'] === undefined)
|
|
23
|
+
return false;
|
|
24
|
+
if (!('documentType' in value) || value['documentType'] === undefined)
|
|
25
|
+
return false;
|
|
26
|
+
if (!('documentOrigin' in value) || value['documentOrigin'] === undefined)
|
|
27
|
+
return false;
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
export function CreateDocumentRequestFromJSON(json) {
|
|
31
|
+
return CreateDocumentRequestFromJSONTyped(json, false);
|
|
32
|
+
}
|
|
33
|
+
export function CreateDocumentRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
34
|
+
if (json == null) {
|
|
35
|
+
return json;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
'name': json['name'],
|
|
39
|
+
'parentId': json['parent_id'],
|
|
40
|
+
'documentType': DocumentTypeFromJSON(json['document_type']),
|
|
41
|
+
'documentOrigin': DocumentOriginFromJSON(json['document_origin']),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function CreateDocumentRequestToJSON(json) {
|
|
45
|
+
return CreateDocumentRequestToJSONTyped(json, false);
|
|
46
|
+
}
|
|
47
|
+
export function CreateDocumentRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
48
|
+
if (value == null) {
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
'name': value['name'],
|
|
53
|
+
'parent_id': value['parentId'],
|
|
54
|
+
'document_type': DocumentTypeToJSON(value['documentType']),
|
|
55
|
+
'document_origin': DocumentOriginToJSON(value['documentOrigin']),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export const CreateDocumentRequestPropertyValidationAttributesMap = {
|
|
59
|
+
name: {
|
|
60
|
+
maxLength: 255,
|
|
61
|
+
minLength: 1,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
/**
|
|
13
|
+
* Origin of document - source/purpose (all origins are first-class).
|
|
14
|
+
* @export
|
|
15
|
+
*/
|
|
16
|
+
export declare const DocumentOrigin: {
|
|
17
|
+
readonly Source: "SOURCE";
|
|
18
|
+
readonly Generated: "GENERATED";
|
|
19
|
+
};
|
|
20
|
+
export type DocumentOrigin = typeof DocumentOrigin[keyof typeof DocumentOrigin];
|
|
21
|
+
export declare function instanceOfDocumentOrigin(value: any): boolean;
|
|
22
|
+
export declare function DocumentOriginFromJSON(json: any): DocumentOrigin;
|
|
23
|
+
export declare function DocumentOriginFromJSONTyped(json: any, ignoreDiscriminator: boolean): DocumentOrigin;
|
|
24
|
+
export declare function DocumentOriginToJSON(value?: DocumentOrigin | null): any;
|
|
25
|
+
export declare function DocumentOriginToJSONTyped(value: any, ignoreDiscriminator: boolean): DocumentOrigin;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
/**
|
|
15
|
+
* Origin of document - source/purpose (all origins are first-class).
|
|
16
|
+
* @export
|
|
17
|
+
*/
|
|
18
|
+
export const DocumentOrigin = {
|
|
19
|
+
Source: 'SOURCE',
|
|
20
|
+
Generated: 'GENERATED'
|
|
21
|
+
};
|
|
22
|
+
export function instanceOfDocumentOrigin(value) {
|
|
23
|
+
for (const key in DocumentOrigin) {
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(DocumentOrigin, key)) {
|
|
25
|
+
if (DocumentOrigin[key] === value) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
export function DocumentOriginFromJSON(json) {
|
|
33
|
+
return DocumentOriginFromJSONTyped(json, false);
|
|
34
|
+
}
|
|
35
|
+
export function DocumentOriginFromJSONTyped(json, ignoreDiscriminator) {
|
|
36
|
+
return json;
|
|
37
|
+
}
|
|
38
|
+
export function DocumentOriginToJSON(value) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
export function DocumentOriginToJSONTyped(value, ignoreDiscriminator) {
|
|
42
|
+
return value;
|
|
43
|
+
}
|