@@ -254,21 +254,6 @@ def _parse_retry_after_header(header_value: str | None) -> float | None:
254254 return seconds if seconds > 0 else 0.0
255255
256256
257- def _merge_non_default_values (
258- * ,
259- payload : dict [str , Any ],
260- values : Mapping [str , Any ],
261- defaults : Mapping [str , Any ],
262- ) -> None :
263- payload .update (
264- {
265- key : value
266- for key , value in values .items ()
267- if value is not None and (key not in defaults or value != defaults [key ])
268- }
269- )
270-
271-
272257FileContent = IO [bytes ] | bytes | str
273258FileTuple2 = tuple [str | None , FileContent ]
274259FileTuple3 = tuple [str | None , FileContent , str | None ]
@@ -3663,35 +3648,21 @@ def watermark_pdf_with_text(
36633648 payload : dict [str , Any ] = {
36643649 "files" : file ,
36653650 "watermark_text" : watermark_text ,
3651+ "output" : output ,
3652+ "font" : font ,
3653+ "text_size" : text_size ,
3654+ "text_color_rgb" : text_color_rgb ,
3655+ "text_color_cmyk" : text_color_cmyk ,
3656+ "opacity" : opacity ,
3657+ "horizontal_alignment" : horizontal_alignment ,
3658+ "vertical_alignment" : vertical_alignment ,
3659+ "x" : x ,
3660+ "y" : y ,
3661+ "rotation" : rotation ,
3662+ "pages" : pages ,
3663+ "behind_page" : behind_page ,
36663664 }
3667- _merge_non_default_values (
3668- payload = payload ,
3669- values = {
3670- "output" : output ,
3671- "font" : font ,
3672- "text_size" : text_size ,
3673- "text_color_rgb" : text_color_rgb ,
3674- "text_color_cmyk" : text_color_cmyk ,
3675- "opacity" : opacity ,
3676- "horizontal_alignment" : horizontal_alignment ,
3677- "vertical_alignment" : vertical_alignment ,
3678- "x" : x ,
3679- "y" : y ,
3680- "rotation" : rotation ,
3681- "pages" : pages ,
3682- "behind_page" : behind_page ,
3683- },
3684- defaults = {
3685- "text_size" : 72 ,
3686- "opacity" : 0.5 ,
3687- "horizontal_alignment" : "center" ,
3688- "vertical_alignment" : "center" ,
3689- "x" : 0 ,
3690- "y" : 0 ,
3691- "rotation" : 0 ,
3692- "behind_page" : False ,
3693- },
3694- )
3665+ payload = {key : value for key , value in payload .items () if value is not None }
36953666
36963667 return self ._post_file_operation (
36973668 endpoint = "/watermarked-pdf" ,
@@ -3728,32 +3699,18 @@ def watermark_pdf_with_image(
37283699 payload : dict [str , Any ] = {
37293700 "files" : file ,
37303701 "watermark_file" : watermark_file ,
3702+ "output" : output ,
3703+ "watermark_file_scale" : watermark_file_scale ,
3704+ "opacity" : opacity ,
3705+ "horizontal_alignment" : horizontal_alignment ,
3706+ "vertical_alignment" : vertical_alignment ,
3707+ "x" : x ,
3708+ "y" : y ,
3709+ "rotation" : rotation ,
3710+ "pages" : pages ,
3711+ "behind_page" : behind_page ,
37313712 }
3732- _merge_non_default_values (
3733- payload = payload ,
3734- values = {
3735- "output" : output ,
3736- "watermark_file_scale" : watermark_file_scale ,
3737- "opacity" : opacity ,
3738- "horizontal_alignment" : horizontal_alignment ,
3739- "vertical_alignment" : vertical_alignment ,
3740- "x" : x ,
3741- "y" : y ,
3742- "rotation" : rotation ,
3743- "pages" : pages ,
3744- "behind_page" : behind_page ,
3745- },
3746- defaults = {
3747- "watermark_file_scale" : 0.5 ,
3748- "opacity" : 0.5 ,
3749- "horizontal_alignment" : "center" ,
3750- "vertical_alignment" : "center" ,
3751- "x" : 0 ,
3752- "y" : 0 ,
3753- "rotation" : 0 ,
3754- "behind_page" : False ,
3755- },
3756- )
3713+ payload = {key : value for key , value in payload .items () if value is not None }
37573714
37583715 return self ._post_file_operation (
37593716 endpoint = "/watermarked-pdf" ,
@@ -5590,35 +5547,21 @@ async def watermark_pdf_with_text(
55905547 payload : dict [str , Any ] = {
55915548 "files" : file ,
55925549 "watermark_text" : watermark_text ,
5550+ "output" : output ,
5551+ "font" : font ,
5552+ "text_size" : text_size ,
5553+ "text_color_rgb" : text_color_rgb ,
5554+ "text_color_cmyk" : text_color_cmyk ,
5555+ "opacity" : opacity ,
5556+ "horizontal_alignment" : horizontal_alignment ,
5557+ "vertical_alignment" : vertical_alignment ,
5558+ "x" : x ,
5559+ "y" : y ,
5560+ "rotation" : rotation ,
5561+ "pages" : pages ,
5562+ "behind_page" : behind_page ,
55935563 }
5594- _merge_non_default_values (
5595- payload = payload ,
5596- values = {
5597- "output" : output ,
5598- "font" : font ,
5599- "text_size" : text_size ,
5600- "text_color_rgb" : text_color_rgb ,
5601- "text_color_cmyk" : text_color_cmyk ,
5602- "opacity" : opacity ,
5603- "horizontal_alignment" : horizontal_alignment ,
5604- "vertical_alignment" : vertical_alignment ,
5605- "x" : x ,
5606- "y" : y ,
5607- "rotation" : rotation ,
5608- "pages" : pages ,
5609- "behind_page" : behind_page ,
5610- },
5611- defaults = {
5612- "text_size" : 72 ,
5613- "opacity" : 0.5 ,
5614- "horizontal_alignment" : "center" ,
5615- "vertical_alignment" : "center" ,
5616- "x" : 0 ,
5617- "y" : 0 ,
5618- "rotation" : 0 ,
5619- "behind_page" : False ,
5620- },
5621- )
5564+ payload = {key : value for key , value in payload .items () if value is not None }
56225565
56235566 return await self ._post_file_operation (
56245567 endpoint = "/watermarked-pdf" ,
@@ -5655,32 +5598,18 @@ async def watermark_pdf_with_image(
56555598 payload : dict [str , Any ] = {
56565599 "files" : file ,
56575600 "watermark_file" : watermark_file ,
5601+ "output" : output ,
5602+ "watermark_file_scale" : watermark_file_scale ,
5603+ "opacity" : opacity ,
5604+ "horizontal_alignment" : horizontal_alignment ,
5605+ "vertical_alignment" : vertical_alignment ,
5606+ "x" : x ,
5607+ "y" : y ,
5608+ "rotation" : rotation ,
5609+ "pages" : pages ,
5610+ "behind_page" : behind_page ,
56585611 }
5659- _merge_non_default_values (
5660- payload = payload ,
5661- values = {
5662- "output" : output ,
5663- "watermark_file_scale" : watermark_file_scale ,
5664- "opacity" : opacity ,
5665- "horizontal_alignment" : horizontal_alignment ,
5666- "vertical_alignment" : vertical_alignment ,
5667- "x" : x ,
5668- "y" : y ,
5669- "rotation" : rotation ,
5670- "pages" : pages ,
5671- "behind_page" : behind_page ,
5672- },
5673- defaults = {
5674- "watermark_file_scale" : 0.5 ,
5675- "opacity" : 0.5 ,
5676- "horizontal_alignment" : "center" ,
5677- "vertical_alignment" : "center" ,
5678- "x" : 0 ,
5679- "y" : 0 ,
5680- "rotation" : 0 ,
5681- "behind_page" : False ,
5682- },
5683- )
5612+ payload = {key : value for key , value in payload .items () if value is not None }
56845613
56855614 return await self ._post_file_operation (
56865615 endpoint = "/watermarked-pdf" ,
0 commit comments