bannerify-js 0.0.12 → 0.0.15
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/dist/index.cjs +74 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +386 -7
- package/dist/index.d.ts +386 -7
- package/dist/index.js +74 -34
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ChartData } from 'chart.js';
|
|
2
|
-
export { HTTPError, TimeoutError } from 'ky';
|
|
3
2
|
|
|
4
3
|
type Modification = {
|
|
5
4
|
name: string;
|
|
@@ -75,26 +74,406 @@ type Modification = {
|
|
|
75
74
|
visible?: boolean;
|
|
76
75
|
};
|
|
77
76
|
|
|
77
|
+
/**
|
|
78
|
+
* This file was auto-generated by openapi-typescript.
|
|
79
|
+
* Do not make direct changes to the file.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
interface paths {
|
|
84
|
+
"/v1/liveness": {
|
|
85
|
+
get: {
|
|
86
|
+
responses: {
|
|
87
|
+
/** @description The configured services and their status */
|
|
88
|
+
200: {
|
|
89
|
+
content: {
|
|
90
|
+
"application/json": {
|
|
91
|
+
/** @description The status of the server */
|
|
92
|
+
status: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/** @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
|
+
400: {
|
|
98
|
+
content: {
|
|
99
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
103
|
+
401: {
|
|
104
|
+
content: {
|
|
105
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
/** @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. */
|
|
109
|
+
403: {
|
|
110
|
+
content: {
|
|
111
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/** @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. */
|
|
115
|
+
404: {
|
|
116
|
+
content: {
|
|
117
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
121
|
+
409: {
|
|
122
|
+
content: {
|
|
123
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
127
|
+
429: {
|
|
128
|
+
content: {
|
|
129
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
133
|
+
500: {
|
|
134
|
+
content: {
|
|
135
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
"/v1/templates/createImage": {
|
|
142
|
+
get: {
|
|
143
|
+
parameters: {
|
|
144
|
+
query: {
|
|
145
|
+
modifications?: string;
|
|
146
|
+
format?: "png" | "svg";
|
|
147
|
+
nocache?: string;
|
|
148
|
+
_debug?: string;
|
|
149
|
+
apiKey: string;
|
|
150
|
+
templateId: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
responses: {
|
|
154
|
+
/** @description A image file */
|
|
155
|
+
200: {
|
|
156
|
+
content: {
|
|
157
|
+
"image/png": unknown;
|
|
158
|
+
"image/svg+xml": string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
/** @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
|
+
400: {
|
|
163
|
+
content: {
|
|
164
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
168
|
+
401: {
|
|
169
|
+
content: {
|
|
170
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
/** @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. */
|
|
174
|
+
403: {
|
|
175
|
+
content: {
|
|
176
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
/** @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. */
|
|
180
|
+
404: {
|
|
181
|
+
content: {
|
|
182
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
186
|
+
409: {
|
|
187
|
+
content: {
|
|
188
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
192
|
+
429: {
|
|
193
|
+
content: {
|
|
194
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
198
|
+
500: {
|
|
199
|
+
content: {
|
|
200
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
"/v1/templates/imageSignedUrl": {
|
|
207
|
+
get: {
|
|
208
|
+
parameters: {
|
|
209
|
+
query: {
|
|
210
|
+
modifications?: string;
|
|
211
|
+
format?: "png" | "svg";
|
|
212
|
+
nocache?: string;
|
|
213
|
+
_debug?: string;
|
|
214
|
+
templateId: string;
|
|
215
|
+
apiKeyMd5: string;
|
|
216
|
+
sign: string;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
responses: {
|
|
220
|
+
/** @description A image file */
|
|
221
|
+
200: {
|
|
222
|
+
content: {
|
|
223
|
+
"image/png": unknown;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
/** @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
|
+
400: {
|
|
228
|
+
content: {
|
|
229
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
233
|
+
401: {
|
|
234
|
+
content: {
|
|
235
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
/** @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. */
|
|
239
|
+
403: {
|
|
240
|
+
content: {
|
|
241
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
/** @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. */
|
|
245
|
+
404: {
|
|
246
|
+
content: {
|
|
247
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
251
|
+
409: {
|
|
252
|
+
content: {
|
|
253
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
257
|
+
429: {
|
|
258
|
+
content: {
|
|
259
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
263
|
+
500: {
|
|
264
|
+
content: {
|
|
265
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
interface components {
|
|
274
|
+
schemas: {
|
|
275
|
+
ErrBadRequest: {
|
|
276
|
+
error: {
|
|
277
|
+
/**
|
|
278
|
+
* @description A machine readable error code.
|
|
279
|
+
* @example BAD_REQUEST
|
|
280
|
+
* @enum {string}
|
|
281
|
+
*/
|
|
282
|
+
code: "BAD_REQUEST";
|
|
283
|
+
/**
|
|
284
|
+
* @description A link to our documentation with more details about this error code
|
|
285
|
+
* @example https://bannerify.co/docs/api-reference/errors/code/BAD_REQUEST
|
|
286
|
+
*/
|
|
287
|
+
docs: string;
|
|
288
|
+
/** @description A human readable explanation of what went wrong */
|
|
289
|
+
message: string;
|
|
290
|
+
/**
|
|
291
|
+
* @description Please always include the requestId in your error report
|
|
292
|
+
* @example req:1234
|
|
293
|
+
*/
|
|
294
|
+
requestId: string;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
ErrUnauthorized: {
|
|
298
|
+
error: {
|
|
299
|
+
/**
|
|
300
|
+
* @description A machine readable error code.
|
|
301
|
+
* @example UNAUTHORIZED
|
|
302
|
+
* @enum {string}
|
|
303
|
+
*/
|
|
304
|
+
code: "UNAUTHORIZED";
|
|
305
|
+
/**
|
|
306
|
+
* @description A link to our documentation with more details about this error code
|
|
307
|
+
* @example https://bannerify.co/docs/api-reference/errors/code/UNAUTHORIZED
|
|
308
|
+
*/
|
|
309
|
+
docs: string;
|
|
310
|
+
/** @description A human readable explanation of what went wrong */
|
|
311
|
+
message: string;
|
|
312
|
+
/**
|
|
313
|
+
* @description Please always include the requestId in your error report
|
|
314
|
+
* @example req:1234
|
|
315
|
+
*/
|
|
316
|
+
requestId: string;
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
ErrForbidden: {
|
|
320
|
+
error: {
|
|
321
|
+
/**
|
|
322
|
+
* @description A machine readable error code.
|
|
323
|
+
* @example FORBIDDEN
|
|
324
|
+
* @enum {string}
|
|
325
|
+
*/
|
|
326
|
+
code: "FORBIDDEN";
|
|
327
|
+
/**
|
|
328
|
+
* @description A link to our documentation with more details about this error code
|
|
329
|
+
* @example https://bannerify.co/docs/api-reference/errors/code/FORBIDDEN
|
|
330
|
+
*/
|
|
331
|
+
docs: string;
|
|
332
|
+
/** @description A human readable explanation of what went wrong */
|
|
333
|
+
message: string;
|
|
334
|
+
/**
|
|
335
|
+
* @description Please always include the requestId in your error report
|
|
336
|
+
* @example req:1234
|
|
337
|
+
*/
|
|
338
|
+
requestId: string;
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
ErrNotFound: {
|
|
342
|
+
error: {
|
|
343
|
+
/**
|
|
344
|
+
* @description A machine readable error code.
|
|
345
|
+
* @example NOT_FOUND
|
|
346
|
+
* @enum {string}
|
|
347
|
+
*/
|
|
348
|
+
code: "NOT_FOUND";
|
|
349
|
+
/**
|
|
350
|
+
* @description A link to our documentation with more details about this error code
|
|
351
|
+
* @example https://bannerify.co/docs/api-reference/errors/code/NOT_FOUND
|
|
352
|
+
*/
|
|
353
|
+
docs: string;
|
|
354
|
+
/** @description A human readable explanation of what went wrong */
|
|
355
|
+
message: string;
|
|
356
|
+
/**
|
|
357
|
+
* @description Please always include the requestId in your error report
|
|
358
|
+
* @example req:1234
|
|
359
|
+
*/
|
|
360
|
+
requestId: string;
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
ErrConflict: {
|
|
364
|
+
error: {
|
|
365
|
+
/**
|
|
366
|
+
* @description A machine readable error code.
|
|
367
|
+
* @example CONFLICT
|
|
368
|
+
* @enum {string}
|
|
369
|
+
*/
|
|
370
|
+
code: "CONFLICT";
|
|
371
|
+
/**
|
|
372
|
+
* @description A link to our documentation with more details about this error code
|
|
373
|
+
* @example https://bannerify.co/docs/api-reference/errors/code/CONFLICT
|
|
374
|
+
*/
|
|
375
|
+
docs: string;
|
|
376
|
+
/** @description A human readable explanation of what went wrong */
|
|
377
|
+
message: string;
|
|
378
|
+
/**
|
|
379
|
+
* @description Please always include the requestId in your error report
|
|
380
|
+
* @example req:1234
|
|
381
|
+
*/
|
|
382
|
+
requestId: string;
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
ErrTooManyRequests: {
|
|
386
|
+
error: {
|
|
387
|
+
/**
|
|
388
|
+
* @description A machine readable error code.
|
|
389
|
+
* @example TOO_MANY_REQUESTS
|
|
390
|
+
* @enum {string}
|
|
391
|
+
*/
|
|
392
|
+
code: "TOO_MANY_REQUESTS";
|
|
393
|
+
/**
|
|
394
|
+
* @description A link to our documentation with more details about this error code
|
|
395
|
+
* @example https://bannerify.co/docs/api-reference/errors/code/TOO_MANY_REQUESTS
|
|
396
|
+
*/
|
|
397
|
+
docs: string;
|
|
398
|
+
/** @description A human readable explanation of what went wrong */
|
|
399
|
+
message: string;
|
|
400
|
+
/**
|
|
401
|
+
* @description Please always include the requestId in your error report
|
|
402
|
+
* @example req:1234
|
|
403
|
+
*/
|
|
404
|
+
requestId: string;
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
ErrInternalServerError: {
|
|
408
|
+
error: {
|
|
409
|
+
/**
|
|
410
|
+
* @description A machine readable error code.
|
|
411
|
+
* @example INTERNAL_SERVER_ERROR
|
|
412
|
+
* @enum {string}
|
|
413
|
+
*/
|
|
414
|
+
code: "INTERNAL_SERVER_ERROR";
|
|
415
|
+
/**
|
|
416
|
+
* @description A link to our documentation with more details about this error code
|
|
417
|
+
* @example https://bannerify.co/docs/api-reference/errors/code/INTERNAL_SERVER_ERROR
|
|
418
|
+
*/
|
|
419
|
+
docs: string;
|
|
420
|
+
/** @description A human readable explanation of what went wrong */
|
|
421
|
+
message: string;
|
|
422
|
+
/**
|
|
423
|
+
* @description Please always include the requestId in your error report
|
|
424
|
+
* @example req:1234
|
|
425
|
+
*/
|
|
426
|
+
requestId: string;
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
responses: never;
|
|
431
|
+
parameters: {
|
|
432
|
+
};
|
|
433
|
+
requestBodies: never;
|
|
434
|
+
headers: never;
|
|
435
|
+
pathItems: never;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
type codes = '400' | '401' | '403' | '404' | '500';
|
|
439
|
+
type ErrorResponse = paths['/v1/liveness']['get']['responses'][codes]['content']['application/json'];
|
|
440
|
+
declare const timeoutError: {
|
|
441
|
+
error: {
|
|
442
|
+
code: string;
|
|
443
|
+
message: string;
|
|
444
|
+
docs: string;
|
|
445
|
+
requestId: string;
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
type Result<R> = {
|
|
449
|
+
result: R;
|
|
450
|
+
error?: never;
|
|
451
|
+
} | {
|
|
452
|
+
result?: never;
|
|
453
|
+
error: ErrorResponse['error'] | typeof timeoutError;
|
|
454
|
+
};
|
|
455
|
+
|
|
78
456
|
interface Options {
|
|
79
457
|
apiKey: string;
|
|
80
458
|
fetch?: typeof fetch;
|
|
81
459
|
baseUrl?: string;
|
|
460
|
+
timeout?: number;
|
|
82
461
|
}
|
|
83
462
|
type CreateOptions = {
|
|
84
463
|
modifications?: Modification[];
|
|
85
464
|
container?: Modification;
|
|
86
465
|
format?: 'svg' | 'png';
|
|
87
|
-
timeout?: number;
|
|
88
466
|
};
|
|
89
|
-
declare function createClient(
|
|
467
|
+
declare function createClient(apiKey: string, opts?: Options): Bannerify;
|
|
90
468
|
declare class Bannerify {
|
|
91
469
|
#private;
|
|
92
|
-
private readonly
|
|
470
|
+
private readonly apiKey;
|
|
471
|
+
private readonly opts?;
|
|
93
472
|
private readonly client;
|
|
94
473
|
private readonly baseUrl;
|
|
95
|
-
constructor(
|
|
96
|
-
createImage(templateId: string, options?: CreateOptions): Promise<
|
|
97
|
-
createPdf(templateId: string, options?: CreateOptions): Promise<
|
|
474
|
+
constructor(apiKey: string, opts?: Options | undefined);
|
|
475
|
+
createImage(templateId: string, options?: CreateOptions): Promise<Result<ArrayBuffer | string>>;
|
|
476
|
+
createPdf(templateId: string, options?: CreateOptions): Promise<void>;
|
|
98
477
|
createPermanentImage(): Promise<void>;
|
|
99
478
|
generateImageSignedUrl(templateId: string, options?: CreateOptions): Promise<string>;
|
|
100
479
|
}
|