@knowledge-stack/ksapi 1.163.0 → 2.4.2

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 (153) hide show
  1. package/.openapi-generator/FILES +20 -2
  2. package/README.md +13 -3
  3. package/dist/apis/BillingApi.d.ts +70 -0
  4. package/dist/apis/BillingApi.js +120 -0
  5. package/dist/apis/DocumentVersionsApi.d.ts +8 -8
  6. package/dist/apis/DocumentVersionsApi.js +4 -4
  7. package/dist/apis/DocumentsApi.d.ts +4 -4
  8. package/dist/apis/DocumentsApi.js +2 -2
  9. package/dist/apis/SubscriptionsApi.d.ts +17 -20
  10. package/dist/apis/SubscriptionsApi.js +6 -9
  11. package/dist/apis/TenantsApi.d.ts +4 -4
  12. package/dist/apis/TenantsApi.js +2 -2
  13. package/dist/apis/TrashApi.d.ts +39 -1
  14. package/dist/apis/TrashApi.js +48 -0
  15. package/dist/apis/WorkflowRunsApi.d.ts +4 -4
  16. package/dist/apis/WorkflowRunsApi.js +2 -2
  17. package/dist/apis/index.d.ts +1 -0
  18. package/dist/apis/index.js +1 -0
  19. package/dist/esm/apis/BillingApi.d.ts +70 -0
  20. package/dist/esm/apis/BillingApi.js +83 -0
  21. package/dist/esm/apis/DocumentVersionsApi.d.ts +8 -8
  22. package/dist/esm/apis/DocumentVersionsApi.js +4 -4
  23. package/dist/esm/apis/DocumentsApi.d.ts +4 -4
  24. package/dist/esm/apis/DocumentsApi.js +2 -2
  25. package/dist/esm/apis/SubscriptionsApi.d.ts +17 -20
  26. package/dist/esm/apis/SubscriptionsApi.js +7 -10
  27. package/dist/esm/apis/TenantsApi.d.ts +4 -4
  28. package/dist/esm/apis/TenantsApi.js +2 -2
  29. package/dist/esm/apis/TrashApi.d.ts +39 -1
  30. package/dist/esm/apis/TrashApi.js +49 -1
  31. package/dist/esm/apis/WorkflowRunsApi.d.ts +4 -4
  32. package/dist/esm/apis/WorkflowRunsApi.js +2 -2
  33. package/dist/esm/apis/index.d.ts +1 -0
  34. package/dist/esm/apis/index.js +1 -0
  35. package/dist/esm/models/BillingInterval.d.ts +25 -0
  36. package/dist/esm/models/BillingInterval.js +43 -0
  37. package/dist/esm/models/BillingPaymentResponse.d.ts +100 -0
  38. package/dist/esm/models/BillingPaymentResponse.js +75 -0
  39. package/dist/esm/models/BillingSystem.d.ts +30 -0
  40. package/dist/esm/models/BillingSystem.js +48 -0
  41. package/dist/esm/models/ChangeSubscriptionRequest.d.ts +34 -0
  42. package/dist/esm/models/ChangeSubscriptionRequest.js +10 -0
  43. package/dist/esm/models/CheckoutAction.d.ts +27 -0
  44. package/dist/esm/models/CheckoutAction.js +45 -0
  45. package/dist/esm/models/CheckoutResponse.d.ts +76 -0
  46. package/dist/esm/models/{SubmitSubscriptionResponse.js → CheckoutResponse.js} +20 -20
  47. package/dist/esm/models/CreateWorkflowDefinitionRequest.d.ts +19 -0
  48. package/dist/esm/models/CreateWorkflowDefinitionRequest.js +10 -0
  49. package/dist/esm/models/IdpConfig.d.ts +6 -0
  50. package/dist/esm/models/IdpConfig.js +10 -1
  51. package/dist/esm/models/PaginatedResponseBillingPaymentResponse.d.ts +66 -0
  52. package/dist/esm/models/PaginatedResponseBillingPaymentResponse.js +70 -0
  53. package/dist/esm/models/ScheduleCadence.d.ts +32 -0
  54. package/dist/esm/models/ScheduleCadence.js +50 -0
  55. package/dist/esm/models/SubscriptionPlanResponse.d.ts +24 -0
  56. package/dist/esm/models/SubscriptionPlanResponse.js +8 -0
  57. package/dist/esm/models/{SubmitSubscriptionResponse.d.ts → TenantSubscriptionResponse.d.ts} +49 -38
  58. package/dist/esm/models/TenantSubscriptionResponse.js +67 -0
  59. package/dist/esm/models/TrashItemDetailResponse.d.ts +110 -0
  60. package/dist/esm/models/TrashItemDetailResponse.js +81 -0
  61. package/dist/esm/models/TrashItemResponse.d.ts +7 -0
  62. package/dist/esm/models/TrashItemResponse.js +3 -0
  63. package/dist/esm/models/UpdateWorkflowDefinitionRequest.d.ts +19 -0
  64. package/dist/esm/models/UpdateWorkflowDefinitionRequest.js +10 -0
  65. package/dist/esm/models/WorkflowDefinitionResponse.d.ts +19 -0
  66. package/dist/esm/models/WorkflowDefinitionResponse.js +7 -0
  67. package/dist/esm/models/index.d.ts +9 -1
  68. package/dist/esm/models/index.js +9 -1
  69. package/dist/models/BillingInterval.d.ts +25 -0
  70. package/dist/models/BillingInterval.js +51 -0
  71. package/dist/models/BillingPaymentResponse.d.ts +100 -0
  72. package/dist/models/BillingPaymentResponse.js +83 -0
  73. package/dist/models/BillingSystem.d.ts +30 -0
  74. package/dist/models/BillingSystem.js +56 -0
  75. package/dist/models/ChangeSubscriptionRequest.d.ts +34 -0
  76. package/dist/models/ChangeSubscriptionRequest.js +10 -0
  77. package/dist/models/CheckoutAction.d.ts +27 -0
  78. package/dist/models/CheckoutAction.js +53 -0
  79. package/dist/models/CheckoutResponse.d.ts +76 -0
  80. package/dist/models/{SubmitSubscriptionResponse.js → CheckoutResponse.js} +26 -26
  81. package/dist/models/CreateWorkflowDefinitionRequest.d.ts +19 -0
  82. package/dist/models/CreateWorkflowDefinitionRequest.js +10 -0
  83. package/dist/models/IdpConfig.d.ts +6 -0
  84. package/dist/models/IdpConfig.js +10 -1
  85. package/dist/models/PaginatedResponseBillingPaymentResponse.d.ts +66 -0
  86. package/dist/models/PaginatedResponseBillingPaymentResponse.js +78 -0
  87. package/dist/models/ScheduleCadence.d.ts +32 -0
  88. package/dist/models/ScheduleCadence.js +58 -0
  89. package/dist/models/SubscriptionPlanResponse.d.ts +24 -0
  90. package/dist/models/SubscriptionPlanResponse.js +8 -0
  91. package/dist/models/{SubmitSubscriptionResponse.d.ts → TenantSubscriptionResponse.d.ts} +49 -38
  92. package/dist/models/TenantSubscriptionResponse.js +75 -0
  93. package/dist/models/TrashItemDetailResponse.d.ts +110 -0
  94. package/dist/models/TrashItemDetailResponse.js +89 -0
  95. package/dist/models/TrashItemResponse.d.ts +7 -0
  96. package/dist/models/TrashItemResponse.js +3 -0
  97. package/dist/models/UpdateWorkflowDefinitionRequest.d.ts +19 -0
  98. package/dist/models/UpdateWorkflowDefinitionRequest.js +10 -0
  99. package/dist/models/WorkflowDefinitionResponse.d.ts +19 -0
  100. package/dist/models/WorkflowDefinitionResponse.js +7 -0
  101. package/dist/models/index.d.ts +9 -1
  102. package/dist/models/index.js +9 -1
  103. package/docs/BillingApi.md +90 -0
  104. package/docs/BillingInterval.md +33 -0
  105. package/docs/BillingPaymentResponse.md +51 -0
  106. package/docs/BillingSystem.md +33 -0
  107. package/docs/ChangeSubscriptionRequest.md +9 -1
  108. package/docs/CheckoutAction.md +33 -0
  109. package/docs/CheckoutResponse.md +41 -0
  110. package/docs/CreateWorkflowDefinitionRequest.md +6 -0
  111. package/docs/DocumentVersionsApi.md +2 -2
  112. package/docs/DocumentsApi.md +1 -1
  113. package/docs/FolderResponseOrDocumentResponseOrWorkflowDefinitionResponseOrWorkflowRunResponseOrDataSourceResponseOrDataSourceSchemaR.md +6 -0
  114. package/docs/IdpConfig.md +2 -0
  115. package/docs/PaginatedResponseBillingPaymentResponse.md +40 -0
  116. package/docs/ScheduleCadence.md +33 -0
  117. package/docs/SubscriptionPlanResponse.md +8 -0
  118. package/docs/SubscriptionsApi.md +7 -10
  119. package/docs/TenantSubscriptionResponse.md +47 -0
  120. package/docs/TenantsApi.md +1 -1
  121. package/docs/TrashApi.md +76 -0
  122. package/docs/TrashItemDetailResponse.md +55 -0
  123. package/docs/TrashItemResponse.md +2 -0
  124. package/docs/UpdateWorkflowDefinitionRequest.md +6 -0
  125. package/docs/WorkflowDefinitionResponse.md +6 -0
  126. package/docs/WorkflowRunsApi.md +1 -1
  127. package/package.json +1 -1
  128. package/src/apis/BillingApi.ts +142 -0
  129. package/src/apis/DocumentVersionsApi.ts +8 -8
  130. package/src/apis/DocumentsApi.ts +4 -4
  131. package/src/apis/SubscriptionsApi.ts +24 -31
  132. package/src/apis/TenantsApi.ts +4 -4
  133. package/src/apis/TrashApi.ts +86 -0
  134. package/src/apis/WorkflowRunsApi.ts +4 -4
  135. package/src/apis/index.ts +1 -0
  136. package/src/models/BillingInterval.ts +53 -0
  137. package/src/models/BillingPaymentResponse.ts +168 -0
  138. package/src/models/BillingSystem.ts +58 -0
  139. package/src/models/ChangeSubscriptionRequest.ts +55 -0
  140. package/src/models/CheckoutAction.ts +55 -0
  141. package/src/models/{SubmitSubscriptionResponse.ts → CheckoutResponse.ts} +61 -47
  142. package/src/models/CreateWorkflowDefinitionRequest.ts +37 -0
  143. package/src/models/IdpConfig.ts +14 -0
  144. package/src/models/PaginatedResponseBillingPaymentResponse.ts +130 -0
  145. package/src/models/ScheduleCadence.ts +60 -0
  146. package/src/models/SubscriptionPlanResponse.ts +32 -0
  147. package/src/models/TenantSubscriptionResponse.ts +159 -0
  148. package/src/models/TrashItemDetailResponse.ts +194 -0
  149. package/src/models/TrashItemResponse.ts +15 -0
  150. package/src/models/UpdateWorkflowDefinitionRequest.ts +37 -0
  151. package/src/models/WorkflowDefinitionResponse.ts +31 -0
  152. package/src/models/index.ts +9 -1
  153. package/docs/SubmitSubscriptionResponse.md +0 -39
@@ -23,6 +23,7 @@ import type {
23
23
  PartType,
24
24
  PathOrder,
25
25
  SortDirection,
26
+ TrashItemDetailResponse,
26
27
  } from '../models/index';
27
28
  import {
28
29
  BulkOperationResponseFromJSON,
@@ -41,6 +42,8 @@ import {
41
42
  PathOrderToJSON,
42
43
  SortDirectionFromJSON,
43
44
  SortDirectionToJSON,
45
+ TrashItemDetailResponseFromJSON,
46
+ TrashItemDetailResponseToJSON,
44
47
  } from '../models/index';
45
48
 
46
49
  export interface BulkPermanentlyDeleteTrashRequest {
@@ -51,6 +54,10 @@ export interface BulkRestoreTrashRequest {
51
54
  bulkTrashRequest: BulkTrashRequest;
52
55
  }
53
56
 
57
+ export interface GetTrashItemRequest {
58
+ pathPartId: string;
59
+ }
60
+
54
61
  export interface ListTrashRequest {
55
62
  sortOrder?: PathOrder;
56
63
  sortDir?: SortDirection;
@@ -128,6 +135,30 @@ export interface TrashApiInterface {
128
135
  */
129
136
  bulkRestoreTrash(requestParameters: BulkRestoreTrashRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BulkOperationResponse>;
130
137
 
138
+ /**
139
+ * Creates request options for getTrashItem without sending the request
140
+ * @param {string} pathPartId Trashed PathPart ID
141
+ * @throws {RequiredError}
142
+ * @memberof TrashApiInterface
143
+ */
144
+ getTrashItemRequestOpts(requestParameters: GetTrashItemRequest): Promise<runtime.RequestOpts>;
145
+
146
+ /**
147
+ * Fetch a single trash root, with a preview URL for DOCUMENT items.
148
+ * @summary Get Trash Item Handler
149
+ * @param {string} pathPartId Trashed PathPart ID
150
+ * @param {*} [options] Override http request option.
151
+ * @throws {RequiredError}
152
+ * @memberof TrashApiInterface
153
+ */
154
+ getTrashItemRaw(requestParameters: GetTrashItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TrashItemDetailResponse>>;
155
+
156
+ /**
157
+ * Fetch a single trash root, with a preview URL for DOCUMENT items.
158
+ * Get Trash Item Handler
159
+ */
160
+ getTrashItem(requestParameters: GetTrashItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TrashItemDetailResponse>;
161
+
131
162
  /**
132
163
  * Creates request options for listTrash without sending the request
133
164
  * @param {PathOrder} [sortOrder] Sort order (default: LOGICAL &#x3D; deletion recency)
@@ -341,6 +372,61 @@ export class TrashApi extends runtime.BaseAPI implements TrashApiInterface {
341
372
  return await response.value();
342
373
  }
343
374
 
375
+ /**
376
+ * Creates request options for getTrashItem without sending the request
377
+ */
378
+ async getTrashItemRequestOpts(requestParameters: GetTrashItemRequest): Promise<runtime.RequestOpts> {
379
+ if (requestParameters['pathPartId'] == null) {
380
+ throw new runtime.RequiredError(
381
+ 'pathPartId',
382
+ 'Required parameter "pathPartId" was null or undefined when calling getTrashItem().'
383
+ );
384
+ }
385
+
386
+ const queryParameters: any = {};
387
+
388
+ const headerParameters: runtime.HTTPHeaders = {};
389
+
390
+ if (this.configuration && this.configuration.accessToken) {
391
+ const token = this.configuration.accessToken;
392
+ const tokenString = await token("bearerAuth", []);
393
+
394
+ if (tokenString) {
395
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
396
+ }
397
+ }
398
+
399
+ let urlPath = `/v1/trash/{path_part_id}`;
400
+ urlPath = urlPath.replace(`{${"path_part_id"}}`, encodeURIComponent(String(requestParameters['pathPartId'])));
401
+
402
+ return {
403
+ path: urlPath,
404
+ method: 'GET',
405
+ headers: headerParameters,
406
+ query: queryParameters,
407
+ };
408
+ }
409
+
410
+ /**
411
+ * Fetch a single trash root, with a preview URL for DOCUMENT items.
412
+ * Get Trash Item Handler
413
+ */
414
+ async getTrashItemRaw(requestParameters: GetTrashItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TrashItemDetailResponse>> {
415
+ const requestOptions = await this.getTrashItemRequestOpts(requestParameters);
416
+ const response = await this.request(requestOptions, initOverrides);
417
+
418
+ return new runtime.JSONApiResponse(response, (jsonValue) => TrashItemDetailResponseFromJSON(jsonValue));
419
+ }
420
+
421
+ /**
422
+ * Fetch a single trash root, with a preview URL for DOCUMENT items.
423
+ * Get Trash Item Handler
424
+ */
425
+ async getTrashItem(requestParameters: GetTrashItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TrashItemDetailResponse> {
426
+ const response = await this.getTrashItemRaw(requestParameters, initOverrides);
427
+ return await response.value();
428
+ }
429
+
344
430
  /**
345
431
  * Creates request options for listTrash without sending the request
346
432
  */
@@ -455,7 +455,7 @@ export interface WorkflowRunsApiInterface {
455
455
  workflowRunCallbackRequestOpts(requestParameters: WorkflowRunCallbackOperationRequest): Promise<runtime.RequestOpts>;
456
456
 
457
457
  /**
458
- * Terminal-state write seam for the in-process agent runner. The gating Temporal activities ``mark_run_completed_activity`` and ``mark_run_failed_activity`` authenticate as the triggering user (via ``assume_user``) and POST here. Only the user who triggered the run (or OWNER/ADMIN) may write its terminal state. The handler is idempotent: a callback against an already-terminal row returns ``already_terminal`` and the activity-level retry treats it as a no-op.
458
+ * Terminal-state write seam for the in-process agent runner. The gating Temporal activities ``mark_run_completed_activity`` and ``mark_run_failed_activity`` authenticate as the triggering user (via ``assume_user``) and POST here. Only the user who triggered the run (or OWNER/ADMIN) may write its terminal state. The handler is idempotent: a callback against an already-terminal row returns ``already_terminal`` and the activity-level retry treats it as a no-op. On the first terminal transition it emails the run\'s triggering user (``run.user_id``) a completion or failure notification. Only already-loaded columns are captured in-session; recipient/language lookups and the send run post-commit and best-effort, so a rolled-back transaction never notifies and a notification failure never fails the callback.
459
459
  * @summary Workflow Run Callback Handler
460
460
  * @param {string} runId
461
461
  * @param {WorkflowRunCallbackRequest} workflowRunCallbackRequest
@@ -466,7 +466,7 @@ export interface WorkflowRunsApiInterface {
466
466
  workflowRunCallbackRaw(requestParameters: WorkflowRunCallbackOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowCallbackResponse>>;
467
467
 
468
468
  /**
469
- * Terminal-state write seam for the in-process agent runner. The gating Temporal activities ``mark_run_completed_activity`` and ``mark_run_failed_activity`` authenticate as the triggering user (via ``assume_user``) and POST here. Only the user who triggered the run (or OWNER/ADMIN) may write its terminal state. The handler is idempotent: a callback against an already-terminal row returns ``already_terminal`` and the activity-level retry treats it as a no-op.
469
+ * Terminal-state write seam for the in-process agent runner. The gating Temporal activities ``mark_run_completed_activity`` and ``mark_run_failed_activity`` authenticate as the triggering user (via ``assume_user``) and POST here. Only the user who triggered the run (or OWNER/ADMIN) may write its terminal state. The handler is idempotent: a callback against an already-terminal row returns ``already_terminal`` and the activity-level retry treats it as a no-op. On the first terminal transition it emails the run\'s triggering user (``run.user_id``) a completion or failure notification. Only already-loaded columns are captured in-session; recipient/language lookups and the send run post-commit and best-effort, so a rolled-back transaction never notifies and a notification failure never fails the callback.
470
470
  * Workflow Run Callback Handler
471
471
  */
472
472
  workflowRunCallback(requestParameters: WorkflowRunCallbackOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowCallbackResponse>;
@@ -1217,7 +1217,7 @@ export class WorkflowRunsApi extends runtime.BaseAPI implements WorkflowRunsApiI
1217
1217
  }
1218
1218
 
1219
1219
  /**
1220
- * Terminal-state write seam for the in-process agent runner. The gating Temporal activities ``mark_run_completed_activity`` and ``mark_run_failed_activity`` authenticate as the triggering user (via ``assume_user``) and POST here. Only the user who triggered the run (or OWNER/ADMIN) may write its terminal state. The handler is idempotent: a callback against an already-terminal row returns ``already_terminal`` and the activity-level retry treats it as a no-op.
1220
+ * Terminal-state write seam for the in-process agent runner. The gating Temporal activities ``mark_run_completed_activity`` and ``mark_run_failed_activity`` authenticate as the triggering user (via ``assume_user``) and POST here. Only the user who triggered the run (or OWNER/ADMIN) may write its terminal state. The handler is idempotent: a callback against an already-terminal row returns ``already_terminal`` and the activity-level retry treats it as a no-op. On the first terminal transition it emails the run\'s triggering user (``run.user_id``) a completion or failure notification. Only already-loaded columns are captured in-session; recipient/language lookups and the send run post-commit and best-effort, so a rolled-back transaction never notifies and a notification failure never fails the callback.
1221
1221
  * Workflow Run Callback Handler
1222
1222
  */
1223
1223
  async workflowRunCallbackRaw(requestParameters: WorkflowRunCallbackOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowCallbackResponse>> {
@@ -1228,7 +1228,7 @@ export class WorkflowRunsApi extends runtime.BaseAPI implements WorkflowRunsApiI
1228
1228
  }
1229
1229
 
1230
1230
  /**
1231
- * Terminal-state write seam for the in-process agent runner. The gating Temporal activities ``mark_run_completed_activity`` and ``mark_run_failed_activity`` authenticate as the triggering user (via ``assume_user``) and POST here. Only the user who triggered the run (or OWNER/ADMIN) may write its terminal state. The handler is idempotent: a callback against an already-terminal row returns ``already_terminal`` and the activity-level retry treats it as a no-op.
1231
+ * Terminal-state write seam for the in-process agent runner. The gating Temporal activities ``mark_run_completed_activity`` and ``mark_run_failed_activity`` authenticate as the triggering user (via ``assume_user``) and POST here. Only the user who triggered the run (or OWNER/ADMIN) may write its terminal state. The handler is idempotent: a callback against an already-terminal row returns ``already_terminal`` and the activity-level retry treats it as a no-op. On the first terminal transition it emails the run\'s triggering user (``run.user_id``) a completion or failure notification. Only already-loaded columns are captured in-session; recipient/language lookups and the send run post-commit and best-effort, so a rolled-back transaction never notifies and a notification failure never fails the callback.
1232
1232
  * Workflow Run Callback Handler
1233
1233
  */
1234
1234
  async workflowRunCallback(requestParameters: WorkflowRunCallbackOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowCallbackResponse> {
package/src/apis/index.ts CHANGED
@@ -7,6 +7,7 @@ export * from './ApiConnectionsApi';
7
7
  export * from './ApiKeysApi';
8
8
  export * from './AuditEventsApi';
9
9
  export * from './AuthApi';
10
+ export * from './BillingApi';
10
11
  export * from './BulkDeleteApi';
11
12
  export * from './BulkDownloadApi';
12
13
  export * from './BulkMoveApi';
@@ -0,0 +1,53 @@
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
+ /**
17
+ * Self-serve billing period length.
18
+ * @export
19
+ */
20
+ export const BillingInterval = {
21
+ Monthly: 'MONTHLY',
22
+ Annual: 'ANNUAL'
23
+ } as const;
24
+ export type BillingInterval = typeof BillingInterval[keyof typeof BillingInterval];
25
+
26
+
27
+ export function instanceOfBillingInterval(value: any): boolean {
28
+ for (const key in BillingInterval) {
29
+ if (Object.prototype.hasOwnProperty.call(BillingInterval, key)) {
30
+ if (BillingInterval[key as keyof typeof BillingInterval] === value) {
31
+ return true;
32
+ }
33
+ }
34
+ }
35
+ return false;
36
+ }
37
+
38
+ export function BillingIntervalFromJSON(json: any): BillingInterval {
39
+ return BillingIntervalFromJSONTyped(json, false);
40
+ }
41
+
42
+ export function BillingIntervalFromJSONTyped(json: any, ignoreDiscriminator: boolean): BillingInterval {
43
+ return json as BillingInterval;
44
+ }
45
+
46
+ export function BillingIntervalToJSON(value?: BillingInterval | null): any {
47
+ return value as any;
48
+ }
49
+
50
+ export function BillingIntervalToJSONTyped(value: any, ignoreDiscriminator: boolean): BillingInterval {
51
+ return value as BillingInterval;
52
+ }
53
+
@@ -0,0 +1,168 @@
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
+ import { mapValues } from '../runtime';
16
+ import type { BillingSystem } from './BillingSystem';
17
+ import {
18
+ BillingSystemFromJSON,
19
+ BillingSystemFromJSONTyped,
20
+ BillingSystemToJSON,
21
+ BillingSystemToJSONTyped,
22
+ } from './BillingSystem';
23
+
24
+ /**
25
+ * One confirmed payment, as shown in the tenant's billing history.
26
+ *
27
+ * Backs in-app receipts: CN payments have no provider-hosted invoice
28
+ * (``invoice_url`` is NULL) — the frontend renders a receipt from
29
+ * these fields. Stripe payments link the hosted invoice.
30
+ * @export
31
+ * @interface BillingPaymentResponse
32
+ */
33
+ export interface BillingPaymentResponse {
34
+ /**
35
+ * Payment id.
36
+ * @type {string}
37
+ * @memberof BillingPaymentResponse
38
+ */
39
+ id: string;
40
+ /**
41
+ *
42
+ * @type {BillingSystem}
43
+ * @memberof BillingPaymentResponse
44
+ */
45
+ billingSystem: BillingSystem;
46
+ /**
47
+ * Plan purchased.
48
+ * @type {string}
49
+ * @memberof BillingPaymentResponse
50
+ */
51
+ planId: string;
52
+ /**
53
+ * Billing period purchased.
54
+ * @type {string}
55
+ * @memberof BillingPaymentResponse
56
+ */
57
+ interval: string;
58
+ /**
59
+ * Seats purchased.
60
+ * @type {number}
61
+ * @memberof BillingPaymentResponse
62
+ */
63
+ numSeats: number;
64
+ /**
65
+ * Total charged, in the currency's minor unit.
66
+ * @type {number}
67
+ * @memberof BillingPaymentResponse
68
+ */
69
+ amount: number;
70
+ /**
71
+ * USD (cents) or CNY (fen).
72
+ * @type {string}
73
+ * @memberof BillingPaymentResponse
74
+ */
75
+ currency: string;
76
+ /**
77
+ * Provider-hosted invoice/receipt, when available.
78
+ * @type {string}
79
+ * @memberof BillingPaymentResponse
80
+ */
81
+ invoiceUrl?: string | null;
82
+ /**
83
+ * When the payment confirmed.
84
+ * @type {Date}
85
+ * @memberof BillingPaymentResponse
86
+ */
87
+ createdAt: Date;
88
+ }
89
+
90
+
91
+ export const BillingPaymentResponsePropertyValidationAttributesMap: {
92
+ [property: string]: {
93
+ maxLength?: number,
94
+ minLength?: number,
95
+ pattern?: string,
96
+ maximum?: number,
97
+ exclusiveMaximum?: boolean,
98
+ minimum?: number,
99
+ exclusiveMinimum?: boolean,
100
+ multipleOf?: number,
101
+ maxItems?: number,
102
+ minItems?: number,
103
+ uniqueItems?: boolean
104
+ }
105
+ } = {
106
+ }
107
+
108
+
109
+ /**
110
+ * Check if a given object implements the BillingPaymentResponse interface.
111
+ */
112
+ export function instanceOfBillingPaymentResponse(value: object): value is BillingPaymentResponse {
113
+ if (!('id' in value) || value['id'] === undefined) return false;
114
+ if (!('billingSystem' in value) || value['billingSystem'] === undefined) return false;
115
+ if (!('planId' in value) || value['planId'] === undefined) return false;
116
+ if (!('interval' in value) || value['interval'] === undefined) return false;
117
+ if (!('numSeats' in value) || value['numSeats'] === undefined) return false;
118
+ if (!('amount' in value) || value['amount'] === undefined) return false;
119
+ if (!('currency' in value) || value['currency'] === undefined) return false;
120
+ if (!('createdAt' in value) || value['createdAt'] === undefined) return false;
121
+ return true;
122
+ }
123
+
124
+ export function BillingPaymentResponseFromJSON(json: any): BillingPaymentResponse {
125
+ return BillingPaymentResponseFromJSONTyped(json, false);
126
+ }
127
+
128
+ export function BillingPaymentResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): BillingPaymentResponse {
129
+ if (json == null) {
130
+ return json;
131
+ }
132
+ return {
133
+
134
+ 'id': json['id'],
135
+ 'billingSystem': BillingSystemFromJSON(json['billing_system']),
136
+ 'planId': json['plan_id'],
137
+ 'interval': json['interval'],
138
+ 'numSeats': json['num_seats'],
139
+ 'amount': json['amount'],
140
+ 'currency': json['currency'],
141
+ 'invoiceUrl': json['invoice_url'] == null ? undefined : json['invoice_url'],
142
+ 'createdAt': (new Date(json['created_at'])),
143
+ };
144
+ }
145
+
146
+ export function BillingPaymentResponseToJSON(json: any): BillingPaymentResponse {
147
+ return BillingPaymentResponseToJSONTyped(json, false);
148
+ }
149
+
150
+ export function BillingPaymentResponseToJSONTyped(value?: BillingPaymentResponse | null, ignoreDiscriminator: boolean = false): any {
151
+ if (value == null) {
152
+ return value;
153
+ }
154
+
155
+ return {
156
+
157
+ 'id': value['id'],
158
+ 'billing_system': BillingSystemToJSON(value['billingSystem']),
159
+ 'plan_id': value['planId'],
160
+ 'interval': value['interval'],
161
+ 'num_seats': value['numSeats'],
162
+ 'amount': value['amount'],
163
+ 'currency': value['currency'],
164
+ 'invoice_url': value['invoiceUrl'],
165
+ 'created_at': value['createdAt'].toISOString(),
166
+ };
167
+ }
168
+
@@ -0,0 +1,58 @@
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
+ /**
17
+ * External payment platform a subscription or payment is linked to.
18
+ *
19
+ * ``STRIPE`` serves North America; ``PING_PP`` (Ping++, a mainland-China
20
+ * payment aggregator fronting Alipay + WeChat Pay) serves China. Rows
21
+ * with no external billing linkage (free / admin-issued / synthetic
22
+ * fall-back subscriptions) carry NULL instead of a value.
23
+ * @export
24
+ */
25
+ export const BillingSystem = {
26
+ Stripe: 'STRIPE',
27
+ PingPp: 'PING_PP'
28
+ } as const;
29
+ export type BillingSystem = typeof BillingSystem[keyof typeof BillingSystem];
30
+
31
+
32
+ export function instanceOfBillingSystem(value: any): boolean {
33
+ for (const key in BillingSystem) {
34
+ if (Object.prototype.hasOwnProperty.call(BillingSystem, key)) {
35
+ if (BillingSystem[key as keyof typeof BillingSystem] === value) {
36
+ return true;
37
+ }
38
+ }
39
+ }
40
+ return false;
41
+ }
42
+
43
+ export function BillingSystemFromJSON(json: any): BillingSystem {
44
+ return BillingSystemFromJSONTyped(json, false);
45
+ }
46
+
47
+ export function BillingSystemFromJSONTyped(json: any, ignoreDiscriminator: boolean): BillingSystem {
48
+ return json as BillingSystem;
49
+ }
50
+
51
+ export function BillingSystemToJSON(value?: BillingSystem | null): any {
52
+ return value as any;
53
+ }
54
+
55
+ export function BillingSystemToJSONTyped(value: any, ignoreDiscriminator: boolean): BillingSystem {
56
+ return value as BillingSystem;
57
+ }
58
+
@@ -13,8 +13,29 @@
13
13
  */
14
14
 
15
15
  import { mapValues } from '../runtime';
16
+ import type { BillingInterval } from './BillingInterval';
17
+ import {
18
+ BillingIntervalFromJSON,
19
+ BillingIntervalFromJSONTyped,
20
+ BillingIntervalToJSON,
21
+ BillingIntervalToJSONTyped,
22
+ } from './BillingInterval';
23
+ import type { BillingSystem } from './BillingSystem';
24
+ import {
25
+ BillingSystemFromJSON,
26
+ BillingSystemFromJSONTyped,
27
+ BillingSystemToJSON,
28
+ BillingSystemToJSONTyped,
29
+ } from './BillingSystem';
30
+
16
31
  /**
17
32
  * Body for ``POST /v1/tenants/{tenant_id}/subscriptions``.
33
+ *
34
+ * For a priced plan, ``interval`` and ``billing_system`` are required
35
+ * (``channel`` too for Ping++); the response carries the provider
36
+ * checkout to complete. For the free plan they are ignored — the
37
+ * downgrade is applied immediately (unbilled tenants) or scheduled
38
+ * for period end (billed tenants).
18
39
  * @export
19
40
  * @interface ChangeSubscriptionRequest
20
41
  */
@@ -31,7 +52,33 @@ export interface ChangeSubscriptionRequest {
31
52
  * @memberof ChangeSubscriptionRequest
32
53
  */
33
54
  numSeats: number;
55
+ /**
56
+ *
57
+ * @type {BillingInterval}
58
+ * @memberof ChangeSubscriptionRequest
59
+ */
60
+ interval?: BillingInterval;
61
+ /**
62
+ *
63
+ * @type {BillingSystem}
64
+ * @memberof ChangeSubscriptionRequest
65
+ */
66
+ billingSystem?: BillingSystem;
67
+ /**
68
+ * Ping++ payment channel chosen in the UI (e.g. 'alipay_pc_direct', 'wx_pub_qr'). Required when billing_system=PING_PP.
69
+ * @type {string}
70
+ * @memberof ChangeSubscriptionRequest
71
+ */
72
+ channel?: string | null;
73
+ /**
74
+ * Channel-specific Ping++ charge `extra` parameters (success_url, product ids, ... — see the Ping++ charge API for the chosen channel). Passed through verbatim; amounts are always resolved server-side.
75
+ * @type {{ [key: string]: any; }}
76
+ * @memberof ChangeSubscriptionRequest
77
+ */
78
+ channelExtra?: { [key: string]: any; } | null;
34
79
  }
80
+
81
+
35
82
  export const ChangeSubscriptionRequestPropertyValidationAttributesMap: {
36
83
  [property: string]: {
37
84
  maxLength?: number,
@@ -75,6 +122,10 @@ export function ChangeSubscriptionRequestFromJSONTyped(json: any, ignoreDiscrimi
75
122
 
76
123
  'subscriptionId': json['subscription_id'],
77
124
  'numSeats': json['num_seats'],
125
+ 'interval': json['interval'] == null ? undefined : BillingIntervalFromJSON(json['interval']),
126
+ 'billingSystem': json['billing_system'] == null ? undefined : BillingSystemFromJSON(json['billing_system']),
127
+ 'channel': json['channel'] == null ? undefined : json['channel'],
128
+ 'channelExtra': json['channel_extra'] == null ? undefined : json['channel_extra'],
78
129
  };
79
130
  }
80
131
 
@@ -91,6 +142,10 @@ export function ChangeSubscriptionRequestToJSONTyped(value?: ChangeSubscriptionR
91
142
 
92
143
  'subscription_id': value['subscriptionId'],
93
144
  'num_seats': value['numSeats'],
145
+ 'interval': BillingIntervalToJSON(value['interval']),
146
+ 'billing_system': BillingSystemToJSON(value['billingSystem']),
147
+ 'channel': value['channel'],
148
+ 'channel_extra': value['channelExtra'],
94
149
  };
95
150
  }
96
151
 
@@ -0,0 +1,55 @@
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
+ /**
17
+ * What the client must do next after a subscription-change request.
18
+ * @export
19
+ */
20
+ export const CheckoutAction = {
21
+ Redirect: 'REDIRECT',
22
+ Credential: 'CREDENTIAL',
23
+ Scheduled: 'SCHEDULED',
24
+ Applied: 'APPLIED'
25
+ } as const;
26
+ export type CheckoutAction = typeof CheckoutAction[keyof typeof CheckoutAction];
27
+
28
+
29
+ export function instanceOfCheckoutAction(value: any): boolean {
30
+ for (const key in CheckoutAction) {
31
+ if (Object.prototype.hasOwnProperty.call(CheckoutAction, key)) {
32
+ if (CheckoutAction[key as keyof typeof CheckoutAction] === value) {
33
+ return true;
34
+ }
35
+ }
36
+ }
37
+ return false;
38
+ }
39
+
40
+ export function CheckoutActionFromJSON(json: any): CheckoutAction {
41
+ return CheckoutActionFromJSONTyped(json, false);
42
+ }
43
+
44
+ export function CheckoutActionFromJSONTyped(json: any, ignoreDiscriminator: boolean): CheckoutAction {
45
+ return json as CheckoutAction;
46
+ }
47
+
48
+ export function CheckoutActionToJSON(value?: CheckoutAction | null): any {
49
+ return value as any;
50
+ }
51
+
52
+ export function CheckoutActionToJSONTyped(value: any, ignoreDiscriminator: boolean): CheckoutAction {
53
+ return value as CheckoutAction;
54
+ }
55
+