Skip to content

Commit 41114a1

Browse files
feat(api): manual updates
1 parent c033a80 commit 41114a1

File tree

15 files changed

+324
-13
lines changed

15 files changed

+324
-13
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: 10
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-c9f598f79a7265337b04e831c4c36bfd8216901c74a5e6d14a38e30d33ec731b.yml
3-
openapi_spec_hash: 458ba78d4ac13aea449822777e9194a5
4-
config_hash: 7532946d051190f2cb8accabad7d586b
1+
configured_endpoints: 14
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-4fd8477b6ac821ae7ed8be9f2bf0995788a1b89009bf771bff6868f3a62c0c50.yml
3+
openapi_spec_hash: 43ec44a0c44eacf31a71a5f00cd28a83
4+
config_hash: 66be21d9e622533a4b22a18501a02005

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The full API of this library can be found in [api.md](api.md).
2626
import StainlessV0 from 'stainless-v0';
2727

2828
const client = new StainlessV0({
29-
apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted
29+
apiKey: process.env['STAINLESS_V0_API_KEY'], // This is the default and can be omitted
3030
});
3131

3232
async function main() {
@@ -47,7 +47,7 @@ This library includes TypeScript definitions for all request params and response
4747
import StainlessV0 from 'stainless-v0';
4848

4949
const client = new StainlessV0({
50-
apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted
50+
apiKey: process.env['STAINLESS_V0_API_KEY'], // This is the default and can be omitted
5151
});
5252

5353
async function main() {

api.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ Types:
44

55
- <code><a href="./src/resources/projects/projects.ts">ProjectRetrieveResponse</a></code>
66
- <code><a href="./src/resources/projects/projects.ts">ProjectUpdateResponse</a></code>
7+
- <code><a href="./src/resources/projects/projects.ts">ProjectListResponse</a></code>
78

89
Methods:
910

1011
- <code title="get /v0/projects/{projectName}">client.projects.<a href="./src/resources/projects/projects.ts">retrieve</a>(projectName) -> ProjectRetrieveResponse</code>
1112
- <code title="patch /v0/projects/{projectName}">client.projects.<a href="./src/resources/projects/projects.ts">update</a>(projectName, { ...params }) -> ProjectUpdateResponse</code>
13+
- <code title="get /v0/projects">client.projects.<a href="./src/resources/projects/projects.ts">list</a>({ ...params }) -> ProjectListResponse</code>
1214

1315
## Branches
1416

@@ -33,6 +35,16 @@ Methods:
3335
- <code title="get /v0/projects/{project}/configs">client.projects.configs.<a href="./src/resources/projects/configs.ts">retrieve</a>(project, { ...params }) -> ConfigRetrieveResponse</code>
3436
- <code title="post /v0/projects/{project}/configs/guess">client.projects.configs.<a href="./src/resources/projects/configs.ts">guess</a>(project, { ...params }) -> ConfigGuessResponse</code>
3537

38+
## Snippets
39+
40+
Types:
41+
42+
- <code><a href="./src/resources/projects/snippets.ts">SnippetCreateRequestResponse</a></code>
43+
44+
Methods:
45+
46+
- <code title="post /v0/projects/{projectName}/snippets/request">client.projects.snippets.<a href="./src/resources/projects/snippets.ts">createRequest</a>(projectName, { ...params }) -> SnippetCreateRequestResponse</code>
47+
3648
# Builds
3749

3850
Types:
@@ -56,3 +68,15 @@ Types:
5668
Methods:
5769

5870
- <code title="get /v0/build_target_outputs">client.buildTargetOutputs.<a href="./src/resources/build-target-outputs.ts">retrieve</a>({ ...params }) -> BuildTargetOutputRetrieveResponse</code>
71+
72+
# Orgs
73+
74+
Types:
75+
76+
- <code><a href="./src/resources/orgs.ts">OrgRetrieveResponse</a></code>
77+
- <code><a href="./src/resources/orgs.ts">OrgListResponse</a></code>
78+
79+
Methods:
80+
81+
- <code title="get /v0/orgs/{orgName}">client.orgs.<a href="./src/resources/orgs.ts">retrieve</a>(orgName) -> OrgRetrieveResponse</code>
82+
- <code title="get /v0/orgs">client.orgs.<a href="./src/resources/orgs.ts">list</a>() -> OrgListResponse</code>

src/client.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ import {
3434
BuildTarget,
3535
Builds,
3636
} from './resources/builds';
37+
import { OrgListResponse, OrgRetrieveResponse, Orgs } from './resources/orgs';
3738
import { readEnv } from './internal/utils/env';
3839
import { formatRequestDetails, loggerFor } from './internal/utils/log';
3940
import { isEmptyObj } from './internal/utils/values';
4041
import {
42+
ProjectListParams,
43+
ProjectListResponse,
4144
ProjectRetrieveResponse,
4245
ProjectUpdateParams,
4346
ProjectUpdateResponse,
@@ -46,7 +49,7 @@ import {
4649

4750
export interface ClientOptions {
4851
/**
49-
* Defaults to process.env['STAINLESS_API_KEY'].
52+
* Defaults to process.env['STAINLESS_V0_API_KEY'].
5053
*/
5154
apiKey?: string | null | undefined;
5255

@@ -138,7 +141,7 @@ export class StainlessV0 {
138141
/**
139142
* API Client for interfacing with the Stainless V0 API.
140143
*
141-
* @param {string | null | undefined} [opts.apiKey=process.env['STAINLESS_API_KEY'] ?? null]
144+
* @param {string | null | undefined} [opts.apiKey=process.env['STAINLESS_V0_API_KEY'] ?? null]
142145
* @param {string} [opts.baseURL=process.env['STAINLESS_V0_BASE_URL'] ?? https://api.stainless.com] - Override the default base URL for the API.
143146
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
144147
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -149,7 +152,7 @@ export class StainlessV0 {
149152
*/
150153
constructor({
151154
baseURL = readEnv('STAINLESS_V0_BASE_URL'),
152-
apiKey = readEnv('STAINLESS_API_KEY') ?? null,
155+
apiKey = readEnv('STAINLESS_V0_API_KEY') ?? null,
153156
...opts
154157
}: ClientOptions = {}) {
155158
const options: ClientOptions = {
@@ -686,18 +689,22 @@ export class StainlessV0 {
686689
projects: API.Projects = new API.Projects(this);
687690
builds: API.Builds = new API.Builds(this);
688691
buildTargetOutputs: API.BuildTargetOutputs = new API.BuildTargetOutputs(this);
692+
orgs: API.Orgs = new API.Orgs(this);
689693
}
690694
StainlessV0.Projects = Projects;
691695
StainlessV0.Builds = Builds;
692696
StainlessV0.BuildTargetOutputs = BuildTargetOutputs;
697+
StainlessV0.Orgs = Orgs;
693698
export declare namespace StainlessV0 {
694699
export type RequestOptions = Opts.RequestOptions;
695700

696701
export {
697702
Projects as Projects,
698703
type ProjectRetrieveResponse as ProjectRetrieveResponse,
699704
type ProjectUpdateResponse as ProjectUpdateResponse,
705+
type ProjectListResponse as ProjectListResponse,
700706
type ProjectUpdateParams as ProjectUpdateParams,
707+
type ProjectListParams as ProjectListParams,
701708
};
702709

703710
export {
@@ -714,4 +721,10 @@ export declare namespace StainlessV0 {
714721
type BuildTargetOutputRetrieveResponse as BuildTargetOutputRetrieveResponse,
715722
type BuildTargetOutputRetrieveParams as BuildTargetOutputRetrieveParams,
716723
};
724+
725+
export {
726+
Orgs as Orgs,
727+
type OrgRetrieveResponse as OrgRetrieveResponse,
728+
type OrgListResponse as OrgListResponse,
729+
};
717730
}

src/resources/builds.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export interface BuildObject {
3636

3737
object: 'build';
3838

39+
org: string;
40+
41+
project: string;
42+
3943
targets: BuildObject.Targets;
4044
}
4145

@@ -300,7 +304,7 @@ export interface BuildListParams {
300304
cursor?: string;
301305

302306
/**
303-
* Maximum number of builds to return, defaults to 10
307+
* Maximum number of builds to return, defaults to 10 (maximum: 100)
304308
*/
305309
limit?: number;
306310

src/resources/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ export {
1313
type BuildCreateParams,
1414
type BuildListParams,
1515
} from './builds';
16+
export { Orgs, type OrgRetrieveResponse, type OrgListResponse } from './orgs';
1617
export {
1718
Projects,
1819
type ProjectRetrieveResponse,
1920
type ProjectUpdateResponse,
21+
type ProjectListResponse,
2022
type ProjectUpdateParams,
23+
type ProjectListParams,
2124
} from './projects/projects';

src/resources/orgs.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../core/resource';
4+
import { APIPromise } from '../core/api-promise';
5+
import { RequestOptions } from '../internal/request-options';
6+
import { path } from '../internal/utils/path';
7+
8+
export class Orgs extends APIResource {
9+
/**
10+
* TODO
11+
*/
12+
retrieve(orgName: string, options?: RequestOptions): APIPromise<OrgRetrieveResponse> {
13+
return this._client.get(path`/v0/orgs/${orgName}`, options);
14+
}
15+
16+
/**
17+
* TODO
18+
*/
19+
list(options?: RequestOptions): APIPromise<OrgListResponse> {
20+
return this._client.get('/v0/orgs', options);
21+
}
22+
}
23+
24+
export interface OrgRetrieveResponse {
25+
display_name: string | null;
26+
27+
object: 'org';
28+
29+
slug: string;
30+
}
31+
32+
export interface OrgListResponse {
33+
data: Array<OrgListResponse.Data>;
34+
35+
has_more: boolean;
36+
37+
next_cursor?: string;
38+
}
39+
40+
export namespace OrgListResponse {
41+
export interface Data {
42+
display_name: string | null;
43+
44+
object: 'org';
45+
46+
slug: string;
47+
}
48+
}
49+
50+
export declare namespace Orgs {
51+
export { type OrgRetrieveResponse as OrgRetrieveResponse, type OrgListResponse as OrgListResponse };
52+
}

src/resources/projects/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ export {
1212
Projects,
1313
type ProjectRetrieveResponse,
1414
type ProjectUpdateResponse,
15+
type ProjectListResponse,
1516
type ProjectUpdateParams,
17+
type ProjectListParams,
1618
} from './projects';
19+
export { Snippets, type SnippetCreateRequestResponse, type SnippetCreateRequestParams } from './snippets';

src/resources/projects/projects.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ import {
1111
ConfigRetrieveResponse,
1212
Configs,
1313
} from './configs';
14+
import * as SnippetsAPI from './snippets';
15+
import { SnippetCreateRequestParams, SnippetCreateRequestResponse, Snippets } from './snippets';
1416
import { APIPromise } from '../../core/api-promise';
1517
import { RequestOptions } from '../../internal/request-options';
1618
import { path } from '../../internal/utils/path';
1719

1820
export class Projects extends APIResource {
1921
branches: BranchesAPI.Branches = new BranchesAPI.Branches(this._client);
2022
configs: ConfigsAPI.Configs = new ConfigsAPI.Configs(this._client);
23+
snippets: SnippetsAPI.Snippets = new SnippetsAPI.Snippets(this._client);
2124

2225
/**
2326
* TODO
@@ -36,6 +39,13 @@ export class Projects extends APIResource {
3639
): APIPromise<ProjectUpdateResponse> {
3740
return this._client.patch(path`/v0/projects/${projectName}`, { body, ...options });
3841
}
42+
43+
/**
44+
* TODO
45+
*/
46+
list(query: ProjectListParams, options?: RequestOptions): APIPromise<ProjectListResponse> {
47+
return this._client.get('/v0/projects', { query, ...options });
48+
}
3949
}
4050

4151
export interface ProjectRetrieveResponse {
@@ -62,18 +72,57 @@ export interface ProjectUpdateResponse {
6272
slug: string;
6373
}
6474

75+
export interface ProjectListResponse {
76+
data: Array<ProjectListResponse.Data>;
77+
78+
has_more: boolean;
79+
80+
next_cursor?: string;
81+
}
82+
83+
export namespace ProjectListResponse {
84+
export interface Data {
85+
config_repo: string;
86+
87+
display_name: string | null;
88+
89+
object: 'project';
90+
91+
org: string;
92+
93+
slug: string;
94+
}
95+
}
96+
6597
export interface ProjectUpdateParams {
6698
display_name?: string | null;
6799
}
68100

101+
export interface ProjectListParams {
102+
org: string;
103+
104+
/**
105+
* Pagination cursor from a previous response
106+
*/
107+
cursor?: string;
108+
109+
/**
110+
* Maximum number of projects to return, defaults to 10 (maximum: 100)
111+
*/
112+
limit?: number;
113+
}
114+
69115
Projects.Branches = Branches;
70116
Projects.Configs = Configs;
117+
Projects.Snippets = Snippets;
71118

72119
export declare namespace Projects {
73120
export {
74121
type ProjectRetrieveResponse as ProjectRetrieveResponse,
75122
type ProjectUpdateResponse as ProjectUpdateResponse,
123+
type ProjectListResponse as ProjectListResponse,
76124
type ProjectUpdateParams as ProjectUpdateParams,
125+
type ProjectListParams as ProjectListParams,
77126
};
78127

79128
export {
@@ -90,4 +139,10 @@ export declare namespace Projects {
90139
type ConfigRetrieveParams as ConfigRetrieveParams,
91140
type ConfigGuessParams as ConfigGuessParams,
92141
};
142+
143+
export {
144+
Snippets as Snippets,
145+
type SnippetCreateRequestResponse as SnippetCreateRequestResponse,
146+
type SnippetCreateRequestParams as SnippetCreateRequestParams,
147+
};
93148
}

0 commit comments

Comments
 (0)