@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,984 @@
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
+
16
+ import * as runtime from '../runtime';
17
+ import type {
18
+ ErrorModel,
19
+ ScriptAuditResBody,
20
+ ScriptDetail,
21
+ ScriptExportResBody,
22
+ ScriptListResBody,
23
+ ScriptPatchReqBody,
24
+ ScriptPostReqBody,
25
+ ScriptRunLogsResBody,
26
+ ScriptRunsResBody,
27
+ ScriptSchedulePreviewReqBody,
28
+ ScriptSchedulePreviewResBody,
29
+ ScriptSecretsReqBody,
30
+ ScriptSecretsResBody,
31
+ ScriptWebhookResBody,
32
+ } from '../models/index';
33
+ import {
34
+ ErrorModelFromJSON,
35
+ ErrorModelToJSON,
36
+ ScriptAuditResBodyFromJSON,
37
+ ScriptAuditResBodyToJSON,
38
+ ScriptDetailFromJSON,
39
+ ScriptDetailToJSON,
40
+ ScriptExportResBodyFromJSON,
41
+ ScriptExportResBodyToJSON,
42
+ ScriptListResBodyFromJSON,
43
+ ScriptListResBodyToJSON,
44
+ ScriptPatchReqBodyFromJSON,
45
+ ScriptPatchReqBodyToJSON,
46
+ ScriptPostReqBodyFromJSON,
47
+ ScriptPostReqBodyToJSON,
48
+ ScriptRunLogsResBodyFromJSON,
49
+ ScriptRunLogsResBodyToJSON,
50
+ ScriptRunsResBodyFromJSON,
51
+ ScriptRunsResBodyToJSON,
52
+ ScriptSchedulePreviewReqBodyFromJSON,
53
+ ScriptSchedulePreviewReqBodyToJSON,
54
+ ScriptSchedulePreviewResBodyFromJSON,
55
+ ScriptSchedulePreviewResBodyToJSON,
56
+ ScriptSecretsReqBodyFromJSON,
57
+ ScriptSecretsReqBodyToJSON,
58
+ ScriptSecretsResBodyFromJSON,
59
+ ScriptSecretsResBodyToJSON,
60
+ ScriptWebhookResBodyFromJSON,
61
+ ScriptWebhookResBodyToJSON,
62
+ } from '../models/index';
63
+
64
+ export interface ScriptsApiCreateRequest {
65
+ scriptPostReqBody: ScriptPostReqBody;
66
+ }
67
+
68
+ export interface ScriptsApiCreateReauthoriseRequest {
69
+ id: string;
70
+ }
71
+
72
+ export interface ScriptsApiCreateRegenerateWebhookRequest {
73
+ id: string;
74
+ }
75
+
76
+ export interface ScriptsApiCreateSchedulePreviewRequest {
77
+ scriptSchedulePreviewReqBody: ScriptSchedulePreviewReqBody;
78
+ }
79
+
80
+ export interface ScriptsApiDeleteRequest {
81
+ id: string;
82
+ }
83
+
84
+ export interface ScriptsApiGetRequest {
85
+ id: string;
86
+ }
87
+
88
+ export interface ScriptsApiGetAuditRequest {
89
+ id: string;
90
+ limit?: number;
91
+ cursor?: string;
92
+ }
93
+
94
+ export interface ScriptsApiListRunsRequest {
95
+ id: string;
96
+ limit?: number;
97
+ cursor?: string;
98
+ }
99
+
100
+ export interface ScriptsApiListRunsLogsRequest {
101
+ id: string;
102
+ runId: string;
103
+ }
104
+
105
+ export interface ScriptsApiUpdateRequest {
106
+ id: string;
107
+ scriptPatchReqBody: ScriptPatchReqBody;
108
+ }
109
+
110
+ export interface ScriptsApiUpdateSecretsRequest {
111
+ id: string;
112
+ scriptSecretsReqBody: ScriptSecretsReqBody;
113
+ }
114
+
115
+ /**
116
+ * ScriptsApi - interface
117
+ *
118
+ * @export
119
+ * @interface ScriptsApiInterface
120
+ */
121
+ export interface ScriptsApiInterface {
122
+ /**
123
+ * 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.
124
+ * @summary Create a script
125
+ * @param {ScriptPostReqBody} scriptPostReqBody
126
+ * @param {*} [options] Override http request option.
127
+ * @throws {RequiredError}
128
+ * @memberof ScriptsApiInterface
129
+ */
130
+ createRaw(requestParameters: ScriptsApiCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>>;
131
+
132
+ /**
133
+ * 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.
134
+ * Create a script
135
+ */
136
+ create(requestParameters: ScriptsApiCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail>;
137
+
138
+ /**
139
+ * 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.
140
+ * @summary Re-authorise a script
141
+ * @param {string} id
142
+ * @param {*} [options] Override http request option.
143
+ * @throws {RequiredError}
144
+ * @memberof ScriptsApiInterface
145
+ */
146
+ createReauthoriseRaw(requestParameters: ScriptsApiCreateReauthoriseRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>>;
147
+
148
+ /**
149
+ * 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.
150
+ * Re-authorise a script
151
+ */
152
+ createReauthorise(requestParameters: ScriptsApiCreateReauthoriseRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail>;
153
+
154
+ /**
155
+ * 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.
156
+ * @summary Regenerate a script\'s webhook URL
157
+ * @param {string} id
158
+ * @param {*} [options] Override http request option.
159
+ * @throws {RequiredError}
160
+ * @memberof ScriptsApiInterface
161
+ */
162
+ createRegenerateWebhookRaw(requestParameters: ScriptsApiCreateRegenerateWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptWebhookResBody>>;
163
+
164
+ /**
165
+ * 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.
166
+ * Regenerate a script\'s webhook URL
167
+ */
168
+ createRegenerateWebhook(requestParameters: ScriptsApiCreateRegenerateWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptWebhookResBody>;
169
+
170
+ /**
171
+ * 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.
172
+ * @summary Preview a script schedule
173
+ * @param {ScriptSchedulePreviewReqBody} scriptSchedulePreviewReqBody
174
+ * @param {*} [options] Override http request option.
175
+ * @throws {RequiredError}
176
+ * @memberof ScriptsApiInterface
177
+ */
178
+ createSchedulePreviewRaw(requestParameters: ScriptsApiCreateSchedulePreviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptSchedulePreviewResBody>>;
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: ScriptsApiCreateSchedulePreviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptSchedulePreviewResBody>;
185
+
186
+ /**
187
+ * Stops any active runs, deletes the script with its secrets and run history, and revokes its API keys. Requires the *Manage my account* permission.
188
+ * @summary Delete a script
189
+ * @param {string} id
190
+ * @param {*} [options] Override http request option.
191
+ * @throws {RequiredError}
192
+ * @memberof ScriptsApiInterface
193
+ */
194
+ deleteRaw(requestParameters: ScriptsApiDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
195
+
196
+ /**
197
+ * Stops any active runs, deletes the script with its secrets and run history, and revokes its API keys. Requires the *Manage my account* permission.
198
+ * Delete a script
199
+ */
200
+ delete(requestParameters: ScriptsApiDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
201
+
202
+ /**
203
+ * 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.
204
+ * @summary Get a script
205
+ * @param {string} id
206
+ * @param {*} [options] Override http request option.
207
+ * @throws {RequiredError}
208
+ * @memberof ScriptsApiInterface
209
+ */
210
+ getRaw(requestParameters: ScriptsApiGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>>;
211
+
212
+ /**
213
+ * 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.
214
+ * Get a script
215
+ */
216
+ get(requestParameters: ScriptsApiGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail>;
217
+
218
+ /**
219
+ * Lists changes to the script and its API key, newest first. Requires the *Manage my account* permission.
220
+ * @summary List a script\'s activity
221
+ * @param {string} id
222
+ * @param {number} [limit]
223
+ * @param {string} [cursor] nextCursor from the previous page.
224
+ * @param {*} [options] Override http request option.
225
+ * @throws {RequiredError}
226
+ * @memberof ScriptsApiInterface
227
+ */
228
+ getAuditRaw(requestParameters: ScriptsApiGetAuditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptAuditResBody>>;
229
+
230
+ /**
231
+ * Lists changes to the script and its API key, newest first. Requires the *Manage my account* permission.
232
+ * List a script\'s activity
233
+ */
234
+ getAudit(requestParameters: ScriptsApiGetAuditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptAuditResBody>;
235
+
236
+ /**
237
+ * 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.
238
+ * @summary Export scripts
239
+ * @param {*} [options] Override http request option.
240
+ * @throws {RequiredError}
241
+ * @memberof ScriptsApiInterface
242
+ */
243
+ getExportRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptExportResBody>>;
244
+
245
+ /**
246
+ * 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.
247
+ * Export scripts
248
+ */
249
+ getExport(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptExportResBody>;
250
+
251
+ /**
252
+ * Lists the account\'s scripts, sorted by name, without their source code. Requires the *Manage my account* permission.
253
+ * @summary List scripts
254
+ * @param {*} [options] Override http request option.
255
+ * @throws {RequiredError}
256
+ * @memberof ScriptsApiInterface
257
+ */
258
+ listRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptListResBody>>;
259
+
260
+ /**
261
+ * Lists the account\'s scripts, sorted by name, without their source code. Requires the *Manage my account* permission.
262
+ * List scripts
263
+ */
264
+ list(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptListResBody>;
265
+
266
+ /**
267
+ * Lists the script\'s builds and runs, newest first. Requires the *Manage my account* permission.
268
+ * @summary List a script\'s runs
269
+ * @param {string} id
270
+ * @param {number} [limit]
271
+ * @param {string} [cursor] nextCursor from the previous page.
272
+ * @param {*} [options] Override http request option.
273
+ * @throws {RequiredError}
274
+ * @memberof ScriptsApiInterface
275
+ */
276
+ listRunsRaw(requestParameters: ScriptsApiListRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptRunsResBody>>;
277
+
278
+ /**
279
+ * Lists the script\'s builds and runs, newest first. Requires the *Manage my account* permission.
280
+ * List a script\'s runs
281
+ */
282
+ listRuns(requestParameters: ScriptsApiListRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptRunsResBody>;
283
+
284
+ /**
285
+ * Returns the output the run or build wrote to stdout and stderr. Requires the *Manage my account* permission.
286
+ * @summary Get a script run\'s logs
287
+ * @param {string} id
288
+ * @param {string} runId
289
+ * @param {*} [options] Override http request option.
290
+ * @throws {RequiredError}
291
+ * @memberof ScriptsApiInterface
292
+ */
293
+ listRunsLogsRaw(requestParameters: ScriptsApiListRunsLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptRunLogsResBody>>;
294
+
295
+ /**
296
+ * Returns the output the run or build wrote to stdout and stderr. Requires the *Manage my account* permission.
297
+ * Get a script run\'s logs
298
+ */
299
+ listRunsLogs(requestParameters: ScriptsApiListRunsLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptRunLogsResBody>;
300
+
301
+ /**
302
+ * 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.
303
+ * @summary Update a script
304
+ * @param {string} id
305
+ * @param {ScriptPatchReqBody} scriptPatchReqBody
306
+ * @param {*} [options] Override http request option.
307
+ * @throws {RequiredError}
308
+ * @memberof ScriptsApiInterface
309
+ */
310
+ updateRaw(requestParameters: ScriptsApiUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>>;
311
+
312
+ /**
313
+ * 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.
314
+ * Update a script
315
+ */
316
+ update(requestParameters: ScriptsApiUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail>;
317
+
318
+ /**
319
+ * 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.
320
+ * @summary Set script secrets
321
+ * @param {string} id
322
+ * @param {ScriptSecretsReqBody} scriptSecretsReqBody
323
+ * @param {*} [options] Override http request option.
324
+ * @throws {RequiredError}
325
+ * @memberof ScriptsApiInterface
326
+ */
327
+ updateSecretsRaw(requestParameters: ScriptsApiUpdateSecretsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptSecretsResBody>>;
328
+
329
+ /**
330
+ * 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.
331
+ * Set script secrets
332
+ */
333
+ updateSecrets(requestParameters: ScriptsApiUpdateSecretsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptSecretsResBody>;
334
+
335
+ }
336
+
337
+ /**
338
+ *
339
+ */
340
+ export class ScriptsApi extends runtime.BaseAPI implements ScriptsApiInterface {
341
+
342
+ /**
343
+ * 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.
344
+ * Create a script
345
+ */
346
+ async createRaw(requestParameters: ScriptsApiCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>> {
347
+ if (requestParameters['scriptPostReqBody'] == null) {
348
+ throw new runtime.RequiredError(
349
+ 'scriptPostReqBody',
350
+ 'Required parameter "scriptPostReqBody" was null or undefined when calling create().'
351
+ );
352
+ }
353
+
354
+ const queryParameters: any = {};
355
+
356
+ const headerParameters: runtime.HTTPHeaders = {};
357
+
358
+ headerParameters['Content-Type'] = 'application/json';
359
+
360
+ if (this.configuration && this.configuration.accessToken) {
361
+ const token = this.configuration.accessToken;
362
+ const tokenString = await token("accessToken", []);
363
+
364
+ if (tokenString) {
365
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
366
+ }
367
+ }
368
+
369
+ let urlPath = `/v1/scripts`;
370
+
371
+ const response = await this.request({
372
+ path: urlPath,
373
+ method: 'POST',
374
+ headers: headerParameters,
375
+ query: queryParameters,
376
+ body: ScriptPostReqBodyToJSON(requestParameters['scriptPostReqBody']),
377
+ }, initOverrides);
378
+
379
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptDetailFromJSON(jsonValue));
380
+ }
381
+
382
+ /**
383
+ * 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.
384
+ * Create a script
385
+ */
386
+ async create(requestParameters: ScriptsApiCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail> {
387
+ const response = await this.createRaw(requestParameters, initOverrides);
388
+ return await response.value();
389
+ }
390
+
391
+ /**
392
+ * 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.
393
+ * Re-authorise a script
394
+ */
395
+ async createReauthoriseRaw(requestParameters: ScriptsApiCreateReauthoriseRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>> {
396
+ if (requestParameters['id'] == null) {
397
+ throw new runtime.RequiredError(
398
+ 'id',
399
+ 'Required parameter "id" was null or undefined when calling createReauthorise().'
400
+ );
401
+ }
402
+
403
+ const queryParameters: any = {};
404
+
405
+ const headerParameters: runtime.HTTPHeaders = {};
406
+
407
+ if (this.configuration && this.configuration.accessToken) {
408
+ const token = this.configuration.accessToken;
409
+ const tokenString = await token("accessToken", []);
410
+
411
+ if (tokenString) {
412
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
413
+ }
414
+ }
415
+
416
+ let urlPath = `/v1/scripts/{id}/reauthorise`;
417
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
418
+
419
+ const response = await this.request({
420
+ path: urlPath,
421
+ method: 'POST',
422
+ headers: headerParameters,
423
+ query: queryParameters,
424
+ }, initOverrides);
425
+
426
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptDetailFromJSON(jsonValue));
427
+ }
428
+
429
+ /**
430
+ * 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.
431
+ * Re-authorise a script
432
+ */
433
+ async createReauthorise(requestParameters: ScriptsApiCreateReauthoriseRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail> {
434
+ const response = await this.createReauthoriseRaw(requestParameters, initOverrides);
435
+ return await response.value();
436
+ }
437
+
438
+ /**
439
+ * 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.
440
+ * Regenerate a script\'s webhook URL
441
+ */
442
+ async createRegenerateWebhookRaw(requestParameters: ScriptsApiCreateRegenerateWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptWebhookResBody>> {
443
+ if (requestParameters['id'] == null) {
444
+ throw new runtime.RequiredError(
445
+ 'id',
446
+ 'Required parameter "id" was null or undefined when calling createRegenerateWebhook().'
447
+ );
448
+ }
449
+
450
+ const queryParameters: any = {};
451
+
452
+ const headerParameters: runtime.HTTPHeaders = {};
453
+
454
+ if (this.configuration && this.configuration.accessToken) {
455
+ const token = this.configuration.accessToken;
456
+ const tokenString = await token("accessToken", []);
457
+
458
+ if (tokenString) {
459
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
460
+ }
461
+ }
462
+
463
+ let urlPath = `/v1/scripts/{id}/regenerate-webhook`;
464
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
465
+
466
+ const response = await this.request({
467
+ path: urlPath,
468
+ method: 'POST',
469
+ headers: headerParameters,
470
+ query: queryParameters,
471
+ }, initOverrides);
472
+
473
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptWebhookResBodyFromJSON(jsonValue));
474
+ }
475
+
476
+ /**
477
+ * 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.
478
+ * Regenerate a script\'s webhook URL
479
+ */
480
+ async createRegenerateWebhook(requestParameters: ScriptsApiCreateRegenerateWebhookRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptWebhookResBody> {
481
+ const response = await this.createRegenerateWebhookRaw(requestParameters, initOverrides);
482
+ return await response.value();
483
+ }
484
+
485
+ /**
486
+ * 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.
487
+ * Preview a script schedule
488
+ */
489
+ async createSchedulePreviewRaw(requestParameters: ScriptsApiCreateSchedulePreviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptSchedulePreviewResBody>> {
490
+ if (requestParameters['scriptSchedulePreviewReqBody'] == null) {
491
+ throw new runtime.RequiredError(
492
+ 'scriptSchedulePreviewReqBody',
493
+ 'Required parameter "scriptSchedulePreviewReqBody" was null or undefined when calling createSchedulePreview().'
494
+ );
495
+ }
496
+
497
+ const queryParameters: any = {};
498
+
499
+ const headerParameters: runtime.HTTPHeaders = {};
500
+
501
+ headerParameters['Content-Type'] = 'application/json';
502
+
503
+ if (this.configuration && this.configuration.accessToken) {
504
+ const token = this.configuration.accessToken;
505
+ const tokenString = await token("accessToken", []);
506
+
507
+ if (tokenString) {
508
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
509
+ }
510
+ }
511
+
512
+ let urlPath = `/v1/scripts/schedule-preview`;
513
+
514
+ const response = await this.request({
515
+ path: urlPath,
516
+ method: 'POST',
517
+ headers: headerParameters,
518
+ query: queryParameters,
519
+ body: ScriptSchedulePreviewReqBodyToJSON(requestParameters['scriptSchedulePreviewReqBody']),
520
+ }, initOverrides);
521
+
522
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptSchedulePreviewResBodyFromJSON(jsonValue));
523
+ }
524
+
525
+ /**
526
+ * 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.
527
+ * Preview a script schedule
528
+ */
529
+ async createSchedulePreview(requestParameters: ScriptsApiCreateSchedulePreviewRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptSchedulePreviewResBody> {
530
+ const response = await this.createSchedulePreviewRaw(requestParameters, initOverrides);
531
+ return await response.value();
532
+ }
533
+
534
+ /**
535
+ * Stops any active runs, deletes the script with its secrets and run history, and revokes its API keys. Requires the *Manage my account* permission.
536
+ * Delete a script
537
+ */
538
+ async deleteRaw(requestParameters: ScriptsApiDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
539
+ if (requestParameters['id'] == null) {
540
+ throw new runtime.RequiredError(
541
+ 'id',
542
+ 'Required parameter "id" was null or undefined when calling delete().'
543
+ );
544
+ }
545
+
546
+ const queryParameters: any = {};
547
+
548
+ const headerParameters: runtime.HTTPHeaders = {};
549
+
550
+ if (this.configuration && this.configuration.accessToken) {
551
+ const token = this.configuration.accessToken;
552
+ const tokenString = await token("accessToken", []);
553
+
554
+ if (tokenString) {
555
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
556
+ }
557
+ }
558
+
559
+ let urlPath = `/v1/scripts/{id}`;
560
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
561
+
562
+ const response = await this.request({
563
+ path: urlPath,
564
+ method: 'DELETE',
565
+ headers: headerParameters,
566
+ query: queryParameters,
567
+ }, initOverrides);
568
+
569
+ return new runtime.VoidApiResponse(response);
570
+ }
571
+
572
+ /**
573
+ * Stops any active runs, deletes the script with its secrets and run history, and revokes its API keys. Requires the *Manage my account* permission.
574
+ * Delete a script
575
+ */
576
+ async delete(requestParameters: ScriptsApiDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
577
+ await this.deleteRaw(requestParameters, initOverrides);
578
+ }
579
+
580
+ /**
581
+ * 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.
582
+ * Get a script
583
+ */
584
+ async getRaw(requestParameters: ScriptsApiGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>> {
585
+ if (requestParameters['id'] == null) {
586
+ throw new runtime.RequiredError(
587
+ 'id',
588
+ 'Required parameter "id" was null or undefined when calling get().'
589
+ );
590
+ }
591
+
592
+ const queryParameters: any = {};
593
+
594
+ const headerParameters: runtime.HTTPHeaders = {};
595
+
596
+ if (this.configuration && this.configuration.accessToken) {
597
+ const token = this.configuration.accessToken;
598
+ const tokenString = await token("accessToken", []);
599
+
600
+ if (tokenString) {
601
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
602
+ }
603
+ }
604
+
605
+ let urlPath = `/v1/scripts/{id}`;
606
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
607
+
608
+ const response = await this.request({
609
+ path: urlPath,
610
+ method: 'GET',
611
+ headers: headerParameters,
612
+ query: queryParameters,
613
+ }, initOverrides);
614
+
615
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptDetailFromJSON(jsonValue));
616
+ }
617
+
618
+ /**
619
+ * 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.
620
+ * Get a script
621
+ */
622
+ async get(requestParameters: ScriptsApiGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail> {
623
+ const response = await this.getRaw(requestParameters, initOverrides);
624
+ return await response.value();
625
+ }
626
+
627
+ /**
628
+ * Lists changes to the script and its API key, newest first. Requires the *Manage my account* permission.
629
+ * List a script\'s activity
630
+ */
631
+ async getAuditRaw(requestParameters: ScriptsApiGetAuditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptAuditResBody>> {
632
+ if (requestParameters['id'] == null) {
633
+ throw new runtime.RequiredError(
634
+ 'id',
635
+ 'Required parameter "id" was null or undefined when calling getAudit().'
636
+ );
637
+ }
638
+
639
+ const queryParameters: any = {};
640
+
641
+ if (requestParameters['limit'] != null) {
642
+ queryParameters['limit'] = requestParameters['limit'];
643
+ }
644
+
645
+ if (requestParameters['cursor'] != null) {
646
+ queryParameters['cursor'] = requestParameters['cursor'];
647
+ }
648
+
649
+ const headerParameters: runtime.HTTPHeaders = {};
650
+
651
+ if (this.configuration && this.configuration.accessToken) {
652
+ const token = this.configuration.accessToken;
653
+ const tokenString = await token("accessToken", []);
654
+
655
+ if (tokenString) {
656
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
657
+ }
658
+ }
659
+
660
+ let urlPath = `/v1/scripts/{id}/audit`;
661
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
662
+
663
+ const response = await this.request({
664
+ path: urlPath,
665
+ method: 'GET',
666
+ headers: headerParameters,
667
+ query: queryParameters,
668
+ }, initOverrides);
669
+
670
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptAuditResBodyFromJSON(jsonValue));
671
+ }
672
+
673
+ /**
674
+ * Lists changes to the script and its API key, newest first. Requires the *Manage my account* permission.
675
+ * List a script\'s activity
676
+ */
677
+ async getAudit(requestParameters: ScriptsApiGetAuditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptAuditResBody> {
678
+ const response = await this.getAuditRaw(requestParameters, initOverrides);
679
+ return await response.value();
680
+ }
681
+
682
+ /**
683
+ * 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.
684
+ * Export scripts
685
+ */
686
+ async getExportRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptExportResBody>> {
687
+ const queryParameters: any = {};
688
+
689
+ const headerParameters: runtime.HTTPHeaders = {};
690
+
691
+ if (this.configuration && this.configuration.accessToken) {
692
+ const token = this.configuration.accessToken;
693
+ const tokenString = await token("accessToken", []);
694
+
695
+ if (tokenString) {
696
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
697
+ }
698
+ }
699
+
700
+ let urlPath = `/v1/scripts/export`;
701
+
702
+ const response = await this.request({
703
+ path: urlPath,
704
+ method: 'GET',
705
+ headers: headerParameters,
706
+ query: queryParameters,
707
+ }, initOverrides);
708
+
709
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptExportResBodyFromJSON(jsonValue));
710
+ }
711
+
712
+ /**
713
+ * 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.
714
+ * Export scripts
715
+ */
716
+ async getExport(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptExportResBody> {
717
+ const response = await this.getExportRaw(initOverrides);
718
+ return await response.value();
719
+ }
720
+
721
+ /**
722
+ * Lists the account\'s scripts, sorted by name, without their source code. Requires the *Manage my account* permission.
723
+ * List scripts
724
+ */
725
+ async listRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptListResBody>> {
726
+ const queryParameters: any = {};
727
+
728
+ const headerParameters: runtime.HTTPHeaders = {};
729
+
730
+ if (this.configuration && this.configuration.accessToken) {
731
+ const token = this.configuration.accessToken;
732
+ const tokenString = await token("accessToken", []);
733
+
734
+ if (tokenString) {
735
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
736
+ }
737
+ }
738
+
739
+ let urlPath = `/v1/scripts`;
740
+
741
+ const response = await this.request({
742
+ path: urlPath,
743
+ method: 'GET',
744
+ headers: headerParameters,
745
+ query: queryParameters,
746
+ }, initOverrides);
747
+
748
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptListResBodyFromJSON(jsonValue));
749
+ }
750
+
751
+ /**
752
+ * Lists the account\'s scripts, sorted by name, without their source code. Requires the *Manage my account* permission.
753
+ * List scripts
754
+ */
755
+ async list(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptListResBody> {
756
+ const response = await this.listRaw(initOverrides);
757
+ return await response.value();
758
+ }
759
+
760
+ /**
761
+ * Lists the script\'s builds and runs, newest first. Requires the *Manage my account* permission.
762
+ * List a script\'s runs
763
+ */
764
+ async listRunsRaw(requestParameters: ScriptsApiListRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptRunsResBody>> {
765
+ if (requestParameters['id'] == null) {
766
+ throw new runtime.RequiredError(
767
+ 'id',
768
+ 'Required parameter "id" was null or undefined when calling listRuns().'
769
+ );
770
+ }
771
+
772
+ const queryParameters: any = {};
773
+
774
+ if (requestParameters['limit'] != null) {
775
+ queryParameters['limit'] = requestParameters['limit'];
776
+ }
777
+
778
+ if (requestParameters['cursor'] != null) {
779
+ queryParameters['cursor'] = requestParameters['cursor'];
780
+ }
781
+
782
+ const headerParameters: runtime.HTTPHeaders = {};
783
+
784
+ if (this.configuration && this.configuration.accessToken) {
785
+ const token = this.configuration.accessToken;
786
+ const tokenString = await token("accessToken", []);
787
+
788
+ if (tokenString) {
789
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
790
+ }
791
+ }
792
+
793
+ let urlPath = `/v1/scripts/{id}/runs`;
794
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
795
+
796
+ const response = await this.request({
797
+ path: urlPath,
798
+ method: 'GET',
799
+ headers: headerParameters,
800
+ query: queryParameters,
801
+ }, initOverrides);
802
+
803
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptRunsResBodyFromJSON(jsonValue));
804
+ }
805
+
806
+ /**
807
+ * Lists the script\'s builds and runs, newest first. Requires the *Manage my account* permission.
808
+ * List a script\'s runs
809
+ */
810
+ async listRuns(requestParameters: ScriptsApiListRunsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptRunsResBody> {
811
+ const response = await this.listRunsRaw(requestParameters, initOverrides);
812
+ return await response.value();
813
+ }
814
+
815
+ /**
816
+ * Returns the output the run or build wrote to stdout and stderr. Requires the *Manage my account* permission.
817
+ * Get a script run\'s logs
818
+ */
819
+ async listRunsLogsRaw(requestParameters: ScriptsApiListRunsLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptRunLogsResBody>> {
820
+ if (requestParameters['id'] == null) {
821
+ throw new runtime.RequiredError(
822
+ 'id',
823
+ 'Required parameter "id" was null or undefined when calling listRunsLogs().'
824
+ );
825
+ }
826
+
827
+ if (requestParameters['runId'] == null) {
828
+ throw new runtime.RequiredError(
829
+ 'runId',
830
+ 'Required parameter "runId" was null or undefined when calling listRunsLogs().'
831
+ );
832
+ }
833
+
834
+ const queryParameters: any = {};
835
+
836
+ const headerParameters: runtime.HTTPHeaders = {};
837
+
838
+ if (this.configuration && this.configuration.accessToken) {
839
+ const token = this.configuration.accessToken;
840
+ const tokenString = await token("accessToken", []);
841
+
842
+ if (tokenString) {
843
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
844
+ }
845
+ }
846
+
847
+ let urlPath = `/v1/scripts/{id}/runs/{runId}/logs`;
848
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
849
+ urlPath = urlPath.replace(`{${"runId"}}`, encodeURIComponent(String(requestParameters['runId'])));
850
+
851
+ const response = await this.request({
852
+ path: urlPath,
853
+ method: 'GET',
854
+ headers: headerParameters,
855
+ query: queryParameters,
856
+ }, initOverrides);
857
+
858
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptRunLogsResBodyFromJSON(jsonValue));
859
+ }
860
+
861
+ /**
862
+ * Returns the output the run or build wrote to stdout and stderr. Requires the *Manage my account* permission.
863
+ * Get a script run\'s logs
864
+ */
865
+ async listRunsLogs(requestParameters: ScriptsApiListRunsLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptRunLogsResBody> {
866
+ const response = await this.listRunsLogsRaw(requestParameters, initOverrides);
867
+ return await response.value();
868
+ }
869
+
870
+ /**
871
+ * 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.
872
+ * Update a script
873
+ */
874
+ async updateRaw(requestParameters: ScriptsApiUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>> {
875
+ if (requestParameters['id'] == null) {
876
+ throw new runtime.RequiredError(
877
+ 'id',
878
+ 'Required parameter "id" was null or undefined when calling update().'
879
+ );
880
+ }
881
+
882
+ if (requestParameters['scriptPatchReqBody'] == null) {
883
+ throw new runtime.RequiredError(
884
+ 'scriptPatchReqBody',
885
+ 'Required parameter "scriptPatchReqBody" was null or undefined when calling update().'
886
+ );
887
+ }
888
+
889
+ const queryParameters: any = {};
890
+
891
+ const headerParameters: runtime.HTTPHeaders = {};
892
+
893
+ headerParameters['Content-Type'] = 'application/json';
894
+
895
+ if (this.configuration && this.configuration.accessToken) {
896
+ const token = this.configuration.accessToken;
897
+ const tokenString = await token("accessToken", []);
898
+
899
+ if (tokenString) {
900
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
901
+ }
902
+ }
903
+
904
+ let urlPath = `/v1/scripts/{id}`;
905
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
906
+
907
+ const response = await this.request({
908
+ path: urlPath,
909
+ method: 'PATCH',
910
+ headers: headerParameters,
911
+ query: queryParameters,
912
+ body: ScriptPatchReqBodyToJSON(requestParameters['scriptPatchReqBody']),
913
+ }, initOverrides);
914
+
915
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptDetailFromJSON(jsonValue));
916
+ }
917
+
918
+ /**
919
+ * 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.
920
+ * Update a script
921
+ */
922
+ async update(requestParameters: ScriptsApiUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail> {
923
+ const response = await this.updateRaw(requestParameters, initOverrides);
924
+ return await response.value();
925
+ }
926
+
927
+ /**
928
+ * 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.
929
+ * Set script secrets
930
+ */
931
+ async updateSecretsRaw(requestParameters: ScriptsApiUpdateSecretsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptSecretsResBody>> {
932
+ if (requestParameters['id'] == null) {
933
+ throw new runtime.RequiredError(
934
+ 'id',
935
+ 'Required parameter "id" was null or undefined when calling updateSecrets().'
936
+ );
937
+ }
938
+
939
+ if (requestParameters['scriptSecretsReqBody'] == null) {
940
+ throw new runtime.RequiredError(
941
+ 'scriptSecretsReqBody',
942
+ 'Required parameter "scriptSecretsReqBody" was null or undefined when calling updateSecrets().'
943
+ );
944
+ }
945
+
946
+ const queryParameters: any = {};
947
+
948
+ const headerParameters: runtime.HTTPHeaders = {};
949
+
950
+ headerParameters['Content-Type'] = 'application/json';
951
+
952
+ if (this.configuration && this.configuration.accessToken) {
953
+ const token = this.configuration.accessToken;
954
+ const tokenString = await token("accessToken", []);
955
+
956
+ if (tokenString) {
957
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
958
+ }
959
+ }
960
+
961
+ let urlPath = `/v1/scripts/{id}/secrets`;
962
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
963
+
964
+ const response = await this.request({
965
+ path: urlPath,
966
+ method: 'PUT',
967
+ headers: headerParameters,
968
+ query: queryParameters,
969
+ body: ScriptSecretsReqBodyToJSON(requestParameters['scriptSecretsReqBody']),
970
+ }, initOverrides);
971
+
972
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptSecretsResBodyFromJSON(jsonValue));
973
+ }
974
+
975
+ /**
976
+ * 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.
977
+ * Set script secrets
978
+ */
979
+ async updateSecrets(requestParameters: ScriptsApiUpdateSecretsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptSecretsResBody> {
980
+ const response = await this.updateSecretsRaw(requestParameters, initOverrides);
981
+ return await response.value();
982
+ }
983
+
984
+ }