@gpuai/sdk 0.3.18 → 0.4.1

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 (187) hide show
  1. package/.openapi-generator/FILES +48 -0
  2. package/README.md +41 -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/InstancesApi.d.ts +18 -0
  8. package/dist/apis/InstancesApi.js +49 -0
  9. package/dist/apis/index.d.ts +1 -0
  10. package/dist/apis/index.js +1 -0
  11. package/dist/esm/apis/BillingApi.d.ts +70 -0
  12. package/dist/esm/apis/BillingApi.js +197 -0
  13. package/dist/esm/apis/FunctionsApi.d.ts +228 -0
  14. package/dist/esm/apis/FunctionsApi.js +623 -0
  15. package/dist/esm/apis/InstancesApi.d.ts +18 -0
  16. package/dist/esm/apis/InstancesApi.js +49 -0
  17. package/dist/esm/apis/index.d.ts +1 -0
  18. package/dist/esm/apis/index.js +1 -0
  19. package/dist/esm/models/AutolaunchRule.d.ts +2 -1
  20. package/dist/esm/models/BillingDetails.d.ts +98 -0
  21. package/dist/esm/models/BillingDetails.js +85 -0
  22. package/dist/esm/models/CreateFunctionRequest.d.ts +32 -0
  23. package/dist/esm/models/CreateFunctionRequest.js +43 -0
  24. package/dist/esm/models/CreateFunctionRunRequest.d.ts +38 -0
  25. package/dist/esm/models/CreateFunctionRunRequest.js +45 -0
  26. package/dist/esm/models/CreateFunctionVersionRequest.d.ts +110 -0
  27. package/dist/esm/models/CreateFunctionVersionRequest.js +79 -0
  28. package/dist/esm/models/Function.d.ts +163 -0
  29. package/dist/esm/models/Function.js +109 -0
  30. package/dist/esm/models/FunctionList.d.ts +33 -0
  31. package/dist/esm/models/FunctionList.js +44 -0
  32. package/dist/esm/models/FunctionReplicaCounts.d.ts +44 -0
  33. package/dist/esm/models/FunctionReplicaCounts.js +51 -0
  34. package/dist/esm/models/FunctionRun.d.ts +130 -0
  35. package/dist/esm/models/FunctionRun.js +94 -0
  36. package/dist/esm/models/FunctionRunError.d.ts +44 -0
  37. package/dist/esm/models/FunctionRunError.js +49 -0
  38. package/dist/esm/models/FunctionRunList.d.ts +39 -0
  39. package/dist/esm/models/FunctionRunList.js +48 -0
  40. package/dist/esm/models/FunctionRunLogChunk.d.ts +59 -0
  41. package/dist/esm/models/FunctionRunLogChunk.js +63 -0
  42. package/dist/esm/models/FunctionRunLogs.d.ts +45 -0
  43. package/dist/esm/models/FunctionRunLogs.js +52 -0
  44. package/dist/esm/models/FunctionUpload.d.ts +51 -0
  45. package/dist/esm/models/FunctionUpload.js +59 -0
  46. package/dist/esm/models/FunctionVersion.d.ts +137 -0
  47. package/dist/esm/models/FunctionVersion.js +109 -0
  48. package/dist/esm/models/GpuSuggestion.d.ts +82 -0
  49. package/dist/esm/models/GpuSuggestion.js +77 -0
  50. package/dist/esm/models/GpuSuggestionCheaper.d.ts +62 -0
  51. package/dist/esm/models/GpuSuggestionCheaper.js +63 -0
  52. package/dist/esm/models/GpuSuggestionGpu.d.ts +50 -0
  53. package/dist/esm/models/GpuSuggestionGpu.js +55 -0
  54. package/dist/esm/models/Instance.d.ts +7 -0
  55. package/dist/esm/models/Instance.js +3 -0
  56. package/dist/esm/models/InstanceGpuMemory.d.ts +51 -0
  57. package/dist/esm/models/InstanceGpuMemory.js +55 -0
  58. package/dist/esm/models/Invoice.d.ts +68 -0
  59. package/dist/esm/models/Invoice.js +67 -0
  60. package/dist/esm/models/InvoiceList.d.ts +45 -0
  61. package/dist/esm/models/InvoiceList.js +50 -0
  62. package/dist/esm/models/ModelPricing.d.ts +46 -0
  63. package/dist/esm/models/ModelPricing.js +21 -0
  64. package/dist/esm/models/ModelRate.d.ts +62 -0
  65. package/dist/esm/models/ModelRate.js +51 -0
  66. package/dist/esm/models/PeakWindow.d.ts +38 -0
  67. package/dist/esm/models/PeakWindow.js +47 -0
  68. package/dist/esm/models/UpdateBillingDetailsRequest.d.ts +80 -0
  69. package/dist/esm/models/UpdateBillingDetailsRequest.js +57 -0
  70. package/dist/esm/models/index.d.ts +23 -0
  71. package/dist/esm/models/index.js +23 -0
  72. package/dist/esm/runtime.js +1 -1
  73. package/dist/models/AutolaunchRule.d.ts +2 -1
  74. package/dist/models/BillingDetails.d.ts +98 -0
  75. package/dist/models/BillingDetails.js +92 -0
  76. package/dist/models/CreateFunctionRequest.d.ts +32 -0
  77. package/dist/models/CreateFunctionRequest.js +50 -0
  78. package/dist/models/CreateFunctionRunRequest.d.ts +38 -0
  79. package/dist/models/CreateFunctionRunRequest.js +52 -0
  80. package/dist/models/CreateFunctionVersionRequest.d.ts +110 -0
  81. package/dist/models/CreateFunctionVersionRequest.js +86 -0
  82. package/dist/models/Function.d.ts +163 -0
  83. package/dist/models/Function.js +117 -0
  84. package/dist/models/FunctionList.d.ts +33 -0
  85. package/dist/models/FunctionList.js +51 -0
  86. package/dist/models/FunctionReplicaCounts.d.ts +44 -0
  87. package/dist/models/FunctionReplicaCounts.js +58 -0
  88. package/dist/models/FunctionRun.d.ts +130 -0
  89. package/dist/models/FunctionRun.js +102 -0
  90. package/dist/models/FunctionRunError.d.ts +44 -0
  91. package/dist/models/FunctionRunError.js +56 -0
  92. package/dist/models/FunctionRunList.d.ts +39 -0
  93. package/dist/models/FunctionRunList.js +55 -0
  94. package/dist/models/FunctionRunLogChunk.d.ts +59 -0
  95. package/dist/models/FunctionRunLogChunk.js +71 -0
  96. package/dist/models/FunctionRunLogs.d.ts +45 -0
  97. package/dist/models/FunctionRunLogs.js +59 -0
  98. package/dist/models/FunctionUpload.d.ts +51 -0
  99. package/dist/models/FunctionUpload.js +67 -0
  100. package/dist/models/FunctionVersion.d.ts +137 -0
  101. package/dist/models/FunctionVersion.js +117 -0
  102. package/dist/models/GpuSuggestion.d.ts +82 -0
  103. package/dist/models/GpuSuggestion.js +85 -0
  104. package/dist/models/GpuSuggestionCheaper.d.ts +62 -0
  105. package/dist/models/GpuSuggestionCheaper.js +70 -0
  106. package/dist/models/GpuSuggestionGpu.d.ts +50 -0
  107. package/dist/models/GpuSuggestionGpu.js +62 -0
  108. package/dist/models/Instance.d.ts +7 -0
  109. package/dist/models/Instance.js +3 -0
  110. package/dist/models/InstanceGpuMemory.d.ts +51 -0
  111. package/dist/models/InstanceGpuMemory.js +62 -0
  112. package/dist/models/Invoice.d.ts +68 -0
  113. package/dist/models/Invoice.js +74 -0
  114. package/dist/models/InvoiceList.d.ts +45 -0
  115. package/dist/models/InvoiceList.js +57 -0
  116. package/dist/models/ModelPricing.d.ts +46 -0
  117. package/dist/models/ModelPricing.js +22 -0
  118. package/dist/models/ModelRate.d.ts +62 -0
  119. package/dist/models/ModelRate.js +58 -0
  120. package/dist/models/PeakWindow.d.ts +38 -0
  121. package/dist/models/PeakWindow.js +54 -0
  122. package/dist/models/UpdateBillingDetailsRequest.d.ts +80 -0
  123. package/dist/models/UpdateBillingDetailsRequest.js +64 -0
  124. package/dist/models/index.d.ts +23 -0
  125. package/dist/models/index.js +23 -0
  126. package/dist/runtime.js +1 -1
  127. package/docs/BillingApi.md +299 -0
  128. package/docs/BillingDetails.md +56 -0
  129. package/docs/CreateFunctionRequest.md +34 -0
  130. package/docs/CreateFunctionRunRequest.md +36 -0
  131. package/docs/CreateFunctionVersionRequest.md +60 -0
  132. package/docs/Function.md +75 -0
  133. package/docs/FunctionList.md +34 -0
  134. package/docs/FunctionReplicaCounts.md +39 -0
  135. package/docs/FunctionRun.md +63 -0
  136. package/docs/FunctionRunError.md +38 -0
  137. package/docs/FunctionRunList.md +36 -0
  138. package/docs/FunctionRunLogChunk.md +40 -0
  139. package/docs/FunctionRunLogs.md +38 -0
  140. package/docs/FunctionUpload.md +38 -0
  141. package/docs/FunctionVersion.md +66 -0
  142. package/docs/FunctionsApi.md +880 -0
  143. package/docs/GpuSuggestion.md +47 -0
  144. package/docs/GpuSuggestionCheaper.md +45 -0
  145. package/docs/GpuSuggestionGpu.md +41 -0
  146. package/docs/Instance.md +2 -0
  147. package/docs/InstanceGpuMemory.md +41 -0
  148. package/docs/InstancesApi.md +75 -0
  149. package/docs/Invoice.md +46 -0
  150. package/docs/InvoiceList.md +38 -0
  151. package/docs/ModelPricing.md +12 -0
  152. package/docs/ModelRate.md +45 -0
  153. package/docs/PeakWindow.md +37 -0
  154. package/docs/UpdateBillingDetailsRequest.md +50 -0
  155. package/package.json +1 -1
  156. package/src/apis/BillingApi.ts +247 -0
  157. package/src/apis/FunctionsApi.ts +828 -0
  158. package/src/apis/InstancesApi.ts +64 -0
  159. package/src/apis/index.ts +1 -0
  160. package/src/models/AutolaunchRule.ts +2 -1
  161. package/src/models/BillingDetails.ts +164 -0
  162. package/src/models/CreateFunctionRequest.ts +66 -0
  163. package/src/models/CreateFunctionRunRequest.ts +74 -0
  164. package/src/models/CreateFunctionVersionRequest.ts +175 -0
  165. package/src/models/Function.ts +255 -0
  166. package/src/models/FunctionList.ts +74 -0
  167. package/src/models/FunctionReplicaCounts.ts +84 -0
  168. package/src/models/FunctionRun.ts +207 -0
  169. package/src/models/FunctionRunError.ts +83 -0
  170. package/src/models/FunctionRunList.ts +83 -0
  171. package/src/models/FunctionRunLogChunk.ts +105 -0
  172. package/src/models/FunctionRunLogs.ts +92 -0
  173. package/src/models/FunctionUpload.ts +96 -0
  174. package/src/models/FunctionVersion.ts +226 -0
  175. package/src/models/GpuSuggestion.ts +150 -0
  176. package/src/models/GpuSuggestionCheaper.ts +111 -0
  177. package/src/models/GpuSuggestionGpu.ts +93 -0
  178. package/src/models/Instance.ts +15 -0
  179. package/src/models/InstanceGpuMemory.ts +94 -0
  180. package/src/models/Invoice.ts +120 -0
  181. package/src/models/InvoiceList.ts +91 -0
  182. package/src/models/ModelPricing.ts +74 -0
  183. package/src/models/ModelRate.ts +105 -0
  184. package/src/models/PeakWindow.ts +75 -0
  185. package/src/models/UpdateBillingDetailsRequest.ts +129 -0
  186. package/src/models/index.ts +23 -0
  187. package/src/runtime.ts +1 -1
@@ -0,0 +1,623 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * GPU.ai Public Developer API
5
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@gpu.ai
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ import * as runtime from '../runtime';
24
+ import { CreateFunctionRequestToJSON, } from '../models/CreateFunctionRequest';
25
+ import { CreateFunctionRunRequestToJSON, } from '../models/CreateFunctionRunRequest';
26
+ import { CreateFunctionVersionRequestToJSON, } from '../models/CreateFunctionVersionRequest';
27
+ import { FunctionFromJSON, } from '../models/Function';
28
+ import { FunctionListFromJSON, } from '../models/FunctionList';
29
+ import { FunctionRunFromJSON, } from '../models/FunctionRun';
30
+ import { FunctionRunListFromJSON, } from '../models/FunctionRunList';
31
+ import { FunctionRunLogsFromJSON, } from '../models/FunctionRunLogs';
32
+ import { FunctionVersionFromJSON, } from '../models/FunctionVersion';
33
+ /**
34
+ *
35
+ */
36
+ export class FunctionsApi extends runtime.BaseAPI {
37
+ /**
38
+ * Creates request options for activateFunctionVersion without sending the request
39
+ */
40
+ activateFunctionVersionRequestOpts(requestParameters) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ if (requestParameters['id'] == null) {
43
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling activateFunctionVersion().');
44
+ }
45
+ if (requestParameters['versionId'] == null) {
46
+ throw new runtime.RequiredError('versionId', 'Required parameter "versionId" was null or undefined when calling activateFunctionVersion().');
47
+ }
48
+ const queryParameters = {};
49
+ const headerParameters = {};
50
+ if (requestParameters['idempotencyKey'] != null) {
51
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
52
+ }
53
+ if (this.configuration && this.configuration.accessToken) {
54
+ const token = this.configuration.accessToken;
55
+ const tokenString = yield token("bearerAuth", []);
56
+ if (tokenString) {
57
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
58
+ }
59
+ }
60
+ let urlPath = `/functions/{id}/versions/{version_id}/activate`;
61
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
62
+ urlPath = urlPath.replace('{version_id}', encodeURIComponent(String(requestParameters['versionId'])));
63
+ return {
64
+ path: urlPath,
65
+ method: 'POST',
66
+ headers: headerParameters,
67
+ query: queryParameters,
68
+ };
69
+ });
70
+ }
71
+ /**
72
+ * 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.
73
+ * Confirm a version\'s upload and make it current
74
+ */
75
+ activateFunctionVersionRaw(requestParameters, initOverrides) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const requestOptions = yield this.activateFunctionVersionRequestOpts(requestParameters);
78
+ const response = yield this.request(requestOptions, initOverrides);
79
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionVersionFromJSON(jsonValue));
80
+ });
81
+ }
82
+ /**
83
+ * 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.
84
+ * Confirm a version\'s upload and make it current
85
+ */
86
+ activateFunctionVersion(requestParameters, initOverrides) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const response = yield this.activateFunctionVersionRaw(requestParameters, initOverrides);
89
+ return yield response.value();
90
+ });
91
+ }
92
+ /**
93
+ * Creates request options for cancelFunctionRun without sending the request
94
+ */
95
+ cancelFunctionRunRequestOpts(requestParameters) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ if (requestParameters['id'] == null) {
98
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling cancelFunctionRun().');
99
+ }
100
+ if (requestParameters['runId'] == null) {
101
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling cancelFunctionRun().');
102
+ }
103
+ const queryParameters = {};
104
+ const headerParameters = {};
105
+ if (requestParameters['idempotencyKey'] != null) {
106
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
107
+ }
108
+ if (this.configuration && this.configuration.accessToken) {
109
+ const token = this.configuration.accessToken;
110
+ const tokenString = yield token("bearerAuth", []);
111
+ if (tokenString) {
112
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
113
+ }
114
+ }
115
+ let urlPath = `/functions/{id}/runs/{run_id}/cancel`;
116
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
117
+ urlPath = urlPath.replace('{run_id}', encodeURIComponent(String(requestParameters['runId'])));
118
+ return {
119
+ path: urlPath,
120
+ method: 'POST',
121
+ headers: headerParameters,
122
+ query: queryParameters,
123
+ };
124
+ });
125
+ }
126
+ /**
127
+ * 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.
128
+ * Cancel a run
129
+ */
130
+ cancelFunctionRunRaw(requestParameters, initOverrides) {
131
+ return __awaiter(this, void 0, void 0, function* () {
132
+ const requestOptions = yield this.cancelFunctionRunRequestOpts(requestParameters);
133
+ const response = yield this.request(requestOptions, initOverrides);
134
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionRunFromJSON(jsonValue));
135
+ });
136
+ }
137
+ /**
138
+ * 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.
139
+ * Cancel a run
140
+ */
141
+ cancelFunctionRun(requestParameters, initOverrides) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ const response = yield this.cancelFunctionRunRaw(requestParameters, initOverrides);
144
+ return yield response.value();
145
+ });
146
+ }
147
+ /**
148
+ * Creates request options for createFunction without sending the request
149
+ */
150
+ createFunctionRequestOpts(requestParameters) {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ if (requestParameters['createFunctionRequest'] == null) {
153
+ throw new runtime.RequiredError('createFunctionRequest', 'Required parameter "createFunctionRequest" was null or undefined when calling createFunction().');
154
+ }
155
+ const queryParameters = {};
156
+ const headerParameters = {};
157
+ headerParameters['Content-Type'] = 'application/json';
158
+ if (requestParameters['idempotencyKey'] != null) {
159
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
160
+ }
161
+ if (this.configuration && this.configuration.accessToken) {
162
+ const token = this.configuration.accessToken;
163
+ const tokenString = yield token("bearerAuth", []);
164
+ if (tokenString) {
165
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
166
+ }
167
+ }
168
+ let urlPath = `/functions`;
169
+ return {
170
+ path: urlPath,
171
+ method: 'POST',
172
+ headers: headerParameters,
173
+ query: queryParameters,
174
+ body: CreateFunctionRequestToJSON(requestParameters['createFunctionRequest']),
175
+ };
176
+ });
177
+ }
178
+ /**
179
+ * 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.
180
+ * Get or create a function by name
181
+ */
182
+ createFunctionRaw(requestParameters, initOverrides) {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ const requestOptions = yield this.createFunctionRequestOpts(requestParameters);
185
+ const response = yield this.request(requestOptions, initOverrides);
186
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionFromJSON(jsonValue));
187
+ });
188
+ }
189
+ /**
190
+ * 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.
191
+ * Get or create a function by name
192
+ */
193
+ createFunction(requestParameters, initOverrides) {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ const response = yield this.createFunctionRaw(requestParameters, initOverrides);
196
+ return yield response.value();
197
+ });
198
+ }
199
+ /**
200
+ * Creates request options for createFunctionRun without sending the request
201
+ */
202
+ createFunctionRunRequestOpts(requestParameters) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ if (requestParameters['id'] == null) {
205
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling createFunctionRun().');
206
+ }
207
+ if (requestParameters['createFunctionRunRequest'] == null) {
208
+ throw new runtime.RequiredError('createFunctionRunRequest', 'Required parameter "createFunctionRunRequest" was null or undefined when calling createFunctionRun().');
209
+ }
210
+ const queryParameters = {};
211
+ const headerParameters = {};
212
+ headerParameters['Content-Type'] = 'application/json';
213
+ if (requestParameters['idempotencyKey'] != null) {
214
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
215
+ }
216
+ if (this.configuration && this.configuration.accessToken) {
217
+ const token = this.configuration.accessToken;
218
+ const tokenString = yield token("bearerAuth", []);
219
+ if (tokenString) {
220
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
221
+ }
222
+ }
223
+ let urlPath = `/functions/{id}/runs`;
224
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
225
+ return {
226
+ path: urlPath,
227
+ method: 'POST',
228
+ headers: headerParameters,
229
+ query: queryParameters,
230
+ body: CreateFunctionRunRequestToJSON(requestParameters['createFunctionRunRequest']),
231
+ };
232
+ });
233
+ }
234
+ /**
235
+ * 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.
236
+ * Call a function
237
+ */
238
+ createFunctionRunRaw(requestParameters, initOverrides) {
239
+ return __awaiter(this, void 0, void 0, function* () {
240
+ const requestOptions = yield this.createFunctionRunRequestOpts(requestParameters);
241
+ const response = yield this.request(requestOptions, initOverrides);
242
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionRunFromJSON(jsonValue));
243
+ });
244
+ }
245
+ /**
246
+ * 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.
247
+ * Call a function
248
+ */
249
+ createFunctionRun(requestParameters, initOverrides) {
250
+ return __awaiter(this, void 0, void 0, function* () {
251
+ const response = yield this.createFunctionRunRaw(requestParameters, initOverrides);
252
+ return yield response.value();
253
+ });
254
+ }
255
+ /**
256
+ * Creates request options for createFunctionVersion without sending the request
257
+ */
258
+ createFunctionVersionRequestOpts(requestParameters) {
259
+ return __awaiter(this, void 0, void 0, function* () {
260
+ if (requestParameters['id'] == null) {
261
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling createFunctionVersion().');
262
+ }
263
+ if (requestParameters['createFunctionVersionRequest'] == null) {
264
+ throw new runtime.RequiredError('createFunctionVersionRequest', 'Required parameter "createFunctionVersionRequest" was null or undefined when calling createFunctionVersion().');
265
+ }
266
+ const queryParameters = {};
267
+ const headerParameters = {};
268
+ headerParameters['Content-Type'] = 'application/json';
269
+ if (requestParameters['idempotencyKey'] != null) {
270
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
271
+ }
272
+ if (this.configuration && this.configuration.accessToken) {
273
+ const token = this.configuration.accessToken;
274
+ const tokenString = yield token("bearerAuth", []);
275
+ if (tokenString) {
276
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
277
+ }
278
+ }
279
+ let urlPath = `/functions/{id}/versions`;
280
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
281
+ return {
282
+ path: urlPath,
283
+ method: 'POST',
284
+ headers: headerParameters,
285
+ query: queryParameters,
286
+ body: CreateFunctionVersionRequestToJSON(requestParameters['createFunctionVersionRequest']),
287
+ };
288
+ });
289
+ }
290
+ /**
291
+ * 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.
292
+ * Register a version of a function
293
+ */
294
+ createFunctionVersionRaw(requestParameters, initOverrides) {
295
+ return __awaiter(this, void 0, void 0, function* () {
296
+ const requestOptions = yield this.createFunctionVersionRequestOpts(requestParameters);
297
+ const response = yield this.request(requestOptions, initOverrides);
298
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionVersionFromJSON(jsonValue));
299
+ });
300
+ }
301
+ /**
302
+ * 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.
303
+ * Register a version of a function
304
+ */
305
+ createFunctionVersion(requestParameters, initOverrides) {
306
+ return __awaiter(this, void 0, void 0, function* () {
307
+ const response = yield this.createFunctionVersionRaw(requestParameters, initOverrides);
308
+ return yield response.value();
309
+ });
310
+ }
311
+ /**
312
+ * Creates request options for deleteFunction without sending the request
313
+ */
314
+ deleteFunctionRequestOpts(requestParameters) {
315
+ return __awaiter(this, void 0, void 0, function* () {
316
+ if (requestParameters['id'] == null) {
317
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteFunction().');
318
+ }
319
+ const queryParameters = {};
320
+ const headerParameters = {};
321
+ if (this.configuration && this.configuration.accessToken) {
322
+ const token = this.configuration.accessToken;
323
+ const tokenString = yield token("bearerAuth", []);
324
+ if (tokenString) {
325
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
326
+ }
327
+ }
328
+ let urlPath = `/functions/{id}`;
329
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
330
+ return {
331
+ path: urlPath,
332
+ method: 'DELETE',
333
+ headers: headerParameters,
334
+ query: queryParameters,
335
+ };
336
+ });
337
+ }
338
+ /**
339
+ * 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.
340
+ * Delete a function
341
+ */
342
+ deleteFunctionRaw(requestParameters, initOverrides) {
343
+ return __awaiter(this, void 0, void 0, function* () {
344
+ const requestOptions = yield this.deleteFunctionRequestOpts(requestParameters);
345
+ const response = yield this.request(requestOptions, initOverrides);
346
+ return new runtime.VoidApiResponse(response);
347
+ });
348
+ }
349
+ /**
350
+ * 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.
351
+ * Delete a function
352
+ */
353
+ deleteFunction(requestParameters, initOverrides) {
354
+ return __awaiter(this, void 0, void 0, function* () {
355
+ yield this.deleteFunctionRaw(requestParameters, initOverrides);
356
+ });
357
+ }
358
+ /**
359
+ * Creates request options for getFunction without sending the request
360
+ */
361
+ getFunctionRequestOpts(requestParameters) {
362
+ return __awaiter(this, void 0, void 0, function* () {
363
+ if (requestParameters['id'] == null) {
364
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFunction().');
365
+ }
366
+ const queryParameters = {};
367
+ const headerParameters = {};
368
+ if (this.configuration && this.configuration.accessToken) {
369
+ const token = this.configuration.accessToken;
370
+ const tokenString = yield token("bearerAuth", []);
371
+ if (tokenString) {
372
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
373
+ }
374
+ }
375
+ let urlPath = `/functions/{id}`;
376
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
377
+ return {
378
+ path: urlPath,
379
+ method: 'GET',
380
+ headers: headerParameters,
381
+ query: queryParameters,
382
+ };
383
+ });
384
+ }
385
+ /**
386
+ * Requires the `functions:read` scope.
387
+ * Get a function
388
+ */
389
+ getFunctionRaw(requestParameters, initOverrides) {
390
+ return __awaiter(this, void 0, void 0, function* () {
391
+ const requestOptions = yield this.getFunctionRequestOpts(requestParameters);
392
+ const response = yield this.request(requestOptions, initOverrides);
393
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionFromJSON(jsonValue));
394
+ });
395
+ }
396
+ /**
397
+ * Requires the `functions:read` scope.
398
+ * Get a function
399
+ */
400
+ getFunction(requestParameters, initOverrides) {
401
+ return __awaiter(this, void 0, void 0, function* () {
402
+ const response = yield this.getFunctionRaw(requestParameters, initOverrides);
403
+ return yield response.value();
404
+ });
405
+ }
406
+ /**
407
+ * Creates request options for getFunctionRun without sending the request
408
+ */
409
+ getFunctionRunRequestOpts(requestParameters) {
410
+ return __awaiter(this, void 0, void 0, function* () {
411
+ if (requestParameters['id'] == null) {
412
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFunctionRun().');
413
+ }
414
+ if (requestParameters['runId'] == null) {
415
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling getFunctionRun().');
416
+ }
417
+ const queryParameters = {};
418
+ if (requestParameters['wait'] != null) {
419
+ queryParameters['wait'] = requestParameters['wait'];
420
+ }
421
+ if (requestParameters['includeResult'] != null) {
422
+ queryParameters['include_result'] = requestParameters['includeResult'];
423
+ }
424
+ const headerParameters = {};
425
+ if (this.configuration && this.configuration.accessToken) {
426
+ const token = this.configuration.accessToken;
427
+ const tokenString = yield token("bearerAuth", []);
428
+ if (tokenString) {
429
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
430
+ }
431
+ }
432
+ let urlPath = `/functions/{id}/runs/{run_id}`;
433
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
434
+ urlPath = urlPath.replace('{run_id}', encodeURIComponent(String(requestParameters['runId'])));
435
+ return {
436
+ path: urlPath,
437
+ method: 'GET',
438
+ headers: headerParameters,
439
+ query: queryParameters,
440
+ };
441
+ });
442
+ }
443
+ /**
444
+ * 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.
445
+ * Get a run
446
+ */
447
+ getFunctionRunRaw(requestParameters, initOverrides) {
448
+ return __awaiter(this, void 0, void 0, function* () {
449
+ const requestOptions = yield this.getFunctionRunRequestOpts(requestParameters);
450
+ const response = yield this.request(requestOptions, initOverrides);
451
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionRunFromJSON(jsonValue));
452
+ });
453
+ }
454
+ /**
455
+ * 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.
456
+ * Get a run
457
+ */
458
+ getFunctionRun(requestParameters, initOverrides) {
459
+ return __awaiter(this, void 0, void 0, function* () {
460
+ const response = yield this.getFunctionRunRaw(requestParameters, initOverrides);
461
+ return yield response.value();
462
+ });
463
+ }
464
+ /**
465
+ * Creates request options for getFunctionRunLogs without sending the request
466
+ */
467
+ getFunctionRunLogsRequestOpts(requestParameters) {
468
+ return __awaiter(this, void 0, void 0, function* () {
469
+ if (requestParameters['id'] == null) {
470
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getFunctionRunLogs().');
471
+ }
472
+ if (requestParameters['runId'] == null) {
473
+ throw new runtime.RequiredError('runId', 'Required parameter "runId" was null or undefined when calling getFunctionRunLogs().');
474
+ }
475
+ const queryParameters = {};
476
+ if (requestParameters['after'] != null) {
477
+ queryParameters['after'] = requestParameters['after'];
478
+ }
479
+ if (requestParameters['limit'] != null) {
480
+ queryParameters['limit'] = requestParameters['limit'];
481
+ }
482
+ if (requestParameters['wait'] != null) {
483
+ queryParameters['wait'] = requestParameters['wait'];
484
+ }
485
+ const headerParameters = {};
486
+ if (this.configuration && this.configuration.accessToken) {
487
+ const token = this.configuration.accessToken;
488
+ const tokenString = yield token("bearerAuth", []);
489
+ if (tokenString) {
490
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
491
+ }
492
+ }
493
+ let urlPath = `/functions/{id}/runs/{run_id}/logs`;
494
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
495
+ urlPath = urlPath.replace('{run_id}', encodeURIComponent(String(requestParameters['runId'])));
496
+ return {
497
+ path: urlPath,
498
+ method: 'GET',
499
+ headers: headerParameters,
500
+ query: queryParameters,
501
+ };
502
+ });
503
+ }
504
+ /**
505
+ * 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.
506
+ * Read a run\'s output
507
+ */
508
+ getFunctionRunLogsRaw(requestParameters, initOverrides) {
509
+ return __awaiter(this, void 0, void 0, function* () {
510
+ const requestOptions = yield this.getFunctionRunLogsRequestOpts(requestParameters);
511
+ const response = yield this.request(requestOptions, initOverrides);
512
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionRunLogsFromJSON(jsonValue));
513
+ });
514
+ }
515
+ /**
516
+ * 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.
517
+ * Read a run\'s output
518
+ */
519
+ getFunctionRunLogs(requestParameters, initOverrides) {
520
+ return __awaiter(this, void 0, void 0, function* () {
521
+ const response = yield this.getFunctionRunLogsRaw(requestParameters, initOverrides);
522
+ return yield response.value();
523
+ });
524
+ }
525
+ /**
526
+ * Creates request options for listFunctionRuns without sending the request
527
+ */
528
+ listFunctionRunsRequestOpts(requestParameters) {
529
+ return __awaiter(this, void 0, void 0, function* () {
530
+ if (requestParameters['id'] == null) {
531
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling listFunctionRuns().');
532
+ }
533
+ const queryParameters = {};
534
+ if (requestParameters['cursor'] != null) {
535
+ queryParameters['cursor'] = requestParameters['cursor'];
536
+ }
537
+ if (requestParameters['limit'] != null) {
538
+ queryParameters['limit'] = requestParameters['limit'];
539
+ }
540
+ const headerParameters = {};
541
+ if (this.configuration && this.configuration.accessToken) {
542
+ const token = this.configuration.accessToken;
543
+ const tokenString = yield token("bearerAuth", []);
544
+ if (tokenString) {
545
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
546
+ }
547
+ }
548
+ let urlPath = `/functions/{id}/runs`;
549
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
550
+ return {
551
+ path: urlPath,
552
+ method: 'GET',
553
+ headers: headerParameters,
554
+ query: queryParameters,
555
+ };
556
+ });
557
+ }
558
+ /**
559
+ * Newest first. Requires the `functions:read` scope.
560
+ * List a function\'s runs
561
+ */
562
+ listFunctionRunsRaw(requestParameters, initOverrides) {
563
+ return __awaiter(this, void 0, void 0, function* () {
564
+ const requestOptions = yield this.listFunctionRunsRequestOpts(requestParameters);
565
+ const response = yield this.request(requestOptions, initOverrides);
566
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionRunListFromJSON(jsonValue));
567
+ });
568
+ }
569
+ /**
570
+ * Newest first. Requires the `functions:read` scope.
571
+ * List a function\'s runs
572
+ */
573
+ listFunctionRuns(requestParameters, initOverrides) {
574
+ return __awaiter(this, void 0, void 0, function* () {
575
+ const response = yield this.listFunctionRunsRaw(requestParameters, initOverrides);
576
+ return yield response.value();
577
+ });
578
+ }
579
+ /**
580
+ * Creates request options for listFunctions without sending the request
581
+ */
582
+ listFunctionsRequestOpts() {
583
+ return __awaiter(this, void 0, void 0, function* () {
584
+ const queryParameters = {};
585
+ const headerParameters = {};
586
+ if (this.configuration && this.configuration.accessToken) {
587
+ const token = this.configuration.accessToken;
588
+ const tokenString = yield token("bearerAuth", []);
589
+ if (tokenString) {
590
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
591
+ }
592
+ }
593
+ let urlPath = `/functions`;
594
+ return {
595
+ path: urlPath,
596
+ method: 'GET',
597
+ headers: headerParameters,
598
+ query: queryParameters,
599
+ };
600
+ });
601
+ }
602
+ /**
603
+ * 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.
604
+ * List functions
605
+ */
606
+ listFunctionsRaw(initOverrides) {
607
+ return __awaiter(this, void 0, void 0, function* () {
608
+ const requestOptions = yield this.listFunctionsRequestOpts();
609
+ const response = yield this.request(requestOptions, initOverrides);
610
+ return new runtime.JSONApiResponse(response, (jsonValue) => FunctionListFromJSON(jsonValue));
611
+ });
612
+ }
613
+ /**
614
+ * 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.
615
+ * List functions
616
+ */
617
+ listFunctions(initOverrides) {
618
+ return __awaiter(this, void 0, void 0, function* () {
619
+ const response = yield this.listFunctionsRaw(initOverrides);
620
+ return yield response.value();
621
+ });
622
+ }
623
+ }
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import * as runtime from '../runtime';
13
13
  import { type CreateInstanceRequest } from '../models/CreateInstanceRequest';
14
+ import { type GpuSuggestion } from '../models/GpuSuggestion';
14
15
  import { type Instance } from '../models/Instance';
15
16
  import { type InstancePage } from '../models/InstancePage';
16
17
  import { type Operation } from '../models/Operation';
@@ -27,6 +28,9 @@ export interface GetInstanceRequest {
27
28
  id: string;
28
29
  include?: GetInstanceIncludeEnum;
29
30
  }
31
+ export interface GetInstanceGpuSuggestionRequest {
32
+ id: string;
33
+ }
30
34
  export interface ListInstancesRequest {
31
35
  cursor?: string;
32
36
  limit?: number;
@@ -79,6 +83,20 @@ export declare class InstancesApi extends runtime.BaseAPI {
79
83
  * Get an instance
80
84
  */
81
85
  getInstance(requestParameters: GetInstanceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Instance>;
86
+ /**
87
+ * Creates request options for getInstanceGpuSuggestion without sending the request
88
+ */
89
+ getInstanceGpuSuggestionRequestOpts(requestParameters: GetInstanceGpuSuggestionRequest): Promise<runtime.RequestOpts>;
90
+ /**
91
+ * Compares the highest GPU memory this instance has used (its `gpu_memory` peak, plus headroom) with the GPU models currently listed, and names the cheapest model that would have fit when the saving is worth a look. It never changes anything: it reports what the telemetry shows. Memory use can grow later, so treat it as a starting point. `status` is `insufficient_data` until the instance has about an hour of telemetry, `no_cheaper_fit` when no cheaper listed model covers the peak, and `suggestion` when one does. Requires the `instances:read` scope. An instance owned by another organization returns 404.
92
+ * Suggest a lower-priced GPU for an instance
93
+ */
94
+ getInstanceGpuSuggestionRaw(requestParameters: GetInstanceGpuSuggestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GpuSuggestion>>;
95
+ /**
96
+ * Compares the highest GPU memory this instance has used (its `gpu_memory` peak, plus headroom) with the GPU models currently listed, and names the cheapest model that would have fit when the saving is worth a look. It never changes anything: it reports what the telemetry shows. Memory use can grow later, so treat it as a starting point. `status` is `insufficient_data` until the instance has about an hour of telemetry, `no_cheaper_fit` when no cheaper listed model covers the peak, and `suggestion` when one does. Requires the `instances:read` scope. An instance owned by another organization returns 404.
97
+ * Suggest a lower-priced GPU for an instance
98
+ */
99
+ getInstanceGpuSuggestion(requestParameters: GetInstanceGpuSuggestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GpuSuggestion>;
82
100
  /**
83
101
  * Creates request options for listInstances without sending the request
84
102
  */