-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilds.ts
144 lines (121 loc) · 3.46 KB
/
builds.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../resource';
import * as OutputsAPI from './outputs';
import {
BuildStepOutputInProgress,
BuildStepOutputNotStarted,
BuildStepOutputQueued,
CommitBuildStep,
LintBuildStep,
OutputRetrieveParams,
OutputRetrieveResponse,
Outputs,
TestBuildStep,
} from './outputs';
import { APIPromise } from '../../api-promise';
import { type Uploadable } from '../../uploads';
import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { multipartFormRequestOptions } from '../../internal/uploads';
export class Builds extends APIResource {
outputs: OutputsAPI.Outputs = new OutputsAPI.Outputs(this._client);
/**
* Create a build by uploading a spec along with some other info
*/
create(body: BuildCreateParams, options?: RequestOptions): APIPromise<void> {
return this._client.post(
'/api/spec',
multipartFormRequestOptions(
{ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
this._client,
),
);
}
/**
* Retrieve a list of builds for a project
*/
list(query: BuildListParams, options?: RequestOptions): APIPromise<BuildListResponse> {
return this._client.get('/v1/builds', { query, ...options });
}
}
export interface BuildResponse {
id: string;
targets: Array<'node' | 'python' | 'go' | 'java' | 'kotlin' | 'ruby' | 'typescript'>;
}
export type BuildListResponse = Array<BuildResponse>;
export interface BuildCreateParams {
/**
* The OpenAPI spec to upload
*/
oasSpec: Uploadable;
/**
* The name of the project to create the build in
*/
projectName: string;
/**
* The name of the Stainless branch to upload the spec to
*/
branch?: string;
/**
* The commit message to use in any resultant commits to the SDK repo
*/
commitMessage?: string;
/**
* Whether or not to use an LLM to automatically guess config changes
*/
guessConfig?: boolean;
/**
* The name of the branch to merge in
*/
mergeBranch?: string;
/**
* The ID of the parent build
*/
parentBuildId?: string;
/**
* The Stainless Config to upload
*/
stainlessConfig?: Uploadable;
}
export interface BuildListParams {
/**
* Project name
*/
project: string;
/**
* Optional filter - the branch the build was created on
*/
branch?: string;
/**
* Optional filter - the md5 hash of the Stainless config used for the build
*/
config_hash?: string;
/**
* Optional limit for number of results
*/
limit?: number;
/**
* Optional filter - the md5 hash of the OpenAPI spec used for the build
*/
spec_hash?: string;
}
Builds.Outputs = Outputs;
export declare namespace Builds {
export {
type BuildResponse as BuildResponse,
type BuildListResponse as BuildListResponse,
type BuildCreateParams as BuildCreateParams,
type BuildListParams as BuildListParams,
};
export {
Outputs as Outputs,
type BuildStepOutputInProgress as BuildStepOutputInProgress,
type BuildStepOutputNotStarted as BuildStepOutputNotStarted,
type BuildStepOutputQueued as BuildStepOutputQueued,
type CommitBuildStep as CommitBuildStep,
type LintBuildStep as LintBuildStep,
type TestBuildStep as TestBuildStep,
type OutputRetrieveResponse as OutputRetrieveResponse,
type OutputRetrieveParams as OutputRetrieveParams,
};
}