@spaciv/sdk 0.1.19 → 0.1.21

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 (73) hide show
  1. package/.openapi-generator/FILES +8 -0
  2. package/README.md +2 -2
  3. package/dist/apis/FilesApi.d.ts +132 -18
  4. package/dist/apis/FilesApi.js +175 -8
  5. package/dist/apis/ScriptsApi.d.ts +57 -1
  6. package/dist/apis/ScriptsApi.js +82 -0
  7. package/dist/esm/apis/FilesApi.d.ts +132 -18
  8. package/dist/esm/apis/FilesApi.js +176 -9
  9. package/dist/esm/apis/ScriptsApi.d.ts +57 -1
  10. package/dist/esm/apis/ScriptsApi.js +83 -1
  11. package/dist/esm/models/AccountDirectoryPatchBody.d.ts +38 -0
  12. package/dist/esm/models/AccountDirectoryPatchBody.js +43 -0
  13. package/dist/esm/models/AccountDirectoryPostBody.d.ts +38 -0
  14. package/dist/esm/models/AccountDirectoryPostBody.js +45 -0
  15. package/dist/esm/models/AccountFilePatchBody.d.ts +8 -2
  16. package/dist/esm/models/AccountFilePatchBody.js +3 -3
  17. package/dist/esm/models/Directory.d.ts +56 -0
  18. package/dist/esm/models/Directory.js +57 -0
  19. package/dist/esm/models/DirectoryPage.d.ts +39 -0
  20. package/dist/esm/models/DirectoryPage.js +46 -0
  21. package/dist/esm/models/ListPage.d.ts +7 -0
  22. package/dist/esm/models/ListPage.js +3 -0
  23. package/dist/esm/models/ModelRecord.d.ts +7 -1
  24. package/dist/esm/models/ModelRecord.js +2 -0
  25. package/dist/esm/models/ScratchpadOutput.d.ts +69 -0
  26. package/dist/esm/models/ScratchpadOutput.js +64 -0
  27. package/dist/esm/models/ScratchpadOutputFile.d.ts +44 -0
  28. package/dist/esm/models/ScratchpadOutputFile.js +49 -0
  29. package/dist/esm/models/ScratchpadRun.d.ts +127 -0
  30. package/dist/esm/models/ScratchpadRun.js +91 -0
  31. package/dist/esm/models/ScratchpadRunPostReqBody.d.ts +58 -0
  32. package/dist/esm/models/ScratchpadRunPostReqBody.js +53 -0
  33. package/dist/esm/models/index.d.ts +8 -0
  34. package/dist/esm/models/index.js +8 -0
  35. package/dist/models/AccountDirectoryPatchBody.d.ts +38 -0
  36. package/dist/models/AccountDirectoryPatchBody.js +50 -0
  37. package/dist/models/AccountDirectoryPostBody.d.ts +38 -0
  38. package/dist/models/AccountDirectoryPostBody.js +52 -0
  39. package/dist/models/AccountFilePatchBody.d.ts +8 -2
  40. package/dist/models/AccountFilePatchBody.js +3 -3
  41. package/dist/models/Directory.d.ts +56 -0
  42. package/dist/models/Directory.js +64 -0
  43. package/dist/models/DirectoryPage.d.ts +39 -0
  44. package/dist/models/DirectoryPage.js +53 -0
  45. package/dist/models/ListPage.d.ts +7 -0
  46. package/dist/models/ListPage.js +3 -0
  47. package/dist/models/ModelRecord.d.ts +7 -1
  48. package/dist/models/ModelRecord.js +2 -0
  49. package/dist/models/ScratchpadOutput.d.ts +69 -0
  50. package/dist/models/ScratchpadOutput.js +71 -0
  51. package/dist/models/ScratchpadOutputFile.d.ts +44 -0
  52. package/dist/models/ScratchpadOutputFile.js +56 -0
  53. package/dist/models/ScratchpadRun.d.ts +127 -0
  54. package/dist/models/ScratchpadRun.js +99 -0
  55. package/dist/models/ScratchpadRunPostReqBody.d.ts +58 -0
  56. package/dist/models/ScratchpadRunPostReqBody.js +60 -0
  57. package/dist/models/index.d.ts +8 -0
  58. package/dist/models/index.js +8 -0
  59. package/package.json +1 -1
  60. package/src/apis/FilesApi.ts +319 -17
  61. package/src/apis/ScriptsApi.ts +148 -0
  62. package/src/models/AccountDirectoryPatchBody.ts +73 -0
  63. package/src/models/AccountDirectoryPostBody.ts +74 -0
  64. package/src/models/AccountFilePatchBody.ts +11 -4
  65. package/src/models/Directory.ts +101 -0
  66. package/src/models/DirectoryPage.ts +82 -0
  67. package/src/models/ListPage.ts +15 -0
  68. package/src/models/ModelRecord.ts +9 -1
  69. package/src/models/ScratchpadOutput.ts +126 -0
  70. package/src/models/ScratchpadOutputFile.ts +83 -0
  71. package/src/models/ScratchpadRun.ts +203 -0
  72. package/src/models/ScratchpadRunPostReqBody.ts +99 -0
  73. package/src/models/index.ts +8 -0
@@ -16,6 +16,8 @@
16
16
  import * as runtime from '../runtime';
17
17
  import type {
18
18
  ErrorModel,
19
+ ScratchpadRun,
20
+ ScratchpadRunPostReqBody,
19
21
  ScriptAuditResBody,
20
22
  ScriptDetail,
21
23
  ScriptExportResBody,
@@ -34,6 +36,10 @@ import type {
34
36
  import {
35
37
  ErrorModelFromJSON,
36
38
  ErrorModelToJSON,
39
+ ScratchpadRunFromJSON,
40
+ ScratchpadRunToJSON,
41
+ ScratchpadRunPostReqBodyFromJSON,
42
+ ScratchpadRunPostReqBodyToJSON,
37
43
  ScriptAuditResBodyFromJSON,
38
44
  ScriptAuditResBodyToJSON,
39
45
  ScriptDetailFromJSON,
@@ -80,6 +86,10 @@ export interface ScriptsApiCreateSchedulePreviewRequest {
80
86
  scriptSchedulePreviewReqBody: ScriptSchedulePreviewReqBody;
81
87
  }
82
88
 
89
+ export interface ScriptsApiCreateScratchpadRunsRequest {
90
+ scratchpadRunPostReqBody: ScratchpadRunPostReqBody;
91
+ }
92
+
83
93
  export interface ScriptsApiDeleteRequest {
84
94
  id: string;
85
95
  }
@@ -94,6 +104,11 @@ export interface ScriptsApiGetAuditRequest {
94
104
  cursor?: string;
95
105
  }
96
106
 
107
+ export interface ScriptsApiGetScratchpadRunsRequest {
108
+ runId: string;
109
+ waitSeconds?: number;
110
+ }
111
+
97
112
  export interface ScriptsApiListRunsRequest {
98
113
  id: string;
99
114
  limit?: number;
@@ -186,6 +201,22 @@ export interface ScriptsApiInterface {
186
201
  */
187
202
  createSchedulePreview(requestParameters: ScriptsApiCreateSchedulePreviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptSchedulePreviewResBody>;
188
203
 
204
+ /**
205
+ * Runs Python or JavaScript code once in a sandbox without saving it as a script, for working something out from the account\'s data. The handler is the one an integration script implements, with `input` as `event.input`; there is no build, so dependency manifests and Go are not supported. The code runs with a read-only access token scoped to the caller: only the caller\'s view permissions, in the caller\'s current project if there is one, for 5 minutes. `ctx.fetch` sends it to the Spaciv API. Files the handler writes to its output directory (`ctx.output_dir` in Python, `ctx.outputDir` in JavaScript) are returned with its stdout, stderr and return value. Limits: code up to 256 KiB in at most 50 files, `input` up to 1 MiB, and `timeoutSeconds` up to 120 (default 30). Of the output, stdout and stderr are kept up to 256 KiB each, the return value up to 256 KiB, and up to 20 output files totalling 2 MiB. Runs count towards the account\'s script credits and concurrent runs. The request waits up to `waitSeconds` for the run to finish; a run still in progress is returned without `output`, and can be read with `GET /v1/scripts/scratchpad/runs/{runId}`. A run is visible only to the user who started it, and is kept for 24 hours. Returns `422` when the language or code is not accepted, and `403` for a script\'s API key or a scratchpad run\'s own token. Requires the *AI assistant* permission.
206
+ * @summary Run scratchpad code
207
+ * @param {ScratchpadRunPostReqBody} scratchpadRunPostReqBody
208
+ * @param {*} [options] Override http request option.
209
+ * @throws {RequiredError}
210
+ * @memberof ScriptsApiInterface
211
+ */
212
+ createScratchpadRunsRaw(requestParameters: ScriptsApiCreateScratchpadRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScratchpadRun>>;
213
+
214
+ /**
215
+ * Runs Python or JavaScript code once in a sandbox without saving it as a script, for working something out from the account\'s data. The handler is the one an integration script implements, with `input` as `event.input`; there is no build, so dependency manifests and Go are not supported. The code runs with a read-only access token scoped to the caller: only the caller\'s view permissions, in the caller\'s current project if there is one, for 5 minutes. `ctx.fetch` sends it to the Spaciv API. Files the handler writes to its output directory (`ctx.output_dir` in Python, `ctx.outputDir` in JavaScript) are returned with its stdout, stderr and return value. Limits: code up to 256 KiB in at most 50 files, `input` up to 1 MiB, and `timeoutSeconds` up to 120 (default 30). Of the output, stdout and stderr are kept up to 256 KiB each, the return value up to 256 KiB, and up to 20 output files totalling 2 MiB. Runs count towards the account\'s script credits and concurrent runs. The request waits up to `waitSeconds` for the run to finish; a run still in progress is returned without `output`, and can be read with `GET /v1/scripts/scratchpad/runs/{runId}`. A run is visible only to the user who started it, and is kept for 24 hours. Returns `422` when the language or code is not accepted, and `403` for a script\'s API key or a scratchpad run\'s own token. Requires the *AI assistant* permission.
216
+ * Run scratchpad code
217
+ */
218
+ createScratchpadRuns(requestParameters: ScriptsApiCreateScratchpadRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScratchpadRun>;
219
+
189
220
  /**
190
221
  * Stops any active runs, deletes the script with its secrets and run history, and revokes its API keys. Requires the *Manage my account* permission.
191
222
  * @summary Delete a script
@@ -251,6 +282,23 @@ export interface ScriptsApiInterface {
251
282
  */
252
283
  getExport(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptExportResBody>;
253
284
 
285
+ /**
286
+ * Returns a scratchpad run the caller started, with its output once it has finished. Runs are kept for 24 hours. Returns `404` when the run does not exist, has expired or was started by someone else, and `403` for a script\'s API key or a scratchpad run\'s own token. Requires the *AI assistant* permission.
287
+ * @summary Get a scratchpad run
288
+ * @param {string} runId
289
+ * @param {number} [waitSeconds] Longest to wait for a run in progress to finish before responding. Defaults to 0, returning at once.
290
+ * @param {*} [options] Override http request option.
291
+ * @throws {RequiredError}
292
+ * @memberof ScriptsApiInterface
293
+ */
294
+ getScratchpadRunsRaw(requestParameters: ScriptsApiGetScratchpadRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScratchpadRun>>;
295
+
296
+ /**
297
+ * Returns a scratchpad run the caller started, with its output once it has finished. Runs are kept for 24 hours. Returns `404` when the run does not exist, has expired or was started by someone else, and `403` for a script\'s API key or a scratchpad run\'s own token. Requires the *AI assistant* permission.
298
+ * Get a scratchpad run
299
+ */
300
+ getScratchpadRuns(requestParameters: ScriptsApiGetScratchpadRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScratchpadRun>;
301
+
254
302
  /**
255
303
  * Returns the credits the account\'s script runs were charged this calendar month (UTC), against the account\'s monthly script credit limit and its other script limits, with how many runs each script made, failed and had refused. creditState is near from 80% of the monthly limit and reached once it is used, after which runs are recorded as quota_exceeded until the month ends. creditsUsed is the scripts figure of `GET /v1/account/usage/calculation-credits`. Run counts are added when runs end. Requires the *Manage my account* permission.
256
304
  * @summary Get script usage
@@ -549,6 +597,55 @@ export class ScriptsApi extends runtime.BaseAPI implements ScriptsApiInterface {
549
597
  return await response.value();
550
598
  }
551
599
 
600
+ /**
601
+ * Runs Python or JavaScript code once in a sandbox without saving it as a script, for working something out from the account\'s data. The handler is the one an integration script implements, with `input` as `event.input`; there is no build, so dependency manifests and Go are not supported. The code runs with a read-only access token scoped to the caller: only the caller\'s view permissions, in the caller\'s current project if there is one, for 5 minutes. `ctx.fetch` sends it to the Spaciv API. Files the handler writes to its output directory (`ctx.output_dir` in Python, `ctx.outputDir` in JavaScript) are returned with its stdout, stderr and return value. Limits: code up to 256 KiB in at most 50 files, `input` up to 1 MiB, and `timeoutSeconds` up to 120 (default 30). Of the output, stdout and stderr are kept up to 256 KiB each, the return value up to 256 KiB, and up to 20 output files totalling 2 MiB. Runs count towards the account\'s script credits and concurrent runs. The request waits up to `waitSeconds` for the run to finish; a run still in progress is returned without `output`, and can be read with `GET /v1/scripts/scratchpad/runs/{runId}`. A run is visible only to the user who started it, and is kept for 24 hours. Returns `422` when the language or code is not accepted, and `403` for a script\'s API key or a scratchpad run\'s own token. Requires the *AI assistant* permission.
602
+ * Run scratchpad code
603
+ */
604
+ async createScratchpadRunsRaw(requestParameters: ScriptsApiCreateScratchpadRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScratchpadRun>> {
605
+ if (requestParameters['scratchpadRunPostReqBody'] == null) {
606
+ throw new runtime.RequiredError(
607
+ 'scratchpadRunPostReqBody',
608
+ 'Required parameter "scratchpadRunPostReqBody" was null or undefined when calling createScratchpadRuns().'
609
+ );
610
+ }
611
+
612
+ const queryParameters: any = {};
613
+
614
+ const headerParameters: runtime.HTTPHeaders = {};
615
+
616
+ headerParameters['Content-Type'] = 'application/json';
617
+
618
+ if (this.configuration && this.configuration.accessToken) {
619
+ const token = this.configuration.accessToken;
620
+ const tokenString = await token("accessToken", []);
621
+
622
+ if (tokenString) {
623
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
624
+ }
625
+ }
626
+
627
+ let urlPath = `/v1/scripts/scratchpad/runs`;
628
+
629
+ const response = await this.request({
630
+ path: urlPath,
631
+ method: 'POST',
632
+ headers: headerParameters,
633
+ query: queryParameters,
634
+ body: ScratchpadRunPostReqBodyToJSON(requestParameters['scratchpadRunPostReqBody']),
635
+ }, initOverrides);
636
+
637
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScratchpadRunFromJSON(jsonValue));
638
+ }
639
+
640
+ /**
641
+ * Runs Python or JavaScript code once in a sandbox without saving it as a script, for working something out from the account\'s data. The handler is the one an integration script implements, with `input` as `event.input`; there is no build, so dependency manifests and Go are not supported. The code runs with a read-only access token scoped to the caller: only the caller\'s view permissions, in the caller\'s current project if there is one, for 5 minutes. `ctx.fetch` sends it to the Spaciv API. Files the handler writes to its output directory (`ctx.output_dir` in Python, `ctx.outputDir` in JavaScript) are returned with its stdout, stderr and return value. Limits: code up to 256 KiB in at most 50 files, `input` up to 1 MiB, and `timeoutSeconds` up to 120 (default 30). Of the output, stdout and stderr are kept up to 256 KiB each, the return value up to 256 KiB, and up to 20 output files totalling 2 MiB. Runs count towards the account\'s script credits and concurrent runs. The request waits up to `waitSeconds` for the run to finish; a run still in progress is returned without `output`, and can be read with `GET /v1/scripts/scratchpad/runs/{runId}`. A run is visible only to the user who started it, and is kept for 24 hours. Returns `422` when the language or code is not accepted, and `403` for a script\'s API key or a scratchpad run\'s own token. Requires the *AI assistant* permission.
642
+ * Run scratchpad code
643
+ */
644
+ async createScratchpadRuns(requestParameters: ScriptsApiCreateScratchpadRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScratchpadRun> {
645
+ const response = await this.createScratchpadRunsRaw(requestParameters, initOverrides);
646
+ return await response.value();
647
+ }
648
+
552
649
  /**
553
650
  * Stops any active runs, deletes the script with its secrets and run history, and revokes its API keys. Requires the *Manage my account* permission.
554
651
  * Delete a script
@@ -736,6 +833,57 @@ export class ScriptsApi extends runtime.BaseAPI implements ScriptsApiInterface {
736
833
  return await response.value();
737
834
  }
738
835
 
836
+ /**
837
+ * Returns a scratchpad run the caller started, with its output once it has finished. Runs are kept for 24 hours. Returns `404` when the run does not exist, has expired or was started by someone else, and `403` for a script\'s API key or a scratchpad run\'s own token. Requires the *AI assistant* permission.
838
+ * Get a scratchpad run
839
+ */
840
+ async getScratchpadRunsRaw(requestParameters: ScriptsApiGetScratchpadRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScratchpadRun>> {
841
+ if (requestParameters['runId'] == null) {
842
+ throw new runtime.RequiredError(
843
+ 'runId',
844
+ 'Required parameter "runId" was null or undefined when calling getScratchpadRuns().'
845
+ );
846
+ }
847
+
848
+ const queryParameters: any = {};
849
+
850
+ if (requestParameters['waitSeconds'] != null) {
851
+ queryParameters['waitSeconds'] = requestParameters['waitSeconds'];
852
+ }
853
+
854
+ const headerParameters: runtime.HTTPHeaders = {};
855
+
856
+ if (this.configuration && this.configuration.accessToken) {
857
+ const token = this.configuration.accessToken;
858
+ const tokenString = await token("accessToken", []);
859
+
860
+ if (tokenString) {
861
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
862
+ }
863
+ }
864
+
865
+ let urlPath = `/v1/scripts/scratchpad/runs/{runId}`;
866
+ urlPath = urlPath.replace(`{${"runId"}}`, encodeURIComponent(String(requestParameters['runId'])));
867
+
868
+ const response = await this.request({
869
+ path: urlPath,
870
+ method: 'GET',
871
+ headers: headerParameters,
872
+ query: queryParameters,
873
+ }, initOverrides);
874
+
875
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScratchpadRunFromJSON(jsonValue));
876
+ }
877
+
878
+ /**
879
+ * Returns a scratchpad run the caller started, with its output once it has finished. Runs are kept for 24 hours. Returns `404` when the run does not exist, has expired or was started by someone else, and `403` for a script\'s API key or a scratchpad run\'s own token. Requires the *AI assistant* permission.
880
+ * Get a scratchpad run
881
+ */
882
+ async getScratchpadRuns(requestParameters: ScriptsApiGetScratchpadRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScratchpadRun> {
883
+ const response = await this.getScratchpadRunsRaw(requestParameters, initOverrides);
884
+ return await response.value();
885
+ }
886
+
739
887
  /**
740
888
  * Returns the credits the account\'s script runs were charged this calendar month (UTC), against the account\'s monthly script credit limit and its other script limits, with how many runs each script made, failed and had refused. creditState is near from 80% of the monthly limit and reached once it is used, after which runs are recorded as quota_exceeded until the month ends. creditsUsed is the scripts figure of `GET /v1/account/usage/calculation-credits`. Run counts are added when runs end. Requires the *Manage my account* permission.
741
889
  * Get script usage
@@ -0,0 +1,73 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * spaciv API
5
+ * The spaciv API powers workplace planning: modelling how many people an organisation has, how they work, and how much space that requires. ## Getting started 1. Exchange credentials for an access token using one of the operations under **Authentication**. 2. Send that token on every subsequent request as `Authorization: Bearer <token>`. 3. Access tokens are short lived. Call `POST /v1/auth/refresh-token` to obtain a new one before the old one expires. ## Conventions Every operation is versioned under `/v1`. Collections are plural (`GET /v1/dashboards` lists, `POST /v1/dashboards` creates) and individual records live beneath them (`/v1/dashboards/{id}`). Singular paths such as `/v1/account`, `/v1/project` and `/v1/user` refer to the record the access token was issued for. Request and response bodies are JSON. Timestamps are RFC 3339. Identifiers are opaque strings unless documented otherwise, and collection operations return the records visible to the account the token was issued for. Failures return an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem document with a `detail` field describing what went wrong.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@spaciv.com
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
+ *
18
+ * @export
19
+ * @interface AccountDirectoryPatchBody
20
+ */
21
+ export interface AccountDirectoryPatchBody {
22
+ /**
23
+ * New display name for the directory. At most 255 bytes after normalising to Unicode NFC. Must not contain a forward slash or a backslash, and must not be . or ..
24
+ * @type {string}
25
+ * @memberof AccountDirectoryPatchBody
26
+ */
27
+ name?: string;
28
+ /**
29
+ * Identifier of the directory to move this one into, or an empty string to move it to the root.
30
+ * @type {string}
31
+ * @memberof AccountDirectoryPatchBody
32
+ */
33
+ parentId?: string;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the AccountDirectoryPatchBody interface.
38
+ */
39
+ export function instanceOfAccountDirectoryPatchBody(value: object): value is AccountDirectoryPatchBody {
40
+ return true;
41
+ }
42
+
43
+ export function AccountDirectoryPatchBodyFromJSON(json: any): AccountDirectoryPatchBody {
44
+ return AccountDirectoryPatchBodyFromJSONTyped(json, false);
45
+ }
46
+
47
+ export function AccountDirectoryPatchBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccountDirectoryPatchBody {
48
+ if (json == null) {
49
+ return json;
50
+ }
51
+ return {
52
+
53
+ 'name': json['name'] == null ? undefined : json['name'],
54
+ 'parentId': json['parentId'] == null ? undefined : json['parentId'],
55
+ };
56
+ }
57
+
58
+ export function AccountDirectoryPatchBodyToJSON(json: any): AccountDirectoryPatchBody {
59
+ return AccountDirectoryPatchBodyToJSONTyped(json, false);
60
+ }
61
+
62
+ export function AccountDirectoryPatchBodyToJSONTyped(value?: AccountDirectoryPatchBody | null, ignoreDiscriminator: boolean = false): any {
63
+ if (value == null) {
64
+ return value;
65
+ }
66
+
67
+ return {
68
+
69
+ 'name': value['name'],
70
+ 'parentId': value['parentId'],
71
+ };
72
+ }
73
+
@@ -0,0 +1,74 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * spaciv API
5
+ * The spaciv API powers workplace planning: modelling how many people an organisation has, how they work, and how much space that requires. ## Getting started 1. Exchange credentials for an access token using one of the operations under **Authentication**. 2. Send that token on every subsequent request as `Authorization: Bearer <token>`. 3. Access tokens are short lived. Call `POST /v1/auth/refresh-token` to obtain a new one before the old one expires. ## Conventions Every operation is versioned under `/v1`. Collections are plural (`GET /v1/dashboards` lists, `POST /v1/dashboards` creates) and individual records live beneath them (`/v1/dashboards/{id}`). Singular paths such as `/v1/account`, `/v1/project` and `/v1/user` refer to the record the access token was issued for. Request and response bodies are JSON. Timestamps are RFC 3339. Identifiers are opaque strings unless documented otherwise, and collection operations return the records visible to the account the token was issued for. Failures return an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem document with a `detail` field describing what went wrong.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@spaciv.com
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
+ *
18
+ * @export
19
+ * @interface AccountDirectoryPostBody
20
+ */
21
+ export interface AccountDirectoryPostBody {
22
+ /**
23
+ * Display name of the directory. At most 255 bytes after normalising to Unicode NFC. Must not contain a forward slash or a backslash, and must not be . or ..
24
+ * @type {string}
25
+ * @memberof AccountDirectoryPostBody
26
+ */
27
+ name: string;
28
+ /**
29
+ * Identifier of the directory to create this one in. Leave it out to create it at the root.
30
+ * @type {string}
31
+ * @memberof AccountDirectoryPostBody
32
+ */
33
+ parentId?: string;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the AccountDirectoryPostBody interface.
38
+ */
39
+ export function instanceOfAccountDirectoryPostBody(value: object): value is AccountDirectoryPostBody {
40
+ if (!('name' in value) || value['name'] === undefined) return false;
41
+ return true;
42
+ }
43
+
44
+ export function AccountDirectoryPostBodyFromJSON(json: any): AccountDirectoryPostBody {
45
+ return AccountDirectoryPostBodyFromJSONTyped(json, false);
46
+ }
47
+
48
+ export function AccountDirectoryPostBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccountDirectoryPostBody {
49
+ if (json == null) {
50
+ return json;
51
+ }
52
+ return {
53
+
54
+ 'name': json['name'],
55
+ 'parentId': json['parentId'] == null ? undefined : json['parentId'],
56
+ };
57
+ }
58
+
59
+ export function AccountDirectoryPostBodyToJSON(json: any): AccountDirectoryPostBody {
60
+ return AccountDirectoryPostBodyToJSONTyped(json, false);
61
+ }
62
+
63
+ export function AccountDirectoryPostBodyToJSONTyped(value?: AccountDirectoryPostBody | null, ignoreDiscriminator: boolean = false): any {
64
+ if (value == null) {
65
+ return value;
66
+ }
67
+
68
+ return {
69
+
70
+ 'name': value['name'],
71
+ 'parentId': value['parentId'],
72
+ };
73
+ }
74
+
@@ -20,18 +20,23 @@ import { mapValues } from '../runtime';
20
20
  */
21
21
  export interface AccountFilePatchBody {
22
22
  /**
23
- * New display name for the file. Must not contain a forward slash or a backslash.
23
+ * New display name for the file. At most 255 bytes after normalising to Unicode NFC. Must not contain a forward slash or a backslash.
24
24
  * @type {string}
25
25
  * @memberof AccountFilePatchBody
26
26
  */
27
- name: string;
27
+ name?: string;
28
+ /**
29
+ * Identifier of the directory to move the file into, or an empty string to move it to the root.
30
+ * @type {string}
31
+ * @memberof AccountFilePatchBody
32
+ */
33
+ parentId?: string;
28
34
  }
29
35
 
30
36
  /**
31
37
  * Check if a given object implements the AccountFilePatchBody interface.
32
38
  */
33
39
  export function instanceOfAccountFilePatchBody(value: object): value is AccountFilePatchBody {
34
- if (!('name' in value) || value['name'] === undefined) return false;
35
40
  return true;
36
41
  }
37
42
 
@@ -45,7 +50,8 @@ export function AccountFilePatchBodyFromJSONTyped(json: any, ignoreDiscriminator
45
50
  }
46
51
  return {
47
52
 
48
- 'name': json['name'],
53
+ 'name': json['name'] == null ? undefined : json['name'],
54
+ 'parentId': json['parentId'] == null ? undefined : json['parentId'],
49
55
  };
50
56
  }
51
57
 
@@ -61,6 +67,7 @@ export function AccountFilePatchBodyToJSONTyped(value?: AccountFilePatchBody | n
61
67
  return {
62
68
 
63
69
  'name': value['name'],
70
+ 'parentId': value['parentId'],
64
71
  };
65
72
  }
66
73
 
@@ -0,0 +1,101 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * spaciv API
5
+ * The spaciv API powers workplace planning: modelling how many people an organisation has, how they work, and how much space that requires. ## Getting started 1. Exchange credentials for an access token using one of the operations under **Authentication**. 2. Send that token on every subsequent request as `Authorization: Bearer <token>`. 3. Access tokens are short lived. Call `POST /v1/auth/refresh-token` to obtain a new one before the old one expires. ## Conventions Every operation is versioned under `/v1`. Collections are plural (`GET /v1/dashboards` lists, `POST /v1/dashboards` creates) and individual records live beneath them (`/v1/dashboards/{id}`). Singular paths such as `/v1/account`, `/v1/project` and `/v1/user` refer to the record the access token was issued for. Request and response bodies are JSON. Timestamps are RFC 3339. Identifiers are opaque strings unless documented otherwise, and collection operations return the records visible to the account the token was issued for. Failures return an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem document with a `detail` field describing what went wrong.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@spaciv.com
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
+ *
18
+ * @export
19
+ * @interface Directory
20
+ */
21
+ export interface Directory {
22
+ /**
23
+ * When the directory was created (RFC 3339).
24
+ * @type {Date}
25
+ * @memberof Directory
26
+ */
27
+ createdAt: Date;
28
+ /**
29
+ * Identifier of the user who created the directory.
30
+ * @type {number}
31
+ * @memberof Directory
32
+ */
33
+ createdBy: number;
34
+ /**
35
+ * Opaque identifier of the directory.
36
+ * @type {string}
37
+ * @memberof Directory
38
+ */
39
+ id: string;
40
+ /**
41
+ * Display name of the directory. Nothing else in the same parent has the same name, compared exactly and after normalising to Unicode NFC.
42
+ * @type {string}
43
+ * @memberof Directory
44
+ */
45
+ name: string;
46
+ /**
47
+ * Identifier of the directory this one is in. Absent for a directory at the root.
48
+ * @type {string}
49
+ * @memberof Directory
50
+ */
51
+ parentId?: string;
52
+ }
53
+
54
+ /**
55
+ * Check if a given object implements the Directory interface.
56
+ */
57
+ export function instanceOfDirectory(value: object): value is Directory {
58
+ if (!('createdAt' in value) || value['createdAt'] === undefined) return false;
59
+ if (!('createdBy' in value) || value['createdBy'] === undefined) return false;
60
+ if (!('id' in value) || value['id'] === undefined) return false;
61
+ if (!('name' in value) || value['name'] === undefined) return false;
62
+ return true;
63
+ }
64
+
65
+ export function DirectoryFromJSON(json: any): Directory {
66
+ return DirectoryFromJSONTyped(json, false);
67
+ }
68
+
69
+ export function DirectoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): Directory {
70
+ if (json == null) {
71
+ return json;
72
+ }
73
+ return {
74
+
75
+ 'createdAt': (new Date(json['createdAt'])),
76
+ 'createdBy': json['createdBy'],
77
+ 'id': json['id'],
78
+ 'name': json['name'],
79
+ 'parentId': json['parentId'] == null ? undefined : json['parentId'],
80
+ };
81
+ }
82
+
83
+ export function DirectoryToJSON(json: any): Directory {
84
+ return DirectoryToJSONTyped(json, false);
85
+ }
86
+
87
+ export function DirectoryToJSONTyped(value?: Directory | null, ignoreDiscriminator: boolean = false): any {
88
+ if (value == null) {
89
+ return value;
90
+ }
91
+
92
+ return {
93
+
94
+ 'createdAt': ((value['createdAt']).toISOString()),
95
+ 'createdBy': value['createdBy'],
96
+ 'id': value['id'],
97
+ 'name': value['name'],
98
+ 'parentId': value['parentId'],
99
+ };
100
+ }
101
+
@@ -0,0 +1,82 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * spaciv API
5
+ * The spaciv API powers workplace planning: modelling how many people an organisation has, how they work, and how much space that requires. ## Getting started 1. Exchange credentials for an access token using one of the operations under **Authentication**. 2. Send that token on every subsequent request as `Authorization: Bearer <token>`. 3. Access tokens are short lived. Call `POST /v1/auth/refresh-token` to obtain a new one before the old one expires. ## Conventions Every operation is versioned under `/v1`. Collections are plural (`GET /v1/dashboards` lists, `POST /v1/dashboards` creates) and individual records live beneath them (`/v1/dashboards/{id}`). Singular paths such as `/v1/account`, `/v1/project` and `/v1/user` refer to the record the access token was issued for. Request and response bodies are JSON. Timestamps are RFC 3339. Identifiers are opaque strings unless documented otherwise, and collection operations return the records visible to the account the token was issued for. Failures return an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem document with a `detail` field describing what went wrong.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@spaciv.com
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 { Directory } from './Directory';
17
+ import {
18
+ DirectoryFromJSON,
19
+ DirectoryFromJSONTyped,
20
+ DirectoryToJSON,
21
+ DirectoryToJSONTyped,
22
+ } from './Directory';
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ * @interface DirectoryPage
28
+ */
29
+ export interface DirectoryPage {
30
+ /**
31
+ *
32
+ * @type {Array<Directory>}
33
+ * @memberof DirectoryPage
34
+ */
35
+ directories: Array<Directory>;
36
+ /**
37
+ * Pass back as cursor to fetch the following page. Absent on the last page.
38
+ * @type {string}
39
+ * @memberof DirectoryPage
40
+ */
41
+ nextCursor?: string;
42
+ }
43
+
44
+ /**
45
+ * Check if a given object implements the DirectoryPage interface.
46
+ */
47
+ export function instanceOfDirectoryPage(value: object): value is DirectoryPage {
48
+ if (!('directories' in value) || value['directories'] === undefined) return false;
49
+ return true;
50
+ }
51
+
52
+ export function DirectoryPageFromJSON(json: any): DirectoryPage {
53
+ return DirectoryPageFromJSONTyped(json, false);
54
+ }
55
+
56
+ export function DirectoryPageFromJSONTyped(json: any, ignoreDiscriminator: boolean): DirectoryPage {
57
+ if (json == null) {
58
+ return json;
59
+ }
60
+ return {
61
+
62
+ 'directories': ((json['directories'] as Array<any>).map(DirectoryFromJSON)),
63
+ 'nextCursor': json['nextCursor'] == null ? undefined : json['nextCursor'],
64
+ };
65
+ }
66
+
67
+ export function DirectoryPageToJSON(json: any): DirectoryPage {
68
+ return DirectoryPageToJSONTyped(json, false);
69
+ }
70
+
71
+ export function DirectoryPageToJSONTyped(value?: DirectoryPage | null, ignoreDiscriminator: boolean = false): any {
72
+ if (value == null) {
73
+ return value;
74
+ }
75
+
76
+ return {
77
+
78
+ 'directories': ((value['directories'] as Array<any>).map(DirectoryToJSON)),
79
+ 'nextCursor': value['nextCursor'],
80
+ };
81
+ }
82
+
@@ -20,6 +20,13 @@ import {
20
20
  ModelRecordToJSON,
21
21
  ModelRecordToJSONTyped,
22
22
  } from './ModelRecord';
23
+ import type { Directory } from './Directory';
24
+ import {
25
+ DirectoryFromJSON,
26
+ DirectoryFromJSONTyped,
27
+ DirectoryToJSON,
28
+ DirectoryToJSONTyped,
29
+ } from './Directory';
23
30
 
24
31
  /**
25
32
  *
@@ -27,6 +34,12 @@ import {
27
34
  * @interface ListPage
28
35
  */
29
36
  export interface ListPage {
37
+ /**
38
+ * Directories directly inside the listed directory. Returned only when a parent is given, and only on the pages that hold some.
39
+ * @type {Array<Directory>}
40
+ * @memberof ListPage
41
+ */
42
+ directories?: Array<Directory>;
30
43
  /**
31
44
  *
32
45
  * @type {Array<ModelRecord>}
@@ -59,6 +72,7 @@ export function ListPageFromJSONTyped(json: any, ignoreDiscriminator: boolean):
59
72
  }
60
73
  return {
61
74
 
75
+ 'directories': json['directories'] == null ? undefined : ((json['directories'] as Array<any>).map(DirectoryFromJSON)),
62
76
  'files': ((json['files'] as Array<any>).map(ModelRecordFromJSON)),
63
77
  'nextCursor': json['nextCursor'] == null ? undefined : json['nextCursor'],
64
78
  };
@@ -75,6 +89,7 @@ export function ListPageToJSONTyped(value?: ListPage | null, ignoreDiscriminator
75
89
 
76
90
  return {
77
91
 
92
+ 'directories': value['directories'] == null ? undefined : ((value['directories'] as Array<any>).map(DirectoryToJSON)),
78
93
  'files': ((value['files'] as Array<any>).map(ModelRecordToJSON)),
79
94
  'nextCursor': value['nextCursor'],
80
95
  };
@@ -38,11 +38,17 @@ export interface ModelRecord {
38
38
  */
39
39
  mimeType: string;
40
40
  /**
41
- * Display name of the file, taken from the uploaded file name and changeable afterwards.
41
+ * Display name of the file, taken from the uploaded file name and changeable afterwards. Nothing else in the same directory has the same name, compared exactly and after normalising to Unicode NFC.
42
42
  * @type {string}
43
43
  * @memberof ModelRecord
44
44
  */
45
45
  name: string;
46
+ /**
47
+ * Identifier of the directory the file is in. Absent for a file at the root.
48
+ * @type {string}
49
+ * @memberof ModelRecord
50
+ */
51
+ parentId?: string;
46
52
  /**
47
53
  * Name of the virus signature the file matched when it was quarantined.
48
54
  * @type {string}
@@ -96,6 +102,7 @@ export function ModelRecordFromJSONTyped(json: any, ignoreDiscriminator: boolean
96
102
  'id': json['id'],
97
103
  'mimeType': json['mimeType'],
98
104
  'name': json['name'],
105
+ 'parentId': json['parentId'] == null ? undefined : json['parentId'],
99
106
  'quarantineSignature': json['quarantineSignature'] == null ? undefined : json['quarantineSignature'],
100
107
  'quarantinedAt': json['quarantinedAt'] == null ? undefined : (new Date(json['quarantinedAt'])),
101
108
  'size': json['size'],
@@ -118,6 +125,7 @@ export function ModelRecordToJSONTyped(value?: ModelRecord | null, ignoreDiscrim
118
125
  'id': value['id'],
119
126
  'mimeType': value['mimeType'],
120
127
  'name': value['name'],
128
+ 'parentId': value['parentId'],
121
129
  'quarantineSignature': value['quarantineSignature'],
122
130
  'quarantinedAt': value['quarantinedAt'] == null ? undefined : ((value['quarantinedAt']).toISOString()),
123
131
  'size': value['size'],