Skip to content

Commit 2a0bc98

Browse files
committed
fix: comprehensive fix for Direct API integration
Root cause: Tool names vs action types mismatch Changes: - Use kebab-case tool names: 'create-redactions' (not 'createRedactions') - Builder maps kebab-case tools to camelCase actions - Fixed whitespace linting issue Pattern established: - Tool names: kebab-case (e.g., 'create-redactions') - Action types: camelCase (e.g., 'createRedactions') - API parameters: camelCase (e.g., 'userPassword') - Python methods: snake_case (e.g., 'create_redactions_preset') This aligns with existing patterns like 'apply-instant-json' → 'applyInstantJson'
1 parent 6400965 commit 2a0bc98

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/nutrient_dws/api/direct.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def create_redactions_preset(
339339
if content:
340340
options["content"] = content
341341

342-
return self._process_file("createRedactions", input_file, output_path, **options)
342+
return self._process_file("create-redactions", input_file, output_path, **options)
343343

344344
def create_redactions_regex(
345345
self,
@@ -400,7 +400,7 @@ def create_redactions_regex(
400400
if content:
401401
options["content"] = content
402402

403-
return self._process_file("createRedactions", input_file, output_path, **options)
403+
return self._process_file("create-redactions", input_file, output_path, **options)
404404

405405
def create_redactions_text(
406406
self,
@@ -464,7 +464,7 @@ def create_redactions_text(
464464
if content:
465465
options["content"] = content
466466

467-
return self._process_file("createRedactions", input_file, output_path, **options)
467+
return self._process_file("create-redactions", input_file, output_path, **options)
468468

469469
def optimize_pdf(
470470
self,
@@ -535,7 +535,7 @@ def optimize_pdf(
535535

536536
# Build using the Builder API with output options
537537
builder = self.build(input_file) # type: ignore[attr-defined]
538-
538+
539539
# Apply optimization via output options
540540
output_options = {"optimize": options if options else True}
541541
builder.set_output_options(**output_options)

src/nutrient_dws/builder.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,8 @@ def _map_tool_to_action(self, tool: str, options: dict[str, Any]) -> dict[str, A
173173
"flatten-annotations": "flatten",
174174
"apply-instant-json": "applyInstantJson",
175175
"apply-xfdf": "applyXfdf",
176-
"createRedactions": "createRedactions",
176+
"create-redactions": "createRedactions",
177177
"apply-redactions": "applyRedactions",
178-
"optimize": "optimize",
179178
}
180179

181180
action_type = tool_mapping.get(tool, tool)

0 commit comments

Comments
 (0)