@spaciv/sdk 0.1.1 → 0.1.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 (151) hide show
  1. package/.openapi-generator/FILES +23 -0
  2. package/README.md +2 -2
  3. package/dist/apis/AccountsApi.d.ts +24 -24
  4. package/dist/apis/AccountsApi.js +12 -12
  5. package/dist/apis/AuditLogApi.d.ts +1 -1
  6. package/dist/apis/AuthenticationApi.d.ts +8 -8
  7. package/dist/apis/AuthenticationApi.js +4 -4
  8. package/dist/apis/ScriptsApi.d.ts +383 -0
  9. package/dist/apis/ScriptsApi.js +559 -0
  10. package/dist/apis/UsersApi.d.ts +4 -4
  11. package/dist/apis/UsersApi.js +2 -2
  12. package/dist/apis/index.d.ts +1 -0
  13. package/dist/apis/index.js +1 -0
  14. package/dist/esm/apis/AccountsApi.d.ts +24 -24
  15. package/dist/esm/apis/AccountsApi.js +12 -12
  16. package/dist/esm/apis/AuditLogApi.d.ts +1 -1
  17. package/dist/esm/apis/AuthenticationApi.d.ts +8 -8
  18. package/dist/esm/apis/AuthenticationApi.js +4 -4
  19. package/dist/esm/apis/ScriptsApi.d.ts +383 -0
  20. package/dist/esm/apis/ScriptsApi.js +555 -0
  21. package/dist/esm/apis/UsersApi.d.ts +4 -4
  22. package/dist/esm/apis/UsersApi.js +2 -2
  23. package/dist/esm/apis/index.d.ts +1 -0
  24. package/dist/esm/apis/index.js +1 -0
  25. package/dist/esm/models/APIKey.d.ts +6 -0
  26. package/dist/esm/models/APIKey.js +2 -0
  27. package/dist/esm/models/ScriptAuditEntry.d.ts +67 -0
  28. package/dist/esm/models/ScriptAuditEntry.js +63 -0
  29. package/dist/esm/models/ScriptAuditResBody.d.ts +39 -0
  30. package/dist/esm/models/ScriptAuditResBody.js +46 -0
  31. package/dist/esm/models/ScriptDetail.d.ts +161 -0
  32. package/dist/esm/models/ScriptDetail.js +122 -0
  33. package/dist/esm/models/ScriptExport.d.ts +174 -0
  34. package/dist/esm/models/ScriptExport.js +129 -0
  35. package/dist/esm/models/ScriptExportResBody.d.ts +39 -0
  36. package/dist/esm/models/ScriptExportResBody.js +48 -0
  37. package/dist/esm/models/ScriptExportRun.d.ts +92 -0
  38. package/dist/esm/models/ScriptExportRun.js +73 -0
  39. package/dist/esm/models/ScriptKey.d.ts +64 -0
  40. package/dist/esm/models/ScriptKey.js +58 -0
  41. package/dist/esm/models/ScriptListResBody.d.ts +33 -0
  42. package/dist/esm/models/ScriptListResBody.js +44 -0
  43. package/dist/esm/models/ScriptLogLine.d.ts +38 -0
  44. package/dist/esm/models/ScriptLogLine.js +47 -0
  45. package/dist/esm/models/ScriptPatchReqBody.d.ts +98 -0
  46. package/dist/esm/models/ScriptPatchReqBody.js +70 -0
  47. package/dist/esm/models/ScriptPostReqBody.d.ts +113 -0
  48. package/dist/esm/models/ScriptPostReqBody.js +82 -0
  49. package/dist/esm/models/ScriptRun.d.ts +86 -0
  50. package/dist/esm/models/ScriptRun.js +69 -0
  51. package/dist/esm/models/ScriptRunLogsResBody.d.ts +39 -0
  52. package/dist/esm/models/ScriptRunLogsResBody.js +48 -0
  53. package/dist/esm/models/ScriptRunsResBody.d.ts +39 -0
  54. package/dist/esm/models/ScriptRunsResBody.js +46 -0
  55. package/dist/esm/models/ScriptRuntime.d.ts +62 -0
  56. package/dist/esm/models/ScriptRuntime.js +51 -0
  57. package/dist/esm/models/ScriptSchedule.d.ts +38 -0
  58. package/dist/esm/models/ScriptSchedule.js +43 -0
  59. package/dist/esm/models/ScriptSchedulePreviewReqBody.d.ts +44 -0
  60. package/dist/esm/models/ScriptSchedulePreviewReqBody.js +45 -0
  61. package/dist/esm/models/ScriptSchedulePreviewResBody.d.ts +44 -0
  62. package/dist/esm/models/ScriptSchedulePreviewResBody.js +49 -0
  63. package/dist/esm/models/ScriptSecretsReqBody.d.ts +40 -0
  64. package/dist/esm/models/ScriptSecretsReqBody.js +43 -0
  65. package/dist/esm/models/ScriptSecretsResBody.d.ts +134 -0
  66. package/dist/esm/models/ScriptSecretsResBody.js +111 -0
  67. package/dist/esm/models/ScriptSummary.d.ts +128 -0
  68. package/dist/esm/models/ScriptSummary.js +107 -0
  69. package/dist/esm/models/ScriptWebhookResBody.d.ts +32 -0
  70. package/dist/esm/models/ScriptWebhookResBody.js +43 -0
  71. package/dist/esm/models/index.d.ts +22 -0
  72. package/dist/esm/models/index.js +22 -0
  73. package/dist/models/APIKey.d.ts +6 -0
  74. package/dist/models/APIKey.js +2 -0
  75. package/dist/models/ScriptAuditEntry.d.ts +67 -0
  76. package/dist/models/ScriptAuditEntry.js +71 -0
  77. package/dist/models/ScriptAuditResBody.d.ts +39 -0
  78. package/dist/models/ScriptAuditResBody.js +53 -0
  79. package/dist/models/ScriptDetail.d.ts +161 -0
  80. package/dist/models/ScriptDetail.js +130 -0
  81. package/dist/models/ScriptExport.d.ts +174 -0
  82. package/dist/models/ScriptExport.js +137 -0
  83. package/dist/models/ScriptExportResBody.d.ts +39 -0
  84. package/dist/models/ScriptExportResBody.js +55 -0
  85. package/dist/models/ScriptExportRun.d.ts +92 -0
  86. package/dist/models/ScriptExportRun.js +80 -0
  87. package/dist/models/ScriptKey.d.ts +64 -0
  88. package/dist/models/ScriptKey.js +66 -0
  89. package/dist/models/ScriptListResBody.d.ts +33 -0
  90. package/dist/models/ScriptListResBody.js +51 -0
  91. package/dist/models/ScriptLogLine.d.ts +38 -0
  92. package/dist/models/ScriptLogLine.js +54 -0
  93. package/dist/models/ScriptPatchReqBody.d.ts +98 -0
  94. package/dist/models/ScriptPatchReqBody.js +78 -0
  95. package/dist/models/ScriptPostReqBody.d.ts +113 -0
  96. package/dist/models/ScriptPostReqBody.js +90 -0
  97. package/dist/models/ScriptRun.d.ts +86 -0
  98. package/dist/models/ScriptRun.js +76 -0
  99. package/dist/models/ScriptRunLogsResBody.d.ts +39 -0
  100. package/dist/models/ScriptRunLogsResBody.js +55 -0
  101. package/dist/models/ScriptRunsResBody.d.ts +39 -0
  102. package/dist/models/ScriptRunsResBody.js +53 -0
  103. package/dist/models/ScriptRuntime.d.ts +62 -0
  104. package/dist/models/ScriptRuntime.js +58 -0
  105. package/dist/models/ScriptSchedule.d.ts +38 -0
  106. package/dist/models/ScriptSchedule.js +50 -0
  107. package/dist/models/ScriptSchedulePreviewReqBody.d.ts +44 -0
  108. package/dist/models/ScriptSchedulePreviewReqBody.js +52 -0
  109. package/dist/models/ScriptSchedulePreviewResBody.d.ts +44 -0
  110. package/dist/models/ScriptSchedulePreviewResBody.js +56 -0
  111. package/dist/models/ScriptSecretsReqBody.d.ts +40 -0
  112. package/dist/models/ScriptSecretsReqBody.js +50 -0
  113. package/dist/models/ScriptSecretsResBody.d.ts +134 -0
  114. package/dist/models/ScriptSecretsResBody.js +119 -0
  115. package/dist/models/ScriptSummary.d.ts +128 -0
  116. package/dist/models/ScriptSummary.js +115 -0
  117. package/dist/models/ScriptWebhookResBody.d.ts +32 -0
  118. package/dist/models/ScriptWebhookResBody.js +50 -0
  119. package/dist/models/index.d.ts +22 -0
  120. package/dist/models/index.js +22 -0
  121. package/package.json +1 -1
  122. package/src/apis/AccountsApi.ts +24 -24
  123. package/src/apis/AuditLogApi.ts +1 -1
  124. package/src/apis/AuthenticationApi.ts +8 -8
  125. package/src/apis/ScriptsApi.ts +984 -0
  126. package/src/apis/UsersApi.ts +4 -4
  127. package/src/apis/index.ts +1 -0
  128. package/src/models/APIKey.ts +8 -0
  129. package/src/models/ScriptAuditEntry.ts +112 -0
  130. package/src/models/ScriptAuditResBody.ts +82 -0
  131. package/src/models/ScriptDetail.ts +265 -0
  132. package/src/models/ScriptExport.ts +289 -0
  133. package/src/models/ScriptExportResBody.ts +83 -0
  134. package/src/models/ScriptExportRun.ts +151 -0
  135. package/src/models/ScriptKey.ts +109 -0
  136. package/src/models/ScriptListResBody.ts +74 -0
  137. package/src/models/ScriptLogLine.ts +75 -0
  138. package/src/models/ScriptPatchReqBody.ts +158 -0
  139. package/src/models/ScriptPostReqBody.ts +176 -0
  140. package/src/models/ScriptRun.ts +142 -0
  141. package/src/models/ScriptRunLogsResBody.ts +83 -0
  142. package/src/models/ScriptRunsResBody.ts +82 -0
  143. package/src/models/ScriptRuntime.ts +105 -0
  144. package/src/models/ScriptSchedule.ts +73 -0
  145. package/src/models/ScriptSchedulePreviewReqBody.ts +81 -0
  146. package/src/models/ScriptSchedulePreviewResBody.ts +83 -0
  147. package/src/models/ScriptSecretsReqBody.ts +73 -0
  148. package/src/models/ScriptSecretsResBody.ts +225 -0
  149. package/src/models/ScriptSummary.ts +216 -0
  150. package/src/models/ScriptWebhookResBody.ts +66 -0
  151. package/src/models/index.ts +22 -0
@@ -0,0 +1,559 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * spaciv API
6
+ * 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.
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: support@spaciv.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.ScriptsApi = void 0;
26
+ const runtime = require("../runtime");
27
+ const index_1 = require("../models/index");
28
+ /**
29
+ *
30
+ */
31
+ class ScriptsApi extends runtime.BaseAPI {
32
+ /**
33
+ * Creates a script whose Python, Go or JavaScript handler is called on a schedule, from a webhook, or both. The handler\'s context carries a Spaciv API key acting with the caller\'s permissions, except the account-administration permissions (*Manage my account*, *Manage users*, *Edit my user profile*, *Edit billing address* and the system permissions), which a script\'s key never carries, plus the account and, when a project is set, the project; the key is rotated automatically. A non-null return value is written to the run\'s logs. When `webhook` is true the response\'s `webhookUrl` is the only time the URL is returned. Rejected with `422` when the source, schedule or secrets are invalid or the project does not exist, and with `409` when the account already has 50 scripts. Requires the *Manage my account* permission; a script\'s own API key cannot call this or any other script operation.
34
+ * Create a script
35
+ */
36
+ createRaw(requestParameters, initOverrides) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (requestParameters['scriptPostReqBody'] == null) {
39
+ throw new runtime.RequiredError('scriptPostReqBody', 'Required parameter "scriptPostReqBody" was null or undefined when calling create().');
40
+ }
41
+ const queryParameters = {};
42
+ const headerParameters = {};
43
+ headerParameters['Content-Type'] = 'application/json';
44
+ if (this.configuration && this.configuration.accessToken) {
45
+ const token = this.configuration.accessToken;
46
+ const tokenString = yield token("accessToken", []);
47
+ if (tokenString) {
48
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
49
+ }
50
+ }
51
+ let urlPath = `/v1/scripts`;
52
+ const response = yield this.request({
53
+ path: urlPath,
54
+ method: 'POST',
55
+ headers: headerParameters,
56
+ query: queryParameters,
57
+ body: (0, index_1.ScriptPostReqBodyToJSON)(requestParameters['scriptPostReqBody']),
58
+ }, initOverrides);
59
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptDetailFromJSON)(jsonValue));
60
+ });
61
+ }
62
+ /**
63
+ * Creates a script whose Python, Go or JavaScript handler is called on a schedule, from a webhook, or both. The handler\'s context carries a Spaciv API key acting with the caller\'s permissions, except the account-administration permissions (*Manage my account*, *Manage users*, *Edit my user profile*, *Edit billing address* and the system permissions), which a script\'s key never carries, plus the account and, when a project is set, the project; the key is rotated automatically. A non-null return value is written to the run\'s logs. When `webhook` is true the response\'s `webhookUrl` is the only time the URL is returned. Rejected with `422` when the source, schedule or secrets are invalid or the project does not exist, and with `409` when the account already has 50 scripts. Requires the *Manage my account* permission; a script\'s own API key cannot call this or any other script operation.
64
+ * Create a script
65
+ */
66
+ create(requestParameters, initOverrides) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const response = yield this.createRaw(requestParameters, initOverrides);
69
+ return yield response.value();
70
+ });
71
+ }
72
+ /**
73
+ * Replaces the script\'s API key with a new one acting with the caller\'s permissions, except the account-administration permissions (*Manage my account*, *Manage users*, *Edit my user profile*, *Edit billing address* and the system permissions), which a script\'s key never carries, and revokes the old one. Use it when the key needs re-authorising because its owner lost access, or to hand the script to another user. Requires the *Manage my account* permission.
74
+ * Re-authorise a script
75
+ */
76
+ createReauthoriseRaw(requestParameters, initOverrides) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ if (requestParameters['id'] == null) {
79
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling createReauthorise().');
80
+ }
81
+ const queryParameters = {};
82
+ const headerParameters = {};
83
+ if (this.configuration && this.configuration.accessToken) {
84
+ const token = this.configuration.accessToken;
85
+ const tokenString = yield token("accessToken", []);
86
+ if (tokenString) {
87
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
88
+ }
89
+ }
90
+ let urlPath = `/v1/scripts/{id}/reauthorise`;
91
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
92
+ const response = yield this.request({
93
+ path: urlPath,
94
+ method: 'POST',
95
+ headers: headerParameters,
96
+ query: queryParameters,
97
+ }, initOverrides);
98
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptDetailFromJSON)(jsonValue));
99
+ });
100
+ }
101
+ /**
102
+ * Replaces the script\'s API key with a new one acting with the caller\'s permissions, except the account-administration permissions (*Manage my account*, *Manage users*, *Edit my user profile*, *Edit billing address* and the system permissions), which a script\'s key never carries, and revokes the old one. Use it when the key needs re-authorising because its owner lost access, or to hand the script to another user. Requires the *Manage my account* permission.
103
+ * Re-authorise a script
104
+ */
105
+ createReauthorise(requestParameters, initOverrides) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ const response = yield this.createReauthoriseRaw(requestParameters, initOverrides);
108
+ return yield response.value();
109
+ });
110
+ }
111
+ /**
112
+ * Issues a new webhook URL and immediately invalidates the previous one. The URL is returned only in this response. Rejected with `409` when the script\'s webhook is turned off, or when another request regenerated it at the same time; the URL returned to that request is the valid one. Requires the *Manage my account* permission.
113
+ * Regenerate a script\'s webhook URL
114
+ */
115
+ createRegenerateWebhookRaw(requestParameters, initOverrides) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ if (requestParameters['id'] == null) {
118
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling createRegenerateWebhook().');
119
+ }
120
+ const queryParameters = {};
121
+ const headerParameters = {};
122
+ if (this.configuration && this.configuration.accessToken) {
123
+ const token = this.configuration.accessToken;
124
+ const tokenString = yield token("accessToken", []);
125
+ if (tokenString) {
126
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
127
+ }
128
+ }
129
+ let urlPath = `/v1/scripts/{id}/regenerate-webhook`;
130
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
131
+ const response = yield this.request({
132
+ path: urlPath,
133
+ method: 'POST',
134
+ headers: headerParameters,
135
+ query: queryParameters,
136
+ }, initOverrides);
137
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptWebhookResBodyFromJSON)(jsonValue));
138
+ });
139
+ }
140
+ /**
141
+ * Issues a new webhook URL and immediately invalidates the previous one. The URL is returned only in this response. Rejected with `409` when the script\'s webhook is turned off, or when another request regenerated it at the same time; the URL returned to that request is the valid one. Requires the *Manage my account* permission.
142
+ * Regenerate a script\'s webhook URL
143
+ */
144
+ createRegenerateWebhook(requestParameters, initOverrides) {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ const response = yield this.createRegenerateWebhookRaw(requestParameters, initOverrides);
147
+ return yield response.value();
148
+ });
149
+ }
150
+ /**
151
+ * Checks a cron expression and time zone and returns the next times it would run, so a schedule can be confirmed before saving. An invalid schedule is reported in `error` with `valid` false rather than as an error response. Requires the *Manage my account* permission.
152
+ * Preview a script schedule
153
+ */
154
+ createSchedulePreviewRaw(requestParameters, initOverrides) {
155
+ return __awaiter(this, void 0, void 0, function* () {
156
+ if (requestParameters['scriptSchedulePreviewReqBody'] == null) {
157
+ throw new runtime.RequiredError('scriptSchedulePreviewReqBody', 'Required parameter "scriptSchedulePreviewReqBody" was null or undefined when calling createSchedulePreview().');
158
+ }
159
+ const queryParameters = {};
160
+ const headerParameters = {};
161
+ headerParameters['Content-Type'] = 'application/json';
162
+ if (this.configuration && this.configuration.accessToken) {
163
+ const token = this.configuration.accessToken;
164
+ const tokenString = yield token("accessToken", []);
165
+ if (tokenString) {
166
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
167
+ }
168
+ }
169
+ let urlPath = `/v1/scripts/schedule-preview`;
170
+ const response = yield this.request({
171
+ path: urlPath,
172
+ method: 'POST',
173
+ headers: headerParameters,
174
+ query: queryParameters,
175
+ body: (0, index_1.ScriptSchedulePreviewReqBodyToJSON)(requestParameters['scriptSchedulePreviewReqBody']),
176
+ }, initOverrides);
177
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptSchedulePreviewResBodyFromJSON)(jsonValue));
178
+ });
179
+ }
180
+ /**
181
+ * Checks a cron expression and time zone and returns the next times it would run, so a schedule can be confirmed before saving. An invalid schedule is reported in `error` with `valid` false rather than as an error response. Requires the *Manage my account* permission.
182
+ * Preview a script schedule
183
+ */
184
+ createSchedulePreview(requestParameters, initOverrides) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ const response = yield this.createSchedulePreviewRaw(requestParameters, initOverrides);
187
+ return yield response.value();
188
+ });
189
+ }
190
+ /**
191
+ * Stops any active runs, deletes the script with its secrets and run history, and revokes its API keys. Requires the *Manage my account* permission.
192
+ * Delete a script
193
+ */
194
+ deleteRaw(requestParameters, initOverrides) {
195
+ return __awaiter(this, void 0, void 0, function* () {
196
+ if (requestParameters['id'] == null) {
197
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling delete().');
198
+ }
199
+ const queryParameters = {};
200
+ const headerParameters = {};
201
+ if (this.configuration && this.configuration.accessToken) {
202
+ const token = this.configuration.accessToken;
203
+ const tokenString = yield token("accessToken", []);
204
+ if (tokenString) {
205
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
206
+ }
207
+ }
208
+ let urlPath = `/v1/scripts/{id}`;
209
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
210
+ const response = yield this.request({
211
+ path: urlPath,
212
+ method: 'DELETE',
213
+ headers: headerParameters,
214
+ query: queryParameters,
215
+ }, initOverrides);
216
+ return new runtime.VoidApiResponse(response);
217
+ });
218
+ }
219
+ /**
220
+ * Stops any active runs, deletes the script with its secrets and run history, and revokes its API keys. Requires the *Manage my account* permission.
221
+ * Delete a script
222
+ */
223
+ delete(requestParameters, initOverrides) {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ yield this.deleteRaw(requestParameters, initOverrides);
226
+ });
227
+ }
228
+ /**
229
+ * Returns a script with its source, the names of its secrets (never their values), its API key\'s status and, when the runner can be reached, its build state, next scheduled run and resource limits. Requires the *Manage my account* permission.
230
+ * Get a script
231
+ */
232
+ getRaw(requestParameters, initOverrides) {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ if (requestParameters['id'] == null) {
235
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling get().');
236
+ }
237
+ const queryParameters = {};
238
+ const headerParameters = {};
239
+ if (this.configuration && this.configuration.accessToken) {
240
+ const token = this.configuration.accessToken;
241
+ const tokenString = yield token("accessToken", []);
242
+ if (tokenString) {
243
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
244
+ }
245
+ }
246
+ let urlPath = `/v1/scripts/{id}`;
247
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
248
+ const response = yield this.request({
249
+ path: urlPath,
250
+ method: 'GET',
251
+ headers: headerParameters,
252
+ query: queryParameters,
253
+ }, initOverrides);
254
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptDetailFromJSON)(jsonValue));
255
+ });
256
+ }
257
+ /**
258
+ * Returns a script with its source, the names of its secrets (never their values), its API key\'s status and, when the runner can be reached, its build state, next scheduled run and resource limits. Requires the *Manage my account* permission.
259
+ * Get a script
260
+ */
261
+ get(requestParameters, initOverrides) {
262
+ return __awaiter(this, void 0, void 0, function* () {
263
+ const response = yield this.getRaw(requestParameters, initOverrides);
264
+ return yield response.value();
265
+ });
266
+ }
267
+ /**
268
+ * Lists changes to the script and its API key, newest first. Requires the *Manage my account* permission.
269
+ * List a script\'s activity
270
+ */
271
+ getAuditRaw(requestParameters, initOverrides) {
272
+ return __awaiter(this, void 0, void 0, function* () {
273
+ if (requestParameters['id'] == null) {
274
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getAudit().');
275
+ }
276
+ const queryParameters = {};
277
+ if (requestParameters['limit'] != null) {
278
+ queryParameters['limit'] = requestParameters['limit'];
279
+ }
280
+ if (requestParameters['cursor'] != null) {
281
+ queryParameters['cursor'] = requestParameters['cursor'];
282
+ }
283
+ const headerParameters = {};
284
+ if (this.configuration && this.configuration.accessToken) {
285
+ const token = this.configuration.accessToken;
286
+ const tokenString = yield token("accessToken", []);
287
+ if (tokenString) {
288
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
289
+ }
290
+ }
291
+ let urlPath = `/v1/scripts/{id}/audit`;
292
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
293
+ const response = yield this.request({
294
+ path: urlPath,
295
+ method: 'GET',
296
+ headers: headerParameters,
297
+ query: queryParameters,
298
+ }, initOverrides);
299
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptAuditResBodyFromJSON)(jsonValue));
300
+ });
301
+ }
302
+ /**
303
+ * Lists changes to the script and its API key, newest first. Requires the *Manage my account* permission.
304
+ * List a script\'s activity
305
+ */
306
+ getAudit(requestParameters, initOverrides) {
307
+ return __awaiter(this, void 0, void 0, function* () {
308
+ const response = yield this.getAuditRaw(requestParameters, initOverrides);
309
+ return yield response.value();
310
+ });
311
+ }
312
+ /**
313
+ * Returns every script in the account with its settings, source, dependency manifest and secret names (never their values), and each script\'s run history: every build and run still kept, with the API path of its logs. A history too long to read within the request keeps its newest runs and sets runsError; page through the script\'s runs for the rest. Webhook URLs are not included. Requires the *Manage my account* permission.
314
+ * Export scripts
315
+ */
316
+ getExportRaw(initOverrides) {
317
+ return __awaiter(this, void 0, void 0, function* () {
318
+ const queryParameters = {};
319
+ const headerParameters = {};
320
+ if (this.configuration && this.configuration.accessToken) {
321
+ const token = this.configuration.accessToken;
322
+ const tokenString = yield token("accessToken", []);
323
+ if (tokenString) {
324
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
325
+ }
326
+ }
327
+ let urlPath = `/v1/scripts/export`;
328
+ const response = yield this.request({
329
+ path: urlPath,
330
+ method: 'GET',
331
+ headers: headerParameters,
332
+ query: queryParameters,
333
+ }, initOverrides);
334
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptExportResBodyFromJSON)(jsonValue));
335
+ });
336
+ }
337
+ /**
338
+ * Returns every script in the account with its settings, source, dependency manifest and secret names (never their values), and each script\'s run history: every build and run still kept, with the API path of its logs. A history too long to read within the request keeps its newest runs and sets runsError; page through the script\'s runs for the rest. Webhook URLs are not included. Requires the *Manage my account* permission.
339
+ * Export scripts
340
+ */
341
+ getExport(initOverrides) {
342
+ return __awaiter(this, void 0, void 0, function* () {
343
+ const response = yield this.getExportRaw(initOverrides);
344
+ return yield response.value();
345
+ });
346
+ }
347
+ /**
348
+ * Lists the account\'s scripts, sorted by name, without their source code. Requires the *Manage my account* permission.
349
+ * List scripts
350
+ */
351
+ listRaw(initOverrides) {
352
+ return __awaiter(this, void 0, void 0, function* () {
353
+ const queryParameters = {};
354
+ const headerParameters = {};
355
+ if (this.configuration && this.configuration.accessToken) {
356
+ const token = this.configuration.accessToken;
357
+ const tokenString = yield token("accessToken", []);
358
+ if (tokenString) {
359
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
360
+ }
361
+ }
362
+ let urlPath = `/v1/scripts`;
363
+ const response = yield this.request({
364
+ path: urlPath,
365
+ method: 'GET',
366
+ headers: headerParameters,
367
+ query: queryParameters,
368
+ }, initOverrides);
369
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptListResBodyFromJSON)(jsonValue));
370
+ });
371
+ }
372
+ /**
373
+ * Lists the account\'s scripts, sorted by name, without their source code. Requires the *Manage my account* permission.
374
+ * List scripts
375
+ */
376
+ list(initOverrides) {
377
+ return __awaiter(this, void 0, void 0, function* () {
378
+ const response = yield this.listRaw(initOverrides);
379
+ return yield response.value();
380
+ });
381
+ }
382
+ /**
383
+ * Lists the script\'s builds and runs, newest first. Requires the *Manage my account* permission.
384
+ * List a script\'s runs
385
+ */
386
+ listRunsRaw(requestParameters, initOverrides) {
387
+ return __awaiter(this, void 0, void 0, function* () {
388
+ if (requestParameters['id'] == null) {
389
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling listRuns().');
390
+ }
391
+ const queryParameters = {};
392
+ if (requestParameters['limit'] != null) {
393
+ queryParameters['limit'] = requestParameters['limit'];
394
+ }
395
+ if (requestParameters['cursor'] != null) {
396
+ queryParameters['cursor'] = requestParameters['cursor'];
397
+ }
398
+ const headerParameters = {};
399
+ if (this.configuration && this.configuration.accessToken) {
400
+ const token = this.configuration.accessToken;
401
+ const tokenString = yield token("accessToken", []);
402
+ if (tokenString) {
403
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
404
+ }
405
+ }
406
+ let urlPath = `/v1/scripts/{id}/runs`;
407
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
408
+ const response = yield this.request({
409
+ path: urlPath,
410
+ method: 'GET',
411
+ headers: headerParameters,
412
+ query: queryParameters,
413
+ }, initOverrides);
414
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptRunsResBodyFromJSON)(jsonValue));
415
+ });
416
+ }
417
+ /**
418
+ * Lists the script\'s builds and runs, newest first. Requires the *Manage my account* permission.
419
+ * List a script\'s runs
420
+ */
421
+ listRuns(requestParameters, initOverrides) {
422
+ return __awaiter(this, void 0, void 0, function* () {
423
+ const response = yield this.listRunsRaw(requestParameters, initOverrides);
424
+ return yield response.value();
425
+ });
426
+ }
427
+ /**
428
+ * Returns the output the run or build wrote to stdout and stderr. Requires the *Manage my account* permission.
429
+ * Get a script run\'s logs
430
+ */
431
+ listRunsLogsRaw(requestParameters, initOverrides) {
432
+ return __awaiter(this, void 0, void 0, function* () {
433
+ if (requestParameters['id'] == null) {
434
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling listRunsLogs().');
435
+ }
436
+ if (requestParameters['runId'] == null) {
437
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling listRunsLogs().');
438
+ }
439
+ const queryParameters = {};
440
+ const headerParameters = {};
441
+ if (this.configuration && this.configuration.accessToken) {
442
+ const token = this.configuration.accessToken;
443
+ const tokenString = yield token("accessToken", []);
444
+ if (tokenString) {
445
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
446
+ }
447
+ }
448
+ let urlPath = `/v1/scripts/{id}/runs/{runId}/logs`;
449
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
450
+ urlPath = urlPath.replace(`{${"runId"}}`, encodeURIComponent(String(requestParameters['runId'])));
451
+ const response = yield this.request({
452
+ path: urlPath,
453
+ method: 'GET',
454
+ headers: headerParameters,
455
+ query: queryParameters,
456
+ }, initOverrides);
457
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptRunLogsResBodyFromJSON)(jsonValue));
458
+ });
459
+ }
460
+ /**
461
+ * Returns the output the run or build wrote to stdout and stderr. Requires the *Manage my account* permission.
462
+ * Get a script run\'s logs
463
+ */
464
+ listRunsLogs(requestParameters, initOverrides) {
465
+ return __awaiter(this, void 0, void 0, function* () {
466
+ const response = yield this.listRunsLogsRaw(requestParameters, initOverrides);
467
+ return yield response.value();
468
+ });
469
+ }
470
+ /**
471
+ * Updates the fields given. Changing the project replaces the script\'s API key with one scoped to the new project. When someone other than the key\'s owner changes the language, manifest or files, the key is replaced with one acting as them. Turning the webhook on returns its `webhookUrl` once. Rejected with `409` when `revision` is stale, or when enabling a script whose key needs re-authorising; with `422` when the result is invalid. Requires the *Manage my account* permission.
472
+ * Update a script
473
+ */
474
+ updateRaw(requestParameters, initOverrides) {
475
+ return __awaiter(this, void 0, void 0, function* () {
476
+ if (requestParameters['id'] == null) {
477
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling update().');
478
+ }
479
+ if (requestParameters['scriptPatchReqBody'] == null) {
480
+ throw new runtime.RequiredError('scriptPatchReqBody', 'Required parameter "scriptPatchReqBody" was null or undefined when calling update().');
481
+ }
482
+ const queryParameters = {};
483
+ const headerParameters = {};
484
+ headerParameters['Content-Type'] = 'application/json';
485
+ if (this.configuration && this.configuration.accessToken) {
486
+ const token = this.configuration.accessToken;
487
+ const tokenString = yield token("accessToken", []);
488
+ if (tokenString) {
489
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
490
+ }
491
+ }
492
+ let urlPath = `/v1/scripts/{id}`;
493
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
494
+ const response = yield this.request({
495
+ path: urlPath,
496
+ method: 'PATCH',
497
+ headers: headerParameters,
498
+ query: queryParameters,
499
+ body: (0, index_1.ScriptPatchReqBodyToJSON)(requestParameters['scriptPatchReqBody']),
500
+ }, initOverrides);
501
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptDetailFromJSON)(jsonValue));
502
+ });
503
+ }
504
+ /**
505
+ * Updates the fields given. Changing the project replaces the script\'s API key with one scoped to the new project. When someone other than the key\'s owner changes the language, manifest or files, the key is replaced with one acting as them. Turning the webhook on returns its `webhookUrl` once. Rejected with `409` when `revision` is stale, or when enabling a script whose key needs re-authorising; with `422` when the result is invalid. Requires the *Manage my account* permission.
506
+ * Update a script
507
+ */
508
+ update(requestParameters, initOverrides) {
509
+ return __awaiter(this, void 0, void 0, function* () {
510
+ const response = yield this.updateRaw(requestParameters, initOverrides);
511
+ return yield response.value();
512
+ });
513
+ }
514
+ /**
515
+ * Adds, replaces or removes the script\'s secrets; secrets not named are left unchanged. Values are write-only and are never returned; the response has the script\'s new `revision`. When someone other than the key\'s owner sets secrets, the script\'s API key is replaced with one acting as them. Names must be upper-case environment variable names and must not start with `SPACIV_`, which is reserved for the values Spaciv provides. Requires the *Manage my account* permission.
516
+ * Set script secrets
517
+ */
518
+ updateSecretsRaw(requestParameters, initOverrides) {
519
+ return __awaiter(this, void 0, void 0, function* () {
520
+ if (requestParameters['id'] == null) {
521
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling updateSecrets().');
522
+ }
523
+ if (requestParameters['scriptSecretsReqBody'] == null) {
524
+ throw new runtime.RequiredError('scriptSecretsReqBody', 'Required parameter "scriptSecretsReqBody" was null or undefined when calling updateSecrets().');
525
+ }
526
+ const queryParameters = {};
527
+ const headerParameters = {};
528
+ headerParameters['Content-Type'] = 'application/json';
529
+ if (this.configuration && this.configuration.accessToken) {
530
+ const token = this.configuration.accessToken;
531
+ const tokenString = yield token("accessToken", []);
532
+ if (tokenString) {
533
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
534
+ }
535
+ }
536
+ let urlPath = `/v1/scripts/{id}/secrets`;
537
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
538
+ const response = yield this.request({
539
+ path: urlPath,
540
+ method: 'PUT',
541
+ headers: headerParameters,
542
+ query: queryParameters,
543
+ body: (0, index_1.ScriptSecretsReqBodyToJSON)(requestParameters['scriptSecretsReqBody']),
544
+ }, initOverrides);
545
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ScriptSecretsResBodyFromJSON)(jsonValue));
546
+ });
547
+ }
548
+ /**
549
+ * Adds, replaces or removes the script\'s secrets; secrets not named are left unchanged. Values are write-only and are never returned; the response has the script\'s new `revision`. When someone other than the key\'s owner sets secrets, the script\'s API key is replaced with one acting as them. Names must be upper-case environment variable names and must not start with `SPACIV_`, which is reserved for the values Spaciv provides. Requires the *Manage my account* permission.
550
+ * Set script secrets
551
+ */
552
+ updateSecrets(requestParameters, initOverrides) {
553
+ return __awaiter(this, void 0, void 0, function* () {
554
+ const response = yield this.updateSecretsRaw(requestParameters, initOverrides);
555
+ return yield response.value();
556
+ });
557
+ }
558
+ }
559
+ exports.ScriptsApi = ScriptsApi;
@@ -63,7 +63,7 @@ export interface UsersApiInterface {
63
63
  */
64
64
  createImport(requestParameters: UsersApiCreateImportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
65
65
  /**
66
- * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible.
66
+ * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible. A script\'s own API key cannot delete its user.
67
67
  * @summary Delete the current user\'s account
68
68
  * @param {*} [options] Override http request option.
69
69
  * @throws {RequiredError}
@@ -71,7 +71,7 @@ export interface UsersApiInterface {
71
71
  */
72
72
  deleteRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
73
73
  /**
74
- * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible.
74
+ * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible. A script\'s own API key cannot delete its user.
75
75
  * Delete the current user\'s account
76
76
  */
77
77
  delete(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
@@ -196,12 +196,12 @@ export declare class UsersApi extends runtime.BaseAPI implements UsersApiInterfa
196
196
  */
197
197
  createImport(requestParameters: UsersApiCreateImportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
198
198
  /**
199
- * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible.
199
+ * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible. A script\'s own API key cannot delete its user.
200
200
  * Delete the current user\'s account
201
201
  */
202
202
  deleteRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
203
203
  /**
204
- * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible.
204
+ * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible. A script\'s own API key cannot delete its user.
205
205
  * Delete the current user\'s account
206
206
  */
207
207
  delete(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
@@ -101,7 +101,7 @@ class UsersApi extends runtime.BaseAPI {
101
101
  });
102
102
  }
103
103
  /**
104
- * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible.
104
+ * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible. A script\'s own API key cannot delete its user.
105
105
  * Delete the current user\'s account
106
106
  */
107
107
  deleteRaw(initOverrides) {
@@ -126,7 +126,7 @@ class UsersApi extends runtime.BaseAPI {
126
126
  });
127
127
  }
128
128
  /**
129
- * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible.
129
+ * Permanently deletes the authenticated user\'s own account and all associated data. Requires the *Edit my user profile* permission. This action is irreversible. A script\'s own API key cannot delete its user.
130
130
  * Delete the current user\'s account
131
131
  */
132
132
  delete(initOverrides) {
@@ -20,6 +20,7 @@ export * from './ProjectsApi';
20
20
  export * from './PropertiesApi';
21
21
  export * from './ReportsApi';
22
22
  export * from './ScenariosApi';
23
+ export * from './ScriptsApi';
23
24
  export * from './ServiceApi';
24
25
  export * from './SpaceRulesetsApi';
25
26
  export * from './TemplateProjectsApi';
@@ -38,6 +38,7 @@ __exportStar(require("./ProjectsApi"), exports);
38
38
  __exportStar(require("./PropertiesApi"), exports);
39
39
  __exportStar(require("./ReportsApi"), exports);
40
40
  __exportStar(require("./ScenariosApi"), exports);
41
+ __exportStar(require("./ScriptsApi"), exports);
41
42
  __exportStar(require("./ServiceApi"), exports);
42
43
  __exportStar(require("./SpaceRulesetsApi"), exports);
43
44
  __exportStar(require("./TemplateProjectsApi"), exports);