@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.
- package/.openapi-generator/FILES +48 -0
- package/README.md +41 -2
- package/dist/apis/BillingApi.d.ts +70 -0
- package/dist/apis/BillingApi.js +197 -0
- package/dist/apis/FunctionsApi.d.ts +228 -0
- package/dist/apis/FunctionsApi.js +627 -0
- package/dist/apis/InstancesApi.d.ts +18 -0
- package/dist/apis/InstancesApi.js +49 -0
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +1 -0
- package/dist/esm/apis/BillingApi.d.ts +70 -0
- package/dist/esm/apis/BillingApi.js +197 -0
- package/dist/esm/apis/FunctionsApi.d.ts +228 -0
- package/dist/esm/apis/FunctionsApi.js +623 -0
- package/dist/esm/apis/InstancesApi.d.ts +18 -0
- package/dist/esm/apis/InstancesApi.js +49 -0
- package/dist/esm/apis/index.d.ts +1 -0
- package/dist/esm/apis/index.js +1 -0
- package/dist/esm/models/AutolaunchRule.d.ts +2 -1
- package/dist/esm/models/BillingDetails.d.ts +98 -0
- package/dist/esm/models/BillingDetails.js +85 -0
- package/dist/esm/models/CreateFunctionRequest.d.ts +32 -0
- package/dist/esm/models/CreateFunctionRequest.js +43 -0
- package/dist/esm/models/CreateFunctionRunRequest.d.ts +38 -0
- package/dist/esm/models/CreateFunctionRunRequest.js +45 -0
- package/dist/esm/models/CreateFunctionVersionRequest.d.ts +110 -0
- package/dist/esm/models/CreateFunctionVersionRequest.js +79 -0
- package/dist/esm/models/Function.d.ts +163 -0
- package/dist/esm/models/Function.js +109 -0
- package/dist/esm/models/FunctionList.d.ts +33 -0
- package/dist/esm/models/FunctionList.js +44 -0
- package/dist/esm/models/FunctionReplicaCounts.d.ts +44 -0
- package/dist/esm/models/FunctionReplicaCounts.js +51 -0
- package/dist/esm/models/FunctionRun.d.ts +130 -0
- package/dist/esm/models/FunctionRun.js +94 -0
- package/dist/esm/models/FunctionRunError.d.ts +44 -0
- package/dist/esm/models/FunctionRunError.js +49 -0
- package/dist/esm/models/FunctionRunList.d.ts +39 -0
- package/dist/esm/models/FunctionRunList.js +48 -0
- package/dist/esm/models/FunctionRunLogChunk.d.ts +59 -0
- package/dist/esm/models/FunctionRunLogChunk.js +63 -0
- package/dist/esm/models/FunctionRunLogs.d.ts +45 -0
- package/dist/esm/models/FunctionRunLogs.js +52 -0
- package/dist/esm/models/FunctionUpload.d.ts +51 -0
- package/dist/esm/models/FunctionUpload.js +59 -0
- package/dist/esm/models/FunctionVersion.d.ts +137 -0
- package/dist/esm/models/FunctionVersion.js +109 -0
- package/dist/esm/models/GpuSuggestion.d.ts +82 -0
- package/dist/esm/models/GpuSuggestion.js +77 -0
- package/dist/esm/models/GpuSuggestionCheaper.d.ts +62 -0
- package/dist/esm/models/GpuSuggestionCheaper.js +63 -0
- package/dist/esm/models/GpuSuggestionGpu.d.ts +50 -0
- package/dist/esm/models/GpuSuggestionGpu.js +55 -0
- package/dist/esm/models/Instance.d.ts +7 -0
- package/dist/esm/models/Instance.js +3 -0
- package/dist/esm/models/InstanceGpuMemory.d.ts +51 -0
- package/dist/esm/models/InstanceGpuMemory.js +55 -0
- package/dist/esm/models/Invoice.d.ts +68 -0
- package/dist/esm/models/Invoice.js +67 -0
- package/dist/esm/models/InvoiceList.d.ts +45 -0
- package/dist/esm/models/InvoiceList.js +50 -0
- package/dist/esm/models/ModelPricing.d.ts +46 -0
- package/dist/esm/models/ModelPricing.js +21 -0
- package/dist/esm/models/ModelRate.d.ts +62 -0
- package/dist/esm/models/ModelRate.js +51 -0
- package/dist/esm/models/PeakWindow.d.ts +38 -0
- package/dist/esm/models/PeakWindow.js +47 -0
- package/dist/esm/models/UpdateBillingDetailsRequest.d.ts +80 -0
- package/dist/esm/models/UpdateBillingDetailsRequest.js +57 -0
- package/dist/esm/models/index.d.ts +23 -0
- package/dist/esm/models/index.js +23 -0
- package/dist/esm/runtime.js +1 -1
- package/dist/models/AutolaunchRule.d.ts +2 -1
- package/dist/models/BillingDetails.d.ts +98 -0
- package/dist/models/BillingDetails.js +92 -0
- package/dist/models/CreateFunctionRequest.d.ts +32 -0
- package/dist/models/CreateFunctionRequest.js +50 -0
- package/dist/models/CreateFunctionRunRequest.d.ts +38 -0
- package/dist/models/CreateFunctionRunRequest.js +52 -0
- package/dist/models/CreateFunctionVersionRequest.d.ts +110 -0
- package/dist/models/CreateFunctionVersionRequest.js +86 -0
- package/dist/models/Function.d.ts +163 -0
- package/dist/models/Function.js +117 -0
- package/dist/models/FunctionList.d.ts +33 -0
- package/dist/models/FunctionList.js +51 -0
- package/dist/models/FunctionReplicaCounts.d.ts +44 -0
- package/dist/models/FunctionReplicaCounts.js +58 -0
- package/dist/models/FunctionRun.d.ts +130 -0
- package/dist/models/FunctionRun.js +102 -0
- package/dist/models/FunctionRunError.d.ts +44 -0
- package/dist/models/FunctionRunError.js +56 -0
- package/dist/models/FunctionRunList.d.ts +39 -0
- package/dist/models/FunctionRunList.js +55 -0
- package/dist/models/FunctionRunLogChunk.d.ts +59 -0
- package/dist/models/FunctionRunLogChunk.js +71 -0
- package/dist/models/FunctionRunLogs.d.ts +45 -0
- package/dist/models/FunctionRunLogs.js +59 -0
- package/dist/models/FunctionUpload.d.ts +51 -0
- package/dist/models/FunctionUpload.js +67 -0
- package/dist/models/FunctionVersion.d.ts +137 -0
- package/dist/models/FunctionVersion.js +117 -0
- package/dist/models/GpuSuggestion.d.ts +82 -0
- package/dist/models/GpuSuggestion.js +85 -0
- package/dist/models/GpuSuggestionCheaper.d.ts +62 -0
- package/dist/models/GpuSuggestionCheaper.js +70 -0
- package/dist/models/GpuSuggestionGpu.d.ts +50 -0
- package/dist/models/GpuSuggestionGpu.js +62 -0
- package/dist/models/Instance.d.ts +7 -0
- package/dist/models/Instance.js +3 -0
- package/dist/models/InstanceGpuMemory.d.ts +51 -0
- package/dist/models/InstanceGpuMemory.js +62 -0
- package/dist/models/Invoice.d.ts +68 -0
- package/dist/models/Invoice.js +74 -0
- package/dist/models/InvoiceList.d.ts +45 -0
- package/dist/models/InvoiceList.js +57 -0
- package/dist/models/ModelPricing.d.ts +46 -0
- package/dist/models/ModelPricing.js +22 -0
- package/dist/models/ModelRate.d.ts +62 -0
- package/dist/models/ModelRate.js +58 -0
- package/dist/models/PeakWindow.d.ts +38 -0
- package/dist/models/PeakWindow.js +54 -0
- package/dist/models/UpdateBillingDetailsRequest.d.ts +80 -0
- package/dist/models/UpdateBillingDetailsRequest.js +64 -0
- package/dist/models/index.d.ts +23 -0
- package/dist/models/index.js +23 -0
- package/dist/runtime.js +1 -1
- package/docs/BillingApi.md +299 -0
- package/docs/BillingDetails.md +56 -0
- package/docs/CreateFunctionRequest.md +34 -0
- package/docs/CreateFunctionRunRequest.md +36 -0
- package/docs/CreateFunctionVersionRequest.md +60 -0
- package/docs/Function.md +75 -0
- package/docs/FunctionList.md +34 -0
- package/docs/FunctionReplicaCounts.md +39 -0
- package/docs/FunctionRun.md +63 -0
- package/docs/FunctionRunError.md +38 -0
- package/docs/FunctionRunList.md +36 -0
- package/docs/FunctionRunLogChunk.md +40 -0
- package/docs/FunctionRunLogs.md +38 -0
- package/docs/FunctionUpload.md +38 -0
- package/docs/FunctionVersion.md +66 -0
- package/docs/FunctionsApi.md +880 -0
- package/docs/GpuSuggestion.md +47 -0
- package/docs/GpuSuggestionCheaper.md +45 -0
- package/docs/GpuSuggestionGpu.md +41 -0
- package/docs/Instance.md +2 -0
- package/docs/InstanceGpuMemory.md +41 -0
- package/docs/InstancesApi.md +75 -0
- package/docs/Invoice.md +46 -0
- package/docs/InvoiceList.md +38 -0
- package/docs/ModelPricing.md +12 -0
- package/docs/ModelRate.md +45 -0
- package/docs/PeakWindow.md +37 -0
- package/docs/UpdateBillingDetailsRequest.md +50 -0
- package/package.json +1 -1
- package/src/apis/BillingApi.ts +247 -0
- package/src/apis/FunctionsApi.ts +828 -0
- package/src/apis/InstancesApi.ts +64 -0
- package/src/apis/index.ts +1 -0
- package/src/models/AutolaunchRule.ts +2 -1
- package/src/models/BillingDetails.ts +164 -0
- package/src/models/CreateFunctionRequest.ts +66 -0
- package/src/models/CreateFunctionRunRequest.ts +74 -0
- package/src/models/CreateFunctionVersionRequest.ts +175 -0
- package/src/models/Function.ts +255 -0
- package/src/models/FunctionList.ts +74 -0
- package/src/models/FunctionReplicaCounts.ts +84 -0
- package/src/models/FunctionRun.ts +207 -0
- package/src/models/FunctionRunError.ts +83 -0
- package/src/models/FunctionRunList.ts +83 -0
- package/src/models/FunctionRunLogChunk.ts +105 -0
- package/src/models/FunctionRunLogs.ts +92 -0
- package/src/models/FunctionUpload.ts +96 -0
- package/src/models/FunctionVersion.ts +226 -0
- package/src/models/GpuSuggestion.ts +150 -0
- package/src/models/GpuSuggestionCheaper.ts +111 -0
- package/src/models/GpuSuggestionGpu.ts +93 -0
- package/src/models/Instance.ts +15 -0
- package/src/models/InstanceGpuMemory.ts +94 -0
- package/src/models/Invoice.ts +120 -0
- package/src/models/InvoiceList.ts +91 -0
- package/src/models/ModelPricing.ts +74 -0
- package/src/models/ModelRate.ts +105 -0
- package/src/models/PeakWindow.ts +75 -0
- package/src/models/UpdateBillingDetailsRequest.ts +129 -0
- package/src/models/index.ts +23 -0
- package/src/runtime.ts +1 -1
|
@@ -0,0 +1,880 @@
|
|
|
1
|
+
# FunctionsApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.gpu.ai/v1*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
|------------- | ------------- | -------------|
|
|
7
|
+
| [**activateFunctionVersion**](FunctionsApi.md#activatefunctionversion) | **POST** /functions/{id}/versions/{version_id}/activate | Confirm a version\'s upload and make it current |
|
|
8
|
+
| [**cancelFunctionRun**](FunctionsApi.md#cancelfunctionrun) | **POST** /functions/{id}/runs/{run_id}/cancel | Cancel a run |
|
|
9
|
+
| [**createFunction**](FunctionsApi.md#createfunctionoperation) | **POST** /functions | Get or create a function by name |
|
|
10
|
+
| [**createFunctionRun**](FunctionsApi.md#createfunctionrunoperation) | **POST** /functions/{id}/runs | Call a function |
|
|
11
|
+
| [**createFunctionVersion**](FunctionsApi.md#createfunctionversionoperation) | **POST** /functions/{id}/versions | Register a version of a function |
|
|
12
|
+
| [**deleteFunction**](FunctionsApi.md#deletefunction) | **DELETE** /functions/{id} | Delete a function |
|
|
13
|
+
| [**getFunction**](FunctionsApi.md#getfunction) | **GET** /functions/{id} | Get a function |
|
|
14
|
+
| [**getFunctionRun**](FunctionsApi.md#getfunctionrun) | **GET** /functions/{id}/runs/{run_id} | Get a run |
|
|
15
|
+
| [**getFunctionRunLogs**](FunctionsApi.md#getfunctionrunlogs) | **GET** /functions/{id}/runs/{run_id}/logs | Read a run\'s output |
|
|
16
|
+
| [**listFunctionRuns**](FunctionsApi.md#listfunctionruns) | **GET** /functions/{id}/runs | List a function\'s runs |
|
|
17
|
+
| [**listFunctions**](FunctionsApi.md#listfunctions) | **GET** /functions | List functions |
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## activateFunctionVersion
|
|
22
|
+
|
|
23
|
+
> FunctionVersion activateFunctionVersion(id, versionId, idempotencyKey)
|
|
24
|
+
|
|
25
|
+
Confirm a version\'s upload and make it current
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
### Example
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import {
|
|
33
|
+
Configuration,
|
|
34
|
+
FunctionsApi,
|
|
35
|
+
} from '@gpuai/sdk';
|
|
36
|
+
import type { ActivateFunctionVersionRequest } from '@gpuai/sdk';
|
|
37
|
+
|
|
38
|
+
async function example() {
|
|
39
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
40
|
+
const config = new Configuration({
|
|
41
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
42
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
43
|
+
});
|
|
44
|
+
const api = new FunctionsApi(config);
|
|
45
|
+
|
|
46
|
+
const body = {
|
|
47
|
+
// string | The function id.
|
|
48
|
+
id: id_example,
|
|
49
|
+
// string | The version id.
|
|
50
|
+
versionId: versionId_example,
|
|
51
|
+
// string (optional)
|
|
52
|
+
idempotencyKey: idempotencyKey_example,
|
|
53
|
+
} satisfies ActivateFunctionVersionRequest;
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
const data = await api.activateFunctionVersion(body);
|
|
57
|
+
console.log(data);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error(error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Run the test
|
|
64
|
+
example().catch(console.error);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Parameters
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
| Name | Type | Description | Notes |
|
|
71
|
+
|------------- | ------------- | ------------- | -------------|
|
|
72
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
73
|
+
| **versionId** | `string` | The version id. | [Defaults to `undefined`] |
|
|
74
|
+
| **idempotencyKey** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
75
|
+
|
|
76
|
+
### Return type
|
|
77
|
+
|
|
78
|
+
[**FunctionVersion**](FunctionVersion.md)
|
|
79
|
+
|
|
80
|
+
### Authorization
|
|
81
|
+
|
|
82
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
83
|
+
|
|
84
|
+
### HTTP request headers
|
|
85
|
+
|
|
86
|
+
- **Content-Type**: Not defined
|
|
87
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### HTTP response details
|
|
91
|
+
| Status code | Description | Response headers |
|
|
92
|
+
|-------------|-------------|------------------|
|
|
93
|
+
| **200** | The version is ready. | - |
|
|
94
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
95
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
96
|
+
| **0** | Error response (RFC 7807) | - |
|
|
97
|
+
|
|
98
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## cancelFunctionRun
|
|
102
|
+
|
|
103
|
+
> FunctionRun cancelFunctionRun(id, runId, idempotencyKey)
|
|
104
|
+
|
|
105
|
+
Cancel a run
|
|
106
|
+
|
|
107
|
+
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.
|
|
108
|
+
|
|
109
|
+
### Example
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import {
|
|
113
|
+
Configuration,
|
|
114
|
+
FunctionsApi,
|
|
115
|
+
} from '@gpuai/sdk';
|
|
116
|
+
import type { CancelFunctionRunRequest } from '@gpuai/sdk';
|
|
117
|
+
|
|
118
|
+
async function example() {
|
|
119
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
120
|
+
const config = new Configuration({
|
|
121
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
122
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
123
|
+
});
|
|
124
|
+
const api = new FunctionsApi(config);
|
|
125
|
+
|
|
126
|
+
const body = {
|
|
127
|
+
// string | The function id.
|
|
128
|
+
id: id_example,
|
|
129
|
+
// string | The run id.
|
|
130
|
+
runId: runId_example,
|
|
131
|
+
// string (optional)
|
|
132
|
+
idempotencyKey: idempotencyKey_example,
|
|
133
|
+
} satisfies CancelFunctionRunRequest;
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const data = await api.cancelFunctionRun(body);
|
|
137
|
+
console.log(data);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error(error);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Run the test
|
|
144
|
+
example().catch(console.error);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Parameters
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
| Name | Type | Description | Notes |
|
|
151
|
+
|------------- | ------------- | ------------- | -------------|
|
|
152
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
153
|
+
| **runId** | `string` | The run id. | [Defaults to `undefined`] |
|
|
154
|
+
| **idempotencyKey** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
155
|
+
|
|
156
|
+
### Return type
|
|
157
|
+
|
|
158
|
+
[**FunctionRun**](FunctionRun.md)
|
|
159
|
+
|
|
160
|
+
### Authorization
|
|
161
|
+
|
|
162
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
163
|
+
|
|
164
|
+
### HTTP request headers
|
|
165
|
+
|
|
166
|
+
- **Content-Type**: Not defined
|
|
167
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
### HTTP response details
|
|
171
|
+
| Status code | Description | Response headers |
|
|
172
|
+
|-------------|-------------|------------------|
|
|
173
|
+
| **200** | The run after the request. | - |
|
|
174
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
175
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
176
|
+
| **0** | Error response (RFC 7807) | - |
|
|
177
|
+
|
|
178
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
## createFunction
|
|
182
|
+
|
|
183
|
+
> Function createFunction(createFunctionRequest, idempotencyKey)
|
|
184
|
+
|
|
185
|
+
Get or create a function by name
|
|
186
|
+
|
|
187
|
+
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.
|
|
188
|
+
|
|
189
|
+
### Example
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
import {
|
|
193
|
+
Configuration,
|
|
194
|
+
FunctionsApi,
|
|
195
|
+
} from '@gpuai/sdk';
|
|
196
|
+
import type { CreateFunctionOperationRequest } from '@gpuai/sdk';
|
|
197
|
+
|
|
198
|
+
async function example() {
|
|
199
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
200
|
+
const config = new Configuration({
|
|
201
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
202
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
203
|
+
});
|
|
204
|
+
const api = new FunctionsApi(config);
|
|
205
|
+
|
|
206
|
+
const body = {
|
|
207
|
+
// CreateFunctionRequest
|
|
208
|
+
createFunctionRequest: ...,
|
|
209
|
+
// string (optional)
|
|
210
|
+
idempotencyKey: idempotencyKey_example,
|
|
211
|
+
} satisfies CreateFunctionOperationRequest;
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
const data = await api.createFunction(body);
|
|
215
|
+
console.log(data);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
console.error(error);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Run the test
|
|
222
|
+
example().catch(console.error);
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Parameters
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
| Name | Type | Description | Notes |
|
|
229
|
+
|------------- | ------------- | ------------- | -------------|
|
|
230
|
+
| **createFunctionRequest** | [CreateFunctionRequest](CreateFunctionRequest.md) | | |
|
|
231
|
+
| **idempotencyKey** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
232
|
+
|
|
233
|
+
### Return type
|
|
234
|
+
|
|
235
|
+
[**Function**](Function.md)
|
|
236
|
+
|
|
237
|
+
### Authorization
|
|
238
|
+
|
|
239
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
240
|
+
|
|
241
|
+
### HTTP request headers
|
|
242
|
+
|
|
243
|
+
- **Content-Type**: `application/json`
|
|
244
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
### HTTP response details
|
|
248
|
+
| Status code | Description | Response headers |
|
|
249
|
+
|-------------|-------------|------------------|
|
|
250
|
+
| **200** | The function already existed. | - |
|
|
251
|
+
| **201** | Created. | - |
|
|
252
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
253
|
+
| **0** | Error response (RFC 7807) | - |
|
|
254
|
+
|
|
255
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
## createFunctionRun
|
|
259
|
+
|
|
260
|
+
> FunctionRun createFunctionRun(id, createFunctionRunRequest, idempotencyKey)
|
|
261
|
+
|
|
262
|
+
Call a function
|
|
263
|
+
|
|
264
|
+
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.
|
|
265
|
+
|
|
266
|
+
### Example
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
import {
|
|
270
|
+
Configuration,
|
|
271
|
+
FunctionsApi,
|
|
272
|
+
} from '@gpuai/sdk';
|
|
273
|
+
import type { CreateFunctionRunOperationRequest } from '@gpuai/sdk';
|
|
274
|
+
|
|
275
|
+
async function example() {
|
|
276
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
277
|
+
const config = new Configuration({
|
|
278
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
279
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
280
|
+
});
|
|
281
|
+
const api = new FunctionsApi(config);
|
|
282
|
+
|
|
283
|
+
const body = {
|
|
284
|
+
// string | The function id.
|
|
285
|
+
id: id_example,
|
|
286
|
+
// CreateFunctionRunRequest
|
|
287
|
+
createFunctionRunRequest: ...,
|
|
288
|
+
// string (optional)
|
|
289
|
+
idempotencyKey: idempotencyKey_example,
|
|
290
|
+
} satisfies CreateFunctionRunOperationRequest;
|
|
291
|
+
|
|
292
|
+
try {
|
|
293
|
+
const data = await api.createFunctionRun(body);
|
|
294
|
+
console.log(data);
|
|
295
|
+
} catch (error) {
|
|
296
|
+
console.error(error);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Run the test
|
|
301
|
+
example().catch(console.error);
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Parameters
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
| Name | Type | Description | Notes |
|
|
308
|
+
|------------- | ------------- | ------------- | -------------|
|
|
309
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
310
|
+
| **createFunctionRunRequest** | [CreateFunctionRunRequest](CreateFunctionRunRequest.md) | | |
|
|
311
|
+
| **idempotencyKey** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
312
|
+
|
|
313
|
+
### Return type
|
|
314
|
+
|
|
315
|
+
[**FunctionRun**](FunctionRun.md)
|
|
316
|
+
|
|
317
|
+
### Authorization
|
|
318
|
+
|
|
319
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
320
|
+
|
|
321
|
+
### HTTP request headers
|
|
322
|
+
|
|
323
|
+
- **Content-Type**: `application/json`
|
|
324
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
### HTTP response details
|
|
328
|
+
| Status code | Description | Response headers |
|
|
329
|
+
|-------------|-------------|------------------|
|
|
330
|
+
| **202** | The call is queued. | - |
|
|
331
|
+
| **402** | The organization has no balance. | - |
|
|
332
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
333
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
334
|
+
| **0** | Error response (RFC 7807) | - |
|
|
335
|
+
|
|
336
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
## createFunctionVersion
|
|
340
|
+
|
|
341
|
+
> FunctionVersion createFunctionVersion(id, createFunctionVersionRequest, idempotencyKey)
|
|
342
|
+
|
|
343
|
+
Register a version of a function
|
|
344
|
+
|
|
345
|
+
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.
|
|
346
|
+
|
|
347
|
+
### Example
|
|
348
|
+
|
|
349
|
+
```ts
|
|
350
|
+
import {
|
|
351
|
+
Configuration,
|
|
352
|
+
FunctionsApi,
|
|
353
|
+
} from '@gpuai/sdk';
|
|
354
|
+
import type { CreateFunctionVersionOperationRequest } from '@gpuai/sdk';
|
|
355
|
+
|
|
356
|
+
async function example() {
|
|
357
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
358
|
+
const config = new Configuration({
|
|
359
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
360
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
361
|
+
});
|
|
362
|
+
const api = new FunctionsApi(config);
|
|
363
|
+
|
|
364
|
+
const body = {
|
|
365
|
+
// string | The function id.
|
|
366
|
+
id: id_example,
|
|
367
|
+
// CreateFunctionVersionRequest
|
|
368
|
+
createFunctionVersionRequest: ...,
|
|
369
|
+
// string (optional)
|
|
370
|
+
idempotencyKey: idempotencyKey_example,
|
|
371
|
+
} satisfies CreateFunctionVersionOperationRequest;
|
|
372
|
+
|
|
373
|
+
try {
|
|
374
|
+
const data = await api.createFunctionVersion(body);
|
|
375
|
+
console.log(data);
|
|
376
|
+
} catch (error) {
|
|
377
|
+
console.error(error);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// Run the test
|
|
382
|
+
example().catch(console.error);
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Parameters
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
| Name | Type | Description | Notes |
|
|
389
|
+
|------------- | ------------- | ------------- | -------------|
|
|
390
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
391
|
+
| **createFunctionVersionRequest** | [CreateFunctionVersionRequest](CreateFunctionVersionRequest.md) | | |
|
|
392
|
+
| **idempotencyKey** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
393
|
+
|
|
394
|
+
### Return type
|
|
395
|
+
|
|
396
|
+
[**FunctionVersion**](FunctionVersion.md)
|
|
397
|
+
|
|
398
|
+
### Authorization
|
|
399
|
+
|
|
400
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
401
|
+
|
|
402
|
+
### HTTP request headers
|
|
403
|
+
|
|
404
|
+
- **Content-Type**: `application/json`
|
|
405
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
### HTTP response details
|
|
409
|
+
| Status code | Description | Response headers |
|
|
410
|
+
|-------------|-------------|------------------|
|
|
411
|
+
| **200** | A version with this content hash already existed. | - |
|
|
412
|
+
| **201** | Created. | - |
|
|
413
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
414
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
415
|
+
| **0** | Error response (RFC 7807) | - |
|
|
416
|
+
|
|
417
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
## deleteFunction
|
|
421
|
+
|
|
422
|
+
> deleteFunction(id)
|
|
423
|
+
|
|
424
|
+
Delete a function
|
|
425
|
+
|
|
426
|
+
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.
|
|
427
|
+
|
|
428
|
+
### Example
|
|
429
|
+
|
|
430
|
+
```ts
|
|
431
|
+
import {
|
|
432
|
+
Configuration,
|
|
433
|
+
FunctionsApi,
|
|
434
|
+
} from '@gpuai/sdk';
|
|
435
|
+
import type { DeleteFunctionRequest } from '@gpuai/sdk';
|
|
436
|
+
|
|
437
|
+
async function example() {
|
|
438
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
439
|
+
const config = new Configuration({
|
|
440
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
441
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
442
|
+
});
|
|
443
|
+
const api = new FunctionsApi(config);
|
|
444
|
+
|
|
445
|
+
const body = {
|
|
446
|
+
// string | The function id.
|
|
447
|
+
id: id_example,
|
|
448
|
+
} satisfies DeleteFunctionRequest;
|
|
449
|
+
|
|
450
|
+
try {
|
|
451
|
+
const data = await api.deleteFunction(body);
|
|
452
|
+
console.log(data);
|
|
453
|
+
} catch (error) {
|
|
454
|
+
console.error(error);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Run the test
|
|
459
|
+
example().catch(console.error);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Parameters
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
| Name | Type | Description | Notes |
|
|
466
|
+
|------------- | ------------- | ------------- | -------------|
|
|
467
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
468
|
+
|
|
469
|
+
### Return type
|
|
470
|
+
|
|
471
|
+
`void` (Empty response body)
|
|
472
|
+
|
|
473
|
+
### Authorization
|
|
474
|
+
|
|
475
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
476
|
+
|
|
477
|
+
### HTTP request headers
|
|
478
|
+
|
|
479
|
+
- **Content-Type**: Not defined
|
|
480
|
+
- **Accept**: `application/problem+json`
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
### HTTP response details
|
|
484
|
+
| Status code | Description | Response headers |
|
|
485
|
+
|-------------|-------------|------------------|
|
|
486
|
+
| **204** | Deleted. | - |
|
|
487
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
488
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
489
|
+
| **0** | Error response (RFC 7807) | - |
|
|
490
|
+
|
|
491
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
## getFunction
|
|
495
|
+
|
|
496
|
+
> Function getFunction(id)
|
|
497
|
+
|
|
498
|
+
Get a function
|
|
499
|
+
|
|
500
|
+
Requires the `functions:read` scope.
|
|
501
|
+
|
|
502
|
+
### Example
|
|
503
|
+
|
|
504
|
+
```ts
|
|
505
|
+
import {
|
|
506
|
+
Configuration,
|
|
507
|
+
FunctionsApi,
|
|
508
|
+
} from '@gpuai/sdk';
|
|
509
|
+
import type { GetFunctionRequest } from '@gpuai/sdk';
|
|
510
|
+
|
|
511
|
+
async function example() {
|
|
512
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
513
|
+
const config = new Configuration({
|
|
514
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
515
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
516
|
+
});
|
|
517
|
+
const api = new FunctionsApi(config);
|
|
518
|
+
|
|
519
|
+
const body = {
|
|
520
|
+
// string | The function id.
|
|
521
|
+
id: id_example,
|
|
522
|
+
} satisfies GetFunctionRequest;
|
|
523
|
+
|
|
524
|
+
try {
|
|
525
|
+
const data = await api.getFunction(body);
|
|
526
|
+
console.log(data);
|
|
527
|
+
} catch (error) {
|
|
528
|
+
console.error(error);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// Run the test
|
|
533
|
+
example().catch(console.error);
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Parameters
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
| Name | Type | Description | Notes |
|
|
540
|
+
|------------- | ------------- | ------------- | -------------|
|
|
541
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
542
|
+
|
|
543
|
+
### Return type
|
|
544
|
+
|
|
545
|
+
[**Function**](Function.md)
|
|
546
|
+
|
|
547
|
+
### Authorization
|
|
548
|
+
|
|
549
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
550
|
+
|
|
551
|
+
### HTTP request headers
|
|
552
|
+
|
|
553
|
+
- **Content-Type**: Not defined
|
|
554
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
### HTTP response details
|
|
558
|
+
| Status code | Description | Response headers |
|
|
559
|
+
|-------------|-------------|------------------|
|
|
560
|
+
| **200** | OK | - |
|
|
561
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
562
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
563
|
+
| **0** | Error response (RFC 7807) | - |
|
|
564
|
+
|
|
565
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
## getFunctionRun
|
|
569
|
+
|
|
570
|
+
> FunctionRun getFunctionRun(id, runId, wait, includeResult)
|
|
571
|
+
|
|
572
|
+
Get a run
|
|
573
|
+
|
|
574
|
+
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.
|
|
575
|
+
|
|
576
|
+
### Example
|
|
577
|
+
|
|
578
|
+
```ts
|
|
579
|
+
import {
|
|
580
|
+
Configuration,
|
|
581
|
+
FunctionsApi,
|
|
582
|
+
} from '@gpuai/sdk';
|
|
583
|
+
import type { GetFunctionRunRequest } from '@gpuai/sdk';
|
|
584
|
+
|
|
585
|
+
async function example() {
|
|
586
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
587
|
+
const config = new Configuration({
|
|
588
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
589
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
590
|
+
});
|
|
591
|
+
const api = new FunctionsApi(config);
|
|
592
|
+
|
|
593
|
+
const body = {
|
|
594
|
+
// string | The function id.
|
|
595
|
+
id: id_example,
|
|
596
|
+
// string | The run id.
|
|
597
|
+
runId: runId_example,
|
|
598
|
+
// number | Seconds to hold the request while the run is not finished. (optional)
|
|
599
|
+
wait: 56,
|
|
600
|
+
// boolean | Include the pickled return value of a succeeded run. (optional)
|
|
601
|
+
includeResult: true,
|
|
602
|
+
} satisfies GetFunctionRunRequest;
|
|
603
|
+
|
|
604
|
+
try {
|
|
605
|
+
const data = await api.getFunctionRun(body);
|
|
606
|
+
console.log(data);
|
|
607
|
+
} catch (error) {
|
|
608
|
+
console.error(error);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// Run the test
|
|
613
|
+
example().catch(console.error);
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### Parameters
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
| Name | Type | Description | Notes |
|
|
620
|
+
|------------- | ------------- | ------------- | -------------|
|
|
621
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
622
|
+
| **runId** | `string` | The run id. | [Defaults to `undefined`] |
|
|
623
|
+
| **wait** | `number` | Seconds to hold the request while the run is not finished. | [Optional] [Defaults to `undefined`] |
|
|
624
|
+
| **includeResult** | `boolean` | Include the pickled return value of a succeeded run. | [Optional] [Defaults to `undefined`] |
|
|
625
|
+
|
|
626
|
+
### Return type
|
|
627
|
+
|
|
628
|
+
[**FunctionRun**](FunctionRun.md)
|
|
629
|
+
|
|
630
|
+
### Authorization
|
|
631
|
+
|
|
632
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
633
|
+
|
|
634
|
+
### HTTP request headers
|
|
635
|
+
|
|
636
|
+
- **Content-Type**: Not defined
|
|
637
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
### HTTP response details
|
|
641
|
+
| Status code | Description | Response headers |
|
|
642
|
+
|-------------|-------------|------------------|
|
|
643
|
+
| **200** | OK | - |
|
|
644
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
645
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
646
|
+
| **0** | Error response (RFC 7807) | - |
|
|
647
|
+
|
|
648
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
## getFunctionRunLogs
|
|
652
|
+
|
|
653
|
+
> FunctionRunLogs getFunctionRunLogs(id, runId, after, limit, wait)
|
|
654
|
+
|
|
655
|
+
Read a run\'s output
|
|
656
|
+
|
|
657
|
+
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.
|
|
658
|
+
|
|
659
|
+
### Example
|
|
660
|
+
|
|
661
|
+
```ts
|
|
662
|
+
import {
|
|
663
|
+
Configuration,
|
|
664
|
+
FunctionsApi,
|
|
665
|
+
} from '@gpuai/sdk';
|
|
666
|
+
import type { GetFunctionRunLogsRequest } from '@gpuai/sdk';
|
|
667
|
+
|
|
668
|
+
async function example() {
|
|
669
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
670
|
+
const config = new Configuration({
|
|
671
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
672
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
673
|
+
});
|
|
674
|
+
const api = new FunctionsApi(config);
|
|
675
|
+
|
|
676
|
+
const body = {
|
|
677
|
+
// string | The function id.
|
|
678
|
+
id: id_example,
|
|
679
|
+
// string | The run id.
|
|
680
|
+
runId: runId_example,
|
|
681
|
+
// number | Return chunks after this cursor. Omit to read from the start. (optional)
|
|
682
|
+
after: 789,
|
|
683
|
+
// number (optional)
|
|
684
|
+
limit: 56,
|
|
685
|
+
// number | Seconds to hold the request while there is nothing new. (optional)
|
|
686
|
+
wait: 56,
|
|
687
|
+
} satisfies GetFunctionRunLogsRequest;
|
|
688
|
+
|
|
689
|
+
try {
|
|
690
|
+
const data = await api.getFunctionRunLogs(body);
|
|
691
|
+
console.log(data);
|
|
692
|
+
} catch (error) {
|
|
693
|
+
console.error(error);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// Run the test
|
|
698
|
+
example().catch(console.error);
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
### Parameters
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
| Name | Type | Description | Notes |
|
|
705
|
+
|------------- | ------------- | ------------- | -------------|
|
|
706
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
707
|
+
| **runId** | `string` | The run id. | [Defaults to `undefined`] |
|
|
708
|
+
| **after** | `number` | Return chunks after this cursor. Omit to read from the start. | [Optional] [Defaults to `undefined`] |
|
|
709
|
+
| **limit** | `number` | | [Optional] [Defaults to `1000`] |
|
|
710
|
+
| **wait** | `number` | Seconds to hold the request while there is nothing new. | [Optional] [Defaults to `undefined`] |
|
|
711
|
+
|
|
712
|
+
### Return type
|
|
713
|
+
|
|
714
|
+
[**FunctionRunLogs**](FunctionRunLogs.md)
|
|
715
|
+
|
|
716
|
+
### Authorization
|
|
717
|
+
|
|
718
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
719
|
+
|
|
720
|
+
### HTTP request headers
|
|
721
|
+
|
|
722
|
+
- **Content-Type**: Not defined
|
|
723
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
### HTTP response details
|
|
727
|
+
| Status code | Description | Response headers |
|
|
728
|
+
|-------------|-------------|------------------|
|
|
729
|
+
| **200** | OK | - |
|
|
730
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
731
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
732
|
+
| **0** | Error response (RFC 7807) | - |
|
|
733
|
+
|
|
734
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
## listFunctionRuns
|
|
738
|
+
|
|
739
|
+
> FunctionRunList listFunctionRuns(id, cursor, limit)
|
|
740
|
+
|
|
741
|
+
List a function\'s runs
|
|
742
|
+
|
|
743
|
+
Newest first. Requires the `functions:read` scope.
|
|
744
|
+
|
|
745
|
+
### Example
|
|
746
|
+
|
|
747
|
+
```ts
|
|
748
|
+
import {
|
|
749
|
+
Configuration,
|
|
750
|
+
FunctionsApi,
|
|
751
|
+
} from '@gpuai/sdk';
|
|
752
|
+
import type { ListFunctionRunsRequest } from '@gpuai/sdk';
|
|
753
|
+
|
|
754
|
+
async function example() {
|
|
755
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
756
|
+
const config = new Configuration({
|
|
757
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
758
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
759
|
+
});
|
|
760
|
+
const api = new FunctionsApi(config);
|
|
761
|
+
|
|
762
|
+
const body = {
|
|
763
|
+
// string | The function id.
|
|
764
|
+
id: id_example,
|
|
765
|
+
// string (optional)
|
|
766
|
+
cursor: cursor_example,
|
|
767
|
+
// number (optional)
|
|
768
|
+
limit: 56,
|
|
769
|
+
} satisfies ListFunctionRunsRequest;
|
|
770
|
+
|
|
771
|
+
try {
|
|
772
|
+
const data = await api.listFunctionRuns(body);
|
|
773
|
+
console.log(data);
|
|
774
|
+
} catch (error) {
|
|
775
|
+
console.error(error);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// Run the test
|
|
780
|
+
example().catch(console.error);
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
### Parameters
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
| Name | Type | Description | Notes |
|
|
787
|
+
|------------- | ------------- | ------------- | -------------|
|
|
788
|
+
| **id** | `string` | The function id. | [Defaults to `undefined`] |
|
|
789
|
+
| **cursor** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
790
|
+
| **limit** | `number` | | [Optional] [Defaults to `50`] |
|
|
791
|
+
|
|
792
|
+
### Return type
|
|
793
|
+
|
|
794
|
+
[**FunctionRunList**](FunctionRunList.md)
|
|
795
|
+
|
|
796
|
+
### Authorization
|
|
797
|
+
|
|
798
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
799
|
+
|
|
800
|
+
### HTTP request headers
|
|
801
|
+
|
|
802
|
+
- **Content-Type**: Not defined
|
|
803
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
### HTTP response details
|
|
807
|
+
| Status code | Description | Response headers |
|
|
808
|
+
|-------------|-------------|------------------|
|
|
809
|
+
| **200** | OK | - |
|
|
810
|
+
| **404** | No such function, version or run in the caller\'s organization. | - |
|
|
811
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
812
|
+
| **0** | Error response (RFC 7807) | - |
|
|
813
|
+
|
|
814
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
## listFunctions
|
|
818
|
+
|
|
819
|
+
> FunctionList listFunctions()
|
|
820
|
+
|
|
821
|
+
List functions
|
|
822
|
+
|
|
823
|
+
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.
|
|
824
|
+
|
|
825
|
+
### Example
|
|
826
|
+
|
|
827
|
+
```ts
|
|
828
|
+
import {
|
|
829
|
+
Configuration,
|
|
830
|
+
FunctionsApi,
|
|
831
|
+
} from '@gpuai/sdk';
|
|
832
|
+
import type { ListFunctionsRequest } from '@gpuai/sdk';
|
|
833
|
+
|
|
834
|
+
async function example() {
|
|
835
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
836
|
+
const config = new Configuration({
|
|
837
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
838
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
839
|
+
});
|
|
840
|
+
const api = new FunctionsApi(config);
|
|
841
|
+
|
|
842
|
+
try {
|
|
843
|
+
const data = await api.listFunctions();
|
|
844
|
+
console.log(data);
|
|
845
|
+
} catch (error) {
|
|
846
|
+
console.error(error);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// Run the test
|
|
851
|
+
example().catch(console.error);
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
### Parameters
|
|
855
|
+
|
|
856
|
+
This endpoint does not need any parameter.
|
|
857
|
+
|
|
858
|
+
### Return type
|
|
859
|
+
|
|
860
|
+
[**FunctionList**](FunctionList.md)
|
|
861
|
+
|
|
862
|
+
### Authorization
|
|
863
|
+
|
|
864
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
865
|
+
|
|
866
|
+
### HTTP request headers
|
|
867
|
+
|
|
868
|
+
- **Content-Type**: Not defined
|
|
869
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
### HTTP response details
|
|
873
|
+
| Status code | Description | Response headers |
|
|
874
|
+
|-------------|-------------|------------------|
|
|
875
|
+
| **200** | OK | - |
|
|
876
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
877
|
+
| **0** | Error response (RFC 7807) | - |
|
|
878
|
+
|
|
879
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
880
|
+
|