bannerify-js 0.0.26 → 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 +49 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +592 -102
- package/dist/index.d.ts +592 -102
- package/dist/index.js +49 -7
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,79 +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
|
-
* background color
|
|
14
|
-
* @example #FF0000
|
|
15
|
-
* @default The default background color of the layer
|
|
16
|
-
* @description The background color for the modification, accept any valid CSS color value, for example: #FF0000, red, rgba(0,0,0,0.5), etc.
|
|
17
|
-
*/
|
|
18
|
-
background?: string;
|
|
19
|
-
/**
|
|
20
|
-
* font size
|
|
21
|
-
* @example 12
|
|
22
|
-
* @default The default font size of the layer
|
|
23
|
-
* @description The font size for the modification, accept any valid CSS font size value, for example: 12, 12px;
|
|
24
|
-
*/
|
|
25
|
-
size?: number;
|
|
26
|
-
/**
|
|
27
|
-
* source image
|
|
28
|
-
* @example https://example.com/image.jpg
|
|
29
|
-
* @default The default source image of the layer
|
|
30
|
-
* @description The source image for the modification, accept any valid image URL, for example: https://example.com/image.jpg
|
|
31
|
-
*/
|
|
32
|
-
src?: string;
|
|
33
|
-
/**
|
|
34
|
-
* chart data
|
|
35
|
-
* @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 }] }
|
|
36
|
-
* @default The default chart data of the layer
|
|
37
|
-
* @description Update chart layer's data, follow chart.js data structure
|
|
38
|
-
*/
|
|
39
|
-
chart?: ChartData;
|
|
40
|
-
/**
|
|
41
|
-
* text content
|
|
42
|
-
* @example Hello World
|
|
43
|
-
* @default The default text content of the layer
|
|
44
|
-
* @description You can modify the text layer with this field
|
|
45
|
-
*/
|
|
46
|
-
text?: string;
|
|
47
|
-
/**
|
|
48
|
-
* barcode content
|
|
49
|
-
* @example 1234567890
|
|
50
|
-
* @default The default barcode content of the layer
|
|
51
|
-
* @description Modify the barcode layer content with this field
|
|
52
|
-
*/
|
|
53
|
-
qrcode?: string;
|
|
54
|
-
/**
|
|
55
|
-
* qrcode content
|
|
56
|
-
* @example Some text
|
|
57
|
-
* @default The default qrcode content of the layer
|
|
58
|
-
* @description Modify the qrcode layer content with this field
|
|
59
|
-
*/
|
|
60
|
-
barcode?: string;
|
|
61
|
-
/**
|
|
62
|
-
* icon name
|
|
63
|
-
* @example Menu
|
|
64
|
-
* @default The default icon name of the layer
|
|
65
|
-
* @description Modify the icon name with this field
|
|
66
|
-
*/
|
|
67
|
-
icon?: string;
|
|
68
|
-
/**
|
|
69
|
-
* visibility
|
|
70
|
-
* @example true
|
|
71
|
-
* @default The default visibility of the layer
|
|
72
|
-
* @description Set the visibility of the field
|
|
73
|
-
*/
|
|
74
|
-
visible?: boolean;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
3
|
/**
|
|
78
4
|
* This file was auto-generated by openapi-typescript.
|
|
79
5
|
* Do not make direct changes to the file.
|
|
@@ -81,22 +7,42 @@ type Modification = {
|
|
|
81
7
|
|
|
82
8
|
|
|
83
9
|
interface paths {
|
|
84
|
-
"/v1/
|
|
85
|
-
|
|
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
|
+
};
|
|
86
34
|
responses: {
|
|
87
|
-
/** @description
|
|
35
|
+
/** @description A image file */
|
|
88
36
|
200: {
|
|
89
37
|
content: {
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
status: string;
|
|
93
|
-
};
|
|
38
|
+
"image/png": string;
|
|
39
|
+
"image/svg+xml": string;
|
|
94
40
|
};
|
|
95
41
|
};
|
|
96
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). */
|
|
97
43
|
400: {
|
|
98
44
|
content: {
|
|
99
|
-
"application/json": components["schemas"]["ErrBadRequest"];
|
|
45
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
100
46
|
};
|
|
101
47
|
};
|
|
102
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. */
|
|
@@ -138,16 +84,87 @@ interface paths {
|
|
|
138
84
|
};
|
|
139
85
|
};
|
|
140
86
|
};
|
|
141
|
-
"/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 */
|
|
142
157
|
get: {
|
|
143
158
|
parameters: {
|
|
144
159
|
query: {
|
|
145
|
-
modifications?: string;
|
|
146
160
|
format?: "png" | "svg";
|
|
147
161
|
nocache?: string;
|
|
148
162
|
_debug?: string;
|
|
149
|
-
apiKey: string;
|
|
150
163
|
templateId: string;
|
|
164
|
+
apiKeyMd5?: string;
|
|
165
|
+
apiKeyHashed?: string;
|
|
166
|
+
sign: string;
|
|
167
|
+
modifications?: string;
|
|
151
168
|
};
|
|
152
169
|
};
|
|
153
170
|
responses: {
|
|
@@ -155,13 +172,12 @@ interface paths {
|
|
|
155
172
|
200: {
|
|
156
173
|
content: {
|
|
157
174
|
"image/png": unknown;
|
|
158
|
-
"image/svg+xml": string;
|
|
159
175
|
};
|
|
160
176
|
};
|
|
161
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). */
|
|
162
178
|
400: {
|
|
163
179
|
content: {
|
|
164
|
-
"application/json": components["schemas"]["ErrBadRequest"];
|
|
180
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
165
181
|
};
|
|
166
182
|
};
|
|
167
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. */
|
|
@@ -203,30 +219,244 @@ interface paths {
|
|
|
203
219
|
};
|
|
204
220
|
};
|
|
205
221
|
};
|
|
206
|
-
"/v1/
|
|
222
|
+
"/v1/info": {
|
|
223
|
+
/** @description Get project info */
|
|
207
224
|
get: {
|
|
208
225
|
parameters: {
|
|
209
226
|
query: {
|
|
210
|
-
|
|
211
|
-
format?: "png" | "svg";
|
|
212
|
-
nocache?: string;
|
|
213
|
-
_debug?: string;
|
|
214
|
-
templateId: string;
|
|
215
|
-
apiKeyMd5: string;
|
|
216
|
-
sign: string;
|
|
227
|
+
apiKey: string;
|
|
217
228
|
};
|
|
218
229
|
};
|
|
219
230
|
responses: {
|
|
220
|
-
/** @description
|
|
231
|
+
/** @description Project info */
|
|
221
232
|
200: {
|
|
222
233
|
content: {
|
|
223
|
-
"
|
|
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
|
+
};
|
|
376
|
+
};
|
|
377
|
+
};
|
|
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). */
|
|
379
|
+
400: {
|
|
380
|
+
content: {
|
|
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
|
+
};
|
|
224
454
|
};
|
|
225
455
|
};
|
|
226
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). */
|
|
227
457
|
400: {
|
|
228
458
|
content: {
|
|
229
|
-
"application/json": components["schemas"]["ErrBadRequest"];
|
|
459
|
+
"application/json": components["schemas"]["ErrBadRequest"] | components["schemas"]["ErrFetchImageError"];
|
|
230
460
|
};
|
|
231
461
|
};
|
|
232
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. */
|
|
@@ -294,6 +524,28 @@ interface components {
|
|
|
294
524
|
requestId: string;
|
|
295
525
|
};
|
|
296
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
|
+
};
|
|
297
549
|
ErrUnauthorized: {
|
|
298
550
|
error: {
|
|
299
551
|
/**
|
|
@@ -426,6 +678,75 @@ interface components {
|
|
|
426
678
|
requestId: string;
|
|
427
679
|
};
|
|
428
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
|
+
};
|
|
429
750
|
};
|
|
430
751
|
responses: never;
|
|
431
752
|
parameters: {
|
|
@@ -435,8 +756,89 @@ interface components {
|
|
|
435
756
|
pathItems: never;
|
|
436
757
|
}
|
|
437
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
|
+
|
|
438
840
|
type codes = '400' | '401' | '403' | '404' | '500';
|
|
439
|
-
type ErrorResponse = paths['/v1/
|
|
841
|
+
type ErrorResponse = paths['/v1/templates/createImage']['post']['responses'][codes]['content']['application/json'];
|
|
440
842
|
declare const timeoutError: {
|
|
441
843
|
error: {
|
|
442
844
|
code: string;
|
|
@@ -461,7 +863,7 @@ interface Options {
|
|
|
461
863
|
type CreateOptions = {
|
|
462
864
|
modifications?: Modification[];
|
|
463
865
|
nocache?: boolean;
|
|
464
|
-
format?:
|
|
866
|
+
format?: "svg" | "png";
|
|
465
867
|
};
|
|
466
868
|
declare function createClient(apiKey: string, opts?: Options): Bannerify;
|
|
467
869
|
declare class Bannerify {
|
|
@@ -472,8 +874,96 @@ declare class Bannerify {
|
|
|
472
874
|
private readonly baseUrl;
|
|
473
875
|
constructor(apiKey: string, opts?: Options | undefined);
|
|
474
876
|
createImage(templateId: string, options?: CreateOptions): Promise<Result<ArrayBuffer | string>>;
|
|
475
|
-
createPdf(templateId: string, options?: CreateOptions): Promise<
|
|
476
|
-
|
|
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
|
+
}>;
|
|
477
967
|
generateImageSignedUrl(templateId: string, options?: CreateOptions): Promise<string>;
|
|
478
968
|
}
|
|
479
969
|
|