Skip to content

Commit 76dc7c0

Browse files
chore(api): remove deprecated endpoints
1 parent 93b1d3f commit 76dc7c0

File tree

11 files changed

+95
-379
lines changed

11 files changed

+95
-379
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-a5b1d2c806c42c1534eefc8d34516f7f6e4ab68cb6a836534ee549bdbe4653f3.yml
3-
openapi_spec_hash: 0be350cc8ddbd1fc7e058ce6c3a44ee8
4-
config_hash: 307153ecd5b85f77ce8e0d87f6e5dfab
1+
configured_endpoints: 19
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-84945582139b11633f792c1052a33e6af9cafc96bbafc2902a905312d14c4cc1.yml
3+
openapi_spec_hash: c77be216626b789a543529a6de56faed
4+
config_hash: 65328ff206b8c0168c915914506d9dba

README.md

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,9 @@ const client = new Kernel({
2727
environment: 'development', // defaults to 'production'
2828
});
2929

30-
const deployment = await client.apps.deployments.create({
31-
entrypoint_rel_path: 'main.ts',
32-
file: fs.createReadStream('path/to/file'),
33-
env_vars: { OPENAI_API_KEY: 'x' },
34-
version: '1.0.0',
35-
});
30+
const browser = await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } });
3631

37-
console.log(deployment.apps);
32+
console.log(browser.session_id);
3833
```
3934

4035
### Request & Response types
@@ -50,10 +45,7 @@ const client = new Kernel({
5045
environment: 'development', // defaults to 'production'
5146
});
5247

53-
const params: Kernel.BrowserCreateParams = {
54-
invocation_id: 'REPLACE_ME',
55-
persistence: { id: 'browser-for-user-1234' },
56-
};
48+
const params: Kernel.BrowserCreateParams = { persistence: { id: 'browser-for-user-1234' } };
5749
const browser: Kernel.BrowserCreateResponse = await client.browsers.create(params);
5850
```
5951

@@ -75,29 +67,26 @@ import Kernel, { toFile } from '@onkernel/sdk';
7567
const client = new Kernel();
7668

7769
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
78-
await client.apps.deployments.create({
70+
await client.deployments.create({
7971
entrypoint_rel_path: 'src/app.py',
8072
file: fs.createReadStream('/path/to/file'),
8173
});
8274

8375
// Or if you have the web `File` API you can pass a `File` instance:
84-
await client.apps.deployments.create({
85-
entrypoint_rel_path: 'src/app.py',
86-
file: new File(['my bytes'], 'file'),
87-
});
76+
await client.deployments.create({ entrypoint_rel_path: 'src/app.py', file: new File(['my bytes'], 'file') });
8877

8978
// You can also pass a `fetch` `Response`:
90-
await client.apps.deployments.create({
79+
await client.deployments.create({
9180
entrypoint_rel_path: 'src/app.py',
9281
file: await fetch('https://somesite/file'),
9382
});
9483

9584
// Finally, if none of the above are convenient, you can use our `toFile` helper:
96-
await client.apps.deployments.create({
85+
await client.deployments.create({
9786
entrypoint_rel_path: 'src/app.py',
9887
file: await toFile(Buffer.from('my bytes'), 'file'),
9988
});
100-
await client.apps.deployments.create({
89+
await client.deployments.create({
10190
entrypoint_rel_path: 'src/app.py',
10291
file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
10392
});
@@ -112,7 +101,7 @@ a subclass of `APIError` will be thrown:
112101
<!-- prettier-ignore -->
113102
```ts
114103
const browser = await client.browsers
115-
.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } })
104+
.create({ persistence: { id: 'browser-for-user-1234' } })
116105
.catch(async (err) => {
117106
if (err instanceof Kernel.APIError) {
118107
console.log(err.status); // 400
@@ -153,7 +142,7 @@ const client = new Kernel({
153142
});
154143

155144
// Or, configure per-request:
156-
await client.browsers.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } }, {
145+
await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } }, {
157146
maxRetries: 5,
158147
});
159148
```
@@ -170,7 +159,7 @@ const client = new Kernel({
170159
});
171160

172161
// Override per-request:
173-
await client.browsers.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } }, {
162+
await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } }, {
174163
timeout: 5 * 1000,
175164
});
176165
```
@@ -193,14 +182,12 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
193182
```ts
194183
const client = new Kernel();
195184

196-
const response = await client.browsers
197-
.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } })
198-
.asResponse();
185+
const response = await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } }).asResponse();
199186
console.log(response.headers.get('X-My-Header'));
200187
console.log(response.statusText); // access the underlying Response object
201188

202189
const { data: browser, response: raw } = await client.browsers
203-
.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } })
190+
.create({ persistence: { id: 'browser-for-user-1234' } })
204191
.withResponse();
205192
console.log(raw.headers.get('X-My-Header'));
206193
console.log(browser.session_id);
@@ -283,7 +270,7 @@ parameter. This library doesn't validate at runtime that the request matches the
283270
send will be sent as-is.
284271

285272
```ts
286-
client.apps.deployments.create({
273+
client.browsers.create({
287274
// ...
288275
// @ts-expect-error baz is not yet public
289276
baz: 'undocumented option',

api.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,11 @@ Methods:
3030

3131
Types:
3232

33-
- <code><a href="./src/resources/apps/apps.ts">AppListResponse</a></code>
33+
- <code><a href="./src/resources/apps.ts">AppListResponse</a></code>
3434

3535
Methods:
3636

37-
- <code title="get /apps">client.apps.<a href="./src/resources/apps/apps.ts">list</a>({ ...params }) -> AppListResponse</code>
38-
39-
## Deployments
40-
41-
Types:
42-
43-
- <code><a href="./src/resources/apps/deployments.ts">DeploymentCreateResponse</a></code>
44-
- <code><a href="./src/resources/apps/deployments.ts">DeploymentFollowResponse</a></code>
45-
46-
Methods:
47-
48-
- <code title="post /deploy">client.apps.deployments.<a href="./src/resources/apps/deployments.ts">create</a>({ ...params }) -> DeploymentCreateResponse</code>
49-
- <code title="get /apps/{id}/events">client.apps.deployments.<a href="./src/resources/apps/deployments.ts">follow</a>(id) -> DeploymentFollowResponse</code>
37+
- <code title="get /apps">client.apps.<a href="./src/resources/apps.ts">list</a>({ ...params }) -> AppListResponse</code>
5038

5139
# Invocations
5240

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ 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 { AppListParams, AppListResponse, Apps } from './resources/apps';
1920
import {
2021
DeploymentCreateParams,
2122
DeploymentCreateResponse,
@@ -38,7 +39,6 @@ import {
3839
InvocationUpdateResponse,
3940
Invocations,
4041
} from './resources/invocations';
41-
import { AppListParams, AppListResponse, Apps } from './resources/apps/apps';
4242
import {
4343
BrowserCreateParams,
4444
BrowserCreateResponse,

src/resources/apps.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,75 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
export * from './apps/index';
3+
import { APIResource } from '../core/resource';
4+
import * as Shared from './shared';
5+
import { APIPromise } from '../core/api-promise';
6+
import { RequestOptions } from '../internal/request-options';
7+
8+
export class Apps extends APIResource {
9+
/**
10+
* List applications. Optionally filter by app name and/or version label.
11+
*/
12+
list(query: AppListParams | null | undefined = {}, options?: RequestOptions): APIPromise<AppListResponse> {
13+
return this._client.get('/apps', { query, ...options });
14+
}
15+
}
16+
17+
export type AppListResponse = Array<AppListResponse.AppListResponseItem>;
18+
19+
export namespace AppListResponse {
20+
/**
21+
* Summary of an application version.
22+
*/
23+
export interface AppListResponseItem {
24+
/**
25+
* Unique identifier for the app version
26+
*/
27+
id: string;
28+
29+
/**
30+
* List of actions available on the app
31+
*/
32+
actions: Array<Shared.AppAction>;
33+
34+
/**
35+
* Name of the application
36+
*/
37+
app_name: string;
38+
39+
/**
40+
* Deployment ID
41+
*/
42+
deployment: string;
43+
44+
/**
45+
* Environment variables configured for this app version
46+
*/
47+
env_vars: { [key: string]: string };
48+
49+
/**
50+
* Deployment region code
51+
*/
52+
region: 'aws.us-east-1a';
53+
54+
/**
55+
* Version label for the application
56+
*/
57+
version: string;
58+
}
59+
}
60+
61+
export interface AppListParams {
62+
/**
63+
* Filter results by application name.
64+
*/
65+
app_name?: string;
66+
67+
/**
68+
* Filter results by version label.
69+
*/
70+
version?: string;
71+
}
72+
73+
export declare namespace Apps {
74+
export { type AppListResponse as AppListResponse, type AppListParams as AppListParams };
75+
}

src/resources/apps/apps.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)