-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathextensions.ts
More file actions
211 lines (182 loc) · 4.75 KB
/
extensions.ts
File metadata and controls
211 lines (182 loc) · 4.75 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Core from '../core';
export class Extensions extends APIResource {
/**
* Update a Chrome extension (.zip/.crx file or Chrome Web Store URL) for the
* organization
*/
update(
extensionId: string,
body?: ExtensionUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<ExtensionUpdateResponse>;
update(extensionId: string, options?: Core.RequestOptions): Core.APIPromise<ExtensionUpdateResponse>;
update(
extensionId: string,
body: ExtensionUpdateParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<ExtensionUpdateResponse> {
if (isRequestOptions(body)) {
return this.update(extensionId, {}, body);
}
return this._client.put(
`/v1/extensions/${extensionId}`,
Core.multipartFormRequestOptions({ body, ...options }),
);
}
/**
* List all extensions for the organization
*/
list(options?: Core.RequestOptions): Core.APIPromise<ExtensionListResponse> {
return this._client.get('/v1/extensions', options);
}
/**
* Delete an extension by ID
*/
delete(extensionId: string, options?: Core.RequestOptions): Core.APIPromise<ExtensionDeleteResponse> {
return this._client.delete(`/v1/extensions/${extensionId}`, options);
}
/**
* Delete all extensions for the organization
*/
deleteAll(options?: Core.RequestOptions): Core.APIPromise<ExtensionDeleteAllResponse> {
return this._client.delete('/v1/extensions', options);
}
/**
* Download an extension file by extension ID
*/
download(extensionId: string, options?: Core.RequestOptions): Core.APIPromise<string> {
return this._client.get(`/v1/extensions/${extensionId}`, options);
}
/**
* Upload a Chrome extension (.zip/.crx file or Chrome Web Store URL) for the
* organization
*/
upload(
body?: ExtensionUploadParams,
options?: Core.RequestOptions,
): Core.APIPromise<ExtensionUploadResponse>;
upload(options?: Core.RequestOptions): Core.APIPromise<ExtensionUploadResponse>;
upload(
body: ExtensionUploadParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<ExtensionUploadResponse> {
if (isRequestOptions(body)) {
return this.upload({}, body);
}
return this._client.post('/v1/extensions', Core.multipartFormRequestOptions({ body, ...options }));
}
}
export interface ExtensionUpdateResponse {
/**
* Unique extension identifier (e.g., ext_12345)
*/
id: string;
/**
* Creation timestamp
*/
createdAt: string;
/**
* Extension name
*/
name: string;
/**
* Last update timestamp
*/
updatedAt: string;
}
/**
* Response containing a list of extensions for the organization
*/
export interface ExtensionListResponse {
/**
* Total number of extensions
*/
count: number;
/**
* List of extensions for the organization
*/
extensions: Array<ExtensionListResponse.Extension>;
}
export namespace ExtensionListResponse {
export interface Extension {
/**
* Unique extension identifier (e.g., ext_12345)
*/
id: string;
/**
* Creation timestamp
*/
createdAt: string;
/**
* Extension name
*/
name: string;
/**
* Last update timestamp
*/
updatedAt: string;
}
}
export interface ExtensionDeleteResponse {
message: string;
}
export interface ExtensionDeleteAllResponse {
message: string;
}
/**
* Extension zip file
*/
export type ExtensionDownloadResponse = Core.Uploadable;
export interface ExtensionUploadResponse {
/**
* Unique extension identifier (e.g., ext_12345)
*/
id: string;
/**
* Creation timestamp
*/
createdAt: string;
/**
* Extension name
*/
name: string;
/**
* Last update timestamp
*/
updatedAt: string;
}
export interface ExtensionUpdateParams {
/**
* Extension .zip/.crx file
*/
file?: Core.Uploadable;
/**
* Extension URL
*/
url?: string;
}
export interface ExtensionUploadParams {
/**
* Extension .zip/.crx file
*/
file?: Core.Uploadable;
/**
* Extension URL
*/
url?: string;
}
export declare namespace Extensions {
export {
type ExtensionUpdateResponse as ExtensionUpdateResponse,
type ExtensionListResponse as ExtensionListResponse,
type ExtensionDeleteResponse as ExtensionDeleteResponse,
type ExtensionDeleteAllResponse as ExtensionDeleteAllResponse,
type ExtensionDownloadResponse as ExtensionDownloadResponse,
type ExtensionUploadResponse as ExtensionUploadResponse,
type ExtensionUpdateParams as ExtensionUpdateParams,
type ExtensionUploadParams as ExtensionUploadParams,
};
}