@knowledge-stack/ksapi 1.4.0 → 1.5.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 +8 -0
- package/README.md +2 -2
- package/dist/apis/DocumentsApi.d.ts +179 -0
- package/dist/apis/DocumentsApi.js +206 -0
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +1 -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 +1 -0
- package/dist/esm/apis/index.js +1 -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/UpdateDocumentRequest.d.ts +59 -0
- package/dist/esm/models/UpdateDocumentRequest.js +51 -0
- package/dist/esm/models/index.d.ts +7 -0
- package/dist/esm/models/index.js +7 -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/UpdateDocumentRequest.d.ts +59 -0
- package/dist/models/UpdateDocumentRequest.js +59 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.js +7 -0
- package/package.json +1 -1
- package/src/apis/DocumentsApi.ts +386 -0
- package/src/apis/index.ts +1 -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/UpdateDocumentRequest.ts +102 -0
- package/src/models/index.ts +7 -0
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
* Request to update a document (rename, move, and/or change active version).
|
|
14
|
+
* @export
|
|
15
|
+
* @interface UpdateDocumentRequest
|
|
16
|
+
*/
|
|
17
|
+
export interface UpdateDocumentRequest {
|
|
18
|
+
/**
|
|
19
|
+
* New document name
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof UpdateDocumentRequest
|
|
22
|
+
*/
|
|
23
|
+
name?: string;
|
|
24
|
+
/**
|
|
25
|
+
* New parent folder PathPart ID (for move)
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof UpdateDocumentRequest
|
|
28
|
+
*/
|
|
29
|
+
parentId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* New active version ID
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof UpdateDocumentRequest
|
|
34
|
+
*/
|
|
35
|
+
activeVersionId?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check if a given object implements the UpdateDocumentRequest interface.
|
|
39
|
+
*/
|
|
40
|
+
export declare function instanceOfUpdateDocumentRequest(value: object): value is UpdateDocumentRequest;
|
|
41
|
+
export declare function UpdateDocumentRequestFromJSON(json: any): UpdateDocumentRequest;
|
|
42
|
+
export declare function UpdateDocumentRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateDocumentRequest;
|
|
43
|
+
export declare function UpdateDocumentRequestToJSON(json: any): UpdateDocumentRequest;
|
|
44
|
+
export declare function UpdateDocumentRequestToJSONTyped(value?: UpdateDocumentRequest | null, ignoreDiscriminator?: boolean): any;
|
|
45
|
+
export declare const UpdateDocumentRequestPropertyValidationAttributesMap: {
|
|
46
|
+
[property: string]: {
|
|
47
|
+
maxLength?: number;
|
|
48
|
+
minLength?: number;
|
|
49
|
+
pattern?: string;
|
|
50
|
+
maximum?: number;
|
|
51
|
+
exclusiveMaximum?: boolean;
|
|
52
|
+
minimum?: number;
|
|
53
|
+
exclusiveMinimum?: boolean;
|
|
54
|
+
multipleOf?: number;
|
|
55
|
+
maxItems?: number;
|
|
56
|
+
minItems?: number;
|
|
57
|
+
uniqueItems?: boolean;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Knowledge Stack API
|
|
6
|
+
* Knowledge Stack backend API for authentication and knowledge management
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.1.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.UpdateDocumentRequestPropertyValidationAttributesMap = void 0;
|
|
17
|
+
exports.instanceOfUpdateDocumentRequest = instanceOfUpdateDocumentRequest;
|
|
18
|
+
exports.UpdateDocumentRequestFromJSON = UpdateDocumentRequestFromJSON;
|
|
19
|
+
exports.UpdateDocumentRequestFromJSONTyped = UpdateDocumentRequestFromJSONTyped;
|
|
20
|
+
exports.UpdateDocumentRequestToJSON = UpdateDocumentRequestToJSON;
|
|
21
|
+
exports.UpdateDocumentRequestToJSONTyped = UpdateDocumentRequestToJSONTyped;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a given object implements the UpdateDocumentRequest interface.
|
|
24
|
+
*/
|
|
25
|
+
function instanceOfUpdateDocumentRequest(value) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
function UpdateDocumentRequestFromJSON(json) {
|
|
29
|
+
return UpdateDocumentRequestFromJSONTyped(json, false);
|
|
30
|
+
}
|
|
31
|
+
function UpdateDocumentRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
32
|
+
if (json == null) {
|
|
33
|
+
return json;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
'name': json['name'] == null ? undefined : json['name'],
|
|
37
|
+
'parentId': json['parent_id'] == null ? undefined : json['parent_id'],
|
|
38
|
+
'activeVersionId': json['active_version_id'] == null ? undefined : json['active_version_id'],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function UpdateDocumentRequestToJSON(json) {
|
|
42
|
+
return UpdateDocumentRequestToJSONTyped(json, false);
|
|
43
|
+
}
|
|
44
|
+
function UpdateDocumentRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
45
|
+
if (value == null) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
'name': value['name'],
|
|
50
|
+
'parent_id': value['parentId'],
|
|
51
|
+
'active_version_id': value['activeVersionId'],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.UpdateDocumentRequestPropertyValidationAttributesMap = {
|
|
55
|
+
name: {
|
|
56
|
+
maxLength: 255,
|
|
57
|
+
minLength: 1,
|
|
58
|
+
},
|
|
59
|
+
};
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
export * from './CreateDocumentRequest';
|
|
1
2
|
export * from './CreateFolderRequest';
|
|
2
3
|
export * from './CreatePasswordUserRequest';
|
|
3
4
|
export * from './CreateTenantRequest';
|
|
5
|
+
export * from './DocumentOrigin';
|
|
6
|
+
export * from './DocumentResponse';
|
|
7
|
+
export * from './DocumentType';
|
|
8
|
+
export * from './DocumentVersionResponse';
|
|
4
9
|
export * from './EmailSentResponse';
|
|
5
10
|
export * from './EmailVerificationRequest';
|
|
6
11
|
export * from './FolderResponse';
|
|
@@ -11,6 +16,7 @@ export * from './InviteResponse';
|
|
|
11
16
|
export * from './InviteStatus';
|
|
12
17
|
export * from './InviteUserRequest';
|
|
13
18
|
export * from './OAuth2Config';
|
|
19
|
+
export * from './PaginatedResponseDocumentResponse';
|
|
14
20
|
export * from './PaginatedResponseFolderResponse';
|
|
15
21
|
export * from './PaginatedResponseInviteResponse';
|
|
16
22
|
export * from './PaginatedResponsePathPartResponse';
|
|
@@ -26,6 +32,7 @@ export * from './SignInRequest';
|
|
|
26
32
|
export * from './TenantResponse';
|
|
27
33
|
export * from './TenantUserInTenantResponse';
|
|
28
34
|
export * from './TenantUserRole';
|
|
35
|
+
export * from './UpdateDocumentRequest';
|
|
29
36
|
export * from './UpdateFolderRequest';
|
|
30
37
|
export * from './UpdateTenantRequest';
|
|
31
38
|
export * from './UpdateUserRequest';
|
package/dist/models/index.js
CHANGED
|
@@ -16,9 +16,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/* tslint:disable */
|
|
18
18
|
/* eslint-disable */
|
|
19
|
+
__exportStar(require("./CreateDocumentRequest"), exports);
|
|
19
20
|
__exportStar(require("./CreateFolderRequest"), exports);
|
|
20
21
|
__exportStar(require("./CreatePasswordUserRequest"), exports);
|
|
21
22
|
__exportStar(require("./CreateTenantRequest"), exports);
|
|
23
|
+
__exportStar(require("./DocumentOrigin"), exports);
|
|
24
|
+
__exportStar(require("./DocumentResponse"), exports);
|
|
25
|
+
__exportStar(require("./DocumentType"), exports);
|
|
26
|
+
__exportStar(require("./DocumentVersionResponse"), exports);
|
|
22
27
|
__exportStar(require("./EmailSentResponse"), exports);
|
|
23
28
|
__exportStar(require("./EmailVerificationRequest"), exports);
|
|
24
29
|
__exportStar(require("./FolderResponse"), exports);
|
|
@@ -29,6 +34,7 @@ __exportStar(require("./InviteResponse"), exports);
|
|
|
29
34
|
__exportStar(require("./InviteStatus"), exports);
|
|
30
35
|
__exportStar(require("./InviteUserRequest"), exports);
|
|
31
36
|
__exportStar(require("./OAuth2Config"), exports);
|
|
37
|
+
__exportStar(require("./PaginatedResponseDocumentResponse"), exports);
|
|
32
38
|
__exportStar(require("./PaginatedResponseFolderResponse"), exports);
|
|
33
39
|
__exportStar(require("./PaginatedResponseInviteResponse"), exports);
|
|
34
40
|
__exportStar(require("./PaginatedResponsePathPartResponse"), exports);
|
|
@@ -44,6 +50,7 @@ __exportStar(require("./SignInRequest"), exports);
|
|
|
44
50
|
__exportStar(require("./TenantResponse"), exports);
|
|
45
51
|
__exportStar(require("./TenantUserInTenantResponse"), exports);
|
|
46
52
|
__exportStar(require("./TenantUserRole"), exports);
|
|
53
|
+
__exportStar(require("./UpdateDocumentRequest"), exports);
|
|
47
54
|
__exportStar(require("./UpdateFolderRequest"), exports);
|
|
48
55
|
__exportStar(require("./UpdateTenantRequest"), exports);
|
|
49
56
|
__exportStar(require("./UpdateUserRequest"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,386 @@
|
|
|
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
|
+
|
|
16
|
+
import * as runtime from '../runtime';
|
|
17
|
+
import type {
|
|
18
|
+
CreateDocumentRequest,
|
|
19
|
+
DocumentResponse,
|
|
20
|
+
HTTPValidationError,
|
|
21
|
+
PaginatedResponseDocumentResponse,
|
|
22
|
+
PathOrder,
|
|
23
|
+
UpdateDocumentRequest,
|
|
24
|
+
} from '../models/index';
|
|
25
|
+
import {
|
|
26
|
+
CreateDocumentRequestFromJSON,
|
|
27
|
+
CreateDocumentRequestToJSON,
|
|
28
|
+
DocumentResponseFromJSON,
|
|
29
|
+
DocumentResponseToJSON,
|
|
30
|
+
HTTPValidationErrorFromJSON,
|
|
31
|
+
HTTPValidationErrorToJSON,
|
|
32
|
+
PaginatedResponseDocumentResponseFromJSON,
|
|
33
|
+
PaginatedResponseDocumentResponseToJSON,
|
|
34
|
+
PathOrderFromJSON,
|
|
35
|
+
PathOrderToJSON,
|
|
36
|
+
UpdateDocumentRequestFromJSON,
|
|
37
|
+
UpdateDocumentRequestToJSON,
|
|
38
|
+
} from '../models/index';
|
|
39
|
+
|
|
40
|
+
export interface CreateDocumentOperationRequest {
|
|
41
|
+
createDocumentRequest: CreateDocumentRequest;
|
|
42
|
+
ksUat?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface DeleteDocumentRequest {
|
|
46
|
+
documentId: string;
|
|
47
|
+
ksUat?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface GetDocumentRequest {
|
|
51
|
+
documentId: string;
|
|
52
|
+
ksUat?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ListDocumentsRequest {
|
|
56
|
+
parentId?: string;
|
|
57
|
+
sortOrder?: PathOrder;
|
|
58
|
+
limit?: number;
|
|
59
|
+
offset?: number;
|
|
60
|
+
ksUat?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface UpdateDocumentOperationRequest {
|
|
64
|
+
documentId: string;
|
|
65
|
+
updateDocumentRequest: UpdateDocumentRequest;
|
|
66
|
+
ksUat?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* DocumentsApi - interface
|
|
71
|
+
*
|
|
72
|
+
* @export
|
|
73
|
+
* @interface DocumentsApiInterface
|
|
74
|
+
*/
|
|
75
|
+
export interface DocumentsApiInterface {
|
|
76
|
+
/**
|
|
77
|
+
* 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.
|
|
78
|
+
* @summary Create Document Handler
|
|
79
|
+
* @param {CreateDocumentRequest} createDocumentRequest
|
|
80
|
+
* @param {string} [ksUat]
|
|
81
|
+
* @param {*} [options] Override http request option.
|
|
82
|
+
* @throws {RequiredError}
|
|
83
|
+
* @memberof DocumentsApiInterface
|
|
84
|
+
*/
|
|
85
|
+
createDocumentRaw(requestParameters: CreateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 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.
|
|
89
|
+
* Create Document Handler
|
|
90
|
+
*/
|
|
91
|
+
createDocument(requestParameters: CreateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
95
|
+
* @summary Delete Document Handler
|
|
96
|
+
* @param {string} documentId
|
|
97
|
+
* @param {string} [ksUat]
|
|
98
|
+
* @param {*} [options] Override http request option.
|
|
99
|
+
* @throws {RequiredError}
|
|
100
|
+
* @memberof DocumentsApiInterface
|
|
101
|
+
*/
|
|
102
|
+
deleteDocumentRaw(requestParameters: DeleteDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
106
|
+
* Delete Document Handler
|
|
107
|
+
*/
|
|
108
|
+
deleteDocument(requestParameters: DeleteDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Get a document by its document ID.
|
|
112
|
+
* @summary Get Document Handler
|
|
113
|
+
* @param {string} documentId
|
|
114
|
+
* @param {string} [ksUat]
|
|
115
|
+
* @param {*} [options] Override http request option.
|
|
116
|
+
* @throws {RequiredError}
|
|
117
|
+
* @memberof DocumentsApiInterface
|
|
118
|
+
*/
|
|
119
|
+
getDocumentRaw(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get a document by its document ID.
|
|
123
|
+
* Get Document Handler
|
|
124
|
+
*/
|
|
125
|
+
getDocument(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 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.
|
|
129
|
+
* @summary List Documents Handler
|
|
130
|
+
* @param {string} [parentId] Parent folder PathPart ID (defaults to root)
|
|
131
|
+
* @param {PathOrder} [sortOrder] Sort order for results (default: LOGICAL)
|
|
132
|
+
* @param {number} [limit] Number of items per page
|
|
133
|
+
* @param {number} [offset] Number of items to skip
|
|
134
|
+
* @param {string} [ksUat]
|
|
135
|
+
* @param {*} [options] Override http request option.
|
|
136
|
+
* @throws {RequiredError}
|
|
137
|
+
* @memberof DocumentsApiInterface
|
|
138
|
+
*/
|
|
139
|
+
listDocumentsRaw(requestParameters: ListDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseDocumentResponse>>;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* 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.
|
|
143
|
+
* List Documents Handler
|
|
144
|
+
*/
|
|
145
|
+
listDocuments(requestParameters: ListDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentResponse>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 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.
|
|
149
|
+
* @summary Update Document Handler
|
|
150
|
+
* @param {string} documentId
|
|
151
|
+
* @param {UpdateDocumentRequest} updateDocumentRequest
|
|
152
|
+
* @param {string} [ksUat]
|
|
153
|
+
* @param {*} [options] Override http request option.
|
|
154
|
+
* @throws {RequiredError}
|
|
155
|
+
* @memberof DocumentsApiInterface
|
|
156
|
+
*/
|
|
157
|
+
updateDocumentRaw(requestParameters: UpdateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>>;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 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.
|
|
161
|
+
* Update Document Handler
|
|
162
|
+
*/
|
|
163
|
+
updateDocument(requestParameters: UpdateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse>;
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
*
|
|
169
|
+
*/
|
|
170
|
+
export class DocumentsApi extends runtime.BaseAPI implements DocumentsApiInterface {
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 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.
|
|
174
|
+
* Create Document Handler
|
|
175
|
+
*/
|
|
176
|
+
async createDocumentRaw(requestParameters: CreateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>> {
|
|
177
|
+
if (requestParameters['createDocumentRequest'] == null) {
|
|
178
|
+
throw new runtime.RequiredError(
|
|
179
|
+
'createDocumentRequest',
|
|
180
|
+
'Required parameter "createDocumentRequest" was null or undefined when calling createDocument().'
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const queryParameters: any = {};
|
|
185
|
+
|
|
186
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
187
|
+
|
|
188
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
let urlPath = `/v1/documents`;
|
|
192
|
+
|
|
193
|
+
const response = await this.request({
|
|
194
|
+
path: urlPath,
|
|
195
|
+
method: 'POST',
|
|
196
|
+
headers: headerParameters,
|
|
197
|
+
query: queryParameters,
|
|
198
|
+
body: CreateDocumentRequestToJSON(requestParameters['createDocumentRequest']),
|
|
199
|
+
}, initOverrides);
|
|
200
|
+
|
|
201
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DocumentResponseFromJSON(jsonValue));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* 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.
|
|
206
|
+
* Create Document Handler
|
|
207
|
+
*/
|
|
208
|
+
async createDocument(requestParameters: CreateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse> {
|
|
209
|
+
const response = await this.createDocumentRaw(requestParameters, initOverrides);
|
|
210
|
+
return await response.value();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
215
|
+
* Delete Document Handler
|
|
216
|
+
*/
|
|
217
|
+
async deleteDocumentRaw(requestParameters: DeleteDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
218
|
+
if (requestParameters['documentId'] == null) {
|
|
219
|
+
throw new runtime.RequiredError(
|
|
220
|
+
'documentId',
|
|
221
|
+
'Required parameter "documentId" was null or undefined when calling deleteDocument().'
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const queryParameters: any = {};
|
|
226
|
+
|
|
227
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
let urlPath = `/v1/documents/{document_id}`;
|
|
231
|
+
urlPath = urlPath.replace(`{${"document_id"}}`, encodeURIComponent(String(requestParameters['documentId'])));
|
|
232
|
+
|
|
233
|
+
const response = await this.request({
|
|
234
|
+
path: urlPath,
|
|
235
|
+
method: 'DELETE',
|
|
236
|
+
headers: headerParameters,
|
|
237
|
+
query: queryParameters,
|
|
238
|
+
}, initOverrides);
|
|
239
|
+
|
|
240
|
+
return new runtime.VoidApiResponse(response);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Delete a document and all its contents. WARNING: This cascades to all children (versions, sections, chunks, etc.) due to parent_id ON DELETE CASCADE.
|
|
245
|
+
* Delete Document Handler
|
|
246
|
+
*/
|
|
247
|
+
async deleteDocument(requestParameters: DeleteDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
248
|
+
await this.deleteDocumentRaw(requestParameters, initOverrides);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Get a document by its document ID.
|
|
253
|
+
* Get Document Handler
|
|
254
|
+
*/
|
|
255
|
+
async getDocumentRaw(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>> {
|
|
256
|
+
if (requestParameters['documentId'] == null) {
|
|
257
|
+
throw new runtime.RequiredError(
|
|
258
|
+
'documentId',
|
|
259
|
+
'Required parameter "documentId" was null or undefined when calling getDocument().'
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const queryParameters: any = {};
|
|
264
|
+
|
|
265
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
let urlPath = `/v1/documents/{document_id}`;
|
|
269
|
+
urlPath = urlPath.replace(`{${"document_id"}}`, encodeURIComponent(String(requestParameters['documentId'])));
|
|
270
|
+
|
|
271
|
+
const response = await this.request({
|
|
272
|
+
path: urlPath,
|
|
273
|
+
method: 'GET',
|
|
274
|
+
headers: headerParameters,
|
|
275
|
+
query: queryParameters,
|
|
276
|
+
}, initOverrides);
|
|
277
|
+
|
|
278
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DocumentResponseFromJSON(jsonValue));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Get a document by its document ID.
|
|
283
|
+
* Get Document Handler
|
|
284
|
+
*/
|
|
285
|
+
async getDocument(requestParameters: GetDocumentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse> {
|
|
286
|
+
const response = await this.getDocumentRaw(requestParameters, initOverrides);
|
|
287
|
+
return await response.value();
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* 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.
|
|
292
|
+
* List Documents Handler
|
|
293
|
+
*/
|
|
294
|
+
async listDocumentsRaw(requestParameters: ListDocumentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedResponseDocumentResponse>> {
|
|
295
|
+
const queryParameters: any = {};
|
|
296
|
+
|
|
297
|
+
if (requestParameters['parentId'] != null) {
|
|
298
|
+
queryParameters['parent_id'] = requestParameters['parentId'];
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (requestParameters['sortOrder'] != null) {
|
|
302
|
+
queryParameters['sort_order'] = requestParameters['sortOrder'];
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (requestParameters['limit'] != null) {
|
|
306
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (requestParameters['offset'] != null) {
|
|
310
|
+
queryParameters['offset'] = requestParameters['offset'];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
let urlPath = `/v1/documents`;
|
|
317
|
+
|
|
318
|
+
const response = await this.request({
|
|
319
|
+
path: urlPath,
|
|
320
|
+
method: 'GET',
|
|
321
|
+
headers: headerParameters,
|
|
322
|
+
query: queryParameters,
|
|
323
|
+
}, initOverrides);
|
|
324
|
+
|
|
325
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResponseDocumentResponseFromJSON(jsonValue));
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* 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.
|
|
330
|
+
* List Documents Handler
|
|
331
|
+
*/
|
|
332
|
+
async listDocuments(requestParameters: ListDocumentsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedResponseDocumentResponse> {
|
|
333
|
+
const response = await this.listDocumentsRaw(requestParameters, initOverrides);
|
|
334
|
+
return await response.value();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* 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.
|
|
339
|
+
* Update Document Handler
|
|
340
|
+
*/
|
|
341
|
+
async updateDocumentRaw(requestParameters: UpdateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DocumentResponse>> {
|
|
342
|
+
if (requestParameters['documentId'] == null) {
|
|
343
|
+
throw new runtime.RequiredError(
|
|
344
|
+
'documentId',
|
|
345
|
+
'Required parameter "documentId" was null or undefined when calling updateDocument().'
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (requestParameters['updateDocumentRequest'] == null) {
|
|
350
|
+
throw new runtime.RequiredError(
|
|
351
|
+
'updateDocumentRequest',
|
|
352
|
+
'Required parameter "updateDocumentRequest" was null or undefined when calling updateDocument().'
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const queryParameters: any = {};
|
|
357
|
+
|
|
358
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
359
|
+
|
|
360
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
let urlPath = `/v1/documents/{document_id}`;
|
|
364
|
+
urlPath = urlPath.replace(`{${"document_id"}}`, encodeURIComponent(String(requestParameters['documentId'])));
|
|
365
|
+
|
|
366
|
+
const response = await this.request({
|
|
367
|
+
path: urlPath,
|
|
368
|
+
method: 'PATCH',
|
|
369
|
+
headers: headerParameters,
|
|
370
|
+
query: queryParameters,
|
|
371
|
+
body: UpdateDocumentRequestToJSON(requestParameters['updateDocumentRequest']),
|
|
372
|
+
}, initOverrides);
|
|
373
|
+
|
|
374
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DocumentResponseFromJSON(jsonValue));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* 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.
|
|
379
|
+
* Update Document Handler
|
|
380
|
+
*/
|
|
381
|
+
async updateDocument(requestParameters: UpdateDocumentOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DocumentResponse> {
|
|
382
|
+
const response = await this.updateDocumentRaw(requestParameters, initOverrides);
|
|
383
|
+
return await response.value();
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
}
|