diff --git a/.release-please-manifest.json b/.release-please-manifest.json index abc263a..54cfe49 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.14" + ".": "0.1.0-alpha.15" } diff --git a/.stats.yml b/.stats.yml index f0d8544..2b23ced 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 6 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-19b0d17ba368f32827ee322d15a7f4ff7e1f3bbf66606fad227b3465f8ffc5ab.yml -openapi_spec_hash: 4a3cb766898e8a134ef99fe6c4c87736 +configured_endpoints: 7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-c9d64df733f286f09d2203f4e3d820ce57e8d4c629c5e2db4e2bfac91fbc1598.yml +openapi_spec_hash: fa407611fc566d55f403864fbfaa6c23 config_hash: 4dfa4d870ce0e23e31ce33ab6a53dd21 diff --git a/CHANGELOG.md b/CHANGELOG.md index 18a25f3..6bd61a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.15 (2025-05-20) + +Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/onkernel/kernel-node-sdk/compare/v0.1.0-alpha.14...v0.1.0-alpha.15) + +### Features + +* **api:** update via SDK Studio ([5a8e147](https://github.com/onkernel/kernel-node-sdk/commit/5a8e1474d3a630ae770ebd541375aec4bf183086)) + ## 0.1.0-alpha.14 (2025-05-20) Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/onkernel/kernel-node-sdk/compare/v0.1.0-alpha.13...v0.1.0-alpha.14) diff --git a/api.md b/api.md index d53f92e..93c2c19 100644 --- a/api.md +++ b/api.md @@ -1,5 +1,13 @@ # Apps +Types: + +- AppListResponse + +Methods: + +- client.apps.list({ ...params }) -> AppListResponse + ## Deployments Types: diff --git a/package.json b/package.json index 169baf8..6eac080 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onkernel/sdk", - "version": "0.1.0-alpha.14", + "version": "0.1.0-alpha.15", "description": "The official TypeScript library for the Kernel API", "author": "Kernel <>", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index 6c25324..d3725a3 100644 --- a/src/client.ts +++ b/src/client.ts @@ -30,7 +30,7 @@ import { readEnv } from './internal/utils/env'; import { formatRequestDetails, loggerFor } from './internal/utils/log'; import { isEmptyObj } from './internal/utils/values'; import { KernelApp } from './core/app-framework'; -import { Apps } from './resources/apps/apps'; +import { AppListParams, AppListResponse, Apps } from './resources/apps/apps'; const environments = { production: 'https://api.onkernel.com/', @@ -740,7 +740,7 @@ Kernel.Browsers = Browsers; export declare namespace Kernel { export type RequestOptions = Opts.RequestOptions; - export { Apps as Apps }; + export { Apps as Apps, type AppListResponse as AppListResponse, type AppListParams as AppListParams }; export { Browsers as Browsers, diff --git a/src/resources/apps/apps.ts b/src/resources/apps/apps.ts index 2943499..7db2293 100644 --- a/src/resources/apps/apps.ts +++ b/src/resources/apps/apps.ts @@ -15,16 +15,79 @@ import { InvocationRetrieveResponse, Invocations, } from './invocations'; +import { APIPromise } from '../../core/api-promise'; +import { RequestOptions } from '../../internal/request-options'; export class Apps extends APIResource { deployments: DeploymentsAPI.Deployments = new DeploymentsAPI.Deployments(this._client); invocations: InvocationsAPI.Invocations = new InvocationsAPI.Invocations(this._client); + + /** + * List application versions for the authenticated user. Optionally filter by app + * name and/or version label. + * + * @example + * ```ts + * const apps = await client.apps.list(); + * ``` + */ + list(query: AppListParams | null | undefined = {}, options?: RequestOptions): APIPromise { + return this._client.get('/apps', { query, ...options }); + } +} + +export type AppListResponse = Array; + +export namespace AppListResponse { + /** + * Summary of an application version. + */ + export interface AppListResponseItem { + /** + * Unique identifier for the app version + */ + id: string; + + /** + * Name of the application + */ + app_name: string; + + /** + * Deployment region code + */ + region: string; + + /** + * Version label for the application + */ + version: string; + + /** + * Environment variables configured for this app version + */ + env_vars?: Record; + } +} + +export interface AppListParams { + /** + * Filter results by application name. + */ + app_name?: string; + + /** + * Filter results by version label. + */ + version?: string; } Apps.Deployments = Deployments; Apps.Invocations = Invocations; export declare namespace Apps { + export { type AppListResponse as AppListResponse, type AppListParams as AppListParams }; + export { Deployments as Deployments, type DeploymentCreateResponse as DeploymentCreateResponse, diff --git a/src/resources/apps/index.ts b/src/resources/apps/index.ts index c2215c0..52ecdea 100644 --- a/src/resources/apps/index.ts +++ b/src/resources/apps/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Apps } from './apps'; +export { Apps, type AppListResponse, type AppListParams } from './apps'; export { Deployments, type DeploymentCreateResponse, diff --git a/src/resources/index.ts b/src/resources/index.ts index d8d49ae..ecbf870 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Apps } from './apps/apps'; +export { Apps, type AppListResponse, type AppListParams } from './apps/apps'; export { Browsers, type BrowserCreateResponse, diff --git a/src/version.ts b/src/version.ts index c36bf82..9872581 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.1.0-alpha.14'; // x-release-please-version +export const VERSION = '0.1.0-alpha.15'; // x-release-please-version diff --git a/tests/api-resources/apps/apps.test.ts b/tests/api-resources/apps/apps.test.ts new file mode 100644 index 0000000..6bb4e0d --- /dev/null +++ b/tests/api-resources/apps/apps.test.ts @@ -0,0 +1,30 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Kernel from '@onkernel/sdk'; + +const client = new Kernel({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource apps', () => { + // skipped: tests are disabled for the time being + test.skip('list', async () => { + const responsePromise = client.apps.list(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // skipped: tests are disabled for the time being + test.skip('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.apps.list({ app_name: 'app_name', version: 'version' }, { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(Kernel.NotFoundError); + }); +});