Skip to content

Commit 7c91210

Browse files
feat: apps: add offset pagination + headers
1 parent dfe89b5 commit 7c91210

File tree

6 files changed

+64
-46
lines changed

6 files changed

+64
-46
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 65
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-e914e2d08b888c77051acb09176d5e88052f130e0d22e85d946a675d2c3d39ab.yml
3-
openapi_spec_hash: 611d0ed1b4519331470b5d14e5f6784a
4-
config_hash: 3ded7a0ed77b1bfd68eabc6763521fe8
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-015c11efc34c81d4d82a937c017f5eb789ea3ca21a05b70e2ed31c069b839293.yml
3+
openapi_spec_hash: 3dcab2044da305f376cecf4eca38caee
4+
config_hash: 0fbdda3a736cc2748ca33371871e61b3

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Types:
3434

3535
Methods:
3636

37-
- <code title="get /apps">client.apps.<a href="./src/resources/apps.ts">list</a>({ ...params }) -> AppListResponse</code>
37+
- <code title="get /apps">client.apps.<a href="./src/resources/apps.ts">list</a>({ ...params }) -> AppListResponsesOffsetPagination</code>
3838

3939
# Invocations
4040

src/client.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { AbstractPage, type OffsetPaginationParams, OffsetPaginationResponse } f
1818
import * as Uploads from './core/uploads';
1919
import * as API from './resources/index';
2020
import { APIPromise } from './core/api-promise';
21-
import { AppListParams, AppListResponse, Apps } from './resources/apps';
21+
import { AppListParams, AppListResponse, AppListResponsesOffsetPagination, Apps } from './resources/apps';
2222
import {
2323
DeploymentCreateParams,
2424
DeploymentCreateResponse,
@@ -873,7 +873,12 @@ export declare namespace Kernel {
873873
type DeploymentFollowParams as DeploymentFollowParams,
874874
};
875875

876-
export { Apps as Apps, type AppListResponse as AppListResponse, type AppListParams as AppListParams };
876+
export {
877+
Apps as Apps,
878+
type AppListResponse as AppListResponse,
879+
type AppListResponsesOffsetPagination as AppListResponsesOffsetPagination,
880+
type AppListParams as AppListParams,
881+
};
877882

878883
export {
879884
Invocations as Invocations,

src/resources/apps.ts

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,64 @@
22

33
import { APIResource } from '../core/resource';
44
import * as Shared from './shared';
5-
import { APIPromise } from '../core/api-promise';
5+
import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination';
66
import { RequestOptions } from '../internal/request-options';
77

88
export class Apps extends APIResource {
99
/**
1010
* List applications. Optionally filter by app name and/or version label.
1111
*/
12-
list(query: AppListParams | null | undefined = {}, options?: RequestOptions): APIPromise<AppListResponse> {
13-
return this._client.get('/apps', { query, ...options });
12+
list(
13+
query: AppListParams | null | undefined = {},
14+
options?: RequestOptions,
15+
): PagePromise<AppListResponsesOffsetPagination, AppListResponse> {
16+
return this._client.getAPIList('/apps', OffsetPagination<AppListResponse>, { query, ...options });
1417
}
1518
}
1619

17-
export type AppListResponse = Array<AppListResponse.AppListResponseItem>;
20+
export type AppListResponsesOffsetPagination = OffsetPagination<AppListResponse>;
1821

19-
export namespace AppListResponse {
22+
/**
23+
* Summary of an application version.
24+
*/
25+
export interface AppListResponse {
2026
/**
21-
* Summary of an application version.
27+
* Unique identifier for the app version
2228
*/
23-
export interface AppListResponseItem {
24-
/**
25-
* Unique identifier for the app version
26-
*/
27-
id: string;
29+
id: string;
2830

29-
/**
30-
* List of actions available on the app
31-
*/
32-
actions: Array<Shared.AppAction>;
31+
/**
32+
* List of actions available on the app
33+
*/
34+
actions: Array<Shared.AppAction>;
3335

34-
/**
35-
* Name of the application
36-
*/
37-
app_name: string;
36+
/**
37+
* Name of the application
38+
*/
39+
app_name: string;
3840

39-
/**
40-
* Deployment ID
41-
*/
42-
deployment: string;
41+
/**
42+
* Deployment ID
43+
*/
44+
deployment: string;
4345

44-
/**
45-
* Environment variables configured for this app version
46-
*/
47-
env_vars: { [key: string]: string };
46+
/**
47+
* Environment variables configured for this app version
48+
*/
49+
env_vars: { [key: string]: string };
4850

49-
/**
50-
* Deployment region code
51-
*/
52-
region: 'aws.us-east-1a';
51+
/**
52+
* Deployment region code
53+
*/
54+
region: 'aws.us-east-1a';
5355

54-
/**
55-
* Version label for the application
56-
*/
57-
version: string;
58-
}
56+
/**
57+
* Version label for the application
58+
*/
59+
version: string;
5960
}
6061

61-
export interface AppListParams {
62+
export interface AppListParams extends OffsetPaginationParams {
6263
/**
6364
* Filter results by application name.
6465
*/
@@ -71,5 +72,9 @@ export interface AppListParams {
7172
}
7273

7374
export declare namespace Apps {
74-
export { type AppListResponse as AppListResponse, type AppListParams as AppListParams };
75+
export {
76+
type AppListResponse as AppListResponse,
77+
type AppListResponsesOffsetPagination as AppListResponsesOffsetPagination,
78+
type AppListParams as AppListParams,
79+
};
7580
}

src/resources/index.ts

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

33
export * from './shared';
4-
export { Apps, type AppListResponse, type AppListParams } from './apps';
4+
export {
5+
Apps,
6+
type AppListResponse,
7+
type AppListParams,
8+
type AppListResponsesOffsetPagination,
9+
} from './apps';
510
export {
611
Browsers,
712
type BrowserPersistence,

tests/api-resources/apps.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ describe('resource apps', () => {
2424
test.skip('list: request options and params are passed correctly', async () => {
2525
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
2626
await expect(
27-
client.apps.list({ app_name: 'app_name', version: 'version' }, { path: '/_stainless_unknown_path' }),
27+
client.apps.list(
28+
{ app_name: 'app_name', limit: 1, offset: 0, version: 'version' },
29+
{ path: '/_stainless_unknown_path' },
30+
),
2831
).rejects.toThrow(Kernel.NotFoundError);
2932
});
3033
});

0 commit comments

Comments
 (0)