1
0

BxDolAIToolContentDelete.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. use NeuronAI\Tools\PropertyType;
  10. use NeuronAI\Tools\ToolProperty;
  11. use NeuronAI\Tools\ArrayProperty;
  12. use NeuronAI\Tools\ObjectProperty;
  13. class BxDolAIToolContentDelete extends BxDolAITool
  14. {
  15. public function __construct()
  16. {
  17. parent::__construct(
  18. 'content_delete',
  19. 'Use this tool to delete content. Available modules: ' . $this->getContentModules() . '.',
  20. );
  21. }
  22. protected function properties(): array
  23. {
  24. return [
  25. new ToolProperty(
  26. name: 'module',
  27. type: PropertyType::STRING,
  28. description: 'The module name to perform content changes on. Use "system" for site accounts. ',
  29. required: true
  30. ),
  31. new ToolProperty(
  32. name: 'content_id',
  33. type: PropertyType::INTEGER,
  34. description: 'Content ID to delete.',
  35. required: true
  36. ),
  37. ];
  38. }
  39. public function __invoke(string $module, int $content_id = 0): array
  40. {
  41. $a = bx_srv('system', 'delete', [$module, $content_id], 'TemplServiceContent');
  42. return $a;
  43. }
  44. }