File size: 1,319 Bytes
70cbb67
43c5255
 
8a15af8
43c5255
 
 
 
 
 
b3c3b35
179904f
b3c3b35
 
 
 
 
 
 
43c5255
 
 
 
e4a6743
43c5255
65209dd
 
43c5255
 
65209dd
43c5255
65209dd
43c5255
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from ..tool_utils import *


@tool("delete_attribute", return_direct=False, args_schema=CommonGetAttributeFields)
def delete_attribute(
    application_system_name: str,
    template_system_name: str,
    system_name: str
    ) -> Dict[str, Any]:
    """
    Delete a text attribute by from the given template and application.

    Returns:
        dict: {
            "success": bool - True if the attribute was deleted successfully
            "status_code": int - HTTP response status code  
            "raw_response": dict|str|None - Raw response for auditing or payload body (sanitized)
            "error": str|None - Error message if operation failed
        }
    """

    attribute_global_alias = f"Attribute@{template_system_name}.{system_name}"

    result = requests_._delete_request(f"{ATTRIBUTE_ENDPOINT}/{application_system_name}/{attribute_global_alias}")

    validated = AttributeResult(**result)

    # Check if the request was successful and has the expected structure
    if not result.get('success', False):
        return validated.model_dump()

    return validated.model_dump()

if __name__ == "__main__":
    results = delete_attribute.invoke({
        "system_name": "Test2",
        "application_system_name": "AItestAndApi",
        "template_system_name": "Test"
    })
    print(results)