Skip to content

Commit f4fc2be

Browse files
authored
Merge pull request #7 from Doczilla-APP/improvements
Improvements
2 parents 02f4f05 + f1fd96c commit f4fc2be

18 files changed

+106
-20
lines changed

src/__tests__/pdf.spec.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,27 @@ describe('PDF', () => {
1111

1212
axiosMock.onAny().reply(200, Buffer.from(''))
1313

14-
test('it should encode the pdf.headerTemplate and pdf.footerTemplate options', async () => {
14+
test('it should encode the page.html, page.htmlTemplate, pdf.headerHtml and pdf.footerHtml options', async () => {
1515
await client.pdf.direct({
1616
page: {
17-
html: '<div>Your first Doczilla PDF</div>'
17+
html: '<div>Your first Doczilla PDF</div>',
18+
htmlTemplate: '<div>Your first Doczilla {{ type }}</div>',
1819
},
1920
pdf: {
20-
headerTemplate: '<div>Header template</div>',
21-
footerTemplate: '<div>Footer template</div>'
21+
headerHtml: '<div>Header template</div>',
22+
footerHtml: '<div>Footer template</div>'
2223
}
2324
})
2425

2526
expect(axiosMock.history.post.length).toBe(1)
2627
expect(axiosMock.history.post[0].data).toEqual(JSON.stringify({
2728
page: {
28-
html: 'PGRpdj5Zb3VyIGZpcnN0IERvY3ppbGxhIFBERjwvZGl2Pg=='
29+
html: 'PGRpdj5Zb3VyIGZpcnN0IERvY3ppbGxhIFBERjwvZGl2Pg==',
30+
htmlTemplate: 'PGRpdj5Zb3VyIGZpcnN0IERvY3ppbGxhIHt7IHR5cGUgfX08L2Rpdj4='
2931
},
3032
pdf: {
31-
headerTemplate: 'PGRpdj5IZWFkZXIgdGVtcGxhdGU8L2Rpdj4=',
32-
footerTemplate: 'PGRpdj5Gb290ZXIgdGVtcGxhdGU8L2Rpdj4='
33+
headerHtml: 'PGRpdj5IZWFkZXIgdGVtcGxhdGU8L2Rpdj4=',
34+
footerHtml: 'PGRpdj5Gb290ZXIgdGVtcGxhdGU8L2Rpdj4='
3335
}
3436
}))
3537
})

src/generated/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,27 @@
66
export { AsyncJob } from './models/AsyncJob';
77
export type { AsyncPdf } from './models/AsyncPdf';
88
export type { AsyncScreenshot } from './models/AsyncScreenshot';
9+
export type { BadRequestResponse } from './models/BadRequestResponse';
910
export type { CreatePdf } from './models/CreatePdf';
1011
export type { CreateScreenshot } from './models/CreateScreenshot';
12+
export type { ForbiddenResponse } from './models/ForbiddenResponse';
13+
export type { InternalServerErrorResponse } from './models/InternalServerErrorResponse';
1114
export type { PageAuthentication } from './models/PageAuthentication';
1215
export { PageCookie } from './models/PageCookie';
1316
export { PageOptions } from './models/PageOptions';
17+
export type { PayloadTooLargeResponse } from './models/PayloadTooLargeResponse';
1418
export type { PDFMargin } from './models/PDFMargin';
1519
export { PdfOptions } from './models/PdfOptions';
1620
export type { ScreenshotClip } from './models/ScreenshotClip';
1721
export { ScreenshotOptions } from './models/ScreenshotOptions';
1822
export { ScreenshotOverlay } from './models/ScreenshotOverlay';
1923
export type { ScreenshotViewport } from './models/ScreenshotViewport';
2024
export type { StorageOptions } from './models/StorageOptions';
25+
export type { SubscriptionLimitReachedResponse } from './models/SubscriptionLimitReachedResponse';
2126
export { SyncJob } from './models/SyncJob';
2227
export type { SyncPdf } from './models/SyncPdf';
2328
export type { SyncScreenshot } from './models/SyncScreenshot';
29+
export type { TooManyRequestsResponse } from './models/TooManyRequestsResponse';
30+
export type { UnauthorizedResponse } from './models/UnauthorizedResponse';
2431
export { WebhookEvent } from './models/WebhookEvent';
2532
export { WebhookOptions } from './models/WebhookOptions';

src/generated/models/AsyncPdf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { WebhookOptions } from './WebhookOptions';
1010

1111
export type AsyncPdf = {
1212
/**
13-
* Page options, either provide the `url` or `html` option.
13+
* Page options, either provide the `url`, `html` or `htmlTemplate` option.
1414
*/
1515
page: PageOptions;
1616
pdf?: PdfOptions | null;

src/generated/models/AsyncScreenshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { WebhookOptions } from './WebhookOptions';
1010

1111
export type AsyncScreenshot = {
1212
/**
13-
* Page options, either provide the `url` or `html` option.
13+
* Page options, either provide the `url`, `html` or `htmlTemplate` option.
1414
*/
1515
page: PageOptions;
1616
screenshot?: ScreenshotOptions | null;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
6+
export type BadRequestResponse = {
7+
message: string;
8+
code: string;
9+
fields: Record<string, string>;
10+
};
11+

src/generated/models/CreatePdf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { PdfOptions } from './PdfOptions';
88

99
export type CreatePdf = {
1010
/**
11-
* Page options, either provide the `url` or `html` option.
11+
* Page options, either provide the `url`, `html` or `htmlTemplate` option.
1212
*/
1313
page: PageOptions;
1414
pdf?: PdfOptions | null;

src/generated/models/CreateScreenshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { ScreenshotOptions } from './ScreenshotOptions';
88

99
export type CreateScreenshot = {
1010
/**
11-
* Page options, either provide the `url` or `html` option.
11+
* Page options, either provide the `url`, `html` or `htmlTemplate` option.
1212
*/
1313
page: PageOptions;
1414
screenshot?: ScreenshotOptions | null;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
6+
export type ForbiddenResponse = {
7+
message: string;
8+
};
9+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
6+
export type InternalServerErrorResponse = {
7+
message: string;
8+
};
9+

src/generated/models/PageOptions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ export type PageOptions = {
1515
* HTML to render. Needs to be base64 encoded!
1616
*/
1717
html?: string | null;
18+
/**
19+
* HTML template to render. Needs to be base64 encoded!
20+
*/
21+
htmlTemplate?: string | null;
22+
/**
23+
* Template data, only used in combination with `page.htmlTemplate`.
24+
*/
25+
templateData?: Record<string, any> | null;
1826
/**
1927
* When to consider waiting succeeds.
2028
* - `auto` our smart waiting option that can handle 90% of the cases.

0 commit comments

Comments
 (0)