@knowledge-stack/ksapi 1.154.1 → 1.156.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/.openapi-generator/FILES +28 -0
  2. package/README.md +20 -2
  3. package/dist/apis/BulkDeleteApi.d.ts +64 -0
  4. package/dist/apis/BulkDeleteApi.js +115 -0
  5. package/dist/apis/BulkMoveApi.d.ts +64 -0
  6. package/dist/apis/BulkMoveApi.js +115 -0
  7. package/dist/apis/TrashApi.d.ts +77 -1
  8. package/dist/apis/TrashApi.js +98 -0
  9. package/dist/apis/UserPermissionsApi.d.ts +77 -1
  10. package/dist/apis/UserPermissionsApi.js +98 -0
  11. package/dist/apis/index.d.ts +2 -0
  12. package/dist/apis/index.js +2 -0
  13. package/dist/esm/apis/BulkDeleteApi.d.ts +64 -0
  14. package/dist/esm/apis/BulkDeleteApi.js +78 -0
  15. package/dist/esm/apis/BulkMoveApi.d.ts +64 -0
  16. package/dist/esm/apis/BulkMoveApi.js +78 -0
  17. package/dist/esm/apis/TrashApi.d.ts +77 -1
  18. package/dist/esm/apis/TrashApi.js +99 -1
  19. package/dist/esm/apis/UserPermissionsApi.d.ts +77 -1
  20. package/dist/esm/apis/UserPermissionsApi.js +99 -1
  21. package/dist/esm/apis/index.d.ts +2 -0
  22. package/dist/esm/apis/index.js +2 -0
  23. package/dist/esm/models/BulkDeleteRequest.d.ts +53 -0
  24. package/dist/esm/models/BulkDeleteRequest.js +44 -0
  25. package/dist/esm/models/BulkFailureReason.d.ts +37 -0
  26. package/dist/esm/models/BulkFailureReason.js +55 -0
  27. package/dist/esm/models/BulkGrantItem.d.ts +66 -0
  28. package/dist/esm/models/BulkGrantItem.js +55 -0
  29. package/dist/esm/models/BulkGrantItemFailure.d.ts +60 -0
  30. package/dist/esm/models/BulkGrantItemFailure.js +53 -0
  31. package/dist/esm/models/BulkGrantRequest.d.ts +54 -0
  32. package/dist/esm/models/BulkGrantRequest.js +47 -0
  33. package/dist/esm/models/BulkGrantResponse.d.ts +55 -0
  34. package/dist/esm/models/BulkGrantResponse.js +46 -0
  35. package/dist/esm/models/BulkGrantSuccess.d.ts +72 -0
  36. package/dist/esm/models/BulkGrantSuccess.js +61 -0
  37. package/dist/esm/models/BulkItemFailure.d.ts +54 -0
  38. package/dist/esm/models/BulkItemFailure.js +49 -0
  39. package/dist/esm/models/BulkMoveRequest.d.ts +59 -0
  40. package/dist/esm/models/BulkMoveRequest.js +48 -0
  41. package/dist/esm/models/BulkOperationResponse.d.ts +54 -0
  42. package/dist/esm/models/BulkOperationResponse.js +45 -0
  43. package/dist/esm/models/BulkRevokeRequest.d.ts +53 -0
  44. package/dist/esm/models/BulkRevokeRequest.js +46 -0
  45. package/dist/esm/models/BulkTrashRequest.d.ts +47 -0
  46. package/dist/esm/models/BulkTrashRequest.js +42 -0
  47. package/dist/esm/models/CreateUploadRequest.d.ts +6 -0
  48. package/dist/esm/models/CreateUploadRequest.js +2 -0
  49. package/dist/esm/models/DocumentVersionMetadata.d.ts +18 -0
  50. package/dist/esm/models/DocumentVersionMetadata.js +6 -0
  51. package/dist/esm/models/DocumentVersionMetadataUpdate.d.ts +18 -0
  52. package/dist/esm/models/DocumentVersionMetadataUpdate.js +6 -0
  53. package/dist/esm/models/ErrorResponse.d.ts +1 -0
  54. package/dist/esm/models/ErrorResponse.js +1 -0
  55. package/dist/esm/models/index.d.ts +12 -0
  56. package/dist/esm/models/index.js +12 -0
  57. package/dist/models/BulkDeleteRequest.d.ts +53 -0
  58. package/dist/models/BulkDeleteRequest.js +52 -0
  59. package/dist/models/BulkFailureReason.d.ts +37 -0
  60. package/dist/models/BulkFailureReason.js +63 -0
  61. package/dist/models/BulkGrantItem.d.ts +66 -0
  62. package/dist/models/BulkGrantItem.js +63 -0
  63. package/dist/models/BulkGrantItemFailure.d.ts +60 -0
  64. package/dist/models/BulkGrantItemFailure.js +61 -0
  65. package/dist/models/BulkGrantRequest.d.ts +54 -0
  66. package/dist/models/BulkGrantRequest.js +55 -0
  67. package/dist/models/BulkGrantResponse.d.ts +55 -0
  68. package/dist/models/BulkGrantResponse.js +54 -0
  69. package/dist/models/BulkGrantSuccess.d.ts +72 -0
  70. package/dist/models/BulkGrantSuccess.js +69 -0
  71. package/dist/models/BulkItemFailure.d.ts +54 -0
  72. package/dist/models/BulkItemFailure.js +57 -0
  73. package/dist/models/BulkMoveRequest.d.ts +59 -0
  74. package/dist/models/BulkMoveRequest.js +56 -0
  75. package/dist/models/BulkOperationResponse.d.ts +54 -0
  76. package/dist/models/BulkOperationResponse.js +53 -0
  77. package/dist/models/BulkRevokeRequest.d.ts +53 -0
  78. package/dist/models/BulkRevokeRequest.js +54 -0
  79. package/dist/models/BulkTrashRequest.d.ts +47 -0
  80. package/dist/models/BulkTrashRequest.js +50 -0
  81. package/dist/models/CreateUploadRequest.d.ts +6 -0
  82. package/dist/models/CreateUploadRequest.js +2 -0
  83. package/dist/models/DocumentVersionMetadata.d.ts +18 -0
  84. package/dist/models/DocumentVersionMetadata.js +6 -0
  85. package/dist/models/DocumentVersionMetadataUpdate.d.ts +18 -0
  86. package/dist/models/DocumentVersionMetadataUpdate.js +6 -0
  87. package/dist/models/ErrorResponse.d.ts +1 -0
  88. package/dist/models/ErrorResponse.js +1 -0
  89. package/dist/models/index.d.ts +12 -0
  90. package/dist/models/index.js +12 -0
  91. package/docs/BulkDeleteApi.md +84 -0
  92. package/docs/BulkDeleteRequest.md +37 -0
  93. package/docs/BulkFailureReason.md +33 -0
  94. package/docs/BulkGrantItem.md +41 -0
  95. package/docs/BulkGrantItemFailure.md +39 -0
  96. package/docs/BulkGrantRequest.md +37 -0
  97. package/docs/BulkGrantResponse.md +37 -0
  98. package/docs/BulkGrantSuccess.md +43 -0
  99. package/docs/BulkItemFailure.md +37 -0
  100. package/docs/BulkMoveApi.md +84 -0
  101. package/docs/BulkMoveRequest.md +39 -0
  102. package/docs/BulkOperationResponse.md +37 -0
  103. package/docs/BulkRevokeRequest.md +37 -0
  104. package/docs/BulkTrashRequest.md +35 -0
  105. package/docs/CreateUploadRequest.md +2 -0
  106. package/docs/DocumentVersionMetadata.md +6 -0
  107. package/docs/DocumentVersionMetadataUpdate.md +6 -0
  108. package/docs/TrashApi.md +152 -0
  109. package/docs/UserPermissionsApi.md +152 -0
  110. package/package.json +1 -1
  111. package/src/apis/BulkDeleteApi.ts +133 -0
  112. package/src/apis/BulkMoveApi.ts +133 -0
  113. package/src/apis/TrashApi.ts +176 -0
  114. package/src/apis/UserPermissionsApi.ts +182 -0
  115. package/src/apis/index.ts +2 -0
  116. package/src/models/BulkDeleteRequest.ts +90 -0
  117. package/src/models/BulkFailureReason.ts +65 -0
  118. package/src/models/BulkGrantItem.ts +119 -0
  119. package/src/models/BulkGrantItemFailure.ts +111 -0
  120. package/src/models/BulkGrantRequest.ts +99 -0
  121. package/src/models/BulkGrantResponse.ts +105 -0
  122. package/src/models/BulkGrantSuccess.ts +129 -0
  123. package/src/models/BulkItemFailure.ts +102 -0
  124. package/src/models/BulkMoveRequest.ts +99 -0
  125. package/src/models/BulkOperationResponse.ts +98 -0
  126. package/src/models/BulkRevokeRequest.ts +91 -0
  127. package/src/models/BulkTrashRequest.ts +82 -0
  128. package/src/models/CreateUploadRequest.ts +8 -0
  129. package/src/models/DocumentVersionMetadata.ts +24 -0
  130. package/src/models/DocumentVersionMetadataUpdate.ts +24 -0
  131. package/src/models/ErrorResponse.ts +1 -0
  132. package/src/models/index.ts +12 -0
@@ -4,6 +4,8 @@ All URIs are relative to *http://localhost:8000*
4
4
 
5
5
  | Method | HTTP request | Description |
6
6
  |------------- | ------------- | -------------|
7
+ | [**bulkGrantUserPermissions**](UserPermissionsApi.md#bulkgrantuserpermissions) | **POST** /v1/user-permissions/bulk | Bulk Grant User Permissions Handler |
8
+ | [**bulkRevokeUserPermissions**](UserPermissionsApi.md#bulkrevokeuserpermissions) | **POST** /v1/user-permissions/bulk-delete | Bulk Revoke User Permissions Handler |
7
9
  | [**createUserPermission**](UserPermissionsApi.md#createuserpermission) | **POST** /v1/user-permissions | Create User Permission Handler |
8
10
  | [**deleteUserPermission**](UserPermissionsApi.md#deleteuserpermission) | **DELETE** /v1/user-permissions/{permission_id} | Delete User Permission Handler |
9
11
  | [**listUserPermissions**](UserPermissionsApi.md#listuserpermissions) | **GET** /v1/user-permissions | List User Permissions Handler |
@@ -11,6 +13,156 @@ All URIs are relative to *http://localhost:8000*
11
13
 
12
14
 
13
15
 
16
+ ## bulkGrantUserPermissions
17
+
18
+ > BulkGrantResponse bulkGrantUserPermissions(bulkGrantRequest)
19
+
20
+ Bulk Grant User Permissions Handler
21
+
22
+ Grant many (user, object, capability) permissions (admin/owner only). Each grant is applied in its own transaction, reporting a per-item outcome keyed on the (user_id, object_id) pair: a missing/trashed object or a user not in the tenant is ``not_found``, hitting the per-user cap is ``permission_limit``, and an already-covered grant is ``subsumed``.
23
+
24
+ ### Example
25
+
26
+ ```ts
27
+ import {
28
+ Configuration,
29
+ UserPermissionsApi,
30
+ } from '@knowledge-stack/ksapi';
31
+ import type { BulkGrantUserPermissionsRequest } from '@knowledge-stack/ksapi';
32
+
33
+ async function example() {
34
+ console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
35
+ const config = new Configuration({
36
+ // To configure API key authorization: cookieAuth
37
+ apiKey: "YOUR API KEY",
38
+ // Configure HTTP bearer authorization: bearerAuth
39
+ accessToken: "YOUR BEARER TOKEN",
40
+ });
41
+ const api = new UserPermissionsApi(config);
42
+
43
+ const body = {
44
+ // BulkGrantRequest
45
+ bulkGrantRequest: ...,
46
+ } satisfies BulkGrantUserPermissionsRequest;
47
+
48
+ try {
49
+ const data = await api.bulkGrantUserPermissions(body);
50
+ console.log(data);
51
+ } catch (error) {
52
+ console.error(error);
53
+ }
54
+ }
55
+
56
+ // Run the test
57
+ example().catch(console.error);
58
+ ```
59
+
60
+ ### Parameters
61
+
62
+
63
+ | Name | Type | Description | Notes |
64
+ |------------- | ------------- | ------------- | -------------|
65
+ | **bulkGrantRequest** | [BulkGrantRequest](BulkGrantRequest.md) | | |
66
+
67
+ ### Return type
68
+
69
+ [**BulkGrantResponse**](BulkGrantResponse.md)
70
+
71
+ ### Authorization
72
+
73
+ [cookieAuth](../README.md#cookieAuth), [bearerAuth](../README.md#bearerAuth)
74
+
75
+ ### HTTP request headers
76
+
77
+ - **Content-Type**: `application/json`
78
+ - **Accept**: `application/json`
79
+
80
+
81
+ ### HTTP response details
82
+ | Status code | Description | Response headers |
83
+ |-------------|-------------|------------------|
84
+ | **200** | Successful Response | - |
85
+ | **422** | Validation Error | - |
86
+ | **0** | Error response. | - |
87
+
88
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
89
+
90
+
91
+ ## bulkRevokeUserPermissions
92
+
93
+ > BulkOperationResponse bulkRevokeUserPermissions(bulkRevokeRequest)
94
+
95
+ Bulk Revoke User Permissions Handler
96
+
97
+ Revoke many permissions by their ids (admin/owner only), per item. A permission id not found in the tenant lands in ``failed`` as ``not_found``.
98
+
99
+ ### Example
100
+
101
+ ```ts
102
+ import {
103
+ Configuration,
104
+ UserPermissionsApi,
105
+ } from '@knowledge-stack/ksapi';
106
+ import type { BulkRevokeUserPermissionsRequest } from '@knowledge-stack/ksapi';
107
+
108
+ async function example() {
109
+ console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
110
+ const config = new Configuration({
111
+ // To configure API key authorization: cookieAuth
112
+ apiKey: "YOUR API KEY",
113
+ // Configure HTTP bearer authorization: bearerAuth
114
+ accessToken: "YOUR BEARER TOKEN",
115
+ });
116
+ const api = new UserPermissionsApi(config);
117
+
118
+ const body = {
119
+ // BulkRevokeRequest
120
+ bulkRevokeRequest: ...,
121
+ } satisfies BulkRevokeUserPermissionsRequest;
122
+
123
+ try {
124
+ const data = await api.bulkRevokeUserPermissions(body);
125
+ console.log(data);
126
+ } catch (error) {
127
+ console.error(error);
128
+ }
129
+ }
130
+
131
+ // Run the test
132
+ example().catch(console.error);
133
+ ```
134
+
135
+ ### Parameters
136
+
137
+
138
+ | Name | Type | Description | Notes |
139
+ |------------- | ------------- | ------------- | -------------|
140
+ | **bulkRevokeRequest** | [BulkRevokeRequest](BulkRevokeRequest.md) | | |
141
+
142
+ ### Return type
143
+
144
+ [**BulkOperationResponse**](BulkOperationResponse.md)
145
+
146
+ ### Authorization
147
+
148
+ [cookieAuth](../README.md#cookieAuth), [bearerAuth](../README.md#bearerAuth)
149
+
150
+ ### HTTP request headers
151
+
152
+ - **Content-Type**: `application/json`
153
+ - **Accept**: `application/json`
154
+
155
+
156
+ ### HTTP response details
157
+ | Status code | Description | Response headers |
158
+ |-------------|-------------|------------------|
159
+ | **200** | Successful Response | - |
160
+ | **422** | Validation Error | - |
161
+ | **0** | Error response. | - |
162
+
163
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
164
+
165
+
14
166
  ## createUserPermission
15
167
 
16
168
  > PermissionResponse createUserPermission(createPermissionRequest)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowledge-stack/ksapi",
3
- "version": "1.154.1",
3
+ "version": "1.156.0",
4
4
  "description": "OpenAPI client for @knowledge-stack/ksapi",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -0,0 +1,133 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
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
+ BulkDeleteRequest,
19
+ BulkOperationResponse,
20
+ ErrorResponse,
21
+ HTTPValidationError,
22
+ } from '../models/index';
23
+ import {
24
+ BulkDeleteRequestFromJSON,
25
+ BulkDeleteRequestToJSON,
26
+ BulkOperationResponseFromJSON,
27
+ BulkOperationResponseToJSON,
28
+ ErrorResponseFromJSON,
29
+ ErrorResponseToJSON,
30
+ HTTPValidationErrorFromJSON,
31
+ HTTPValidationErrorToJSON,
32
+ } from '../models/index';
33
+
34
+ export interface BulkDeleteOperationRequest {
35
+ bulkDeleteRequest: BulkDeleteRequest;
36
+ }
37
+
38
+ /**
39
+ * BulkDeleteApi - interface
40
+ *
41
+ * @export
42
+ * @interface BulkDeleteApiInterface
43
+ */
44
+ export interface BulkDeleteApiInterface {
45
+ /**
46
+ * Creates request options for bulkDelete without sending the request
47
+ * @param {BulkDeleteRequest} bulkDeleteRequest
48
+ * @throws {RequiredError}
49
+ * @memberof BulkDeleteApiInterface
50
+ */
51
+ bulkDeleteRequestOpts(requestParameters: BulkDeleteOperationRequest): Promise<runtime.RequestOpts>;
52
+
53
+ /**
54
+ * Move the selected folders and documents to Trash, reporting per item. Each id is soft-deleted in its own transaction: items the caller may not delete, that are approval-sealed, held by another user, contain an in-progress run, or sit inside another selected folder land in ``failed`` with a reason while the rest succeed. Over the selection cap returns ``400``.
55
+ * @summary Bulk Delete Handler
56
+ * @param {BulkDeleteRequest} bulkDeleteRequest
57
+ * @param {*} [options] Override http request option.
58
+ * @throws {RequiredError}
59
+ * @memberof BulkDeleteApiInterface
60
+ */
61
+ bulkDeleteRaw(requestParameters: BulkDeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>>;
62
+
63
+ /**
64
+ * Move the selected folders and documents to Trash, reporting per item. Each id is soft-deleted in its own transaction: items the caller may not delete, that are approval-sealed, held by another user, contain an in-progress run, or sit inside another selected folder land in ``failed`` with a reason while the rest succeed. Over the selection cap returns ``400``.
65
+ * Bulk Delete Handler
66
+ */
67
+ bulkDelete(requestParameters: BulkDeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse>;
68
+
69
+ }
70
+
71
+ /**
72
+ *
73
+ */
74
+ export class BulkDeleteApi extends runtime.BaseAPI implements BulkDeleteApiInterface {
75
+
76
+ /**
77
+ * Creates request options for bulkDelete without sending the request
78
+ */
79
+ async bulkDeleteRequestOpts(requestParameters: BulkDeleteOperationRequest): Promise<runtime.RequestOpts> {
80
+ if (requestParameters['bulkDeleteRequest'] == null) {
81
+ throw new runtime.RequiredError(
82
+ 'bulkDeleteRequest',
83
+ 'Required parameter "bulkDeleteRequest" was null or undefined when calling bulkDelete().'
84
+ );
85
+ }
86
+
87
+ const queryParameters: any = {};
88
+
89
+ const headerParameters: runtime.HTTPHeaders = {};
90
+
91
+ headerParameters['Content-Type'] = 'application/json';
92
+
93
+ if (this.configuration && this.configuration.accessToken) {
94
+ const token = this.configuration.accessToken;
95
+ const tokenString = await token("bearerAuth", []);
96
+
97
+ if (tokenString) {
98
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
99
+ }
100
+ }
101
+
102
+ let urlPath = `/v1/bulk-delete`;
103
+
104
+ return {
105
+ path: urlPath,
106
+ method: 'POST',
107
+ headers: headerParameters,
108
+ query: queryParameters,
109
+ body: BulkDeleteRequestToJSON(requestParameters['bulkDeleteRequest']),
110
+ };
111
+ }
112
+
113
+ /**
114
+ * Move the selected folders and documents to Trash, reporting per item. Each id is soft-deleted in its own transaction: items the caller may not delete, that are approval-sealed, held by another user, contain an in-progress run, or sit inside another selected folder land in ``failed`` with a reason while the rest succeed. Over the selection cap returns ``400``.
115
+ * Bulk Delete Handler
116
+ */
117
+ async bulkDeleteRaw(requestParameters: BulkDeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>> {
118
+ const requestOptions = await this.bulkDeleteRequestOpts(requestParameters);
119
+ const response = await this.request(requestOptions, initOverrides);
120
+
121
+ return new runtime.JSONApiResponse(response, (jsonValue) => BulkOperationResponseFromJSON(jsonValue));
122
+ }
123
+
124
+ /**
125
+ * Move the selected folders and documents to Trash, reporting per item. Each id is soft-deleted in its own transaction: items the caller may not delete, that are approval-sealed, held by another user, contain an in-progress run, or sit inside another selected folder land in ``failed`` with a reason while the rest succeed. Over the selection cap returns ``400``.
126
+ * Bulk Delete Handler
127
+ */
128
+ async bulkDelete(requestParameters: BulkDeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse> {
129
+ const response = await this.bulkDeleteRaw(requestParameters, initOverrides);
130
+ return await response.value();
131
+ }
132
+
133
+ }
@@ -0,0 +1,133 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
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
+ BulkMoveRequest,
19
+ BulkOperationResponse,
20
+ ErrorResponse,
21
+ HTTPValidationError,
22
+ } from '../models/index';
23
+ import {
24
+ BulkMoveRequestFromJSON,
25
+ BulkMoveRequestToJSON,
26
+ BulkOperationResponseFromJSON,
27
+ BulkOperationResponseToJSON,
28
+ ErrorResponseFromJSON,
29
+ ErrorResponseToJSON,
30
+ HTTPValidationErrorFromJSON,
31
+ HTTPValidationErrorToJSON,
32
+ } from '../models/index';
33
+
34
+ export interface BulkMoveOperationRequest {
35
+ bulkMoveRequest: BulkMoveRequest;
36
+ }
37
+
38
+ /**
39
+ * BulkMoveApi - interface
40
+ *
41
+ * @export
42
+ * @interface BulkMoveApiInterface
43
+ */
44
+ export interface BulkMoveApiInterface {
45
+ /**
46
+ * Creates request options for bulkMove without sending the request
47
+ * @param {BulkMoveRequest} bulkMoveRequest
48
+ * @throws {RequiredError}
49
+ * @memberof BulkMoveApiInterface
50
+ */
51
+ bulkMoveRequestOpts(requestParameters: BulkMoveOperationRequest): Promise<runtime.RequestOpts>;
52
+
53
+ /**
54
+ * Move the selected folders and documents into ``target_folder_id``. The destination is checked once up front — an invalid target returns ``400`` and a target the caller cannot write returns ``403``, before any item moves. Each source then moves in its own transaction; items the caller may not write, that are sealed, held by another user, that would form a cycle, hit a name collision, or sit inside another selected folder land in ``failed`` with a reason while the rest succeed.
55
+ * @summary Bulk Move Handler
56
+ * @param {BulkMoveRequest} bulkMoveRequest
57
+ * @param {*} [options] Override http request option.
58
+ * @throws {RequiredError}
59
+ * @memberof BulkMoveApiInterface
60
+ */
61
+ bulkMoveRaw(requestParameters: BulkMoveOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>>;
62
+
63
+ /**
64
+ * Move the selected folders and documents into ``target_folder_id``. The destination is checked once up front — an invalid target returns ``400`` and a target the caller cannot write returns ``403``, before any item moves. Each source then moves in its own transaction; items the caller may not write, that are sealed, held by another user, that would form a cycle, hit a name collision, or sit inside another selected folder land in ``failed`` with a reason while the rest succeed.
65
+ * Bulk Move Handler
66
+ */
67
+ bulkMove(requestParameters: BulkMoveOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse>;
68
+
69
+ }
70
+
71
+ /**
72
+ *
73
+ */
74
+ export class BulkMoveApi extends runtime.BaseAPI implements BulkMoveApiInterface {
75
+
76
+ /**
77
+ * Creates request options for bulkMove without sending the request
78
+ */
79
+ async bulkMoveRequestOpts(requestParameters: BulkMoveOperationRequest): Promise<runtime.RequestOpts> {
80
+ if (requestParameters['bulkMoveRequest'] == null) {
81
+ throw new runtime.RequiredError(
82
+ 'bulkMoveRequest',
83
+ 'Required parameter "bulkMoveRequest" was null or undefined when calling bulkMove().'
84
+ );
85
+ }
86
+
87
+ const queryParameters: any = {};
88
+
89
+ const headerParameters: runtime.HTTPHeaders = {};
90
+
91
+ headerParameters['Content-Type'] = 'application/json';
92
+
93
+ if (this.configuration && this.configuration.accessToken) {
94
+ const token = this.configuration.accessToken;
95
+ const tokenString = await token("bearerAuth", []);
96
+
97
+ if (tokenString) {
98
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
99
+ }
100
+ }
101
+
102
+ let urlPath = `/v1/bulk-move`;
103
+
104
+ return {
105
+ path: urlPath,
106
+ method: 'POST',
107
+ headers: headerParameters,
108
+ query: queryParameters,
109
+ body: BulkMoveRequestToJSON(requestParameters['bulkMoveRequest']),
110
+ };
111
+ }
112
+
113
+ /**
114
+ * Move the selected folders and documents into ``target_folder_id``. The destination is checked once up front — an invalid target returns ``400`` and a target the caller cannot write returns ``403``, before any item moves. Each source then moves in its own transaction; items the caller may not write, that are sealed, held by another user, that would form a cycle, hit a name collision, or sit inside another selected folder land in ``failed`` with a reason while the rest succeed.
115
+ * Bulk Move Handler
116
+ */
117
+ async bulkMoveRaw(requestParameters: BulkMoveOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>> {
118
+ const requestOptions = await this.bulkMoveRequestOpts(requestParameters);
119
+ const response = await this.request(requestOptions, initOverrides);
120
+
121
+ return new runtime.JSONApiResponse(response, (jsonValue) => BulkOperationResponseFromJSON(jsonValue));
122
+ }
123
+
124
+ /**
125
+ * Move the selected folders and documents into ``target_folder_id``. The destination is checked once up front — an invalid target returns ``400`` and a target the caller cannot write returns ``403``, before any item moves. Each source then moves in its own transaction; items the caller may not write, that are sealed, held by another user, that would form a cycle, hit a name collision, or sit inside another selected folder land in ``failed`` with a reason while the rest succeed.
126
+ * Bulk Move Handler
127
+ */
128
+ async bulkMove(requestParameters: BulkMoveOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse> {
129
+ const response = await this.bulkMoveRaw(requestParameters, initOverrides);
130
+ return await response.value();
131
+ }
132
+
133
+ }
@@ -15,6 +15,8 @@
15
15
 
16
16
  import * as runtime from '../runtime';
17
17
  import type {
18
+ BulkOperationResponse,
19
+ BulkTrashRequest,
18
20
  ErrorResponse,
19
21
  HTTPValidationError,
20
22
  PaginatedResponseTrashItemResponse,
@@ -23,6 +25,10 @@ import type {
23
25
  SortDirection,
24
26
  } from '../models/index';
25
27
  import {
28
+ BulkOperationResponseFromJSON,
29
+ BulkOperationResponseToJSON,
30
+ BulkTrashRequestFromJSON,
31
+ BulkTrashRequestToJSON,
26
32
  ErrorResponseFromJSON,
27
33
  ErrorResponseToJSON,
28
34
  HTTPValidationErrorFromJSON,
@@ -37,6 +43,14 @@ import {
37
43
  SortDirectionToJSON,
38
44
  } from '../models/index';
39
45
 
46
+ export interface BulkPermanentlyDeleteTrashRequest {
47
+ bulkTrashRequest: BulkTrashRequest;
48
+ }
49
+
50
+ export interface BulkRestoreTrashRequest {
51
+ bulkTrashRequest: BulkTrashRequest;
52
+ }
53
+
40
54
  export interface ListTrashRequest {
41
55
  sortOrder?: PathOrder;
42
56
  sortDir?: SortDirection;
@@ -66,6 +80,54 @@ export interface RestoreTrashItemRequest {
66
80
  * @interface TrashApiInterface
67
81
  */
68
82
  export interface TrashApiInterface {
83
+ /**
84
+ * Creates request options for bulkPermanentlyDeleteTrash without sending the request
85
+ * @param {BulkTrashRequest} bulkTrashRequest
86
+ * @throws {RequiredError}
87
+ * @memberof TrashApiInterface
88
+ */
89
+ bulkPermanentlyDeleteTrashRequestOpts(requestParameters: BulkPermanentlyDeleteTrashRequest): Promise<runtime.RequestOpts>;
90
+
91
+ /**
92
+ * Permanently delete the selected trashed objects (by PDO id), per item. An object not visible in the caller\'s trash scope lands in ``failed`` as ``not_found``; the rest are hard-deleted and their Qdrant points purged.
93
+ * @summary Bulk Permanently Delete Trash Handler
94
+ * @param {BulkTrashRequest} bulkTrashRequest
95
+ * @param {*} [options] Override http request option.
96
+ * @throws {RequiredError}
97
+ * @memberof TrashApiInterface
98
+ */
99
+ bulkPermanentlyDeleteTrashRaw(requestParameters: BulkPermanentlyDeleteTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>>;
100
+
101
+ /**
102
+ * Permanently delete the selected trashed objects (by PDO id), per item. An object not visible in the caller\'s trash scope lands in ``failed`` as ``not_found``; the rest are hard-deleted and their Qdrant points purged.
103
+ * Bulk Permanently Delete Trash Handler
104
+ */
105
+ bulkPermanentlyDeleteTrash(requestParameters: BulkPermanentlyDeleteTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse>;
106
+
107
+ /**
108
+ * Creates request options for bulkRestoreTrash without sending the request
109
+ * @param {BulkTrashRequest} bulkTrashRequest
110
+ * @throws {RequiredError}
111
+ * @memberof TrashApiInterface
112
+ */
113
+ bulkRestoreTrashRequestOpts(requestParameters: BulkRestoreTrashRequest): Promise<runtime.RequestOpts>;
114
+
115
+ /**
116
+ * Restore the selected trashed objects (by PDO id), reporting per item. An object not visible in the caller\'s trash scope lands in ``failed`` as ``not_found``; a live name collision at the original location that auto-rename cannot resolve lands as ``name_conflict``.
117
+ * @summary Bulk Restore Trash Handler
118
+ * @param {BulkTrashRequest} bulkTrashRequest
119
+ * @param {*} [options] Override http request option.
120
+ * @throws {RequiredError}
121
+ * @memberof TrashApiInterface
122
+ */
123
+ bulkRestoreTrashRaw(requestParameters: BulkRestoreTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>>;
124
+
125
+ /**
126
+ * Restore the selected trashed objects (by PDO id), reporting per item. An object not visible in the caller\'s trash scope lands in ``failed`` as ``not_found``; a live name collision at the original location that auto-rename cannot resolve lands as ``name_conflict``.
127
+ * Bulk Restore Trash Handler
128
+ */
129
+ bulkRestoreTrash(requestParameters: BulkRestoreTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse>;
130
+
69
131
  /**
70
132
  * Creates request options for listTrash without sending the request
71
133
  * @param {PathOrder} [sortOrder] Sort order (default: LOGICAL &#x3D; deletion recency)
@@ -165,6 +227,120 @@ export interface TrashApiInterface {
165
227
  */
166
228
  export class TrashApi extends runtime.BaseAPI implements TrashApiInterface {
167
229
 
230
+ /**
231
+ * Creates request options for bulkPermanentlyDeleteTrash without sending the request
232
+ */
233
+ async bulkPermanentlyDeleteTrashRequestOpts(requestParameters: BulkPermanentlyDeleteTrashRequest): Promise<runtime.RequestOpts> {
234
+ if (requestParameters['bulkTrashRequest'] == null) {
235
+ throw new runtime.RequiredError(
236
+ 'bulkTrashRequest',
237
+ 'Required parameter "bulkTrashRequest" was null or undefined when calling bulkPermanentlyDeleteTrash().'
238
+ );
239
+ }
240
+
241
+ const queryParameters: any = {};
242
+
243
+ const headerParameters: runtime.HTTPHeaders = {};
244
+
245
+ headerParameters['Content-Type'] = 'application/json';
246
+
247
+ if (this.configuration && this.configuration.accessToken) {
248
+ const token = this.configuration.accessToken;
249
+ const tokenString = await token("bearerAuth", []);
250
+
251
+ if (tokenString) {
252
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
253
+ }
254
+ }
255
+
256
+ let urlPath = `/v1/trash/bulk-delete`;
257
+
258
+ return {
259
+ path: urlPath,
260
+ method: 'POST',
261
+ headers: headerParameters,
262
+ query: queryParameters,
263
+ body: BulkTrashRequestToJSON(requestParameters['bulkTrashRequest']),
264
+ };
265
+ }
266
+
267
+ /**
268
+ * Permanently delete the selected trashed objects (by PDO id), per item. An object not visible in the caller\'s trash scope lands in ``failed`` as ``not_found``; the rest are hard-deleted and their Qdrant points purged.
269
+ * Bulk Permanently Delete Trash Handler
270
+ */
271
+ async bulkPermanentlyDeleteTrashRaw(requestParameters: BulkPermanentlyDeleteTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>> {
272
+ const requestOptions = await this.bulkPermanentlyDeleteTrashRequestOpts(requestParameters);
273
+ const response = await this.request(requestOptions, initOverrides);
274
+
275
+ return new runtime.JSONApiResponse(response, (jsonValue) => BulkOperationResponseFromJSON(jsonValue));
276
+ }
277
+
278
+ /**
279
+ * Permanently delete the selected trashed objects (by PDO id), per item. An object not visible in the caller\'s trash scope lands in ``failed`` as ``not_found``; the rest are hard-deleted and their Qdrant points purged.
280
+ * Bulk Permanently Delete Trash Handler
281
+ */
282
+ async bulkPermanentlyDeleteTrash(requestParameters: BulkPermanentlyDeleteTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse> {
283
+ const response = await this.bulkPermanentlyDeleteTrashRaw(requestParameters, initOverrides);
284
+ return await response.value();
285
+ }
286
+
287
+ /**
288
+ * Creates request options for bulkRestoreTrash without sending the request
289
+ */
290
+ async bulkRestoreTrashRequestOpts(requestParameters: BulkRestoreTrashRequest): Promise<runtime.RequestOpts> {
291
+ if (requestParameters['bulkTrashRequest'] == null) {
292
+ throw new runtime.RequiredError(
293
+ 'bulkTrashRequest',
294
+ 'Required parameter "bulkTrashRequest" was null or undefined when calling bulkRestoreTrash().'
295
+ );
296
+ }
297
+
298
+ const queryParameters: any = {};
299
+
300
+ const headerParameters: runtime.HTTPHeaders = {};
301
+
302
+ headerParameters['Content-Type'] = 'application/json';
303
+
304
+ if (this.configuration && this.configuration.accessToken) {
305
+ const token = this.configuration.accessToken;
306
+ const tokenString = await token("bearerAuth", []);
307
+
308
+ if (tokenString) {
309
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
310
+ }
311
+ }
312
+
313
+ let urlPath = `/v1/trash/bulk-restore`;
314
+
315
+ return {
316
+ path: urlPath,
317
+ method: 'POST',
318
+ headers: headerParameters,
319
+ query: queryParameters,
320
+ body: BulkTrashRequestToJSON(requestParameters['bulkTrashRequest']),
321
+ };
322
+ }
323
+
324
+ /**
325
+ * Restore the selected trashed objects (by PDO id), reporting per item. An object not visible in the caller\'s trash scope lands in ``failed`` as ``not_found``; a live name collision at the original location that auto-rename cannot resolve lands as ``name_conflict``.
326
+ * Bulk Restore Trash Handler
327
+ */
328
+ async bulkRestoreTrashRaw(requestParameters: BulkRestoreTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BulkOperationResponse>> {
329
+ const requestOptions = await this.bulkRestoreTrashRequestOpts(requestParameters);
330
+ const response = await this.request(requestOptions, initOverrides);
331
+
332
+ return new runtime.JSONApiResponse(response, (jsonValue) => BulkOperationResponseFromJSON(jsonValue));
333
+ }
334
+
335
+ /**
336
+ * Restore the selected trashed objects (by PDO id), reporting per item. An object not visible in the caller\'s trash scope lands in ``failed`` as ``not_found``; a live name collision at the original location that auto-rename cannot resolve lands as ``name_conflict``.
337
+ * Bulk Restore Trash Handler
338
+ */
339
+ async bulkRestoreTrash(requestParameters: BulkRestoreTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse> {
340
+ const response = await this.bulkRestoreTrashRaw(requestParameters, initOverrides);
341
+ return await response.value();
342
+ }
343
+
168
344
  /**
169
345
  * Creates request options for listTrash without sending the request
170
346
  */