@spaciv/sdk 0.1.5 → 0.1.7

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 (78) hide show
  1. package/.openapi-generator/FILES +6 -0
  2. package/README.md +2 -2
  3. package/dist/apis/AccountsApi.d.ts +4 -4
  4. package/dist/apis/AccountsApi.js +2 -2
  5. package/dist/apis/FloorPlansApi.d.ts +13 -13
  6. package/dist/apis/FloorPlansApi.js +6 -6
  7. package/dist/apis/InternalApi.d.ts +57 -1
  8. package/dist/apis/InternalApi.js +83 -0
  9. package/dist/apis/ScriptsApi.d.ts +32 -9
  10. package/dist/apis/ScriptsApi.js +39 -4
  11. package/dist/esm/apis/AccountsApi.d.ts +4 -4
  12. package/dist/esm/apis/AccountsApi.js +2 -2
  13. package/dist/esm/apis/FloorPlansApi.d.ts +13 -13
  14. package/dist/esm/apis/FloorPlansApi.js +6 -6
  15. package/dist/esm/apis/InternalApi.d.ts +57 -1
  16. package/dist/esm/apis/InternalApi.js +84 -1
  17. package/dist/esm/apis/ScriptsApi.d.ts +32 -9
  18. package/dist/esm/apis/ScriptsApi.js +40 -5
  19. package/dist/esm/models/AccountCalculationUsageDay.d.ts +6 -0
  20. package/dist/esm/models/AccountCalculationUsageDay.js +4 -0
  21. package/dist/esm/models/FloorplanBrief.d.ts +12 -0
  22. package/dist/esm/models/FloorplanBrief.js +4 -0
  23. package/dist/esm/models/FloorplanGetBody.d.ts +12 -0
  24. package/dist/esm/models/FloorplanGetBody.js +4 -0
  25. package/dist/esm/models/FloorplanPatchParamsBody.d.ts +12 -0
  26. package/dist/esm/models/FloorplanPatchParamsBody.js +4 -0
  27. package/dist/esm/models/ScriptLimitOverrides.d.ts +62 -0
  28. package/dist/esm/models/ScriptLimitOverrides.js +51 -0
  29. package/dist/esm/models/ScriptLimitValues.d.ts +62 -0
  30. package/dist/esm/models/ScriptLimitValues.js +63 -0
  31. package/dist/esm/models/ScriptLimits.d.ts +62 -0
  32. package/dist/esm/models/ScriptLimits.js +63 -0
  33. package/dist/esm/models/ScriptLimitsResBody.d.ts +46 -0
  34. package/dist/esm/models/ScriptLimitsResBody.js +53 -0
  35. package/dist/esm/models/ScriptUsage.d.ts +50 -0
  36. package/dist/esm/models/ScriptUsage.js +55 -0
  37. package/dist/esm/models/ScriptUsageResBody.d.ts +103 -0
  38. package/dist/esm/models/ScriptUsageResBody.js +93 -0
  39. package/dist/esm/models/index.d.ts +6 -0
  40. package/dist/esm/models/index.js +6 -0
  41. package/dist/models/AccountCalculationUsageDay.d.ts +6 -0
  42. package/dist/models/AccountCalculationUsageDay.js +4 -0
  43. package/dist/models/FloorplanBrief.d.ts +12 -0
  44. package/dist/models/FloorplanBrief.js +4 -0
  45. package/dist/models/FloorplanGetBody.d.ts +12 -0
  46. package/dist/models/FloorplanGetBody.js +4 -0
  47. package/dist/models/FloorplanPatchParamsBody.d.ts +12 -0
  48. package/dist/models/FloorplanPatchParamsBody.js +4 -0
  49. package/dist/models/ScriptLimitOverrides.d.ts +62 -0
  50. package/dist/models/ScriptLimitOverrides.js +58 -0
  51. package/dist/models/ScriptLimitValues.d.ts +62 -0
  52. package/dist/models/ScriptLimitValues.js +70 -0
  53. package/dist/models/ScriptLimits.d.ts +62 -0
  54. package/dist/models/ScriptLimits.js +70 -0
  55. package/dist/models/ScriptLimitsResBody.d.ts +46 -0
  56. package/dist/models/ScriptLimitsResBody.js +60 -0
  57. package/dist/models/ScriptUsage.d.ts +50 -0
  58. package/dist/models/ScriptUsage.js +62 -0
  59. package/dist/models/ScriptUsageResBody.d.ts +103 -0
  60. package/dist/models/ScriptUsageResBody.js +101 -0
  61. package/dist/models/index.d.ts +6 -0
  62. package/dist/models/index.js +6 -0
  63. package/package.json +1 -1
  64. package/src/apis/AccountsApi.ts +4 -4
  65. package/src/apis/FloorPlansApi.ts +13 -13
  66. package/src/apis/InternalApi.ts +152 -0
  67. package/src/apis/ScriptsApi.ts +65 -8
  68. package/src/models/AccountCalculationUsageDay.ts +9 -0
  69. package/src/models/FloorplanBrief.ts +16 -0
  70. package/src/models/FloorplanGetBody.ts +16 -0
  71. package/src/models/FloorplanPatchParamsBody.ts +16 -0
  72. package/src/models/ScriptLimitOverrides.ts +105 -0
  73. package/src/models/ScriptLimitValues.ts +111 -0
  74. package/src/models/ScriptLimits.ts +111 -0
  75. package/src/models/ScriptLimitsResBody.ts +99 -0
  76. package/src/models/ScriptUsage.ts +93 -0
  77. package/src/models/ScriptUsageResBody.ts +183 -0
  78. package/src/models/index.ts +6 -0
@@ -22,6 +22,8 @@ import type {
22
22
  ReconcileReport,
23
23
  RepairFloorplansResBody,
24
24
  RetriesResBody,
25
+ ScriptLimitOverrides,
26
+ ScriptLimitsResBody,
25
27
  SysAdminUpdateFeatureGroupsParamsWrapperBody,
26
28
  } from '../models/index';
27
29
  import {
@@ -39,6 +41,10 @@ import {
39
41
  RepairFloorplansResBodyToJSON,
40
42
  RetriesResBodyFromJSON,
41
43
  RetriesResBodyToJSON,
44
+ ScriptLimitOverridesFromJSON,
45
+ ScriptLimitOverridesToJSON,
46
+ ScriptLimitsResBodyFromJSON,
47
+ ScriptLimitsResBodyToJSON,
42
48
  SysAdminUpdateFeatureGroupsParamsWrapperBodyFromJSON,
43
49
  SysAdminUpdateFeatureGroupsParamsWrapperBodyToJSON,
44
50
  } from '../models/index';
@@ -64,6 +70,15 @@ export interface InternalApiCreateTranslationsImportRequest {
64
70
  i18nTranslationsImportParamsWrapperBody: I18nTranslationsImportParamsWrapperBody;
65
71
  }
66
72
 
73
+ export interface InternalApiListAdminAccountsScriptLimitsRequest {
74
+ account: number;
75
+ }
76
+
77
+ export interface InternalApiUpdateAdminAccountsScriptLimitsRequest {
78
+ account: number;
79
+ scriptLimitOverrides: ScriptLimitOverrides;
80
+ }
81
+
67
82
  /**
68
83
  * InternalApi - interface
69
84
  *
@@ -227,6 +242,22 @@ export interface InternalApiInterface {
227
242
  */
228
243
  createTranslationsImport(requestParameters: InternalApiCreateTranslationsImportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object>;
229
244
 
245
+ /**
246
+ * Returns the code defaults for scripts, the account\'s overrides and the limits that apply to it. Requires the *Project admin controls* and *Sys admin* permissions.
247
+ * @summary Get an account\'s script limits
248
+ * @param {number} account
249
+ * @param {*} [options] Override http request option.
250
+ * @throws {RequiredError}
251
+ * @memberof InternalApiInterface
252
+ */
253
+ listAdminAccountsScriptLimitsRaw(requestParameters: InternalApiListAdminAccountsScriptLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptLimitsResBody>>;
254
+
255
+ /**
256
+ * Returns the code defaults for scripts, the account\'s overrides and the limits that apply to it. Requires the *Project admin controls* and *Sys admin* permissions.
257
+ * Get an account\'s script limits
258
+ */
259
+ listAdminAccountsScriptLimits(requestParameters: InternalApiListAdminAccountsScriptLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptLimitsResBody>;
260
+
230
261
  /**
231
262
  * Dispatches events to regenerate any preset images and derived assets for the caller\'s account. Requires the *Project admin controls* and *Sys admin* permissions.
232
263
  * @summary Regenerate customer preset assets
@@ -242,6 +273,23 @@ export interface InternalApiInterface {
242
273
  */
243
274
  listAdminRegeneratePresets(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
244
275
 
276
+ /**
277
+ * Replaces all of the account\'s script limit overrides with the body; an absent field uses the default, so an empty body returns the account to the defaults. Rejected with 422 when a value is not positive, or when maxCreditsPerMonth is above 9223372036854. Requires the *Project admin controls* and *Sys admin* permissions.
278
+ * @summary Set an account\'s script limits
279
+ * @param {number} account
280
+ * @param {ScriptLimitOverrides} scriptLimitOverrides
281
+ * @param {*} [options] Override http request option.
282
+ * @throws {RequiredError}
283
+ * @memberof InternalApiInterface
284
+ */
285
+ updateAdminAccountsScriptLimitsRaw(requestParameters: InternalApiUpdateAdminAccountsScriptLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptLimitsResBody>>;
286
+
287
+ /**
288
+ * Replaces all of the account\'s script limit overrides with the body; an absent field uses the default, so an empty body returns the account to the defaults. Rejected with 422 when a value is not positive, or when maxCreditsPerMonth is above 9223372036854. Requires the *Project admin controls* and *Sys admin* permissions.
289
+ * Set an account\'s script limits
290
+ */
291
+ updateAdminAccountsScriptLimits(requestParameters: InternalApiUpdateAdminAccountsScriptLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptLimitsResBody>;
292
+
245
293
  }
246
294
 
247
295
  /**
@@ -692,6 +740,53 @@ export class InternalApi extends runtime.BaseAPI implements InternalApiInterface
692
740
  return await response.value();
693
741
  }
694
742
 
743
+ /**
744
+ * Returns the code defaults for scripts, the account\'s overrides and the limits that apply to it. Requires the *Project admin controls* and *Sys admin* permissions.
745
+ * Get an account\'s script limits
746
+ */
747
+ async listAdminAccountsScriptLimitsRaw(requestParameters: InternalApiListAdminAccountsScriptLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptLimitsResBody>> {
748
+ if (requestParameters['account'] == null) {
749
+ throw new runtime.RequiredError(
750
+ 'account',
751
+ 'Required parameter "account" was null or undefined when calling listAdminAccountsScriptLimits().'
752
+ );
753
+ }
754
+
755
+ const queryParameters: any = {};
756
+
757
+ const headerParameters: runtime.HTTPHeaders = {};
758
+
759
+ if (this.configuration && this.configuration.accessToken) {
760
+ const token = this.configuration.accessToken;
761
+ const tokenString = await token("accessToken", []);
762
+
763
+ if (tokenString) {
764
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
765
+ }
766
+ }
767
+
768
+ let urlPath = `/v1/admin/accounts/{account}/script-limits`;
769
+ urlPath = urlPath.replace(`{${"account"}}`, encodeURIComponent(String(requestParameters['account'])));
770
+
771
+ const response = await this.request({
772
+ path: urlPath,
773
+ method: 'GET',
774
+ headers: headerParameters,
775
+ query: queryParameters,
776
+ }, initOverrides);
777
+
778
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptLimitsResBodyFromJSON(jsonValue));
779
+ }
780
+
781
+ /**
782
+ * Returns the code defaults for scripts, the account\'s overrides and the limits that apply to it. Requires the *Project admin controls* and *Sys admin* permissions.
783
+ * Get an account\'s script limits
784
+ */
785
+ async listAdminAccountsScriptLimits(requestParameters: InternalApiListAdminAccountsScriptLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptLimitsResBody> {
786
+ const response = await this.listAdminAccountsScriptLimitsRaw(requestParameters, initOverrides);
787
+ return await response.value();
788
+ }
789
+
695
790
  /**
696
791
  * Dispatches events to regenerate any preset images and derived assets for the caller\'s account. Requires the *Project admin controls* and *Sys admin* permissions.
697
792
  * Regenerate customer preset assets
@@ -730,4 +825,61 @@ export class InternalApi extends runtime.BaseAPI implements InternalApiInterface
730
825
  await this.listAdminRegeneratePresetsRaw(initOverrides);
731
826
  }
732
827
 
828
+ /**
829
+ * Replaces all of the account\'s script limit overrides with the body; an absent field uses the default, so an empty body returns the account to the defaults. Rejected with 422 when a value is not positive, or when maxCreditsPerMonth is above 9223372036854. Requires the *Project admin controls* and *Sys admin* permissions.
830
+ * Set an account\'s script limits
831
+ */
832
+ async updateAdminAccountsScriptLimitsRaw(requestParameters: InternalApiUpdateAdminAccountsScriptLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptLimitsResBody>> {
833
+ if (requestParameters['account'] == null) {
834
+ throw new runtime.RequiredError(
835
+ 'account',
836
+ 'Required parameter "account" was null or undefined when calling updateAdminAccountsScriptLimits().'
837
+ );
838
+ }
839
+
840
+ if (requestParameters['scriptLimitOverrides'] == null) {
841
+ throw new runtime.RequiredError(
842
+ 'scriptLimitOverrides',
843
+ 'Required parameter "scriptLimitOverrides" was null or undefined when calling updateAdminAccountsScriptLimits().'
844
+ );
845
+ }
846
+
847
+ const queryParameters: any = {};
848
+
849
+ const headerParameters: runtime.HTTPHeaders = {};
850
+
851
+ headerParameters['Content-Type'] = 'application/json';
852
+
853
+ if (this.configuration && this.configuration.accessToken) {
854
+ const token = this.configuration.accessToken;
855
+ const tokenString = await token("accessToken", []);
856
+
857
+ if (tokenString) {
858
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
859
+ }
860
+ }
861
+
862
+ let urlPath = `/v1/admin/accounts/{account}/script-limits`;
863
+ urlPath = urlPath.replace(`{${"account"}}`, encodeURIComponent(String(requestParameters['account'])));
864
+
865
+ const response = await this.request({
866
+ path: urlPath,
867
+ method: 'PUT',
868
+ headers: headerParameters,
869
+ query: queryParameters,
870
+ body: ScriptLimitOverridesToJSON(requestParameters['scriptLimitOverrides']),
871
+ }, initOverrides);
872
+
873
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptLimitsResBodyFromJSON(jsonValue));
874
+ }
875
+
876
+ /**
877
+ * Replaces all of the account\'s script limit overrides with the body; an absent field uses the default, so an empty body returns the account to the defaults. Rejected with 422 when a value is not positive, or when maxCreditsPerMonth is above 9223372036854. Requires the *Project admin controls* and *Sys admin* permissions.
878
+ * Set an account\'s script limits
879
+ */
880
+ async updateAdminAccountsScriptLimits(requestParameters: InternalApiUpdateAdminAccountsScriptLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptLimitsResBody> {
881
+ const response = await this.updateAdminAccountsScriptLimitsRaw(requestParameters, initOverrides);
882
+ return await response.value();
883
+ }
884
+
733
885
  }
@@ -28,6 +28,7 @@ import type {
28
28
  ScriptSchedulePreviewResBody,
29
29
  ScriptSecretsReqBody,
30
30
  ScriptSecretsResBody,
31
+ ScriptUsageResBody,
31
32
  ScriptWebhookResBody,
32
33
  } from '../models/index';
33
34
  import {
@@ -57,6 +58,8 @@ import {
57
58
  ScriptSecretsReqBodyToJSON,
58
59
  ScriptSecretsResBodyFromJSON,
59
60
  ScriptSecretsResBodyToJSON,
61
+ ScriptUsageResBodyFromJSON,
62
+ ScriptUsageResBodyToJSON,
60
63
  ScriptWebhookResBodyFromJSON,
61
64
  ScriptWebhookResBodyToJSON,
62
65
  } from '../models/index';
@@ -120,7 +123,7 @@ export interface ScriptsApiUpdateSecretsRequest {
120
123
  */
121
124
  export interface ScriptsApiInterface {
122
125
  /**
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.
126
+ * 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, or when the script is enabled and the account already has its limit of enabled scripts. Requires the *Manage my account* permission; a script\'s own API key cannot call this or any other script operation.
124
127
  * @summary Create a script
125
128
  * @param {ScriptPostReqBody} scriptPostReqBody
126
129
  * @param {*} [options] Override http request option.
@@ -130,7 +133,7 @@ export interface ScriptsApiInterface {
130
133
  createRaw(requestParameters: ScriptsApiCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>>;
131
134
 
132
135
  /**
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.
136
+ * 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, or when the script is enabled and the account already has its limit of enabled scripts. Requires the *Manage my account* permission; a script\'s own API key cannot call this or any other script operation.
134
137
  * Create a script
135
138
  */
136
139
  create(requestParameters: ScriptsApiCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail>;
@@ -248,6 +251,21 @@ export interface ScriptsApiInterface {
248
251
  */
249
252
  getExport(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptExportResBody>;
250
253
 
254
+ /**
255
+ * Returns the credits the account\'s script runs were charged this calendar month (UTC), against the account\'s monthly script credit limit and its other script limits, with how many runs each script made, failed and had refused. creditState is near from 80% of the monthly limit and reached once it is used, after which runs are recorded as quota_exceeded until the month ends. creditsUsed is the scripts figure of `GET /v1/account/usage/calculation-credits`. Run counts are added when runs end. Requires the *Manage my account* permission.
256
+ * @summary Get script usage
257
+ * @param {*} [options] Override http request option.
258
+ * @throws {RequiredError}
259
+ * @memberof ScriptsApiInterface
260
+ */
261
+ getUsageRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptUsageResBody>>;
262
+
263
+ /**
264
+ * Returns the credits the account\'s script runs were charged this calendar month (UTC), against the account\'s monthly script credit limit and its other script limits, with how many runs each script made, failed and had refused. creditState is near from 80% of the monthly limit and reached once it is used, after which runs are recorded as quota_exceeded until the month ends. creditsUsed is the scripts figure of `GET /v1/account/usage/calculation-credits`. Run counts are added when runs end. Requires the *Manage my account* permission.
265
+ * Get script usage
266
+ */
267
+ getUsage(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptUsageResBody>;
268
+
251
269
  /**
252
270
  * Lists the account\'s scripts, sorted by name, without their source code. Requires the *Manage my account* permission.
253
271
  * @summary List scripts
@@ -299,7 +317,7 @@ export interface ScriptsApiInterface {
299
317
  listRunsLogs(requestParameters: ScriptsApiListRunsLogsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptRunLogsResBody>;
300
318
 
301
319
  /**
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.
320
+ * 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, when enabling a script whose key needs re-authorising, or when enabling it would exceed the account\'s limit of enabled scripts; with `422` when the result is invalid, including a changed schedule that runs more often than the account\'s minimum interval. Requires the *Manage my account* permission.
303
321
  * @summary Update a script
304
322
  * @param {string} id
305
323
  * @param {ScriptPatchReqBody} scriptPatchReqBody
@@ -310,7 +328,7 @@ export interface ScriptsApiInterface {
310
328
  updateRaw(requestParameters: ScriptsApiUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>>;
311
329
 
312
330
  /**
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.
331
+ * 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, when enabling a script whose key needs re-authorising, or when enabling it would exceed the account\'s limit of enabled scripts; with `422` when the result is invalid, including a changed schedule that runs more often than the account\'s minimum interval. Requires the *Manage my account* permission.
314
332
  * Update a script
315
333
  */
316
334
  update(requestParameters: ScriptsApiUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail>;
@@ -340,7 +358,7 @@ export interface ScriptsApiInterface {
340
358
  export class ScriptsApi extends runtime.BaseAPI implements ScriptsApiInterface {
341
359
 
342
360
  /**
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.
361
+ * 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, or when the script is enabled and the account already has its limit of enabled scripts. Requires the *Manage my account* permission; a script\'s own API key cannot call this or any other script operation.
344
362
  * Create a script
345
363
  */
346
364
  async createRaw(requestParameters: ScriptsApiCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>> {
@@ -380,7 +398,7 @@ export class ScriptsApi extends runtime.BaseAPI implements ScriptsApiInterface {
380
398
  }
381
399
 
382
400
  /**
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.
401
+ * 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, or when the script is enabled and the account already has its limit of enabled scripts. Requires the *Manage my account* permission; a script\'s own API key cannot call this or any other script operation.
384
402
  * Create a script
385
403
  */
386
404
  async create(requestParameters: ScriptsApiCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail> {
@@ -718,6 +736,45 @@ export class ScriptsApi extends runtime.BaseAPI implements ScriptsApiInterface {
718
736
  return await response.value();
719
737
  }
720
738
 
739
+ /**
740
+ * Returns the credits the account\'s script runs were charged this calendar month (UTC), against the account\'s monthly script credit limit and its other script limits, with how many runs each script made, failed and had refused. creditState is near from 80% of the monthly limit and reached once it is used, after which runs are recorded as quota_exceeded until the month ends. creditsUsed is the scripts figure of `GET /v1/account/usage/calculation-credits`. Run counts are added when runs end. Requires the *Manage my account* permission.
741
+ * Get script usage
742
+ */
743
+ async getUsageRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptUsageResBody>> {
744
+ const queryParameters: any = {};
745
+
746
+ const headerParameters: runtime.HTTPHeaders = {};
747
+
748
+ if (this.configuration && this.configuration.accessToken) {
749
+ const token = this.configuration.accessToken;
750
+ const tokenString = await token("accessToken", []);
751
+
752
+ if (tokenString) {
753
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
754
+ }
755
+ }
756
+
757
+ let urlPath = `/v1/scripts/usage`;
758
+
759
+ const response = await this.request({
760
+ path: urlPath,
761
+ method: 'GET',
762
+ headers: headerParameters,
763
+ query: queryParameters,
764
+ }, initOverrides);
765
+
766
+ return new runtime.JSONApiResponse(response, (jsonValue) => ScriptUsageResBodyFromJSON(jsonValue));
767
+ }
768
+
769
+ /**
770
+ * Returns the credits the account\'s script runs were charged this calendar month (UTC), against the account\'s monthly script credit limit and its other script limits, with how many runs each script made, failed and had refused. creditState is near from 80% of the monthly limit and reached once it is used, after which runs are recorded as quota_exceeded until the month ends. creditsUsed is the scripts figure of `GET /v1/account/usage/calculation-credits`. Run counts are added when runs end. Requires the *Manage my account* permission.
771
+ * Get script usage
772
+ */
773
+ async getUsage(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptUsageResBody> {
774
+ const response = await this.getUsageRaw(initOverrides);
775
+ return await response.value();
776
+ }
777
+
721
778
  /**
722
779
  * Lists the account\'s scripts, sorted by name, without their source code. Requires the *Manage my account* permission.
723
780
  * List scripts
@@ -868,7 +925,7 @@ export class ScriptsApi extends runtime.BaseAPI implements ScriptsApiInterface {
868
925
  }
869
926
 
870
927
  /**
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.
928
+ * 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, when enabling a script whose key needs re-authorising, or when enabling it would exceed the account\'s limit of enabled scripts; with `422` when the result is invalid, including a changed schedule that runs more often than the account\'s minimum interval. Requires the *Manage my account* permission.
872
929
  * Update a script
873
930
  */
874
931
  async updateRaw(requestParameters: ScriptsApiUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ScriptDetail>> {
@@ -916,7 +973,7 @@ export class ScriptsApi extends runtime.BaseAPI implements ScriptsApiInterface {
916
973
  }
917
974
 
918
975
  /**
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.
976
+ * 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, when enabling a script whose key needs re-authorising, or when enabling it would exceed the account\'s limit of enabled scripts; with `422` when the result is invalid, including a changed schedule that runs more often than the account\'s minimum interval. Requires the *Manage my account* permission.
920
977
  * Update a script
921
978
  */
922
979
  async update(requestParameters: ScriptsApiUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ScriptDetail> {
@@ -43,6 +43,12 @@ export interface AccountCalculationUsageDay {
43
43
  * @memberof AccountCalculationUsageDay
44
44
  */
45
45
  date: Date;
46
+ /**
47
+ * Credits used running scripts: one per started minute of each run.
48
+ * @type {number}
49
+ * @memberof AccountCalculationUsageDay
50
+ */
51
+ scripts: number;
46
52
  }
47
53
 
48
54
  /**
@@ -53,6 +59,7 @@ export function instanceOfAccountCalculationUsageDay(value: object): value is Ac
53
59
  if (!('ai' in value) || value['ai'] === undefined) return false;
54
60
  if (!('build' in value) || value['build'] === undefined) return false;
55
61
  if (!('date' in value) || value['date'] === undefined) return false;
62
+ if (!('scripts' in value) || value['scripts'] === undefined) return false;
56
63
  return true;
57
64
  }
58
65
 
@@ -70,6 +77,7 @@ export function AccountCalculationUsageDayFromJSONTyped(json: any, ignoreDiscrim
70
77
  'ai': json['ai'],
71
78
  'build': json['build'],
72
79
  'date': (new Date(json['date'])),
80
+ 'scripts': json['scripts'],
73
81
  };
74
82
  }
75
83
 
@@ -88,6 +96,7 @@ export function AccountCalculationUsageDayToJSONTyped(value?: AccountCalculation
88
96
  'ai': value['ai'],
89
97
  'build': value['build'],
90
98
  'date': ((value['date']).toISOString().substring(0,10)),
99
+ 'scripts': value['scripts'],
91
100
  };
92
101
  }
93
102
 
@@ -19,12 +19,24 @@ import { mapValues } from '../runtime';
19
19
  * @interface FloorplanBrief
20
20
  */
21
21
  export interface FloorplanBrief {
22
+ /**
23
+ * ID of the account file used as the background image, if one is set.
24
+ * @type {string}
25
+ * @memberof FloorplanBrief
26
+ */
27
+ backgroundFile?: string;
22
28
  /**
23
29
  *
24
30
  * @type {number}
25
31
  * @memberof FloorplanBrief
26
32
  */
27
33
  createdAt: number;
34
+ /**
35
+ * ID of the account file used as the foreground image, if one is set.
36
+ * @type {string}
37
+ * @memberof FloorplanBrief
38
+ */
39
+ foregroundFile?: string;
28
40
  /**
29
41
  *
30
42
  * @type {string}
@@ -73,7 +85,9 @@ export function FloorplanBriefFromJSONTyped(json: any, ignoreDiscriminator: bool
73
85
  }
74
86
  return {
75
87
 
88
+ 'backgroundFile': json['backgroundFile'] == null ? undefined : json['backgroundFile'],
76
89
  'createdAt': json['createdAt'],
90
+ 'foregroundFile': json['foregroundFile'] == null ? undefined : json['foregroundFile'],
77
91
  'id': json['id'],
78
92
  'name': json['name'],
79
93
  'property': json['property'],
@@ -92,7 +106,9 @@ export function FloorplanBriefToJSONTyped(value?: FloorplanBrief | null, ignoreD
92
106
 
93
107
  return {
94
108
 
109
+ 'backgroundFile': value['backgroundFile'],
95
110
  'createdAt': value['createdAt'],
111
+ 'foregroundFile': value['foregroundFile'],
96
112
  'id': value['id'],
97
113
  'name': value['name'],
98
114
  'property': value['property'],
@@ -34,12 +34,24 @@ import {
34
34
  * @interface FloorplanGetBody
35
35
  */
36
36
  export interface FloorplanGetBody {
37
+ /**
38
+ * ID of the account file used as the background image, if one is set.
39
+ * @type {string}
40
+ * @memberof FloorplanGetBody
41
+ */
42
+ backgroundFile?: string;
37
43
  /**
38
44
  *
39
45
  * @type {number}
40
46
  * @memberof FloorplanGetBody
41
47
  */
42
48
  createdAt: number;
49
+ /**
50
+ * ID of the account file used as the foreground image, if one is set.
51
+ * @type {string}
52
+ * @memberof FloorplanGetBody
53
+ */
54
+ foregroundFile?: string;
43
55
  /**
44
56
  *
45
57
  * @type {string}
@@ -95,7 +107,9 @@ export function FloorplanGetBodyFromJSONTyped(json: any, ignoreDiscriminator: bo
95
107
  }
96
108
  return {
97
109
 
110
+ 'backgroundFile': json['backgroundFile'] == null ? undefined : json['backgroundFile'],
98
111
  'createdAt': json['createdAt'],
112
+ 'foregroundFile': json['foregroundFile'] == null ? undefined : json['foregroundFile'],
99
113
  'name': json['name'],
100
114
  'overlayOffset': FloorplanGetBodyOverlayOffsetFromJSON(json['overlayOffset']),
101
115
  'property': json['property'],
@@ -115,7 +129,9 @@ export function FloorplanGetBodyToJSONTyped(value?: FloorplanGetBody | null, ign
115
129
 
116
130
  return {
117
131
 
132
+ 'backgroundFile': value['backgroundFile'],
118
133
  'createdAt': value['createdAt'],
134
+ 'foregroundFile': value['foregroundFile'],
119
135
  'name': value['name'],
120
136
  'overlayOffset': FloorplanGetBodyOverlayOffsetToJSON(value['overlayOffset']),
121
137
  'property': value['property'],
@@ -34,12 +34,24 @@ import {
34
34
  * @interface FloorplanPatchParamsBody
35
35
  */
36
36
  export interface FloorplanPatchParamsBody {
37
+ /**
38
+ *
39
+ * @type {string}
40
+ * @memberof FloorplanPatchParamsBody
41
+ */
42
+ backgroundFile?: string;
37
43
  /**
38
44
  *
39
45
  * @type {number}
40
46
  * @memberof FloorplanPatchParamsBody
41
47
  */
42
48
  createdAt?: number;
49
+ /**
50
+ *
51
+ * @type {string}
52
+ * @memberof FloorplanPatchParamsBody
53
+ */
54
+ foregroundFile?: string;
43
55
  /**
44
56
  *
45
57
  * @type {string}
@@ -89,7 +101,9 @@ export function FloorplanPatchParamsBodyFromJSONTyped(json: any, ignoreDiscrimin
89
101
  }
90
102
  return {
91
103
 
104
+ 'backgroundFile': json['backgroundFile'] == null ? undefined : json['backgroundFile'],
92
105
  'createdAt': json['createdAt'] == null ? undefined : json['createdAt'],
106
+ 'foregroundFile': json['foregroundFile'] == null ? undefined : json['foregroundFile'],
93
107
  'name': json['name'] == null ? undefined : json['name'],
94
108
  'overlayOffset': json['overlayOffset'] == null ? undefined : FloorplanChangelogOverlayOffsetFromJSON(json['overlayOffset']),
95
109
  'property': json['property'] == null ? undefined : json['property'],
@@ -109,7 +123,9 @@ export function FloorplanPatchParamsBodyToJSONTyped(value?: FloorplanPatchParams
109
123
 
110
124
  return {
111
125
 
126
+ 'backgroundFile': value['backgroundFile'],
112
127
  'createdAt': value['createdAt'],
128
+ 'foregroundFile': value['foregroundFile'],
113
129
  'name': value['name'],
114
130
  'overlayOffset': FloorplanChangelogOverlayOffsetToJSON(value['overlayOffset']),
115
131
  'property': value['property'],
@@ -0,0 +1,105 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * spaciv API
5
+ * The spaciv API powers workplace planning: modelling how many people an organisation has, how they work, and how much space that requires. ## Getting started 1. Exchange credentials for an access token using one of the operations under **Authentication**. 2. Send that token on every subsequent request as `Authorization: Bearer <token>`. 3. Access tokens are short lived. Call `POST /v1/auth/refresh-token` to obtain a new one before the old one expires. ## Conventions Every operation is versioned under `/v1`. Collections are plural (`GET /v1/dashboards` lists, `POST /v1/dashboards` creates) and individual records live beneath them (`/v1/dashboards/{id}`). Singular paths such as `/v1/account`, `/v1/project` and `/v1/user` refer to the record the access token was issued for. Request and response bodies are JSON. Timestamps are RFC 3339. Identifiers are opaque strings unless documented otherwise, and collection operations return the records visible to the account the token was issued for. Failures return an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem document with a `detail` field describing what went wrong.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@spaciv.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface ScriptLimitOverrides
20
+ */
21
+ export interface ScriptLimitOverrides {
22
+ /**
23
+ *
24
+ * @type {number}
25
+ * @memberof ScriptLimitOverrides
26
+ */
27
+ maxConcurrentRuns?: number;
28
+ /**
29
+ *
30
+ * @type {number}
31
+ * @memberof ScriptLimitOverrides
32
+ */
33
+ maxCreditsPerMonth?: number;
34
+ /**
35
+ *
36
+ * @type {number}
37
+ * @memberof ScriptLimitOverrides
38
+ */
39
+ maxEnabledScripts?: number;
40
+ /**
41
+ *
42
+ * @type {number}
43
+ * @memberof ScriptLimitOverrides
44
+ */
45
+ maxRunSeconds?: number;
46
+ /**
47
+ *
48
+ * @type {number}
49
+ * @memberof ScriptLimitOverrides
50
+ */
51
+ minCronIntervalSeconds?: number;
52
+ /**
53
+ *
54
+ * @type {number}
55
+ * @memberof ScriptLimitOverrides
56
+ */
57
+ webhookRequestsPerMinute?: number;
58
+ }
59
+
60
+ /**
61
+ * Check if a given object implements the ScriptLimitOverrides interface.
62
+ */
63
+ export function instanceOfScriptLimitOverrides(value: object): value is ScriptLimitOverrides {
64
+ return true;
65
+ }
66
+
67
+ export function ScriptLimitOverridesFromJSON(json: any): ScriptLimitOverrides {
68
+ return ScriptLimitOverridesFromJSONTyped(json, false);
69
+ }
70
+
71
+ export function ScriptLimitOverridesFromJSONTyped(json: any, ignoreDiscriminator: boolean): ScriptLimitOverrides {
72
+ if (json == null) {
73
+ return json;
74
+ }
75
+ return {
76
+
77
+ 'maxConcurrentRuns': json['maxConcurrentRuns'] == null ? undefined : json['maxConcurrentRuns'],
78
+ 'maxCreditsPerMonth': json['maxCreditsPerMonth'] == null ? undefined : json['maxCreditsPerMonth'],
79
+ 'maxEnabledScripts': json['maxEnabledScripts'] == null ? undefined : json['maxEnabledScripts'],
80
+ 'maxRunSeconds': json['maxRunSeconds'] == null ? undefined : json['maxRunSeconds'],
81
+ 'minCronIntervalSeconds': json['minCronIntervalSeconds'] == null ? undefined : json['minCronIntervalSeconds'],
82
+ 'webhookRequestsPerMinute': json['webhookRequestsPerMinute'] == null ? undefined : json['webhookRequestsPerMinute'],
83
+ };
84
+ }
85
+
86
+ export function ScriptLimitOverridesToJSON(json: any): ScriptLimitOverrides {
87
+ return ScriptLimitOverridesToJSONTyped(json, false);
88
+ }
89
+
90
+ export function ScriptLimitOverridesToJSONTyped(value?: ScriptLimitOverrides | null, ignoreDiscriminator: boolean = false): any {
91
+ if (value == null) {
92
+ return value;
93
+ }
94
+
95
+ return {
96
+
97
+ 'maxConcurrentRuns': value['maxConcurrentRuns'],
98
+ 'maxCreditsPerMonth': value['maxCreditsPerMonth'],
99
+ 'maxEnabledScripts': value['maxEnabledScripts'],
100
+ 'maxRunSeconds': value['maxRunSeconds'],
101
+ 'minCronIntervalSeconds': value['minCronIntervalSeconds'],
102
+ 'webhookRequestsPerMinute': value['webhookRequestsPerMinute'],
103
+ };
104
+ }
105
+