@yaakapp/api 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,7 @@ export type FilterResponse = {
54
54
  };
55
55
  export type FindHttpResponsesRequest = {
56
56
  requestId: string;
57
- limit: number | null;
57
+ limit?: number;
58
58
  };
59
59
  export type FindHttpResponsesResponse = {
60
60
  httpResponses: Array<HttpResponse>;
@@ -77,9 +77,9 @@ export type GetTemplateFunctionsResponse = {
77
77
  export type HttpRequestAction = {
78
78
  key: string;
79
79
  label: string;
80
- icon: string | null;
80
+ icon?: Icon;
81
81
  };
82
- export type Icon = "copy" | "info" | "check_circle" | "alert_triangle";
82
+ export type Icon = "copy" | "info" | "check_circle" | "alert_triangle" | "_unknown";
83
83
  export type ImportRequest = {
84
84
  content: string;
85
85
  };
@@ -145,12 +145,20 @@ export type InternalEventPayload = {
145
145
  } & CallTemplateFunctionResponse | {
146
146
  "type": "copy_text_request";
147
147
  } & CopyTextRequest | {
148
+ "type": "render_http_request_request";
149
+ } & RenderHttpRequestRequest | {
150
+ "type": "render_http_request_response";
151
+ } & RenderHttpRequestResponse | {
148
152
  "type": "template_render_request";
149
153
  } & TemplateRenderRequest | {
150
154
  "type": "template_render_response";
151
155
  } & TemplateRenderResponse | {
152
156
  "type": "show_toast_request";
153
157
  } & ShowToastRequest | {
158
+ "type": "show_prompt_request";
159
+ } & ShowPromptRequest | {
160
+ "type": "show_prompt_response";
161
+ } & ShowPromptResponse | {
154
162
  "type": "get_http_request_by_id_request";
155
163
  } & GetHttpRequestByIdRequest | {
156
164
  "type": "get_http_request_by_id_response";
@@ -161,6 +169,10 @@ export type InternalEventPayload = {
161
169
  } & FindHttpResponsesResponse | {
162
170
  "type": "empty_response";
163
171
  };
172
+ export type OpenFileFilter = {
173
+ name: string;
174
+ extensions: Array<string>;
175
+ };
164
176
  export type RenderHttpRequestRequest = {
165
177
  httpRequest: HttpRequest;
166
178
  purpose: RenderPurpose;
@@ -175,14 +187,37 @@ export type SendHttpRequestRequest = {
175
187
  export type SendHttpRequestResponse = {
176
188
  httpResponse: HttpResponse;
177
189
  };
190
+ export type ShowPromptRequest = {
191
+ id: string;
192
+ title: string;
193
+ label: string;
194
+ description?: string;
195
+ defaultValue?: string;
196
+ placeholder?: string;
197
+ /**
198
+ * Text to add to the confirmation button
199
+ */
200
+ confirmText?: string;
201
+ /**
202
+ * Text to add to the cancel button
203
+ */
204
+ cancelText?: string;
205
+ /**
206
+ * Require the user to enter a non-empty value
207
+ */
208
+ require?: boolean;
209
+ };
210
+ export type ShowPromptResponse = {
211
+ value: string;
212
+ };
178
213
  export type ShowToastRequest = {
179
214
  message: string;
180
- color?: Color | null;
181
- icon?: Icon | null;
215
+ color?: Color;
216
+ icon?: Icon;
182
217
  };
183
218
  export type TemplateFunction = {
184
219
  name: string;
185
- aliases: Array<string>;
220
+ aliases?: Array<string>;
186
221
  args: Array<TemplateFunctionArg>;
187
222
  };
188
223
  export type TemplateFunctionArg = {
@@ -193,42 +228,55 @@ export type TemplateFunctionArg = {
193
228
  "type": "checkbox";
194
229
  } & TemplateFunctionCheckboxArg | {
195
230
  "type": "http_request";
196
- } & TemplateFunctionHttpRequestArg;
231
+ } & TemplateFunctionHttpRequestArg | {
232
+ "type": "file";
233
+ } & TemplateFunctionFileArg;
197
234
  export type TemplateFunctionBaseArg = {
198
235
  name: string;
199
- optional?: boolean | null;
200
- label?: string | null;
201
- defaultValue?: string | null;
236
+ optional?: boolean;
237
+ label?: string;
238
+ defaultValue?: string;
202
239
  };
203
240
  export type TemplateFunctionCheckboxArg = {
204
241
  name: string;
205
- optional?: boolean | null;
206
- label?: string | null;
207
- defaultValue?: string | null;
242
+ optional?: boolean;
243
+ label?: string;
244
+ defaultValue?: string;
245
+ };
246
+ export type TemplateFunctionFileArg = {
247
+ title: string;
248
+ multiple?: boolean;
249
+ directory?: boolean;
250
+ defaultPath?: string;
251
+ filters?: Array<OpenFileFilter>;
252
+ name: string;
253
+ optional?: boolean;
254
+ label?: string;
255
+ defaultValue?: string;
208
256
  };
209
257
  export type TemplateFunctionHttpRequestArg = {
210
258
  name: string;
211
- optional?: boolean | null;
212
- label?: string | null;
213
- defaultValue?: string | null;
259
+ optional?: boolean;
260
+ label?: string;
261
+ defaultValue?: string;
214
262
  };
215
263
  export type TemplateFunctionSelectArg = {
216
264
  options: Array<TemplateFunctionSelectOption>;
217
265
  name: string;
218
- optional?: boolean | null;
219
- label?: string | null;
220
- defaultValue?: string | null;
266
+ optional?: boolean;
267
+ label?: string;
268
+ defaultValue?: string;
221
269
  };
222
270
  export type TemplateFunctionSelectOption = {
223
271
  name: string;
224
272
  value: string;
225
273
  };
226
274
  export type TemplateFunctionTextArg = {
227
- placeholder?: string | null;
275
+ placeholder?: string;
228
276
  name: string;
229
- optional?: boolean | null;
230
- label?: string | null;
231
- defaultValue?: string | null;
277
+ optional?: boolean;
278
+ label?: string;
279
+ defaultValue?: string;
232
280
  };
233
281
  export type TemplateRenderRequest = {
234
282
  data: JsonValue;
@@ -1,4 +1,4 @@
1
- import { TemplateRenderRequest, TemplateRenderResponse } from '@yaakapp-internal/plugin';
1
+ import { ShowPromptRequest, ShowPromptResponse, TemplateRenderRequest, TemplateRenderResponse } from '@yaakapp-internal/plugin';
2
2
  import { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest } from '..';
3
3
  export type Context = {
4
4
  clipboard: {
@@ -7,6 +7,9 @@ export type Context = {
7
7
  toast: {
8
8
  show(args: ShowToastRequest): void;
9
9
  };
10
+ prompt: {
11
+ show(args: ShowPromptRequest): Promise<ShowPromptResponse['value']>;
12
+ };
10
13
  httpRequest: {
11
14
  send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
12
15
  getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaakapp/api",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "main": "lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "files": [