Skip to content

Commit 5a8e147

Browse files
feat(api): update via SDK Studio
1 parent 38497fa commit 5a8e147

File tree

7 files changed

+109
-8
lines changed

7 files changed

+109
-8
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: 6
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-19b0d17ba368f32827ee322d15a7f4ff7e1f3bbf66606fad227b3465f8ffc5ab.yml
3-
openapi_spec_hash: 4a3cb766898e8a134ef99fe6c4c87736
4-
config_hash: 5b3919927cba9bf9dcc80458c199318d
1+
configured_endpoints: 7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-c9d64df733f286f09d2203f4e3d820ce57e8d4c629c5e2db4e2bfac91fbc1598.yml
3+
openapi_spec_hash: fa407611fc566d55f403864fbfaa6c23
4+
config_hash: 4dfa4d870ce0e23e31ce33ab6a53dd21

api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Apps
22

3+
Types:
4+
5+
- <code><a href="./src/resources/apps/apps.ts">AppListResponse</a></code>
6+
7+
Methods:
8+
9+
- <code title="get /apps">client.apps.<a href="./src/resources/apps/apps.ts">list</a>({ ...params }) -> AppListResponse</code>
10+
311
## Deployments
412

513
Types:

src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { readEnv } from './internal/utils/env';
3030
import { formatRequestDetails, loggerFor } from './internal/utils/log';
3131
import { isEmptyObj } from './internal/utils/values';
3232
import { KernelApp } from './core/app-framework';
33-
import { Apps } from './resources/apps/apps';
33+
import { AppListParams, AppListResponse, Apps } from './resources/apps/apps';
3434

3535
const environments = {
3636
production: 'https://api.onkernel.com/',
@@ -740,7 +740,7 @@ Kernel.Browsers = Browsers;
740740
export declare namespace Kernel {
741741
export type RequestOptions = Opts.RequestOptions;
742742

743-
export { Apps as Apps };
743+
export { Apps as Apps, type AppListResponse as AppListResponse, type AppListParams as AppListParams };
744744

745745
export {
746746
Browsers as Browsers,

src/resources/apps/apps.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,79 @@ import {
1515
InvocationRetrieveResponse,
1616
Invocations,
1717
} from './invocations';
18+
import { APIPromise } from '../../core/api-promise';
19+
import { RequestOptions } from '../../internal/request-options';
1820

1921
export class Apps extends APIResource {
2022
deployments: DeploymentsAPI.Deployments = new DeploymentsAPI.Deployments(this._client);
2123
invocations: InvocationsAPI.Invocations = new InvocationsAPI.Invocations(this._client);
24+
25+
/**
26+
* List application versions for the authenticated user. Optionally filter by app
27+
* name and/or version label.
28+
*
29+
* @example
30+
* ```ts
31+
* const apps = await client.apps.list();
32+
* ```
33+
*/
34+
list(query: AppListParams | null | undefined = {}, options?: RequestOptions): APIPromise<AppListResponse> {
35+
return this._client.get('/apps', { query, ...options });
36+
}
37+
}
38+
39+
export type AppListResponse = Array<AppListResponse.AppListResponseItem>;
40+
41+
export namespace AppListResponse {
42+
/**
43+
* Summary of an application version.
44+
*/
45+
export interface AppListResponseItem {
46+
/**
47+
* Unique identifier for the app version
48+
*/
49+
id: string;
50+
51+
/**
52+
* Name of the application
53+
*/
54+
app_name: string;
55+
56+
/**
57+
* Deployment region code
58+
*/
59+
region: string;
60+
61+
/**
62+
* Version label for the application
63+
*/
64+
version: string;
65+
66+
/**
67+
* Environment variables configured for this app version
68+
*/
69+
env_vars?: Record<string, string>;
70+
}
71+
}
72+
73+
export interface AppListParams {
74+
/**
75+
* Filter results by application name.
76+
*/
77+
app_name?: string;
78+
79+
/**
80+
* Filter results by version label.
81+
*/
82+
version?: string;
2283
}
2384

2485
Apps.Deployments = Deployments;
2586
Apps.Invocations = Invocations;
2687

2788
export declare namespace Apps {
89+
export { type AppListResponse as AppListResponse, type AppListParams as AppListParams };
90+
2891
export {
2992
Deployments as Deployments,
3093
type DeploymentCreateResponse as DeploymentCreateResponse,

src/resources/apps/index.ts

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

3-
export { Apps } from './apps';
3+
export { Apps, type AppListResponse, type AppListParams } from './apps';
44
export {
55
Deployments,
66
type DeploymentCreateResponse,

src/resources/index.ts

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

3-
export { Apps } from './apps/apps';
3+
export { Apps, type AppListResponse, type AppListParams } from './apps/apps';
44
export {
55
Browsers,
66
type BrowserCreateResponse,
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import Kernel from '@onkernel/sdk';
4+
5+
const client = new Kernel({
6+
apiKey: 'My API Key',
7+
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
8+
});
9+
10+
describe('resource apps', () => {
11+
// skipped: tests are disabled for the time being
12+
test.skip('list', async () => {
13+
const responsePromise = client.apps.list();
14+
const rawResponse = await responsePromise.asResponse();
15+
expect(rawResponse).toBeInstanceOf(Response);
16+
const response = await responsePromise;
17+
expect(response).not.toBeInstanceOf(Response);
18+
const dataAndResponse = await responsePromise.withResponse();
19+
expect(dataAndResponse.data).toBe(response);
20+
expect(dataAndResponse.response).toBe(rawResponse);
21+
});
22+
23+
// skipped: tests are disabled for the time being
24+
test.skip('list: request options and params are passed correctly', async () => {
25+
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
26+
await expect(
27+
client.apps.list({ app_name: 'app_name', version: 'version' }, { path: '/_stainless_unknown_path' }),
28+
).rejects.toThrow(Kernel.NotFoundError);
29+
});
30+
});

0 commit comments

Comments
 (0)