diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index b25fc415b0a..2f7ad4f5181 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -1,9 +1,10 @@ - * Copyright (C) 2024 Jose MARTINEZ + * Copyright (C) 2024 Jose Martinez * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025 MDW * Copyright (C) 2025 Charlene Benke + * Copyright (C) 2026 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -182,6 +183,26 @@ class Categories extends DolibarrApi return $obj_ret; } + /** + * List categories types + * + * Get a list of type of categories according to filters + * + * @return array Array of category types + * @url GET /types + * + * @throws RestException + */ + public function getTypes() + { + + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { + throw new RestException(403); + } + + return Categorie::$MAP_TYPE_TITLE_AREA; + } + /** * Create category object *