Skip to content

Commit 72cbe88

Browse files
feat: Add to stainless config new API endpoints
1 parent ba20375 commit 72cbe88

9 files changed

Lines changed: 705 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 30
1+
configured_endpoints: 36
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-e052ac01c788e7e3e46c96bf3c42be7ae57f9dd046129add8012d0eeb388e884.yml
33
openapi_spec_hash: fd805921c0162d63405f5feb7e8c7082
4-
config_hash: 170041ea532e81620e0f6a73f6b31d44
4+
config_hash: 14135b7c88169a15762c8defb0bdfd16

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,35 @@ const response: Hypeman.HealthCheckResponse = await client.health.check();
4848

4949
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
5050

51+
## File uploads
52+
53+
Request parameters that correspond to file uploads can be passed in many different forms:
54+
55+
- `File` (or an object with the same structure)
56+
- a `fetch` `Response` (or an object with the same structure)
57+
- an `fs.ReadStream`
58+
- the return value of our `toFile` helper
59+
60+
```ts
61+
import fs from 'fs';
62+
import Hypeman, { toFile } from '@onkernel/hypeman';
63+
64+
const client = new Hypeman();
65+
66+
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
67+
await client.builds.create({ source: fs.createReadStream('/path/to/file') });
68+
69+
// Or if you have the web `File` API you can pass a `File` instance:
70+
await client.builds.create({ source: new File(['my bytes'], 'file') });
71+
72+
// You can also pass a `fetch` `Response`:
73+
await client.builds.create({ source: await fetch('https://somesite/file') });
74+
75+
// Finally, if none of the above are convenient, you can use our `toFile` helper:
76+
await client.builds.create({ source: await toFile(Buffer.from('my bytes'), 'file') });
77+
await client.builds.create({ source: await toFile(new Uint8Array([0, 1, 2]), 'file') });
78+
```
79+
5180
## Handling errors
5281

5382
When the library is unable to connect to the API,

api.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,38 @@ Methods:
102102
- <code title="get /ingresses">client.ingresses.<a href="./src/resources/ingresses.ts">list</a>() -> IngressListResponse</code>
103103
- <code title="delete /ingresses/{id}">client.ingresses.<a href="./src/resources/ingresses.ts">delete</a>(id) -> void</code>
104104
- <code title="get /ingresses/{id}">client.ingresses.<a href="./src/resources/ingresses.ts">get</a>(id) -> Ingress</code>
105+
106+
# Resources
107+
108+
Types:
109+
110+
- <code><a href="./src/resources/resources.ts">DiskBreakdown</a></code>
111+
- <code><a href="./src/resources/resources.ts">GPUProfile</a></code>
112+
- <code><a href="./src/resources/resources.ts">GPUResourceStatus</a></code>
113+
- <code><a href="./src/resources/resources.ts">PassthroughDevice</a></code>
114+
- <code><a href="./src/resources/resources.ts">ResourceAllocation</a></code>
115+
- <code><a href="./src/resources/resources.ts">ResourceStatus</a></code>
116+
- <code><a href="./src/resources/resources.ts">Resources</a></code>
117+
118+
Methods:
119+
120+
- <code title="get /resources">client.resources.<a href="./src/resources/resources.ts">get</a>() -> Resources</code>
121+
122+
# Builds
123+
124+
Types:
125+
126+
- <code><a href="./src/resources/builds.ts">Build</a></code>
127+
- <code><a href="./src/resources/builds.ts">BuildEvent</a></code>
128+
- <code><a href="./src/resources/builds.ts">BuildPolicy</a></code>
129+
- <code><a href="./src/resources/builds.ts">BuildProvenance</a></code>
130+
- <code><a href="./src/resources/builds.ts">BuildStatus</a></code>
131+
- <code><a href="./src/resources/builds.ts">BuildListResponse</a></code>
132+
133+
Methods:
134+
135+
- <code title="post /builds">client.builds.<a href="./src/resources/builds.ts">create</a>({ ...params }) -> Build</code>
136+
- <code title="get /builds">client.builds.<a href="./src/resources/builds.ts">list</a>() -> BuildListResponse</code>
137+
- <code title="delete /builds/{id}">client.builds.<a href="./src/resources/builds.ts">cancel</a>(id) -> void</code>
138+
- <code title="get /builds/{id}/events">client.builds.<a href="./src/resources/builds.ts">events</a>(id, { ...params }) -> BuildEvent</code>
139+
- <code title="get /builds/{id}">client.builds.<a href="./src/resources/builds.ts">get</a>(id) -> Build</code>

src/client.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ import * as Errors from './core/error';
1616
import * as Uploads from './core/uploads';
1717
import * as API from './resources/index';
1818
import { APIPromise } from './core/api-promise';
19+
import {
20+
Build,
21+
BuildCreateParams,
22+
BuildEvent,
23+
BuildEventsParams,
24+
BuildListResponse,
25+
BuildPolicy,
26+
BuildProvenance,
27+
BuildStatus,
28+
Builds,
29+
} from './resources/builds';
1930
import {
2031
AvailableDevice,
2132
Device,
@@ -36,6 +47,15 @@ import {
3647
IngressTarget,
3748
Ingresses,
3849
} from './resources/ingresses';
50+
import {
51+
DiskBreakdown,
52+
GPUProfile,
53+
GPUResourceStatus,
54+
PassthroughDevice,
55+
ResourceAllocation,
56+
ResourceStatus,
57+
Resources,
58+
} from './resources/resources';
3959
import {
4060
Volume,
4161
VolumeAttachment,
@@ -758,6 +778,8 @@ export class Hypeman {
758778
volumes: API.Volumes = new API.Volumes(this);
759779
devices: API.Devices = new API.Devices(this);
760780
ingresses: API.Ingresses = new API.Ingresses(this);
781+
resources: API.Resources = new API.Resources(this);
782+
builds: API.Builds = new API.Builds(this);
761783
}
762784

763785
Hypeman.Health = Health;
@@ -766,6 +788,7 @@ Hypeman.Instances = Instances;
766788
Hypeman.Volumes = Volumes;
767789
Hypeman.Devices = Devices;
768790
Hypeman.Ingresses = Ingresses;
791+
Hypeman.Builds = Builds;
769792

770793
export declare namespace Hypeman {
771794
export type RequestOptions = Opts.RequestOptions;
@@ -819,4 +842,26 @@ export declare namespace Hypeman {
819842
type IngressListResponse as IngressListResponse,
820843
type IngressCreateParams as IngressCreateParams,
821844
};
845+
846+
export {
847+
type Resources as Resources,
848+
type DiskBreakdown as DiskBreakdown,
849+
type GPUProfile as GPUProfile,
850+
type GPUResourceStatus as GPUResourceStatus,
851+
type PassthroughDevice as PassthroughDevice,
852+
type ResourceAllocation as ResourceAllocation,
853+
type ResourceStatus as ResourceStatus,
854+
};
855+
856+
export {
857+
Builds as Builds,
858+
type Build as Build,
859+
type BuildEvent as BuildEvent,
860+
type BuildPolicy as BuildPolicy,
861+
type BuildProvenance as BuildProvenance,
862+
type BuildStatus as BuildStatus,
863+
type BuildListResponse as BuildListResponse,
864+
type BuildCreateParams as BuildCreateParams,
865+
type BuildEventsParams as BuildEventsParams,
866+
};
822867
}

0 commit comments

Comments
 (0)