@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,255 @@
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
+
15
+ import { mapValues } from '../runtime';
16
+ import type { FunctionReplicaCounts } from './FunctionReplicaCounts';
17
+ import {
18
+ FunctionReplicaCountsFromJSON,
19
+ FunctionReplicaCountsFromJSONTyped,
20
+ FunctionReplicaCountsToJSON,
21
+ FunctionReplicaCountsToJSONTyped,
22
+ } from './FunctionReplicaCounts';
23
+
24
+ /**
25
+ * A Python function registered with GPU.ai. The settings are those of its current version and are null until the first version is uploaded.
26
+ * @export
27
+ * @interface Function
28
+ */
29
+ export interface Function {
30
+ /**
31
+ *
32
+ * @type {string}
33
+ * @memberof Function
34
+ */
35
+ id: string;
36
+ /**
37
+ *
38
+ * @type {string}
39
+ * @memberof Function
40
+ */
41
+ name: string;
42
+ /**
43
+ * `running`: a call is executing. `warm`: a machine is ready and waiting. `starting`: a machine is being started. `idle`: no machine, nothing is billed.
44
+ * @type {FunctionStatusEnum}
45
+ * @memberof Function
46
+ */
47
+ status: FunctionStatusEnum;
48
+ /**
49
+ *
50
+ * @type {string}
51
+ * @memberof Function
52
+ */
53
+ currentVersionId?: string | null;
54
+ /**
55
+ * The GPU type, or null when the cheapest GPU that fits is used.
56
+ * @type {string}
57
+ * @memberof Function
58
+ */
59
+ gpu?: string | null;
60
+ /**
61
+ *
62
+ * @type {number}
63
+ * @memberof Function
64
+ */
65
+ gpuCount?: number | null;
66
+ /**
67
+ *
68
+ * @type {number}
69
+ * @memberof Function
70
+ */
71
+ minVramGb?: number | null;
72
+ /**
73
+ *
74
+ * @type {Array<string>}
75
+ * @memberof Function
76
+ */
77
+ regions?: Array<string>;
78
+ /**
79
+ *
80
+ * @type {number}
81
+ * @memberof Function
82
+ */
83
+ maxPricePerHour?: number | null;
84
+ /**
85
+ *
86
+ * @type {string}
87
+ * @memberof Function
88
+ */
89
+ pythonVersion?: string | null;
90
+ /**
91
+ *
92
+ * @type {Array<string>}
93
+ * @memberof Function
94
+ */
95
+ pip?: Array<string>;
96
+ /**
97
+ * Seconds one call may run before it is stopped.
98
+ * @type {number}
99
+ * @memberof Function
100
+ */
101
+ timeout?: number | null;
102
+ /**
103
+ * Seconds a machine stays ready after a call.
104
+ * @type {number}
105
+ * @memberof Function
106
+ */
107
+ idleTimeout?: number | null;
108
+ /**
109
+ * Most machines running calls at once.
110
+ * @type {number}
111
+ * @memberof Function
112
+ */
113
+ maxConcurrency?: number | null;
114
+ /**
115
+ *
116
+ * @type {FunctionReplicaCounts}
117
+ * @memberof Function
118
+ */
119
+ replicas: FunctionReplicaCounts;
120
+ /**
121
+ *
122
+ * @type {number}
123
+ * @memberof Function
124
+ */
125
+ runsQueued: number;
126
+ /**
127
+ *
128
+ * @type {number}
129
+ * @memberof Function
130
+ */
131
+ runs24h: number;
132
+ /**
133
+ * Sum of the cost of the runs created in the last 24 hours.
134
+ * @type {number}
135
+ * @memberof Function
136
+ */
137
+ runCost24hUsd: number;
138
+ /**
139
+ * What the function's machines were billed in the last 24 hours, including start-up and idle time that belongs to no run.
140
+ * @type {number}
141
+ * @memberof Function
142
+ */
143
+ machineCost24hUsd: number;
144
+ /**
145
+ *
146
+ * @type {Date}
147
+ * @memberof Function
148
+ */
149
+ lastRunAt?: Date | null;
150
+ /**
151
+ *
152
+ * @type {Date}
153
+ * @memberof Function
154
+ */
155
+ createdAt: Date;
156
+ }
157
+
158
+
159
+ /**
160
+ * @export
161
+ */
162
+ export const FunctionStatusEnum = {
163
+ Idle: 'idle',
164
+ Starting: 'starting',
165
+ Warm: 'warm',
166
+ Running: 'running'
167
+ } as const;
168
+ export type FunctionStatusEnum = typeof FunctionStatusEnum[keyof typeof FunctionStatusEnum];
169
+
170
+
171
+ /**
172
+ * Check if a given object implements the Function interface.
173
+ */
174
+ export function instanceOfFunction(value: object): value is Function {
175
+ if (!('id' in value) || value['id'] === undefined) return false;
176
+ if (!('name' in value) || value['name'] === undefined) return false;
177
+ if (!('status' in value) || value['status'] === undefined) return false;
178
+ if (!('replicas' in value) || value['replicas'] === undefined) return false;
179
+ if ((!('runsQueued' in (value as Record<string, any>)) && !('runs_queued' in (value as Record<string, any>))) || ((value as Record<string, any>)['runsQueued'] === undefined && (value as Record<string, any>)['runs_queued'] === undefined)) return false;
180
+ if ((!('runs24h' in (value as Record<string, any>)) && !('runs_24h' in (value as Record<string, any>))) || ((value as Record<string, any>)['runs24h'] === undefined && (value as Record<string, any>)['runs_24h'] === undefined)) return false;
181
+ if ((!('runCost24hUsd' in (value as Record<string, any>)) && !('run_cost_24h_usd' in (value as Record<string, any>))) || ((value as Record<string, any>)['runCost24hUsd'] === undefined && (value as Record<string, any>)['run_cost_24h_usd'] === undefined)) return false;
182
+ if ((!('machineCost24hUsd' in (value as Record<string, any>)) && !('machine_cost_24h_usd' in (value as Record<string, any>))) || ((value as Record<string, any>)['machineCost24hUsd'] === undefined && (value as Record<string, any>)['machine_cost_24h_usd'] === undefined)) return false;
183
+ if ((!('createdAt' in (value as Record<string, any>)) && !('created_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['createdAt'] === undefined && (value as Record<string, any>)['created_at'] === undefined)) return false;
184
+ return true;
185
+ }
186
+
187
+ export function FunctionFromJSON(json: any): Function {
188
+ return FunctionFromJSONTyped(json, false);
189
+ }
190
+
191
+ export function FunctionFromJSONTyped(json: any, ignoreDiscriminator: boolean): Function {
192
+ if (json == null) {
193
+ return json;
194
+ }
195
+ return {
196
+
197
+ 'id': json['id'],
198
+ 'name': json['name'],
199
+ 'status': json['status'],
200
+ 'currentVersionId': json['current_version_id'] === undefined ? undefined : json['current_version_id'] === null ? null : json['current_version_id'],
201
+ 'gpu': json['gpu'] === undefined ? undefined : json['gpu'] === null ? null : json['gpu'],
202
+ 'gpuCount': json['gpu_count'] === undefined ? undefined : json['gpu_count'] === null ? null : json['gpu_count'],
203
+ 'minVramGb': json['min_vram_gb'] === undefined ? undefined : json['min_vram_gb'] === null ? null : json['min_vram_gb'],
204
+ 'regions': json['regions'] == null ? undefined : json['regions'],
205
+ 'maxPricePerHour': json['max_price_per_hour'] === undefined ? undefined : json['max_price_per_hour'] === null ? null : json['max_price_per_hour'],
206
+ 'pythonVersion': json['python_version'] === undefined ? undefined : json['python_version'] === null ? null : json['python_version'],
207
+ 'pip': json['pip'] == null ? undefined : json['pip'],
208
+ 'timeout': json['timeout'] === undefined ? undefined : json['timeout'] === null ? null : json['timeout'],
209
+ 'idleTimeout': json['idle_timeout'] === undefined ? undefined : json['idle_timeout'] === null ? null : json['idle_timeout'],
210
+ 'maxConcurrency': json['max_concurrency'] === undefined ? undefined : json['max_concurrency'] === null ? null : json['max_concurrency'],
211
+ 'replicas': FunctionReplicaCountsFromJSON(json['replicas']),
212
+ 'runsQueued': json['runs_queued'],
213
+ 'runs24h': json['runs_24h'],
214
+ 'runCost24hUsd': json['run_cost_24h_usd'],
215
+ 'machineCost24hUsd': json['machine_cost_24h_usd'],
216
+ 'lastRunAt': json['last_run_at'] === undefined ? undefined : json['last_run_at'] === null ? null : (new Date(json['last_run_at'])),
217
+ 'createdAt': (new Date(json['created_at'])),
218
+ };
219
+ }
220
+
221
+ export function FunctionToJSON(json: any): Function {
222
+ return FunctionToJSONTyped(json, false);
223
+ }
224
+
225
+ export function FunctionToJSONTyped(value?: Function | null, ignoreDiscriminator: boolean = false): any {
226
+ if (value == null) {
227
+ return value;
228
+ }
229
+
230
+ return {
231
+
232
+ 'id': value['id'],
233
+ 'name': value['name'],
234
+ 'status': value['status'],
235
+ 'current_version_id': value['currentVersionId'],
236
+ 'gpu': value['gpu'],
237
+ 'gpu_count': value['gpuCount'],
238
+ 'min_vram_gb': value['minVramGb'],
239
+ 'regions': value['regions'],
240
+ 'max_price_per_hour': value['maxPricePerHour'],
241
+ 'python_version': value['pythonVersion'],
242
+ 'pip': value['pip'],
243
+ 'timeout': value['timeout'],
244
+ 'idle_timeout': value['idleTimeout'],
245
+ 'max_concurrency': value['maxConcurrency'],
246
+ 'replicas': FunctionReplicaCountsToJSON(value['replicas']),
247
+ 'runs_queued': value['runsQueued'],
248
+ 'runs_24h': value['runs24h'],
249
+ 'run_cost_24h_usd': value['runCost24hUsd'],
250
+ 'machine_cost_24h_usd': value['machineCost24hUsd'],
251
+ 'last_run_at': value['lastRunAt'] == null ? value['lastRunAt'] : value['lastRunAt'].toISOString(),
252
+ 'created_at': value['createdAt'].toISOString(),
253
+ };
254
+ }
255
+
@@ -0,0 +1,74 @@
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
+
15
+ import { mapValues } from '../runtime';
16
+ import type { Function } from './Function';
17
+ import {
18
+ FunctionFromJSON,
19
+ FunctionFromJSONTyped,
20
+ FunctionToJSON,
21
+ FunctionToJSONTyped,
22
+ } from './Function';
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ * @interface FunctionList
28
+ */
29
+ export interface FunctionList {
30
+ /**
31
+ *
32
+ * @type {Array<Function>}
33
+ * @memberof FunctionList
34
+ */
35
+ data: Array<Function>;
36
+ }
37
+
38
+ /**
39
+ * Check if a given object implements the FunctionList interface.
40
+ */
41
+ export function instanceOfFunctionList(value: object): value is FunctionList {
42
+ if (!('data' in value) || value['data'] === undefined) return false;
43
+ return true;
44
+ }
45
+
46
+ export function FunctionListFromJSON(json: any): FunctionList {
47
+ return FunctionListFromJSONTyped(json, false);
48
+ }
49
+
50
+ export function FunctionListFromJSONTyped(json: any, ignoreDiscriminator: boolean): FunctionList {
51
+ if (json == null) {
52
+ return json;
53
+ }
54
+ return {
55
+
56
+ 'data': ((json['data'] as Array<any>).map(FunctionFromJSON)),
57
+ };
58
+ }
59
+
60
+ export function FunctionListToJSON(json: any): FunctionList {
61
+ return FunctionListToJSONTyped(json, false);
62
+ }
63
+
64
+ export function FunctionListToJSONTyped(value?: FunctionList | null, ignoreDiscriminator: boolean = false): any {
65
+ if (value == null) {
66
+ return value;
67
+ }
68
+
69
+ return {
70
+
71
+ 'data': ((value['data'] as Array<any>).map(FunctionToJSON)),
72
+ };
73
+ }
74
+
@@ -0,0 +1,84 @@
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
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ * How many machines a function has in each state.
18
+ * @export
19
+ * @interface FunctionReplicaCounts
20
+ */
21
+ export interface FunctionReplicaCounts {
22
+ /**
23
+ * Machines being started.
24
+ * @type {number}
25
+ * @memberof FunctionReplicaCounts
26
+ */
27
+ starting: number;
28
+ /**
29
+ * Machines ready and waiting for a call.
30
+ * @type {number}
31
+ * @memberof FunctionReplicaCounts
32
+ */
33
+ warm: number;
34
+ /**
35
+ * Machines executing a call.
36
+ * @type {number}
37
+ * @memberof FunctionReplicaCounts
38
+ */
39
+ running: number;
40
+ }
41
+
42
+ /**
43
+ * Check if a given object implements the FunctionReplicaCounts interface.
44
+ */
45
+ export function instanceOfFunctionReplicaCounts(value: object): value is FunctionReplicaCounts {
46
+ if (!('starting' in value) || value['starting'] === undefined) return false;
47
+ if (!('warm' in value) || value['warm'] === undefined) return false;
48
+ if (!('running' in value) || value['running'] === undefined) return false;
49
+ return true;
50
+ }
51
+
52
+ export function FunctionReplicaCountsFromJSON(json: any): FunctionReplicaCounts {
53
+ return FunctionReplicaCountsFromJSONTyped(json, false);
54
+ }
55
+
56
+ export function FunctionReplicaCountsFromJSONTyped(json: any, ignoreDiscriminator: boolean): FunctionReplicaCounts {
57
+ if (json == null) {
58
+ return json;
59
+ }
60
+ return {
61
+
62
+ 'starting': json['starting'],
63
+ 'warm': json['warm'],
64
+ 'running': json['running'],
65
+ };
66
+ }
67
+
68
+ export function FunctionReplicaCountsToJSON(json: any): FunctionReplicaCounts {
69
+ return FunctionReplicaCountsToJSONTyped(json, false);
70
+ }
71
+
72
+ export function FunctionReplicaCountsToJSONTyped(value?: FunctionReplicaCounts | null, ignoreDiscriminator: boolean = false): any {
73
+ if (value == null) {
74
+ return value;
75
+ }
76
+
77
+ return {
78
+
79
+ 'starting': value['starting'],
80
+ 'warm': value['warm'],
81
+ 'running': value['running'],
82
+ };
83
+ }
84
+
@@ -0,0 +1,207 @@
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
+
15
+ import { mapValues } from '../runtime';
16
+ import type { FunctionRunError } from './FunctionRunError';
17
+ import {
18
+ FunctionRunErrorFromJSON,
19
+ FunctionRunErrorFromJSONTyped,
20
+ FunctionRunErrorToJSON,
21
+ FunctionRunErrorToJSONTyped,
22
+ } from './FunctionRunError';
23
+
24
+ /**
25
+ * One call of a function.
26
+ * @export
27
+ * @interface FunctionRun
28
+ */
29
+ export interface FunctionRun {
30
+ /**
31
+ *
32
+ * @type {string}
33
+ * @memberof FunctionRun
34
+ */
35
+ id: string;
36
+ /**
37
+ *
38
+ * @type {string}
39
+ * @memberof FunctionRun
40
+ */
41
+ functionId: string;
42
+ /**
43
+ *
44
+ * @type {string}
45
+ * @memberof FunctionRun
46
+ */
47
+ versionId: string;
48
+ /**
49
+ * queued waits for a machine; setting_up means a machine took the call and is installing the function's Python and pip requirements; running means the function body is executing.
50
+ * @type {FunctionRunStatusEnum}
51
+ * @memberof FunctionRun
52
+ */
53
+ status: FunctionRunStatusEnum;
54
+ /**
55
+ *
56
+ * @type {boolean}
57
+ * @memberof FunctionRun
58
+ */
59
+ cancelRequested: boolean;
60
+ /**
61
+ * True when the call waited for a machine to start, false when a warm machine took it.
62
+ * @type {boolean}
63
+ * @memberof FunctionRun
64
+ */
65
+ coldStart?: boolean | null;
66
+ /**
67
+ * The machine that ran the call. It is an instance of the organization.
68
+ * @type {string}
69
+ * @memberof FunctionRun
70
+ */
71
+ instanceId?: string | null;
72
+ /**
73
+ *
74
+ * @type {Date}
75
+ * @memberof FunctionRun
76
+ */
77
+ createdAt: Date;
78
+ /**
79
+ *
80
+ * @type {Date}
81
+ * @memberof FunctionRun
82
+ */
83
+ startedAt?: Date | null;
84
+ /**
85
+ *
86
+ * @type {Date}
87
+ * @memberof FunctionRun
88
+ */
89
+ finishedAt?: Date | null;
90
+ /**
91
+ * How long the function body ran.
92
+ * @type {number}
93
+ * @memberof FunctionRun
94
+ */
95
+ durationMs?: number | null;
96
+ /**
97
+ * The time the call held its machine, at the machine's hourly price. Machine time between calls is billed too but belongs to no call.
98
+ * @type {number}
99
+ * @memberof FunctionRun
100
+ */
101
+ costUsd?: number | null;
102
+ /**
103
+ *
104
+ * @type {number}
105
+ * @memberof FunctionRun
106
+ */
107
+ pricePerHour?: number | null;
108
+ /**
109
+ *
110
+ * @type {FunctionRunError}
111
+ * @memberof FunctionRun
112
+ */
113
+ error?: FunctionRunError | null;
114
+ /**
115
+ * The pickled return value, base64-encoded. Present only on a succeeded run fetched with include_result=true.
116
+ * @type {string}
117
+ * @memberof FunctionRun
118
+ */
119
+ result?: string;
120
+ }
121
+
122
+
123
+ /**
124
+ * @export
125
+ */
126
+ export const FunctionRunStatusEnum = {
127
+ Queued: 'queued',
128
+ SettingUp: 'setting_up',
129
+ Running: 'running',
130
+ Succeeded: 'succeeded',
131
+ Failed: 'failed',
132
+ TimedOut: 'timed_out',
133
+ Cancelled: 'cancelled'
134
+ } as const;
135
+ export type FunctionRunStatusEnum = typeof FunctionRunStatusEnum[keyof typeof FunctionRunStatusEnum];
136
+
137
+
138
+ /**
139
+ * Check if a given object implements the FunctionRun interface.
140
+ */
141
+ export function instanceOfFunctionRun(value: object): value is FunctionRun {
142
+ if (!('id' in value) || value['id'] === undefined) return false;
143
+ if ((!('functionId' in (value as Record<string, any>)) && !('function_id' in (value as Record<string, any>))) || ((value as Record<string, any>)['functionId'] === undefined && (value as Record<string, any>)['function_id'] === undefined)) return false;
144
+ if ((!('versionId' in (value as Record<string, any>)) && !('version_id' in (value as Record<string, any>))) || ((value as Record<string, any>)['versionId'] === undefined && (value as Record<string, any>)['version_id'] === undefined)) return false;
145
+ if (!('status' in value) || value['status'] === undefined) return false;
146
+ if ((!('cancelRequested' in (value as Record<string, any>)) && !('cancel_requested' in (value as Record<string, any>))) || ((value as Record<string, any>)['cancelRequested'] === undefined && (value as Record<string, any>)['cancel_requested'] === undefined)) return false;
147
+ if ((!('createdAt' in (value as Record<string, any>)) && !('created_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['createdAt'] === undefined && (value as Record<string, any>)['created_at'] === undefined)) return false;
148
+ return true;
149
+ }
150
+
151
+ export function FunctionRunFromJSON(json: any): FunctionRun {
152
+ return FunctionRunFromJSONTyped(json, false);
153
+ }
154
+
155
+ export function FunctionRunFromJSONTyped(json: any, ignoreDiscriminator: boolean): FunctionRun {
156
+ if (json == null) {
157
+ return json;
158
+ }
159
+ return {
160
+
161
+ 'id': json['id'],
162
+ 'functionId': json['function_id'],
163
+ 'versionId': json['version_id'],
164
+ 'status': json['status'],
165
+ 'cancelRequested': json['cancel_requested'],
166
+ 'coldStart': json['cold_start'] === undefined ? undefined : json['cold_start'] === null ? null : json['cold_start'],
167
+ 'instanceId': json['instance_id'] === undefined ? undefined : json['instance_id'] === null ? null : json['instance_id'],
168
+ 'createdAt': (new Date(json['created_at'])),
169
+ 'startedAt': json['started_at'] === undefined ? undefined : json['started_at'] === null ? null : (new Date(json['started_at'])),
170
+ 'finishedAt': json['finished_at'] === undefined ? undefined : json['finished_at'] === null ? null : (new Date(json['finished_at'])),
171
+ 'durationMs': json['duration_ms'] === undefined ? undefined : json['duration_ms'] === null ? null : json['duration_ms'],
172
+ 'costUsd': json['cost_usd'] === undefined ? undefined : json['cost_usd'] === null ? null : json['cost_usd'],
173
+ 'pricePerHour': json['price_per_hour'] === undefined ? undefined : json['price_per_hour'] === null ? null : json['price_per_hour'],
174
+ 'error': json['error'] === undefined ? undefined : json['error'] === null ? null : FunctionRunErrorFromJSON(json['error']),
175
+ 'result': json['result'] == null ? undefined : json['result'],
176
+ };
177
+ }
178
+
179
+ export function FunctionRunToJSON(json: any): FunctionRun {
180
+ return FunctionRunToJSONTyped(json, false);
181
+ }
182
+
183
+ export function FunctionRunToJSONTyped(value?: FunctionRun | null, ignoreDiscriminator: boolean = false): any {
184
+ if (value == null) {
185
+ return value;
186
+ }
187
+
188
+ return {
189
+
190
+ 'id': value['id'],
191
+ 'function_id': value['functionId'],
192
+ 'version_id': value['versionId'],
193
+ 'status': value['status'],
194
+ 'cancel_requested': value['cancelRequested'],
195
+ 'cold_start': value['coldStart'],
196
+ 'instance_id': value['instanceId'],
197
+ 'created_at': value['createdAt'].toISOString(),
198
+ 'started_at': value['startedAt'] == null ? value['startedAt'] : value['startedAt'].toISOString(),
199
+ 'finished_at': value['finishedAt'] == null ? value['finishedAt'] : value['finishedAt'].toISOString(),
200
+ 'duration_ms': value['durationMs'],
201
+ 'cost_usd': value['costUsd'],
202
+ 'price_per_hour': value['pricePerHour'],
203
+ 'error': FunctionRunErrorToJSON(value['error']),
204
+ 'result': value['result'],
205
+ };
206
+ }
207
+