@gpuai/sdk 0.3.17 → 0.4.0

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 (152) hide show
  1. package/.openapi-generator/FILES +40 -0
  2. package/README.md +36 -2
  3. package/dist/apis/BillingApi.d.ts +70 -0
  4. package/dist/apis/BillingApi.js +197 -0
  5. package/dist/apis/FunctionsApi.d.ts +228 -0
  6. package/dist/apis/FunctionsApi.js +627 -0
  7. package/dist/apis/index.d.ts +1 -0
  8. package/dist/apis/index.js +1 -0
  9. package/dist/esm/apis/BillingApi.d.ts +70 -0
  10. package/dist/esm/apis/BillingApi.js +197 -0
  11. package/dist/esm/apis/FunctionsApi.d.ts +228 -0
  12. package/dist/esm/apis/FunctionsApi.js +623 -0
  13. package/dist/esm/apis/index.d.ts +1 -0
  14. package/dist/esm/apis/index.js +1 -0
  15. package/dist/esm/models/AutolaunchRule.d.ts +4 -2
  16. package/dist/esm/models/BillingDetails.d.ts +98 -0
  17. package/dist/esm/models/BillingDetails.js +85 -0
  18. package/dist/esm/models/CreateFunctionRequest.d.ts +32 -0
  19. package/dist/esm/models/CreateFunctionRequest.js +43 -0
  20. package/dist/esm/models/CreateFunctionRunRequest.d.ts +38 -0
  21. package/dist/esm/models/CreateFunctionRunRequest.js +45 -0
  22. package/dist/esm/models/CreateFunctionVersionRequest.d.ts +110 -0
  23. package/dist/esm/models/CreateFunctionVersionRequest.js +79 -0
  24. package/dist/esm/models/Function.d.ts +163 -0
  25. package/dist/esm/models/Function.js +109 -0
  26. package/dist/esm/models/FunctionList.d.ts +33 -0
  27. package/dist/esm/models/FunctionList.js +44 -0
  28. package/dist/esm/models/FunctionReplicaCounts.d.ts +44 -0
  29. package/dist/esm/models/FunctionReplicaCounts.js +51 -0
  30. package/dist/esm/models/FunctionRun.d.ts +130 -0
  31. package/dist/esm/models/FunctionRun.js +94 -0
  32. package/dist/esm/models/FunctionRunError.d.ts +44 -0
  33. package/dist/esm/models/FunctionRunError.js +49 -0
  34. package/dist/esm/models/FunctionRunList.d.ts +39 -0
  35. package/dist/esm/models/FunctionRunList.js +48 -0
  36. package/dist/esm/models/FunctionRunLogChunk.d.ts +59 -0
  37. package/dist/esm/models/FunctionRunLogChunk.js +63 -0
  38. package/dist/esm/models/FunctionRunLogs.d.ts +45 -0
  39. package/dist/esm/models/FunctionRunLogs.js +52 -0
  40. package/dist/esm/models/FunctionUpload.d.ts +51 -0
  41. package/dist/esm/models/FunctionUpload.js +59 -0
  42. package/dist/esm/models/FunctionVersion.d.ts +137 -0
  43. package/dist/esm/models/FunctionVersion.js +109 -0
  44. package/dist/esm/models/Invoice.d.ts +68 -0
  45. package/dist/esm/models/Invoice.js +67 -0
  46. package/dist/esm/models/InvoiceList.d.ts +45 -0
  47. package/dist/esm/models/InvoiceList.js +50 -0
  48. package/dist/esm/models/ModelPricing.d.ts +46 -0
  49. package/dist/esm/models/ModelPricing.js +21 -0
  50. package/dist/esm/models/ModelRate.d.ts +62 -0
  51. package/dist/esm/models/ModelRate.js +51 -0
  52. package/dist/esm/models/PeakWindow.d.ts +38 -0
  53. package/dist/esm/models/PeakWindow.js +47 -0
  54. package/dist/esm/models/UpdateBillingDetailsRequest.d.ts +80 -0
  55. package/dist/esm/models/UpdateBillingDetailsRequest.js +57 -0
  56. package/dist/esm/models/index.d.ts +19 -0
  57. package/dist/esm/models/index.js +19 -0
  58. package/dist/esm/runtime.js +1 -1
  59. package/dist/models/AutolaunchRule.d.ts +4 -2
  60. package/dist/models/BillingDetails.d.ts +98 -0
  61. package/dist/models/BillingDetails.js +92 -0
  62. package/dist/models/CreateFunctionRequest.d.ts +32 -0
  63. package/dist/models/CreateFunctionRequest.js +50 -0
  64. package/dist/models/CreateFunctionRunRequest.d.ts +38 -0
  65. package/dist/models/CreateFunctionRunRequest.js +52 -0
  66. package/dist/models/CreateFunctionVersionRequest.d.ts +110 -0
  67. package/dist/models/CreateFunctionVersionRequest.js +86 -0
  68. package/dist/models/Function.d.ts +163 -0
  69. package/dist/models/Function.js +117 -0
  70. package/dist/models/FunctionList.d.ts +33 -0
  71. package/dist/models/FunctionList.js +51 -0
  72. package/dist/models/FunctionReplicaCounts.d.ts +44 -0
  73. package/dist/models/FunctionReplicaCounts.js +58 -0
  74. package/dist/models/FunctionRun.d.ts +130 -0
  75. package/dist/models/FunctionRun.js +102 -0
  76. package/dist/models/FunctionRunError.d.ts +44 -0
  77. package/dist/models/FunctionRunError.js +56 -0
  78. package/dist/models/FunctionRunList.d.ts +39 -0
  79. package/dist/models/FunctionRunList.js +55 -0
  80. package/dist/models/FunctionRunLogChunk.d.ts +59 -0
  81. package/dist/models/FunctionRunLogChunk.js +71 -0
  82. package/dist/models/FunctionRunLogs.d.ts +45 -0
  83. package/dist/models/FunctionRunLogs.js +59 -0
  84. package/dist/models/FunctionUpload.d.ts +51 -0
  85. package/dist/models/FunctionUpload.js +67 -0
  86. package/dist/models/FunctionVersion.d.ts +137 -0
  87. package/dist/models/FunctionVersion.js +117 -0
  88. package/dist/models/Invoice.d.ts +68 -0
  89. package/dist/models/Invoice.js +74 -0
  90. package/dist/models/InvoiceList.d.ts +45 -0
  91. package/dist/models/InvoiceList.js +57 -0
  92. package/dist/models/ModelPricing.d.ts +46 -0
  93. package/dist/models/ModelPricing.js +22 -0
  94. package/dist/models/ModelRate.d.ts +62 -0
  95. package/dist/models/ModelRate.js +58 -0
  96. package/dist/models/PeakWindow.d.ts +38 -0
  97. package/dist/models/PeakWindow.js +54 -0
  98. package/dist/models/UpdateBillingDetailsRequest.d.ts +80 -0
  99. package/dist/models/UpdateBillingDetailsRequest.js +64 -0
  100. package/dist/models/index.d.ts +19 -0
  101. package/dist/models/index.js +19 -0
  102. package/dist/runtime.js +1 -1
  103. package/docs/AutolaunchApi.md +1 -1
  104. package/docs/BillingApi.md +299 -0
  105. package/docs/BillingDetails.md +56 -0
  106. package/docs/CreateFunctionRequest.md +34 -0
  107. package/docs/CreateFunctionRunRequest.md +36 -0
  108. package/docs/CreateFunctionVersionRequest.md +60 -0
  109. package/docs/Function.md +75 -0
  110. package/docs/FunctionList.md +34 -0
  111. package/docs/FunctionReplicaCounts.md +39 -0
  112. package/docs/FunctionRun.md +63 -0
  113. package/docs/FunctionRunError.md +38 -0
  114. package/docs/FunctionRunList.md +36 -0
  115. package/docs/FunctionRunLogChunk.md +40 -0
  116. package/docs/FunctionRunLogs.md +38 -0
  117. package/docs/FunctionUpload.md +38 -0
  118. package/docs/FunctionVersion.md +66 -0
  119. package/docs/FunctionsApi.md +880 -0
  120. package/docs/Invoice.md +46 -0
  121. package/docs/InvoiceList.md +38 -0
  122. package/docs/ModelPricing.md +12 -0
  123. package/docs/ModelRate.md +45 -0
  124. package/docs/PeakWindow.md +37 -0
  125. package/docs/UpdateBillingDetailsRequest.md +50 -0
  126. package/package.json +1 -1
  127. package/src/apis/BillingApi.ts +247 -0
  128. package/src/apis/FunctionsApi.ts +828 -0
  129. package/src/apis/index.ts +1 -0
  130. package/src/models/AutolaunchRule.ts +4 -2
  131. package/src/models/BillingDetails.ts +164 -0
  132. package/src/models/CreateFunctionRequest.ts +66 -0
  133. package/src/models/CreateFunctionRunRequest.ts +74 -0
  134. package/src/models/CreateFunctionVersionRequest.ts +175 -0
  135. package/src/models/Function.ts +255 -0
  136. package/src/models/FunctionList.ts +74 -0
  137. package/src/models/FunctionReplicaCounts.ts +84 -0
  138. package/src/models/FunctionRun.ts +207 -0
  139. package/src/models/FunctionRunError.ts +83 -0
  140. package/src/models/FunctionRunList.ts +83 -0
  141. package/src/models/FunctionRunLogChunk.ts +105 -0
  142. package/src/models/FunctionRunLogs.ts +92 -0
  143. package/src/models/FunctionUpload.ts +96 -0
  144. package/src/models/FunctionVersion.ts +226 -0
  145. package/src/models/Invoice.ts +120 -0
  146. package/src/models/InvoiceList.ts +91 -0
  147. package/src/models/ModelPricing.ts +74 -0
  148. package/src/models/ModelRate.ts +105 -0
  149. package/src/models/PeakWindow.ts +75 -0
  150. package/src/models/UpdateBillingDetailsRequest.ts +129 -0
  151. package/src/models/index.ts +19 -0
  152. package/src/runtime.ts +1 -1
@@ -0,0 +1,627 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * GPU.ai Public Developer API
6
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: support@gpu.ai
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.FunctionsApi = void 0;
26
+ const runtime = require("../runtime");
27
+ const CreateFunctionRequest_1 = require("../models/CreateFunctionRequest");
28
+ const CreateFunctionRunRequest_1 = require("../models/CreateFunctionRunRequest");
29
+ const CreateFunctionVersionRequest_1 = require("../models/CreateFunctionVersionRequest");
30
+ const Function_1 = require("../models/Function");
31
+ const FunctionList_1 = require("../models/FunctionList");
32
+ const FunctionRun_1 = require("../models/FunctionRun");
33
+ const FunctionRunList_1 = require("../models/FunctionRunList");
34
+ const FunctionRunLogs_1 = require("../models/FunctionRunLogs");
35
+ const FunctionVersion_1 = require("../models/FunctionVersion");
36
+ /**
37
+ *
38
+ */
39
+ class FunctionsApi extends runtime.BaseAPI {
40
+ /**
41
+ * Creates request options for activateFunctionVersion without sending the request
42
+ */
43
+ activateFunctionVersionRequestOpts(requestParameters) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ if (requestParameters['id'] == null) {
46
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling activateFunctionVersion().');
47
+ }
48
+ if (requestParameters['versionId'] == null) {
49
+ throw new runtime.RequiredError('versionId', 'Required parameter "versionId" was null or undefined when calling activateFunctionVersion().');
50
+ }
51
+ const queryParameters = {};
52
+ const headerParameters = {};
53
+ if (requestParameters['idempotencyKey'] != null) {
54
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
55
+ }
56
+ if (this.configuration && this.configuration.accessToken) {
57
+ const token = this.configuration.accessToken;
58
+ const tokenString = yield token("bearerAuth", []);
59
+ if (tokenString) {
60
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
61
+ }
62
+ }
63
+ let urlPath = `/functions/{id}/versions/{version_id}/activate`;
64
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
65
+ urlPath = urlPath.replace('{version_id}', encodeURIComponent(String(requestParameters['versionId'])));
66
+ return {
67
+ path: urlPath,
68
+ method: 'POST',
69
+ headers: headerParameters,
70
+ query: queryParameters,
71
+ };
72
+ });
73
+ }
74
+ /**
75
+ * Reads the uploaded bundle back, checks it against the declared size and SHA-256 (422 on a mismatch or a missing upload), and makes the version the one the function\'s next call runs. Safe to repeat. Requires the `functions:write` scope.
76
+ * Confirm a version\'s upload and make it current
77
+ */
78
+ activateFunctionVersionRaw(requestParameters, initOverrides) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const requestOptions = yield this.activateFunctionVersionRequestOpts(requestParameters);
81
+ const response = yield this.request(requestOptions, initOverrides);
82
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, FunctionVersion_1.FunctionVersionFromJSON)(jsonValue));
83
+ });
84
+ }
85
+ /**
86
+ * Reads the uploaded bundle back, checks it against the declared size and SHA-256 (422 on a mismatch or a missing upload), and makes the version the one the function\'s next call runs. Safe to repeat. Requires the `functions:write` scope.
87
+ * Confirm a version\'s upload and make it current
88
+ */
89
+ activateFunctionVersion(requestParameters, initOverrides) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const response = yield this.activateFunctionVersionRaw(requestParameters, initOverrides);
92
+ return yield response.value();
93
+ });
94
+ }
95
+ /**
96
+ * Creates request options for cancelFunctionRun without sending the request
97
+ */
98
+ cancelFunctionRunRequestOpts(requestParameters) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ if (requestParameters['id'] == null) {
101
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling cancelFunctionRun().');
102
+ }
103
+ if (requestParameters['runId'] == null) {
104
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling cancelFunctionRun().');
105
+ }
106
+ const queryParameters = {};
107
+ const headerParameters = {};
108
+ if (requestParameters['idempotencyKey'] != null) {
109
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
110
+ }
111
+ if (this.configuration && this.configuration.accessToken) {
112
+ const token = this.configuration.accessToken;
113
+ const tokenString = yield token("bearerAuth", []);
114
+ if (tokenString) {
115
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
116
+ }
117
+ }
118
+ let urlPath = `/functions/{id}/runs/{run_id}/cancel`;
119
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
120
+ urlPath = urlPath.replace('{run_id}', encodeURIComponent(String(requestParameters['runId'])));
121
+ return {
122
+ path: urlPath,
123
+ method: 'POST',
124
+ headers: headerParameters,
125
+ query: queryParameters,
126
+ };
127
+ });
128
+ }
129
+ /**
130
+ * A queued run is cancelled at once; a running one is stopped on its machine within seconds, and the machine stays ready for the next call. Cancelling a finished run changes nothing and returns it, so the request is safe to repeat. Requires the `functions:write` scope.
131
+ * Cancel a run
132
+ */
133
+ cancelFunctionRunRaw(requestParameters, initOverrides) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ const requestOptions = yield this.cancelFunctionRunRequestOpts(requestParameters);
136
+ const response = yield this.request(requestOptions, initOverrides);
137
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, FunctionRun_1.FunctionRunFromJSON)(jsonValue));
138
+ });
139
+ }
140
+ /**
141
+ * A queued run is cancelled at once; a running one is stopped on its machine within seconds, and the machine stays ready for the next call. Cancelling a finished run changes nothing and returns it, so the request is safe to repeat. Requires the `functions:write` scope.
142
+ * Cancel a run
143
+ */
144
+ cancelFunctionRun(requestParameters, initOverrides) {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ const response = yield this.cancelFunctionRunRaw(requestParameters, initOverrides);
147
+ return yield response.value();
148
+ });
149
+ }
150
+ /**
151
+ * Creates request options for createFunction without sending the request
152
+ */
153
+ createFunctionRequestOpts(requestParameters) {
154
+ return __awaiter(this, void 0, void 0, function* () {
155
+ if (requestParameters['createFunctionRequest'] == null) {
156
+ throw new runtime.RequiredError('createFunctionRequest', 'Required parameter "createFunctionRequest" was null or undefined when calling createFunction().');
157
+ }
158
+ const queryParameters = {};
159
+ const headerParameters = {};
160
+ headerParameters['Content-Type'] = 'application/json';
161
+ if (requestParameters['idempotencyKey'] != null) {
162
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
163
+ }
164
+ if (this.configuration && this.configuration.accessToken) {
165
+ const token = this.configuration.accessToken;
166
+ const tokenString = yield token("bearerAuth", []);
167
+ if (tokenString) {
168
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
169
+ }
170
+ }
171
+ let urlPath = `/functions`;
172
+ return {
173
+ path: urlPath,
174
+ method: 'POST',
175
+ headers: headerParameters,
176
+ query: queryParameters,
177
+ body: (0, CreateFunctionRequest_1.CreateFunctionRequestToJSON)(requestParameters['createFunctionRequest']),
178
+ };
179
+ });
180
+ }
181
+ /**
182
+ * Returns the organization\'s function with this name, creating it on first use (201) or returning the existing one (200). Creating a function starts no machine and costs nothing. Requires the `functions:write` scope. The key must belong to a user, because the function\'s machines are launched as that user.
183
+ * Get or create a function by name
184
+ */
185
+ createFunctionRaw(requestParameters, initOverrides) {
186
+ return __awaiter(this, void 0, void 0, function* () {
187
+ const requestOptions = yield this.createFunctionRequestOpts(requestParameters);
188
+ const response = yield this.request(requestOptions, initOverrides);
189
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, Function_1.FunctionFromJSON)(jsonValue));
190
+ });
191
+ }
192
+ /**
193
+ * Returns the organization\'s function with this name, creating it on first use (201) or returning the existing one (200). Creating a function starts no machine and costs nothing. Requires the `functions:write` scope. The key must belong to a user, because the function\'s machines are launched as that user.
194
+ * Get or create a function by name
195
+ */
196
+ createFunction(requestParameters, initOverrides) {
197
+ return __awaiter(this, void 0, void 0, function* () {
198
+ const response = yield this.createFunctionRaw(requestParameters, initOverrides);
199
+ return yield response.value();
200
+ });
201
+ }
202
+ /**
203
+ * Creates request options for createFunctionRun without sending the request
204
+ */
205
+ createFunctionRunRequestOpts(requestParameters) {
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ if (requestParameters['id'] == null) {
208
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling createFunctionRun().');
209
+ }
210
+ if (requestParameters['createFunctionRunRequest'] == null) {
211
+ throw new runtime.RequiredError('createFunctionRunRequest', 'Required parameter "createFunctionRunRequest" was null or undefined when calling createFunctionRun().');
212
+ }
213
+ const queryParameters = {};
214
+ const headerParameters = {};
215
+ headerParameters['Content-Type'] = 'application/json';
216
+ if (requestParameters['idempotencyKey'] != null) {
217
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
218
+ }
219
+ if (this.configuration && this.configuration.accessToken) {
220
+ const token = this.configuration.accessToken;
221
+ const tokenString = yield token("bearerAuth", []);
222
+ if (tokenString) {
223
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
224
+ }
225
+ }
226
+ let urlPath = `/functions/{id}/runs`;
227
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
228
+ return {
229
+ path: urlPath,
230
+ method: 'POST',
231
+ headers: headerParameters,
232
+ query: queryParameters,
233
+ body: (0, CreateFunctionRunRequest_1.CreateFunctionRunRequestToJSON)(requestParameters['createFunctionRunRequest']),
234
+ };
235
+ });
236
+ }
237
+ /**
238
+ * Queues one call and returns at once (202). A warm machine takes it within moments; otherwise a machine is started for it, up to the function\'s `max_concurrency`, beyond which calls wait in the queue. Read the run with `wait` for the outcome. Send an `Idempotency-Key` so a retried request does not run the function twice. Calling a function can start a billed machine: an organization with no balance is refused with 402, and the organization\'s spending limits apply when the machine is requested. Requires the `functions:write` scope.
239
+ * Call a function
240
+ */
241
+ createFunctionRunRaw(requestParameters, initOverrides) {
242
+ return __awaiter(this, void 0, void 0, function* () {
243
+ const requestOptions = yield this.createFunctionRunRequestOpts(requestParameters);
244
+ const response = yield this.request(requestOptions, initOverrides);
245
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, FunctionRun_1.FunctionRunFromJSON)(jsonValue));
246
+ });
247
+ }
248
+ /**
249
+ * Queues one call and returns at once (202). A warm machine takes it within moments; otherwise a machine is started for it, up to the function\'s `max_concurrency`, beyond which calls wait in the queue. Read the run with `wait` for the outcome. Send an `Idempotency-Key` so a retried request does not run the function twice. Calling a function can start a billed machine: an organization with no balance is refused with 402, and the organization\'s spending limits apply when the machine is requested. Requires the `functions:write` scope.
250
+ * Call a function
251
+ */
252
+ createFunctionRun(requestParameters, initOverrides) {
253
+ return __awaiter(this, void 0, void 0, function* () {
254
+ const response = yield this.createFunctionRunRaw(requestParameters, initOverrides);
255
+ return yield response.value();
256
+ });
257
+ }
258
+ /**
259
+ * Creates request options for createFunctionVersion without sending the request
260
+ */
261
+ createFunctionVersionRequestOpts(requestParameters) {
262
+ return __awaiter(this, void 0, void 0, function* () {
263
+ if (requestParameters['id'] == null) {
264
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling createFunctionVersion().');
265
+ }
266
+ if (requestParameters['createFunctionVersionRequest'] == null) {
267
+ throw new runtime.RequiredError('createFunctionVersionRequest', 'Required parameter "createFunctionVersionRequest" was null or undefined when calling createFunctionVersion().');
268
+ }
269
+ const queryParameters = {};
270
+ const headerParameters = {};
271
+ headerParameters['Content-Type'] = 'application/json';
272
+ if (requestParameters['idempotencyKey'] != null) {
273
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
274
+ }
275
+ if (this.configuration && this.configuration.accessToken) {
276
+ const token = this.configuration.accessToken;
277
+ const tokenString = yield token("bearerAuth", []);
278
+ if (tokenString) {
279
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
280
+ }
281
+ }
282
+ let urlPath = `/functions/{id}/versions`;
283
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
284
+ return {
285
+ path: urlPath,
286
+ method: 'POST',
287
+ headers: headerParameters,
288
+ query: queryParameters,
289
+ body: (0, CreateFunctionVersionRequest_1.CreateFunctionVersionRequestToJSON)(requestParameters['createFunctionVersionRequest']),
290
+ };
291
+ });
292
+ }
293
+ /**
294
+ * Declares one version of the function: the digest of its pickled code, its Python dependencies and its settings. Idempotent on `content_hash`: the same hash returns the existing version (200) instead of a new one (201). A version whose code is not uploaded yet carries an `upload` URL; PUT the bundle there, then activate the version. Requires the `functions:write` scope.
295
+ * Register a version of a function
296
+ */
297
+ createFunctionVersionRaw(requestParameters, initOverrides) {
298
+ return __awaiter(this, void 0, void 0, function* () {
299
+ const requestOptions = yield this.createFunctionVersionRequestOpts(requestParameters);
300
+ const response = yield this.request(requestOptions, initOverrides);
301
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, FunctionVersion_1.FunctionVersionFromJSON)(jsonValue));
302
+ });
303
+ }
304
+ /**
305
+ * Declares one version of the function: the digest of its pickled code, its Python dependencies and its settings. Idempotent on `content_hash`: the same hash returns the existing version (200) instead of a new one (201). A version whose code is not uploaded yet carries an `upload` URL; PUT the bundle there, then activate the version. Requires the `functions:write` scope.
306
+ * Register a version of a function
307
+ */
308
+ createFunctionVersion(requestParameters, initOverrides) {
309
+ return __awaiter(this, void 0, void 0, function* () {
310
+ const response = yield this.createFunctionVersionRaw(requestParameters, initOverrides);
311
+ return yield response.value();
312
+ });
313
+ }
314
+ /**
315
+ * Creates request options for deleteFunction without sending the request
316
+ */
317
+ deleteFunctionRequestOpts(requestParameters) {
318
+ return __awaiter(this, void 0, void 0, function* () {
319
+ if (requestParameters['id'] == null) {
320
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteFunction().');
321
+ }
322
+ const queryParameters = {};
323
+ const headerParameters = {};
324
+ if (this.configuration && this.configuration.accessToken) {
325
+ const token = this.configuration.accessToken;
326
+ const tokenString = yield token("bearerAuth", []);
327
+ if (tokenString) {
328
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
329
+ }
330
+ }
331
+ let urlPath = `/functions/{id}`;
332
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
333
+ return {
334
+ path: urlPath,
335
+ method: 'DELETE',
336
+ headers: headerParameters,
337
+ query: queryParameters,
338
+ };
339
+ });
340
+ }
341
+ /**
342
+ * The function stops taking calls, its queued calls are cancelled, a call that is executing is stopped, and its machines are released, which ends their billing. The name can be reused afterwards. Requires the `functions:write` scope.
343
+ * Delete a function
344
+ */
345
+ deleteFunctionRaw(requestParameters, initOverrides) {
346
+ return __awaiter(this, void 0, void 0, function* () {
347
+ const requestOptions = yield this.deleteFunctionRequestOpts(requestParameters);
348
+ const response = yield this.request(requestOptions, initOverrides);
349
+ return new runtime.VoidApiResponse(response);
350
+ });
351
+ }
352
+ /**
353
+ * The function stops taking calls, its queued calls are cancelled, a call that is executing is stopped, and its machines are released, which ends their billing. The name can be reused afterwards. Requires the `functions:write` scope.
354
+ * Delete a function
355
+ */
356
+ deleteFunction(requestParameters, initOverrides) {
357
+ return __awaiter(this, void 0, void 0, function* () {
358
+ yield this.deleteFunctionRaw(requestParameters, initOverrides);
359
+ });
360
+ }
361
+ /**
362
+ * Creates request options for getFunction without sending the request
363
+ */
364
+ getFunctionRequestOpts(requestParameters) {
365
+ return __awaiter(this, void 0, void 0, function* () {
366
+ if (requestParameters['id'] == null) {
367
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFunction().');
368
+ }
369
+ const queryParameters = {};
370
+ const headerParameters = {};
371
+ if (this.configuration && this.configuration.accessToken) {
372
+ const token = this.configuration.accessToken;
373
+ const tokenString = yield token("bearerAuth", []);
374
+ if (tokenString) {
375
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
376
+ }
377
+ }
378
+ let urlPath = `/functions/{id}`;
379
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
380
+ return {
381
+ path: urlPath,
382
+ method: 'GET',
383
+ headers: headerParameters,
384
+ query: queryParameters,
385
+ };
386
+ });
387
+ }
388
+ /**
389
+ * Requires the `functions:read` scope.
390
+ * Get a function
391
+ */
392
+ getFunctionRaw(requestParameters, initOverrides) {
393
+ return __awaiter(this, void 0, void 0, function* () {
394
+ const requestOptions = yield this.getFunctionRequestOpts(requestParameters);
395
+ const response = yield this.request(requestOptions, initOverrides);
396
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, Function_1.FunctionFromJSON)(jsonValue));
397
+ });
398
+ }
399
+ /**
400
+ * Requires the `functions:read` scope.
401
+ * Get a function
402
+ */
403
+ getFunction(requestParameters, initOverrides) {
404
+ return __awaiter(this, void 0, void 0, function* () {
405
+ const response = yield this.getFunctionRaw(requestParameters, initOverrides);
406
+ return yield response.value();
407
+ });
408
+ }
409
+ /**
410
+ * Creates request options for getFunctionRun without sending the request
411
+ */
412
+ getFunctionRunRequestOpts(requestParameters) {
413
+ return __awaiter(this, void 0, void 0, function* () {
414
+ if (requestParameters['id'] == null) {
415
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFunctionRun().');
416
+ }
417
+ if (requestParameters['runId'] == null) {
418
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling getFunctionRun().');
419
+ }
420
+ const queryParameters = {};
421
+ if (requestParameters['wait'] != null) {
422
+ queryParameters['wait'] = requestParameters['wait'];
423
+ }
424
+ if (requestParameters['includeResult'] != null) {
425
+ queryParameters['include_result'] = requestParameters['includeResult'];
426
+ }
427
+ const headerParameters = {};
428
+ if (this.configuration && this.configuration.accessToken) {
429
+ const token = this.configuration.accessToken;
430
+ const tokenString = yield token("bearerAuth", []);
431
+ if (tokenString) {
432
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
433
+ }
434
+ }
435
+ let urlPath = `/functions/{id}/runs/{run_id}`;
436
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
437
+ urlPath = urlPath.replace('{run_id}', encodeURIComponent(String(requestParameters['runId'])));
438
+ return {
439
+ path: urlPath,
440
+ method: 'GET',
441
+ headers: headerParameters,
442
+ query: queryParameters,
443
+ };
444
+ });
445
+ }
446
+ /**
447
+ * Returns one call. With `wait`, the request is held until the run finishes or the wait elapses, so a caller blocks on one request instead of polling. Requires the `functions:read` scope.
448
+ * Get a run
449
+ */
450
+ getFunctionRunRaw(requestParameters, initOverrides) {
451
+ return __awaiter(this, void 0, void 0, function* () {
452
+ const requestOptions = yield this.getFunctionRunRequestOpts(requestParameters);
453
+ const response = yield this.request(requestOptions, initOverrides);
454
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, FunctionRun_1.FunctionRunFromJSON)(jsonValue));
455
+ });
456
+ }
457
+ /**
458
+ * Returns one call. With `wait`, the request is held until the run finishes or the wait elapses, so a caller blocks on one request instead of polling. Requires the `functions:read` scope.
459
+ * Get a run
460
+ */
461
+ getFunctionRun(requestParameters, initOverrides) {
462
+ return __awaiter(this, void 0, void 0, function* () {
463
+ const response = yield this.getFunctionRunRaw(requestParameters, initOverrides);
464
+ return yield response.value();
465
+ });
466
+ }
467
+ /**
468
+ * Creates request options for getFunctionRunLogs without sending the request
469
+ */
470
+ getFunctionRunLogsRequestOpts(requestParameters) {
471
+ return __awaiter(this, void 0, void 0, function* () {
472
+ if (requestParameters['id'] == null) {
473
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFunctionRunLogs().');
474
+ }
475
+ if (requestParameters['runId'] == null) {
476
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling getFunctionRunLogs().');
477
+ }
478
+ const queryParameters = {};
479
+ if (requestParameters['after'] != null) {
480
+ queryParameters['after'] = requestParameters['after'];
481
+ }
482
+ if (requestParameters['limit'] != null) {
483
+ queryParameters['limit'] = requestParameters['limit'];
484
+ }
485
+ if (requestParameters['wait'] != null) {
486
+ queryParameters['wait'] = requestParameters['wait'];
487
+ }
488
+ const headerParameters = {};
489
+ if (this.configuration && this.configuration.accessToken) {
490
+ const token = this.configuration.accessToken;
491
+ const tokenString = yield token("bearerAuth", []);
492
+ if (tokenString) {
493
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
494
+ }
495
+ }
496
+ let urlPath = `/functions/{id}/runs/{run_id}/logs`;
497
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
498
+ urlPath = urlPath.replace('{run_id}', encodeURIComponent(String(requestParameters['runId'])));
499
+ return {
500
+ path: urlPath,
501
+ method: 'GET',
502
+ headers: headerParameters,
503
+ query: queryParameters,
504
+ };
505
+ });
506
+ }
507
+ /**
508
+ * Returns the run\'s stdout and stderr after `after`, oldest first. With `wait`, the request is held until there is new output or the run finishes, which is how a client follows a live run. Up to 4 MB of output is kept per run. Requires the `functions:read` scope.
509
+ * Read a run\'s output
510
+ */
511
+ getFunctionRunLogsRaw(requestParameters, initOverrides) {
512
+ return __awaiter(this, void 0, void 0, function* () {
513
+ const requestOptions = yield this.getFunctionRunLogsRequestOpts(requestParameters);
514
+ const response = yield this.request(requestOptions, initOverrides);
515
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, FunctionRunLogs_1.FunctionRunLogsFromJSON)(jsonValue));
516
+ });
517
+ }
518
+ /**
519
+ * Returns the run\'s stdout and stderr after `after`, oldest first. With `wait`, the request is held until there is new output or the run finishes, which is how a client follows a live run. Up to 4 MB of output is kept per run. Requires the `functions:read` scope.
520
+ * Read a run\'s output
521
+ */
522
+ getFunctionRunLogs(requestParameters, initOverrides) {
523
+ return __awaiter(this, void 0, void 0, function* () {
524
+ const response = yield this.getFunctionRunLogsRaw(requestParameters, initOverrides);
525
+ return yield response.value();
526
+ });
527
+ }
528
+ /**
529
+ * Creates request options for listFunctionRuns without sending the request
530
+ */
531
+ listFunctionRunsRequestOpts(requestParameters) {
532
+ return __awaiter(this, void 0, void 0, function* () {
533
+ if (requestParameters['id'] == null) {
534
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling listFunctionRuns().');
535
+ }
536
+ const queryParameters = {};
537
+ if (requestParameters['cursor'] != null) {
538
+ queryParameters['cursor'] = requestParameters['cursor'];
539
+ }
540
+ if (requestParameters['limit'] != null) {
541
+ queryParameters['limit'] = requestParameters['limit'];
542
+ }
543
+ const headerParameters = {};
544
+ if (this.configuration && this.configuration.accessToken) {
545
+ const token = this.configuration.accessToken;
546
+ const tokenString = yield token("bearerAuth", []);
547
+ if (tokenString) {
548
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
549
+ }
550
+ }
551
+ let urlPath = `/functions/{id}/runs`;
552
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
553
+ return {
554
+ path: urlPath,
555
+ method: 'GET',
556
+ headers: headerParameters,
557
+ query: queryParameters,
558
+ };
559
+ });
560
+ }
561
+ /**
562
+ * Newest first. Requires the `functions:read` scope.
563
+ * List a function\'s runs
564
+ */
565
+ listFunctionRunsRaw(requestParameters, initOverrides) {
566
+ return __awaiter(this, void 0, void 0, function* () {
567
+ const requestOptions = yield this.listFunctionRunsRequestOpts(requestParameters);
568
+ const response = yield this.request(requestOptions, initOverrides);
569
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, FunctionRunList_1.FunctionRunListFromJSON)(jsonValue));
570
+ });
571
+ }
572
+ /**
573
+ * Newest first. Requires the `functions:read` scope.
574
+ * List a function\'s runs
575
+ */
576
+ listFunctionRuns(requestParameters, initOverrides) {
577
+ return __awaiter(this, void 0, void 0, function* () {
578
+ const response = yield this.listFunctionRunsRaw(requestParameters, initOverrides);
579
+ return yield response.value();
580
+ });
581
+ }
582
+ /**
583
+ * Creates request options for listFunctions without sending the request
584
+ */
585
+ listFunctionsRequestOpts() {
586
+ return __awaiter(this, void 0, void 0, function* () {
587
+ const queryParameters = {};
588
+ const headerParameters = {};
589
+ if (this.configuration && this.configuration.accessToken) {
590
+ const token = this.configuration.accessToken;
591
+ const tokenString = yield token("bearerAuth", []);
592
+ if (tokenString) {
593
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
594
+ }
595
+ }
596
+ let urlPath = `/functions`;
597
+ return {
598
+ path: urlPath,
599
+ method: 'GET',
600
+ headers: headerParameters,
601
+ query: queryParameters,
602
+ };
603
+ });
604
+ }
605
+ /**
606
+ * Returns the organization\'s functions, newest first, each with the settings of its current version, what its machines are doing and what it cost in the last 24 hours. Requires the `functions:read` scope.
607
+ * List functions
608
+ */
609
+ listFunctionsRaw(initOverrides) {
610
+ return __awaiter(this, void 0, void 0, function* () {
611
+ const requestOptions = yield this.listFunctionsRequestOpts();
612
+ const response = yield this.request(requestOptions, initOverrides);
613
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, FunctionList_1.FunctionListFromJSON)(jsonValue));
614
+ });
615
+ }
616
+ /**
617
+ * Returns the organization\'s functions, newest first, each with the settings of its current version, what its machines are doing and what it cost in the last 24 hours. Requires the `functions:read` scope.
618
+ * List functions
619
+ */
620
+ listFunctions(initOverrides) {
621
+ return __awaiter(this, void 0, void 0, function* () {
622
+ const response = yield this.listFunctionsRaw(initOverrides);
623
+ return yield response.value();
624
+ });
625
+ }
626
+ }
627
+ exports.FunctionsApi = FunctionsApi;
@@ -3,6 +3,7 @@ export * from './BillingApi';
3
3
  export * from './CommunityApi';
4
4
  export * from './EnvironmentsApi';
5
5
  export * from './FineTuningApi';
6
+ export * from './FunctionsApi';
6
7
  export * from './GpuTypesApi';
7
8
  export * from './InferenceApi';
8
9
  export * from './InstancesApi';
@@ -21,6 +21,7 @@ __exportStar(require("./BillingApi"), exports);
21
21
  __exportStar(require("./CommunityApi"), exports);
22
22
  __exportStar(require("./EnvironmentsApi"), exports);
23
23
  __exportStar(require("./FineTuningApi"), exports);
24
+ __exportStar(require("./FunctionsApi"), exports);
24
25
  __exportStar(require("./GpuTypesApi"), exports);
25
26
  __exportStar(require("./InferenceApi"), exports);
26
27
  __exportStar(require("./InstancesApi"), exports);