-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapps.ts
More file actions
186 lines (155 loc) · 3.71 KB
/
apps.ts
File metadata and controls
186 lines (155 loc) · 3.71 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { type Uploadable } from '../core/uploads';
import { RequestOptions } from '../internal/request-options';
import { multipartFormRequestOptions } from '../internal/uploads';
import { path } from '../internal/utils/path';
export class Apps extends APIResource {
/**
* Deploy a new application
*
* @example
* ```ts
* const response = await client.apps.deploy({
* file: fs.createReadStream('path/to/file'),
* });
* ```
*/
deploy(body: AppDeployParams, options?: RequestOptions): APIPromise<AppDeployResponse> {
return this._client.post('/apps/deploy', multipartFormRequestOptions({ body, ...options }, this._client));
}
/**
* Invoke an application
*
* @example
* ```ts
* const response = await client.apps.invoke({
* actionName: 'analyze',
* appName: 'my-awesome-app',
* payload: { data: 'example input' },
* version: '1.0.0',
* });
* ```
*/
invoke(body: AppInvokeParams, options?: RequestOptions): APIPromise<AppInvokeResponse> {
return this._client.post('/apps/invoke', { body, ...options });
}
/**
* Get an app invocation by id
*
* @example
* ```ts
* const response = await client.apps.retrieveInvocation(
* 'ckqwer3o20000jb9s7abcdef',
* );
* ```
*/
retrieveInvocation(id: string, options?: RequestOptions): APIPromise<AppRetrieveInvocationResponse> {
return this._client.get(path`/apps/invocations/${id}`, options);
}
}
export interface AppDeployResponse {
apps: Array<AppDeployResponse.App>;
/**
* Success message
*/
message: string;
/**
* Status of the deployment
*/
success: boolean;
}
export namespace AppDeployResponse {
export interface App {
/**
* ID for the app version deployed
*/
id: string;
actions: Array<App.Action>;
/**
* Name of the app
*/
name: string;
}
export namespace App {
export interface Action {
/**
* Name of the action
*/
name: string;
}
}
}
export interface AppInvokeResponse {
/**
* ID of the invocation
*/
id: string;
/**
* Status of the invocation
*/
status: 'QUEUED' | 'RUNNING' | 'SUCCEEDED' | 'FAILED';
/**
* Output from the invocation (if available)
*/
output?: string;
}
export interface AppRetrieveInvocationResponse {
id: string;
appName: string;
finishedAt: string | null;
input: string;
output: string;
startedAt: string;
status: string;
}
export interface AppDeployParams {
/**
* ZIP file containing the application source directory
*/
file: Uploadable;
/**
* Relative path to the entrypoint of the application
*/
entrypointRelPath?: string;
/**
* Allow overwriting an existing app version
*/
force?: 'true' | 'false';
/**
* Region for deployment. Currently we only support "aws.us-east-1a"
*/
region?: 'aws.us-east-1a';
/**
* Version of the application. Can be any string.
*/
version?: string;
}
export interface AppInvokeParams {
/**
* Name of the action to invoke
*/
actionName: string;
/**
* Name of the application
*/
appName: string;
/**
* Input data for the application
*/
payload: unknown;
/**
* Version of the application
*/
version: string;
}
export declare namespace Apps {
export {
type AppDeployResponse as AppDeployResponse,
type AppInvokeResponse as AppInvokeResponse,
type AppRetrieveInvocationResponse as AppRetrieveInvocationResponse,
type AppDeployParams as AppDeployParams,
type AppInvokeParams as AppInvokeParams,
};
}