bannerify-js 0.0.27 → 0.0.28
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.
- package/README.md +1 -1
- package/dist/index.cjs +47 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +592 -109
- package/dist/index.d.ts +592 -109
- package/dist/index.js +47 -5
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
package/dist/index.d.cts
CHANGED
|
@@ -1,86 +1,5 @@
|
|
|
1
1
|
import { ChartData } from 'chart.js';
|
|
2
2
|
|
|
3
|
-
type Modification = {
|
|
4
|
-
name: string;
|
|
5
|
-
/**
|
|
6
|
-
* color
|
|
7
|
-
* @example #FF0000
|
|
8
|
-
* @default The default color of the layer
|
|
9
|
-
* @description The color for the modification, accept any valid CSS color value, for example: #FF0000, red, rgba(0,0,0,0.5), etc. You can only modify the color of the text layer with this field.
|
|
10
|
-
*/
|
|
11
|
-
color?: string;
|
|
12
|
-
/**
|
|
13
|
-
* star
|
|
14
|
-
* @example 5
|
|
15
|
-
* @default The default star of the layer
|
|
16
|
-
* @description The star for the modification, accept range 1-5, for example: 5, 4, 3, 2, 1.
|
|
17
|
-
*/
|
|
18
|
-
star?: number;
|
|
19
|
-
/**
|
|
20
|
-
* background color
|
|
21
|
-
* @example #FF0000
|
|
22
|
-
* @default The default background color of the layer
|
|
23
|
-
* @description The background color for the modification, accept any valid CSS color value, for example: #FF0000, red, rgba(0,0,0,0.5), etc.
|
|
24
|
-
*/
|
|
25
|
-
background?: string;
|
|
26
|
-
/**
|
|
27
|
-
* font size
|
|
28
|
-
* @example 12
|
|
29
|
-
* @default The default font size of the layer
|
|
30
|
-
* @description The font size for the modification, accept any valid CSS font size value, for example: 12, 12px;
|
|
31
|
-
*/
|
|
32
|
-
size?: number;
|
|
33
|
-
/**
|
|
34
|
-
* source image
|
|
35
|
-
* @example https://example.com/image.jpg
|
|
36
|
-
* @default The default source image of the layer
|
|
37
|
-
* @description The source image for the modification, accept any valid image URL, for example: https://example.com/image.jpg
|
|
38
|
-
*/
|
|
39
|
-
src?: string;
|
|
40
|
-
/**
|
|
41
|
-
* chart data
|
|
42
|
-
* @example { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [{ label: 'My First Dataset', data: [65, 59, 80, 81, 56, 55, 40], fill: false, borderColor: 'rgb(75, 192, 192)', tension: 0.1 }] }
|
|
43
|
-
* @default The default chart data of the layer
|
|
44
|
-
* @description Update chart layer's data, follow chart.js data structure
|
|
45
|
-
*/
|
|
46
|
-
chart?: ChartData;
|
|
47
|
-
/**
|
|
48
|
-
* text content
|
|
49
|
-
* @example Hello World
|
|
50
|
-
* @default The default text content of the layer
|
|
51
|
-
* @description You can modify the text layer with this field
|
|
52
|
-
*/
|
|
53
|
-
text?: string;
|
|
54
|
-
/**
|
|
55
|
-
* barcode content
|
|
56
|
-
* @example 1234567890
|
|
57
|
-
* @default The default barcode content of the layer
|
|
58
|
-
* @description Modify the barcode layer content with this field
|
|
59
|
-
*/
|
|
60
|
-
qrcode?: string;
|
|
61
|
-
/**
|
|
62
|
-
* qrcode content
|
|
63
|
-
* @example Some text
|
|
64
|
-
* @default The default qrcode content of the layer
|
|
65
|
-
* @description Modify the qrcode layer content with this field
|
|
66
|
-
*/
|
|
67
|
-
barcode?: string;
|
|
68
|
-
/**
|
|
69
|
-
* icon name
|
|
70
|
-
* @example Menu
|
|
71
|
-
* @default The default icon name of the layer
|
|
72
|
-
* @description Modify the icon name with this field
|
|
73
|
-
*/
|
|
74
|
-
icon?: string;
|
|
75
|
-
/**
|
|
76
|
-
* visibility
|
|
77
|
-
* @example true
|
|
78
|
-
* @default The default visibility of the layer
|
|
79
|
-
* @description Set the visibility of the field
|
|
80
|
-
*/
|
|
81
|
-
visible?: boolean;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
3
|
/**
|
|
85
4
|
* This file was auto-generated by openapi-typescript.
|
|
86
5
|
* Do not make direct changes to the file.
|
|
@@ -88,22 +7,42 @@ type Modification = {
|
|
|
88
7
|
|
|
89
8
|
|
|
90
9
|
interface paths {
|
|
91
|
-
"/v1/
|
|
92
|
-
|
|
10
|
+
"/v1/templates/createImage": {
|
|
11
|
+
/** @description Create an image from a template */
|
|
12
|
+
post: {
|
|
13
|
+
requestBody: {
|
|
14
|
+
content: {
|
|
15
|
+
"application/json": {
|
|
16
|
+
/**
|
|
17
|
+
* @default png
|
|
18
|
+
* @enum {string}
|
|
19
|
+
*/
|
|
20
|
+
format?: "png" | "svg";
|
|
21
|
+
/** @description Only for debug purpose, it draws bounding box for each layer */
|
|
22
|
+
_debug?: string;
|
|
23
|
+
apiKey: string;
|
|
24
|
+
/**
|
|
25
|
+
* @description Your template id
|
|
26
|
+
* @example tpl_xxxxxxxxx
|
|
27
|
+
*/
|
|
28
|
+
templateId: string;
|
|
29
|
+
/** @default [] */
|
|
30
|
+
modifications?: components["schemas"]["Modification"][];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
93
34
|
responses: {
|
|
94
|
-
/** @description
|
|
35
|
+
/** @description A image file */
|
|
95
36
|
200: {
|
|
96
37
|
content: {
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
status: string;
|
|
100
|
-
};
|
|
38
|
+
"image/png": string;
|
|
39
|
+
"image/svg+xml": string;
|
|
101
40
|
};
|
|
102
41
|
};
|
|
103
42
|
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
104
43
|
400: {
|
|
105
44
|
content: {
|
|
106
|
-
"application/json": components["schemas"]["ErrBadRequest"];
|
|
45
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
107
46
|
};
|
|
108
47
|
};
|
|
109
48
|
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
@@ -145,16 +84,87 @@ interface paths {
|
|
|
145
84
|
};
|
|
146
85
|
};
|
|
147
86
|
};
|
|
148
|
-
"/v1/templates/
|
|
87
|
+
"/v1/templates/createPdf": {
|
|
88
|
+
post: {
|
|
89
|
+
requestBody: {
|
|
90
|
+
content: {
|
|
91
|
+
"application/json": {
|
|
92
|
+
apiKey: string;
|
|
93
|
+
/**
|
|
94
|
+
* @description Your template ID
|
|
95
|
+
* @example tpl_xxx
|
|
96
|
+
*/
|
|
97
|
+
templateId: string;
|
|
98
|
+
/** @default [] */
|
|
99
|
+
modifications?: components["schemas"]["Modification"][];
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
responses: {
|
|
104
|
+
/** @description Success create pdf */
|
|
105
|
+
200: {
|
|
106
|
+
content: {
|
|
107
|
+
"application/pdf": string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
111
|
+
400: {
|
|
112
|
+
content: {
|
|
113
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
117
|
+
401: {
|
|
118
|
+
content: {
|
|
119
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
123
|
+
403: {
|
|
124
|
+
content: {
|
|
125
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
129
|
+
404: {
|
|
130
|
+
content: {
|
|
131
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
135
|
+
409: {
|
|
136
|
+
content: {
|
|
137
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
141
|
+
429: {
|
|
142
|
+
content: {
|
|
143
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
147
|
+
500: {
|
|
148
|
+
content: {
|
|
149
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
"/v1/templates/signedurl": {
|
|
156
|
+
/** @description Generate a signed URL for a template */
|
|
149
157
|
get: {
|
|
150
158
|
parameters: {
|
|
151
159
|
query: {
|
|
152
|
-
modifications?: string;
|
|
153
160
|
format?: "png" | "svg";
|
|
154
161
|
nocache?: string;
|
|
155
162
|
_debug?: string;
|
|
156
|
-
apiKey: string;
|
|
157
163
|
templateId: string;
|
|
164
|
+
apiKeyMd5?: string;
|
|
165
|
+
apiKeyHashed?: string;
|
|
166
|
+
sign: string;
|
|
167
|
+
modifications?: string;
|
|
158
168
|
};
|
|
159
169
|
};
|
|
160
170
|
responses: {
|
|
@@ -162,13 +172,12 @@ interface paths {
|
|
|
162
172
|
200: {
|
|
163
173
|
content: {
|
|
164
174
|
"image/png": unknown;
|
|
165
|
-
"image/svg+xml": string;
|
|
166
175
|
};
|
|
167
176
|
};
|
|
168
177
|
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
169
178
|
400: {
|
|
170
179
|
content: {
|
|
171
|
-
"application/json": components["schemas"]["ErrBadRequest"];
|
|
180
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
172
181
|
};
|
|
173
182
|
};
|
|
174
183
|
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
@@ -210,30 +219,244 @@ interface paths {
|
|
|
210
219
|
};
|
|
211
220
|
};
|
|
212
221
|
};
|
|
213
|
-
"/v1/
|
|
222
|
+
"/v1/info": {
|
|
223
|
+
/** @description Get project info */
|
|
214
224
|
get: {
|
|
215
225
|
parameters: {
|
|
216
226
|
query: {
|
|
217
|
-
|
|
218
|
-
format?: "png" | "svg";
|
|
219
|
-
nocache?: string;
|
|
220
|
-
_debug?: string;
|
|
221
|
-
templateId: string;
|
|
222
|
-
apiKeyMd5: string;
|
|
223
|
-
sign: string;
|
|
227
|
+
apiKey: string;
|
|
224
228
|
};
|
|
225
229
|
};
|
|
226
230
|
responses: {
|
|
227
|
-
/** @description
|
|
231
|
+
/** @description Project info */
|
|
228
232
|
200: {
|
|
229
233
|
content: {
|
|
230
|
-
"
|
|
234
|
+
"application/json": {
|
|
235
|
+
id: string;
|
|
236
|
+
name: string;
|
|
237
|
+
createdAt: string;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
242
|
+
400: {
|
|
243
|
+
content: {
|
|
244
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
248
|
+
401: {
|
|
249
|
+
content: {
|
|
250
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
254
|
+
403: {
|
|
255
|
+
content: {
|
|
256
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
260
|
+
404: {
|
|
261
|
+
content: {
|
|
262
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
266
|
+
409: {
|
|
267
|
+
content: {
|
|
268
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
272
|
+
429: {
|
|
273
|
+
content: {
|
|
274
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
278
|
+
500: {
|
|
279
|
+
content: {
|
|
280
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
"/v1/templates": {
|
|
287
|
+
/** @description List templates */
|
|
288
|
+
get: {
|
|
289
|
+
parameters: {
|
|
290
|
+
query: {
|
|
291
|
+
apiKey: string;
|
|
292
|
+
includeLayers?: string;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
responses: {
|
|
296
|
+
/** @description A list of templates */
|
|
297
|
+
200: {
|
|
298
|
+
content: {
|
|
299
|
+
"application/json": unknown[];
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
303
|
+
400: {
|
|
304
|
+
content: {
|
|
305
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
309
|
+
401: {
|
|
310
|
+
content: {
|
|
311
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
315
|
+
403: {
|
|
316
|
+
content: {
|
|
317
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
321
|
+
404: {
|
|
322
|
+
content: {
|
|
323
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
327
|
+
409: {
|
|
328
|
+
content: {
|
|
329
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
333
|
+
429: {
|
|
334
|
+
content: {
|
|
335
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
339
|
+
500: {
|
|
340
|
+
content: {
|
|
341
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
"/v1/templates/:id": {
|
|
348
|
+
/** @description Template details */
|
|
349
|
+
get: {
|
|
350
|
+
parameters: {
|
|
351
|
+
query: {
|
|
352
|
+
apiKey: string;
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
responses: {
|
|
356
|
+
/** @description Template details */
|
|
357
|
+
200: {
|
|
358
|
+
content: {
|
|
359
|
+
"application/json": {
|
|
360
|
+
/** @description The name of the template */
|
|
361
|
+
name: string;
|
|
362
|
+
/** @description The id of the template */
|
|
363
|
+
id: string;
|
|
364
|
+
/** @description The layers of the template */
|
|
365
|
+
layers: ({
|
|
366
|
+
/** @description The name of the layer */
|
|
367
|
+
name: string;
|
|
368
|
+
/** @description The id of the layer */
|
|
369
|
+
id: string;
|
|
370
|
+
/** @description The type of the layer */
|
|
371
|
+
type: string;
|
|
372
|
+
/** @description The suggest input of the layer */
|
|
373
|
+
suggestInput: string | null;
|
|
374
|
+
})[];
|
|
375
|
+
};
|
|
231
376
|
};
|
|
232
377
|
};
|
|
233
378
|
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
234
379
|
400: {
|
|
235
380
|
content: {
|
|
236
|
-
"application/json": components["schemas"]["ErrBadRequest"];
|
|
381
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
385
|
+
401: {
|
|
386
|
+
content: {
|
|
387
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
391
|
+
403: {
|
|
392
|
+
content: {
|
|
393
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
397
|
+
404: {
|
|
398
|
+
content: {
|
|
399
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
403
|
+
409: {
|
|
404
|
+
content: {
|
|
405
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
409
|
+
429: {
|
|
410
|
+
content: {
|
|
411
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
415
|
+
500: {
|
|
416
|
+
content: {
|
|
417
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
"/v1/templates/createStoredImage": {
|
|
424
|
+
/** @description Create an image from a template */
|
|
425
|
+
post: {
|
|
426
|
+
requestBody: {
|
|
427
|
+
content: {
|
|
428
|
+
"application/json": {
|
|
429
|
+
/**
|
|
430
|
+
* @default png
|
|
431
|
+
* @enum {string}
|
|
432
|
+
*/
|
|
433
|
+
format?: "png" | "svg";
|
|
434
|
+
/** @description Only for debug purpose, it draws bounding box for each layer */
|
|
435
|
+
_debug?: string;
|
|
436
|
+
apiKey: string;
|
|
437
|
+
/**
|
|
438
|
+
* @description Your template id
|
|
439
|
+
* @example tpl_xxxxxxxxx
|
|
440
|
+
*/
|
|
441
|
+
templateId: string;
|
|
442
|
+
/** @default [] */
|
|
443
|
+
modifications?: components["schemas"]["Modification"][];
|
|
444
|
+
};
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
responses: {
|
|
448
|
+
/** @description Image object */
|
|
449
|
+
200: {
|
|
450
|
+
content: {
|
|
451
|
+
"application/json": {
|
|
452
|
+
url: string;
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
457
|
+
400: {
|
|
458
|
+
content: {
|
|
459
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
237
460
|
};
|
|
238
461
|
};
|
|
239
462
|
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
@@ -301,6 +524,28 @@ interface components {
|
|
|
301
524
|
requestId: string;
|
|
302
525
|
};
|
|
303
526
|
};
|
|
527
|
+
ErrFetchImageError: {
|
|
528
|
+
error: {
|
|
529
|
+
/**
|
|
530
|
+
* @description A machine readable error code.
|
|
531
|
+
* @example FETCH_IMAGE_ERROR
|
|
532
|
+
* @enum {string}
|
|
533
|
+
*/
|
|
534
|
+
code: "FETCH_IMAGE_ERROR";
|
|
535
|
+
/**
|
|
536
|
+
* @description A link to our documentation with more details about this error code
|
|
537
|
+
* @example https://bannerify.co/docs/api-reference/errors/code/FETCH_IMAGE_ERROR
|
|
538
|
+
*/
|
|
539
|
+
docs: string;
|
|
540
|
+
/** @description A human readable explanation of what went wrong */
|
|
541
|
+
message: string;
|
|
542
|
+
/**
|
|
543
|
+
* @description Please always include the requestId in your error report
|
|
544
|
+
* @example req:1234
|
|
545
|
+
*/
|
|
546
|
+
requestId: string;
|
|
547
|
+
};
|
|
548
|
+
};
|
|
304
549
|
ErrUnauthorized: {
|
|
305
550
|
error: {
|
|
306
551
|
/**
|
|
@@ -433,6 +678,75 @@ interface components {
|
|
|
433
678
|
requestId: string;
|
|
434
679
|
};
|
|
435
680
|
};
|
|
681
|
+
/** @description A modification (aka override) to apply to the layer in image */
|
|
682
|
+
Modification: {
|
|
683
|
+
/**
|
|
684
|
+
* @description The layer name of the modification
|
|
685
|
+
* @example Text 1
|
|
686
|
+
*/
|
|
687
|
+
name: string;
|
|
688
|
+
/**
|
|
689
|
+
* @description The color for the modification
|
|
690
|
+
* @example #FF0000
|
|
691
|
+
*/
|
|
692
|
+
color?: string;
|
|
693
|
+
/**
|
|
694
|
+
* @description The source image for the modification
|
|
695
|
+
* @example https://example.com/image.jpg
|
|
696
|
+
*/
|
|
697
|
+
src?: string;
|
|
698
|
+
/**
|
|
699
|
+
* @description You can modify the text layer with this field
|
|
700
|
+
* @example Hello World
|
|
701
|
+
*/
|
|
702
|
+
text?: string;
|
|
703
|
+
/**
|
|
704
|
+
* @description Modify the barcode layer content with this field
|
|
705
|
+
* @example 1234567890
|
|
706
|
+
*/
|
|
707
|
+
barcode?: string;
|
|
708
|
+
/**
|
|
709
|
+
* @description Modify the qrcode layer content with this field
|
|
710
|
+
* @example Some text
|
|
711
|
+
*/
|
|
712
|
+
qrcode?: string;
|
|
713
|
+
/** @description Update chart layer's data, follow chart.js data structure */
|
|
714
|
+
chart?: {
|
|
715
|
+
[key: string]: unknown;
|
|
716
|
+
};
|
|
717
|
+
/**
|
|
718
|
+
* @description Set the visibility of the field
|
|
719
|
+
* @example true
|
|
720
|
+
*/
|
|
721
|
+
visible?: boolean;
|
|
722
|
+
/**
|
|
723
|
+
* @description Star value
|
|
724
|
+
* @example 5
|
|
725
|
+
*/
|
|
726
|
+
star?: number;
|
|
727
|
+
/**
|
|
728
|
+
* @description Table width mode
|
|
729
|
+
* @example adaptive
|
|
730
|
+
* @enum {string}
|
|
731
|
+
*/
|
|
732
|
+
widthMode?: "standard" | "adaptive";
|
|
733
|
+
/**
|
|
734
|
+
* @description Table height mode
|
|
735
|
+
* @example adaptive
|
|
736
|
+
* @enum {string}
|
|
737
|
+
*/
|
|
738
|
+
heightMode?: "standard" | "adaptive";
|
|
739
|
+
/**
|
|
740
|
+
* @description Table theme
|
|
741
|
+
* @example NONE
|
|
742
|
+
* @enum {string}
|
|
743
|
+
*/
|
|
744
|
+
theme?: "NONE" | "DEFAULT" | "BRIGHT" | "SIMPLIFY" | "ARCO";
|
|
745
|
+
/** @description Table rows */
|
|
746
|
+
rows?: unknown[];
|
|
747
|
+
/** @description Table columns */
|
|
748
|
+
columns?: string[];
|
|
749
|
+
};
|
|
436
750
|
};
|
|
437
751
|
responses: never;
|
|
438
752
|
parameters: {
|
|
@@ -442,8 +756,89 @@ interface components {
|
|
|
442
756
|
pathItems: never;
|
|
443
757
|
}
|
|
444
758
|
|
|
759
|
+
type Modification = NonNullable<paths["/v1/templates/createImage"]["post"]["requestBody"]["content"]["application/json"]["modifications"]>[0] & {
|
|
760
|
+
name: string;
|
|
761
|
+
/**
|
|
762
|
+
* color
|
|
763
|
+
* @example #FF0000
|
|
764
|
+
* @default The default color of the layer
|
|
765
|
+
* @description The color for the modification, accept any valid CSS color value, for example: #FF0000, red, rgba(0,0,0,0.5), etc. You can only modify the color of the text layer with this field.
|
|
766
|
+
*/
|
|
767
|
+
color?: string;
|
|
768
|
+
/**
|
|
769
|
+
* star
|
|
770
|
+
* @example 5
|
|
771
|
+
* @default The default star of the layer
|
|
772
|
+
* @description The star for the modification, accept range 1-5, for example: 5, 4, 3, 2, 1.
|
|
773
|
+
*/
|
|
774
|
+
star?: number;
|
|
775
|
+
/**
|
|
776
|
+
* background color
|
|
777
|
+
* @example #FF0000
|
|
778
|
+
* @default The default background color of the layer
|
|
779
|
+
* @description The background color for the modification, accept any valid CSS color value, for example: #FF0000, red, rgba(0,0,0,0.5), etc.
|
|
780
|
+
*/
|
|
781
|
+
background?: string;
|
|
782
|
+
/**
|
|
783
|
+
* font size
|
|
784
|
+
* @example 12
|
|
785
|
+
* @default The default font size of the layer
|
|
786
|
+
* @description The font size for the modification, accept any valid CSS font size value, for example: 12, 12px;
|
|
787
|
+
*/
|
|
788
|
+
size?: number;
|
|
789
|
+
/**
|
|
790
|
+
* source image
|
|
791
|
+
* @example https://example.com/image.jpg
|
|
792
|
+
* @default The default source image of the layer
|
|
793
|
+
* @description The source image for the modification, accept any valid image URL, for example: https://example.com/image.jpg
|
|
794
|
+
*/
|
|
795
|
+
src?: string;
|
|
796
|
+
/**
|
|
797
|
+
* chart data
|
|
798
|
+
* @example { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [{ label: 'My First Dataset', data: [65, 59, 80, 81, 56, 55, 40], fill: false, borderColor: 'rgb(75, 192, 192)', tension: 0.1 }] }
|
|
799
|
+
* @default The default chart data of the layer
|
|
800
|
+
* @description Update chart layer's data, follow chart.js data structure
|
|
801
|
+
*/
|
|
802
|
+
chart?: ChartData;
|
|
803
|
+
/**
|
|
804
|
+
* text content
|
|
805
|
+
* @example Hello World
|
|
806
|
+
* @default The default text content of the layer
|
|
807
|
+
* @description You can modify the text layer with this field
|
|
808
|
+
*/
|
|
809
|
+
text?: string;
|
|
810
|
+
/**
|
|
811
|
+
* barcode content
|
|
812
|
+
* @example 1234567890
|
|
813
|
+
* @default The default barcode content of the layer
|
|
814
|
+
* @description Modify the barcode layer content with this field
|
|
815
|
+
*/
|
|
816
|
+
qrcode?: string;
|
|
817
|
+
/**
|
|
818
|
+
* qrcode content
|
|
819
|
+
* @example Some text
|
|
820
|
+
* @default The default qrcode content of the layer
|
|
821
|
+
* @description Modify the qrcode layer content with this field
|
|
822
|
+
*/
|
|
823
|
+
barcode?: string;
|
|
824
|
+
/**
|
|
825
|
+
* icon name
|
|
826
|
+
* @example Menu
|
|
827
|
+
* @default The default icon name of the layer
|
|
828
|
+
* @description Modify the icon name with this field
|
|
829
|
+
*/
|
|
830
|
+
icon?: string;
|
|
831
|
+
/**
|
|
832
|
+
* visibility
|
|
833
|
+
* @example true
|
|
834
|
+
* @default The default visibility of the layer
|
|
835
|
+
* @description Set the visibility of the field
|
|
836
|
+
*/
|
|
837
|
+
visible?: boolean;
|
|
838
|
+
};
|
|
839
|
+
|
|
445
840
|
type codes = '400' | '401' | '403' | '404' | '500';
|
|
446
|
-
type ErrorResponse = paths['/v1/
|
|
841
|
+
type ErrorResponse = paths['/v1/templates/createImage']['post']['responses'][codes]['content']['application/json'];
|
|
447
842
|
declare const timeoutError: {
|
|
448
843
|
error: {
|
|
449
844
|
code: string;
|
|
@@ -468,7 +863,7 @@ interface Options {
|
|
|
468
863
|
type CreateOptions = {
|
|
469
864
|
modifications?: Modification[];
|
|
470
865
|
nocache?: boolean;
|
|
471
|
-
format?:
|
|
866
|
+
format?: "svg" | "png";
|
|
472
867
|
};
|
|
473
868
|
declare function createClient(apiKey: string, opts?: Options): Bannerify;
|
|
474
869
|
declare class Bannerify {
|
|
@@ -479,8 +874,96 @@ declare class Bannerify {
|
|
|
479
874
|
private readonly baseUrl;
|
|
480
875
|
constructor(apiKey: string, opts?: Options | undefined);
|
|
481
876
|
createImage(templateId: string, options?: CreateOptions): Promise<Result<ArrayBuffer | string>>;
|
|
482
|
-
createPdf(templateId: string, options?: CreateOptions): Promise<
|
|
483
|
-
|
|
877
|
+
createPdf(templateId: string, options?: CreateOptions): Promise<{
|
|
878
|
+
error: {
|
|
879
|
+
code: "BAD_REQUEST";
|
|
880
|
+
docs: string;
|
|
881
|
+
message: string;
|
|
882
|
+
requestId: string;
|
|
883
|
+
};
|
|
884
|
+
} | {
|
|
885
|
+
error: {
|
|
886
|
+
code: "FETCH_IMAGE_ERROR";
|
|
887
|
+
docs: string;
|
|
888
|
+
message: string;
|
|
889
|
+
requestId: string;
|
|
890
|
+
};
|
|
891
|
+
} | {
|
|
892
|
+
error: {
|
|
893
|
+
code: "UNAUTHORIZED";
|
|
894
|
+
docs: string;
|
|
895
|
+
message: string;
|
|
896
|
+
requestId: string;
|
|
897
|
+
};
|
|
898
|
+
} | {
|
|
899
|
+
error: {
|
|
900
|
+
code: "FORBIDDEN";
|
|
901
|
+
docs: string;
|
|
902
|
+
message: string;
|
|
903
|
+
requestId: string;
|
|
904
|
+
};
|
|
905
|
+
} | {
|
|
906
|
+
error: {
|
|
907
|
+
code: "NOT_FOUND";
|
|
908
|
+
docs: string;
|
|
909
|
+
message: string;
|
|
910
|
+
requestId: string;
|
|
911
|
+
};
|
|
912
|
+
} | {
|
|
913
|
+
error: {
|
|
914
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
915
|
+
docs: string;
|
|
916
|
+
message: string;
|
|
917
|
+
requestId: string;
|
|
918
|
+
};
|
|
919
|
+
} | {
|
|
920
|
+
result: ArrayBuffer;
|
|
921
|
+
}>;
|
|
922
|
+
createStoredImage(templateId: string, options?: CreateOptions): Promise<{
|
|
923
|
+
error: {
|
|
924
|
+
code: "BAD_REQUEST";
|
|
925
|
+
docs: string;
|
|
926
|
+
message: string;
|
|
927
|
+
requestId: string;
|
|
928
|
+
};
|
|
929
|
+
} | {
|
|
930
|
+
error: {
|
|
931
|
+
code: "FETCH_IMAGE_ERROR";
|
|
932
|
+
docs: string;
|
|
933
|
+
message: string;
|
|
934
|
+
requestId: string;
|
|
935
|
+
};
|
|
936
|
+
} | {
|
|
937
|
+
error: {
|
|
938
|
+
code: "UNAUTHORIZED";
|
|
939
|
+
docs: string;
|
|
940
|
+
message: string;
|
|
941
|
+
requestId: string;
|
|
942
|
+
};
|
|
943
|
+
} | {
|
|
944
|
+
error: {
|
|
945
|
+
code: "FORBIDDEN";
|
|
946
|
+
docs: string;
|
|
947
|
+
message: string;
|
|
948
|
+
requestId: string;
|
|
949
|
+
};
|
|
950
|
+
} | {
|
|
951
|
+
error: {
|
|
952
|
+
code: "NOT_FOUND";
|
|
953
|
+
docs: string;
|
|
954
|
+
message: string;
|
|
955
|
+
requestId: string;
|
|
956
|
+
};
|
|
957
|
+
} | {
|
|
958
|
+
error: {
|
|
959
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
960
|
+
docs: string;
|
|
961
|
+
message: string;
|
|
962
|
+
requestId: string;
|
|
963
|
+
};
|
|
964
|
+
} | {
|
|
965
|
+
result: string;
|
|
966
|
+
}>;
|
|
484
967
|
generateImageSignedUrl(templateId: string, options?: CreateOptions): Promise<string>;
|
|
485
968
|
}
|
|
486
969
|
|