@knowledge-stack/ksapi 1.5.0 → 1.7.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 +6 -0
- package/README.md +2 -2
- package/dist/apis/DocumentVersionsApi.d.ts +146 -0
- package/dist/apis/DocumentVersionsApi.js +168 -0
- package/dist/apis/PathPartsApi.d.ts +30 -1
- package/dist/apis/PathPartsApi.js +32 -0
- package/dist/apis/SectionsApi.d.ts +144 -0
- package/dist/apis/SectionsApi.js +166 -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/PathPartsApi.d.ts +30 -1
- package/dist/esm/apis/PathPartsApi.js +33 -1
- package/dist/esm/apis/SectionsApi.d.ts +144 -0
- package/dist/esm/apis/SectionsApi.js +162 -0
- package/dist/esm/apis/index.d.ts +2 -0
- package/dist/esm/apis/index.js +2 -0
- package/dist/esm/models/CreateSectionRequest.d.ts +65 -0
- package/dist/esm/models/CreateSectionRequest.js +57 -0
- package/dist/esm/models/DocumentVersionResponse.d.ts +1 -1
- package/dist/esm/models/PaginatedResponseDocumentVersionResponse.d.ts +66 -0
- package/dist/esm/models/PaginatedResponseDocumentVersionResponse.js +70 -0
- package/dist/esm/models/SectionResponse.d.ts +101 -0
- package/dist/esm/models/SectionResponse.js +74 -0
- package/dist/esm/models/UpdateSectionRequest.d.ts +65 -0
- package/dist/esm/models/UpdateSectionRequest.js +53 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/models/CreateSectionRequest.d.ts +65 -0
- package/dist/models/CreateSectionRequest.js +65 -0
- package/dist/models/DocumentVersionResponse.d.ts +1 -1
- package/dist/models/PaginatedResponseDocumentVersionResponse.d.ts +66 -0
- package/dist/models/PaginatedResponseDocumentVersionResponse.js +78 -0
- package/dist/models/SectionResponse.d.ts +101 -0
- package/dist/models/SectionResponse.js +82 -0
- package/dist/models/UpdateSectionRequest.d.ts +65 -0
- package/dist/models/UpdateSectionRequest.js +61 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +4 -0
- package/package.json +1 -1
- package/src/apis/DocumentVersionsApi.ts +303 -0
- package/src/apis/PathPartsApi.ts +64 -0
- package/src/apis/SectionsApi.ts +305 -0
- package/src/apis/index.ts +2 -0
- package/src/models/CreateSectionRequest.ts +112 -0
- package/src/models/DocumentVersionResponse.ts +1 -1
- package/src/models/PaginatedResponseDocumentVersionResponse.ts +130 -0
- package/src/models/SectionResponse.ts +161 -0
- package/src/models/UpdateSectionRequest.ts +110 -0
- package/src/models/index.ts +4 -0
package/src/apis/PathPartsApi.ts
CHANGED
|
@@ -18,6 +18,7 @@ import type {
|
|
|
18
18
|
HTTPValidationError,
|
|
19
19
|
PaginatedResponsePathPartResponse,
|
|
20
20
|
PathOrder,
|
|
21
|
+
PathPartResponse,
|
|
21
22
|
} from '../models/index';
|
|
22
23
|
import {
|
|
23
24
|
HTTPValidationErrorFromJSON,
|
|
@@ -26,8 +27,15 @@ import {
|
|
|
26
27
|
PaginatedResponsePathPartResponseToJSON,
|
|
27
28
|
PathOrderFromJSON,
|
|
28
29
|
PathOrderToJSON,
|
|
30
|
+
PathPartResponseFromJSON,
|
|
31
|
+
PathPartResponseToJSON,
|
|
29
32
|
} from '../models/index';
|
|
30
33
|
|
|
34
|
+
export interface GetPathPartRequest {
|
|
35
|
+
pathPartId: string;
|
|
36
|
+
ksUat?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
export interface ListPathPartsRequest {
|
|
32
40
|
parentId?: string;
|
|
33
41
|
includeDocuments?: boolean;
|
|
@@ -45,6 +53,23 @@ export interface ListPathPartsRequest {
|
|
|
45
53
|
* @interface PathPartsApiInterface
|
|
46
54
|
*/
|
|
47
55
|
export interface PathPartsApiInterface {
|
|
56
|
+
/**
|
|
57
|
+
* Get a path part by its ID. Returns the path part if it exists and belongs to the user\'s tenant.
|
|
58
|
+
* @summary Get Path Part Handler
|
|
59
|
+
* @param {string} pathPartId
|
|
60
|
+
* @param {string} [ksUat]
|
|
61
|
+
* @param {*} [options] Override http request option.
|
|
62
|
+
* @throws {RequiredError}
|
|
63
|
+
* @memberof PathPartsApiInterface
|
|
64
|
+
*/
|
|
65
|
+
getPathPartRaw(requestParameters: GetPathPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PathPartResponse>>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get a path part by its ID. Returns the path part if it exists and belongs to the user\'s tenant.
|
|
69
|
+
* Get Path Part Handler
|
|
70
|
+
*/
|
|
71
|
+
getPathPart(requestParameters: GetPathPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PathPartResponse>;
|
|
72
|
+
|
|
48
73
|
/**
|
|
49
74
|
* 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.
|
|
50
75
|
* @summary List Path Parts Handler
|
|
@@ -74,6 +99,45 @@ export interface PathPartsApiInterface {
|
|
|
74
99
|
*/
|
|
75
100
|
export class PathPartsApi extends runtime.BaseAPI implements PathPartsApiInterface {
|
|
76
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Get a path part by its ID. Returns the path part if it exists and belongs to the user\'s tenant.
|
|
104
|
+
* Get Path Part Handler
|
|
105
|
+
*/
|
|
106
|
+
async getPathPartRaw(requestParameters: GetPathPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PathPartResponse>> {
|
|
107
|
+
if (requestParameters['pathPartId'] == null) {
|
|
108
|
+
throw new runtime.RequiredError(
|
|
109
|
+
'pathPartId',
|
|
110
|
+
'Required parameter "pathPartId" was null or undefined when calling getPathPart().'
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const queryParameters: any = {};
|
|
115
|
+
|
|
116
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
let urlPath = `/v1/path-parts/{path_part_id}`;
|
|
120
|
+
urlPath = urlPath.replace(`{${"path_part_id"}}`, encodeURIComponent(String(requestParameters['pathPartId'])));
|
|
121
|
+
|
|
122
|
+
const response = await this.request({
|
|
123
|
+
path: urlPath,
|
|
124
|
+
method: 'GET',
|
|
125
|
+
headers: headerParameters,
|
|
126
|
+
query: queryParameters,
|
|
127
|
+
}, initOverrides);
|
|
128
|
+
|
|
129
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PathPartResponseFromJSON(jsonValue));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Get a path part by its ID. Returns the path part if it exists and belongs to the user\'s tenant.
|
|
134
|
+
* Get Path Part Handler
|
|
135
|
+
*/
|
|
136
|
+
async getPathPart(requestParameters: GetPathPartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PathPartResponse> {
|
|
137
|
+
const response = await this.getPathPartRaw(requestParameters, initOverrides);
|
|
138
|
+
return await response.value();
|
|
139
|
+
}
|
|
140
|
+
|
|
77
141
|
/**
|
|
78
142
|
* 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.
|
|
79
143
|
* List Path Parts Handler
|
|
@@ -0,0 +1,305 @@
|
|
|
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
|
+
CreateSectionRequest,
|
|
19
|
+
HTTPValidationError,
|
|
20
|
+
SectionResponse,
|
|
21
|
+
UpdateSectionRequest,
|
|
22
|
+
} from '../models/index';
|
|
23
|
+
import {
|
|
24
|
+
CreateSectionRequestFromJSON,
|
|
25
|
+
CreateSectionRequestToJSON,
|
|
26
|
+
HTTPValidationErrorFromJSON,
|
|
27
|
+
HTTPValidationErrorToJSON,
|
|
28
|
+
SectionResponseFromJSON,
|
|
29
|
+
SectionResponseToJSON,
|
|
30
|
+
UpdateSectionRequestFromJSON,
|
|
31
|
+
UpdateSectionRequestToJSON,
|
|
32
|
+
} from '../models/index';
|
|
33
|
+
|
|
34
|
+
export interface CreateSectionOperationRequest {
|
|
35
|
+
createSectionRequest: CreateSectionRequest;
|
|
36
|
+
ksUat?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface DeleteSectionRequest {
|
|
40
|
+
sectionId: string;
|
|
41
|
+
ksUat?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface GetSectionRequest {
|
|
45
|
+
sectionId: string;
|
|
46
|
+
ksUat?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface UpdateSectionOperationRequest {
|
|
50
|
+
sectionId: string;
|
|
51
|
+
updateSectionRequest: UpdateSectionRequest;
|
|
52
|
+
ksUat?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* SectionsApi - interface
|
|
57
|
+
*
|
|
58
|
+
* @export
|
|
59
|
+
* @interface SectionsApiInterface
|
|
60
|
+
*/
|
|
61
|
+
export interface SectionsApiInterface {
|
|
62
|
+
/**
|
|
63
|
+
* Create a new section. The section is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). If prev_sibling_path_id is provided, the section is inserted after that sibling; otherwise it is appended to the end of the sibling list.
|
|
64
|
+
* @summary Create Section Handler
|
|
65
|
+
* @param {CreateSectionRequest} createSectionRequest
|
|
66
|
+
* @param {string} [ksUat]
|
|
67
|
+
* @param {*} [options] Override http request option.
|
|
68
|
+
* @throws {RequiredError}
|
|
69
|
+
* @memberof SectionsApiInterface
|
|
70
|
+
*/
|
|
71
|
+
createSectionRaw(requestParameters: CreateSectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SectionResponse>>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Create a new section. The section is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). If prev_sibling_path_id is provided, the section is inserted after that sibling; otherwise it is appended to the end of the sibling list.
|
|
75
|
+
* Create Section Handler
|
|
76
|
+
*/
|
|
77
|
+
createSection(requestParameters: CreateSectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SectionResponse>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Delete a section and all its children. WARNING: This cascades to all child sections due to parent_id ON DELETE CASCADE.
|
|
81
|
+
* @summary Delete Section Handler
|
|
82
|
+
* @param {string} sectionId
|
|
83
|
+
* @param {string} [ksUat]
|
|
84
|
+
* @param {*} [options] Override http request option.
|
|
85
|
+
* @throws {RequiredError}
|
|
86
|
+
* @memberof SectionsApiInterface
|
|
87
|
+
*/
|
|
88
|
+
deleteSectionRaw(requestParameters: DeleteSectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Delete a section and all its children. WARNING: This cascades to all child sections due to parent_id ON DELETE CASCADE.
|
|
92
|
+
* Delete Section Handler
|
|
93
|
+
*/
|
|
94
|
+
deleteSection(requestParameters: DeleteSectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get a section by its ID.
|
|
98
|
+
* @summary Get Section Handler
|
|
99
|
+
* @param {string} sectionId
|
|
100
|
+
* @param {string} [ksUat]
|
|
101
|
+
* @param {*} [options] Override http request option.
|
|
102
|
+
* @throws {RequiredError}
|
|
103
|
+
* @memberof SectionsApiInterface
|
|
104
|
+
*/
|
|
105
|
+
getSectionRaw(requestParameters: GetSectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SectionResponse>>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get a section by its ID.
|
|
109
|
+
* Get Section Handler
|
|
110
|
+
*/
|
|
111
|
+
getSection(requestParameters: GetSectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SectionResponse>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Update a section. Can update name, page_number, and/or reorder within siblings. To move: provide prev_sibling_path_id OR move_to_head (not both). Moving is only allowed within the same document version. Note: Section names can contain any characters. The corresponding path_part.name will be automatically normalized by a database trigger.
|
|
115
|
+
* @summary Update Section Handler
|
|
116
|
+
* @param {string} sectionId
|
|
117
|
+
* @param {UpdateSectionRequest} updateSectionRequest
|
|
118
|
+
* @param {string} [ksUat]
|
|
119
|
+
* @param {*} [options] Override http request option.
|
|
120
|
+
* @throws {RequiredError}
|
|
121
|
+
* @memberof SectionsApiInterface
|
|
122
|
+
*/
|
|
123
|
+
updateSectionRaw(requestParameters: UpdateSectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SectionResponse>>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Update a section. Can update name, page_number, and/or reorder within siblings. To move: provide prev_sibling_path_id OR move_to_head (not both). Moving is only allowed within the same document version. Note: Section names can contain any characters. The corresponding path_part.name will be automatically normalized by a database trigger.
|
|
127
|
+
* Update Section Handler
|
|
128
|
+
*/
|
|
129
|
+
updateSection(requestParameters: UpdateSectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SectionResponse>;
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
*/
|
|
136
|
+
export class SectionsApi extends runtime.BaseAPI implements SectionsApiInterface {
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Create a new section. The section is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). If prev_sibling_path_id is provided, the section is inserted after that sibling; otherwise it is appended to the end of the sibling list.
|
|
140
|
+
* Create Section Handler
|
|
141
|
+
*/
|
|
142
|
+
async createSectionRaw(requestParameters: CreateSectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SectionResponse>> {
|
|
143
|
+
if (requestParameters['createSectionRequest'] == null) {
|
|
144
|
+
throw new runtime.RequiredError(
|
|
145
|
+
'createSectionRequest',
|
|
146
|
+
'Required parameter "createSectionRequest" was null or undefined when calling createSection().'
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const queryParameters: any = {};
|
|
151
|
+
|
|
152
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
153
|
+
|
|
154
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
let urlPath = `/v1/sections`;
|
|
158
|
+
|
|
159
|
+
const response = await this.request({
|
|
160
|
+
path: urlPath,
|
|
161
|
+
method: 'POST',
|
|
162
|
+
headers: headerParameters,
|
|
163
|
+
query: queryParameters,
|
|
164
|
+
body: CreateSectionRequestToJSON(requestParameters['createSectionRequest']),
|
|
165
|
+
}, initOverrides);
|
|
166
|
+
|
|
167
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SectionResponseFromJSON(jsonValue));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Create a new section. The section is created as a child of the specified parent (must be DOCUMENT_VERSION or SECTION). If prev_sibling_path_id is provided, the section is inserted after that sibling; otherwise it is appended to the end of the sibling list.
|
|
172
|
+
* Create Section Handler
|
|
173
|
+
*/
|
|
174
|
+
async createSection(requestParameters: CreateSectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SectionResponse> {
|
|
175
|
+
const response = await this.createSectionRaw(requestParameters, initOverrides);
|
|
176
|
+
return await response.value();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Delete a section and all its children. WARNING: This cascades to all child sections due to parent_id ON DELETE CASCADE.
|
|
181
|
+
* Delete Section Handler
|
|
182
|
+
*/
|
|
183
|
+
async deleteSectionRaw(requestParameters: DeleteSectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
184
|
+
if (requestParameters['sectionId'] == null) {
|
|
185
|
+
throw new runtime.RequiredError(
|
|
186
|
+
'sectionId',
|
|
187
|
+
'Required parameter "sectionId" was null or undefined when calling deleteSection().'
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const queryParameters: any = {};
|
|
192
|
+
|
|
193
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
let urlPath = `/v1/sections/{section_id}`;
|
|
197
|
+
urlPath = urlPath.replace(`{${"section_id"}}`, encodeURIComponent(String(requestParameters['sectionId'])));
|
|
198
|
+
|
|
199
|
+
const response = await this.request({
|
|
200
|
+
path: urlPath,
|
|
201
|
+
method: 'DELETE',
|
|
202
|
+
headers: headerParameters,
|
|
203
|
+
query: queryParameters,
|
|
204
|
+
}, initOverrides);
|
|
205
|
+
|
|
206
|
+
return new runtime.VoidApiResponse(response);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Delete a section and all its children. WARNING: This cascades to all child sections due to parent_id ON DELETE CASCADE.
|
|
211
|
+
* Delete Section Handler
|
|
212
|
+
*/
|
|
213
|
+
async deleteSection(requestParameters: DeleteSectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
214
|
+
await this.deleteSectionRaw(requestParameters, initOverrides);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get a section by its ID.
|
|
219
|
+
* Get Section Handler
|
|
220
|
+
*/
|
|
221
|
+
async getSectionRaw(requestParameters: GetSectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SectionResponse>> {
|
|
222
|
+
if (requestParameters['sectionId'] == null) {
|
|
223
|
+
throw new runtime.RequiredError(
|
|
224
|
+
'sectionId',
|
|
225
|
+
'Required parameter "sectionId" was null or undefined when calling getSection().'
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const queryParameters: any = {};
|
|
230
|
+
|
|
231
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
let urlPath = `/v1/sections/{section_id}`;
|
|
235
|
+
urlPath = urlPath.replace(`{${"section_id"}}`, encodeURIComponent(String(requestParameters['sectionId'])));
|
|
236
|
+
|
|
237
|
+
const response = await this.request({
|
|
238
|
+
path: urlPath,
|
|
239
|
+
method: 'GET',
|
|
240
|
+
headers: headerParameters,
|
|
241
|
+
query: queryParameters,
|
|
242
|
+
}, initOverrides);
|
|
243
|
+
|
|
244
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SectionResponseFromJSON(jsonValue));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Get a section by its ID.
|
|
249
|
+
* Get Section Handler
|
|
250
|
+
*/
|
|
251
|
+
async getSection(requestParameters: GetSectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SectionResponse> {
|
|
252
|
+
const response = await this.getSectionRaw(requestParameters, initOverrides);
|
|
253
|
+
return await response.value();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Update a section. Can update name, page_number, and/or reorder within siblings. To move: provide prev_sibling_path_id OR move_to_head (not both). Moving is only allowed within the same document version. Note: Section names can contain any characters. The corresponding path_part.name will be automatically normalized by a database trigger.
|
|
258
|
+
* Update Section Handler
|
|
259
|
+
*/
|
|
260
|
+
async updateSectionRaw(requestParameters: UpdateSectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SectionResponse>> {
|
|
261
|
+
if (requestParameters['sectionId'] == null) {
|
|
262
|
+
throw new runtime.RequiredError(
|
|
263
|
+
'sectionId',
|
|
264
|
+
'Required parameter "sectionId" was null or undefined when calling updateSection().'
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (requestParameters['updateSectionRequest'] == null) {
|
|
269
|
+
throw new runtime.RequiredError(
|
|
270
|
+
'updateSectionRequest',
|
|
271
|
+
'Required parameter "updateSectionRequest" was null or undefined when calling updateSection().'
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const queryParameters: any = {};
|
|
276
|
+
|
|
277
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
278
|
+
|
|
279
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
let urlPath = `/v1/sections/{section_id}`;
|
|
283
|
+
urlPath = urlPath.replace(`{${"section_id"}}`, encodeURIComponent(String(requestParameters['sectionId'])));
|
|
284
|
+
|
|
285
|
+
const response = await this.request({
|
|
286
|
+
path: urlPath,
|
|
287
|
+
method: 'PATCH',
|
|
288
|
+
headers: headerParameters,
|
|
289
|
+
query: queryParameters,
|
|
290
|
+
body: UpdateSectionRequestToJSON(requestParameters['updateSectionRequest']),
|
|
291
|
+
}, initOverrides);
|
|
292
|
+
|
|
293
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SectionResponseFromJSON(jsonValue));
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Update a section. Can update name, page_number, and/or reorder within siblings. To move: provide prev_sibling_path_id OR move_to_head (not both). Moving is only allowed within the same document version. Note: Section names can contain any characters. The corresponding path_part.name will be automatically normalized by a database trigger.
|
|
298
|
+
* Update Section Handler
|
|
299
|
+
*/
|
|
300
|
+
async updateSection(requestParameters: UpdateSectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SectionResponse> {
|
|
301
|
+
const response = await this.updateSectionRaw(requestParameters, initOverrides);
|
|
302
|
+
return await response.value();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
}
|
package/src/apis/index.ts
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export * from './AuthApi';
|
|
4
4
|
export * from './DefaultApi';
|
|
5
|
+
export * from './DocumentVersionsApi';
|
|
5
6
|
export * from './DocumentsApi';
|
|
6
7
|
export * from './FoldersApi';
|
|
7
8
|
export * from './InvitesApi';
|
|
8
9
|
export * from './PathPartsApi';
|
|
10
|
+
export * from './SectionsApi';
|
|
9
11
|
export * from './TenantsApi';
|
|
10
12
|
export * from './UsersApi';
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* Request to create a new section.
|
|
18
|
+
* @export
|
|
19
|
+
* @interface CreateSectionRequest
|
|
20
|
+
*/
|
|
21
|
+
export interface CreateSectionRequest {
|
|
22
|
+
/**
|
|
23
|
+
* Section name (can contain any characters)
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof CreateSectionRequest
|
|
26
|
+
*/
|
|
27
|
+
name: string;
|
|
28
|
+
/**
|
|
29
|
+
* Parent PathPart ID (must be DOCUMENT_VERSION or SECTION)
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof CreateSectionRequest
|
|
32
|
+
*/
|
|
33
|
+
parentPathId: string;
|
|
34
|
+
/**
|
|
35
|
+
* Page number in source document (must be > 0)
|
|
36
|
+
* @type {number}
|
|
37
|
+
* @memberof CreateSectionRequest
|
|
38
|
+
*/
|
|
39
|
+
pageNumber?: number;
|
|
40
|
+
/**
|
|
41
|
+
* PathPart ID to insert after (null = append to tail)
|
|
42
|
+
* @type {string}
|
|
43
|
+
* @memberof CreateSectionRequest
|
|
44
|
+
*/
|
|
45
|
+
prevSiblingPathId?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Check if a given object implements the CreateSectionRequest interface.
|
|
50
|
+
*/
|
|
51
|
+
export function instanceOfCreateSectionRequest(value: object): value is CreateSectionRequest {
|
|
52
|
+
if (!('name' in value) || value['name'] === undefined) return false;
|
|
53
|
+
if (!('parentPathId' in value) || value['parentPathId'] === undefined) return false;
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function CreateSectionRequestFromJSON(json: any): CreateSectionRequest {
|
|
58
|
+
return CreateSectionRequestFromJSONTyped(json, false);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function CreateSectionRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateSectionRequest {
|
|
62
|
+
if (json == null) {
|
|
63
|
+
return json;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
|
|
67
|
+
'name': json['name'],
|
|
68
|
+
'parentPathId': json['parent_path_id'],
|
|
69
|
+
'pageNumber': json['page_number'] == null ? undefined : json['page_number'],
|
|
70
|
+
'prevSiblingPathId': json['prev_sibling_path_id'] == null ? undefined : json['prev_sibling_path_id'],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function CreateSectionRequestToJSON(json: any): CreateSectionRequest {
|
|
75
|
+
return CreateSectionRequestToJSONTyped(json, false);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function CreateSectionRequestToJSONTyped(value?: CreateSectionRequest | null, ignoreDiscriminator: boolean = false): any {
|
|
79
|
+
if (value == null) {
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
|
|
85
|
+
'name': value['name'],
|
|
86
|
+
'parent_path_id': value['parentPathId'],
|
|
87
|
+
'page_number': value['pageNumber'],
|
|
88
|
+
'prev_sibling_path_id': value['prevSiblingPathId'],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const CreateSectionRequestPropertyValidationAttributesMap: {
|
|
93
|
+
[property: string]: {
|
|
94
|
+
maxLength?: number,
|
|
95
|
+
minLength?: number,
|
|
96
|
+
pattern?: string,
|
|
97
|
+
maximum?: number,
|
|
98
|
+
exclusiveMaximum?: boolean,
|
|
99
|
+
minimum?: number,
|
|
100
|
+
exclusiveMinimum?: boolean,
|
|
101
|
+
multipleOf?: number,
|
|
102
|
+
maxItems?: number,
|
|
103
|
+
minItems?: number,
|
|
104
|
+
uniqueItems?: boolean
|
|
105
|
+
}
|
|
106
|
+
} = {
|
|
107
|
+
name: {
|
|
108
|
+
maxLength: 255,
|
|
109
|
+
minLength: 1,
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
|
|
@@ -17,7 +17,7 @@ import { mapValues } from '../runtime';
|
|
|
17
17
|
* DocumentVersion response model.
|
|
18
18
|
*
|
|
19
19
|
* Shared schema for DocumentVersion responses, used by Document endpoints
|
|
20
|
-
* and
|
|
20
|
+
* and DocumentVersion endpoints.
|
|
21
21
|
* @export
|
|
22
22
|
* @interface DocumentVersionResponse
|
|
23
23
|
*/
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
import type { DocumentVersionResponse } from './DocumentVersionResponse';
|
|
17
|
+
import {
|
|
18
|
+
DocumentVersionResponseFromJSON,
|
|
19
|
+
DocumentVersionResponseFromJSONTyped,
|
|
20
|
+
DocumentVersionResponseToJSON,
|
|
21
|
+
DocumentVersionResponseToJSONTyped,
|
|
22
|
+
} from './DocumentVersionResponse';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
* @interface PaginatedResponseDocumentVersionResponse
|
|
28
|
+
*/
|
|
29
|
+
export interface PaginatedResponseDocumentVersionResponse {
|
|
30
|
+
/**
|
|
31
|
+
* List of items
|
|
32
|
+
* @type {Array<DocumentVersionResponse>}
|
|
33
|
+
* @memberof PaginatedResponseDocumentVersionResponse
|
|
34
|
+
*/
|
|
35
|
+
items: Array<DocumentVersionResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Total number of items
|
|
38
|
+
* @type {number}
|
|
39
|
+
* @memberof PaginatedResponseDocumentVersionResponse
|
|
40
|
+
*/
|
|
41
|
+
total: number;
|
|
42
|
+
/**
|
|
43
|
+
* Number of items per page
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @memberof PaginatedResponseDocumentVersionResponse
|
|
46
|
+
*/
|
|
47
|
+
limit: number;
|
|
48
|
+
/**
|
|
49
|
+
* Number of items to skip
|
|
50
|
+
* @type {number}
|
|
51
|
+
* @memberof PaginatedResponseDocumentVersionResponse
|
|
52
|
+
*/
|
|
53
|
+
offset: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Check if a given object implements the PaginatedResponseDocumentVersionResponse interface.
|
|
58
|
+
*/
|
|
59
|
+
export function instanceOfPaginatedResponseDocumentVersionResponse(value: object): value is PaginatedResponseDocumentVersionResponse {
|
|
60
|
+
if (!('items' in value) || value['items'] === undefined) return false;
|
|
61
|
+
if (!('total' in value) || value['total'] === undefined) return false;
|
|
62
|
+
if (!('limit' in value) || value['limit'] === undefined) return false;
|
|
63
|
+
if (!('offset' in value) || value['offset'] === undefined) return false;
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function PaginatedResponseDocumentVersionResponseFromJSON(json: any): PaginatedResponseDocumentVersionResponse {
|
|
68
|
+
return PaginatedResponseDocumentVersionResponseFromJSONTyped(json, false);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function PaginatedResponseDocumentVersionResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedResponseDocumentVersionResponse {
|
|
72
|
+
if (json == null) {
|
|
73
|
+
return json;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
|
|
77
|
+
'items': ((json['items'] as Array<any>).map(DocumentVersionResponseFromJSON)),
|
|
78
|
+
'total': json['total'],
|
|
79
|
+
'limit': json['limit'],
|
|
80
|
+
'offset': json['offset'],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function PaginatedResponseDocumentVersionResponseToJSON(json: any): PaginatedResponseDocumentVersionResponse {
|
|
85
|
+
return PaginatedResponseDocumentVersionResponseToJSONTyped(json, false);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function PaginatedResponseDocumentVersionResponseToJSONTyped(value?: PaginatedResponseDocumentVersionResponse | null, ignoreDiscriminator: boolean = false): any {
|
|
89
|
+
if (value == null) {
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
|
|
95
|
+
'items': ((value['items'] as Array<any>).map(DocumentVersionResponseToJSON)),
|
|
96
|
+
'total': value['total'],
|
|
97
|
+
'limit': value['limit'],
|
|
98
|
+
'offset': value['offset'],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const PaginatedResponseDocumentVersionResponsePropertyValidationAttributesMap: {
|
|
103
|
+
[property: string]: {
|
|
104
|
+
maxLength?: number,
|
|
105
|
+
minLength?: number,
|
|
106
|
+
pattern?: string,
|
|
107
|
+
maximum?: number,
|
|
108
|
+
exclusiveMaximum?: boolean,
|
|
109
|
+
minimum?: number,
|
|
110
|
+
exclusiveMinimum?: boolean,
|
|
111
|
+
multipleOf?: number,
|
|
112
|
+
maxItems?: number,
|
|
113
|
+
minItems?: number,
|
|
114
|
+
uniqueItems?: boolean
|
|
115
|
+
}
|
|
116
|
+
} = {
|
|
117
|
+
total: {
|
|
118
|
+
minimum: 0,
|
|
119
|
+
exclusiveMinimum: false,
|
|
120
|
+
},
|
|
121
|
+
limit: {
|
|
122
|
+
minimum: 1,
|
|
123
|
+
exclusiveMinimum: false,
|
|
124
|
+
},
|
|
125
|
+
offset: {
|
|
126
|
+
minimum: 0,
|
|
127
|
+
exclusiveMinimum: false,
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
|