Add product, product group, tree group, attribute, and text endpoints with CRUD operations

This commit is contained in:
claudi 2026-03-24 15:35:20 +01:00
parent ef53746129
commit 68f0b76feb
17 changed files with 3639 additions and 368 deletions

36
add_methods.py Normal file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env python3
"""Script to add all missing methods to the REST client"""
import re
# Read the generated methods file
with open("generated_methods.py", "r") as f:
generated_content = f.read()
# Extract the Python code from markdown backticks
match = re.search(r"```python\n(.*?)\n```", generated_content, re.DOTALL)
if not match:
print("ERROR: Could not find Python code block in generated_methods.py")
exit(1)
methods_code = match.group(1)
# Read the current client file
with open("elytra_client/rest_api/client.py", "r") as f:
client_content = f.read()
# Find the position of "def close(self)" method
close_pos = client_content.find(" def close(self) -> None:")
if close_pos == -1:
print("ERROR: Could not find 'def close' method in client.py")
exit(1)
# Insert the new methods before the close() method
new_client_content = client_content[:close_pos] + methods_code + "\n\n" + client_content[close_pos:]
# Write back to the client file
with open("elytra_client/rest_api/client.py", "w") as f:
f.write(new_client_content)
print(f"Successfully added {methods_code.count('def ')} new methods to the client")
print("Client file updated successfully")