How do I fetch all categories under a category group using the Element API? I am not too familiar with PHP and am just learning the Element API.
How do I turn this craft query into an element api query?

craft.categories.group("brands").level(1).all(),

In categories this is what it looks like

Brands
    -Luxury
        -Gucci
        -Chanel
        -Louis Vuitton
    -Streetwear
        -Supreme
        -Bape
        -Off White
OtherCategory
    - ...
SomeOtherCategory
    - ... 
    - ...
UPDATE 
Figured it out based on another answer from ElementAPI handling CategoryModel and returning a heirachical object

I wrote the query like this:

'api/categories/&lt;entryCat:[\w-]+&gt;' =&gt; function ($entryCat) { 
  return array_merge(apiConfig(), [
      'elementType' =&gt; Category::class, 'criteria' =&gt; ['group' =&gt; $entryCat, 'level' =&gt; 1, 'with' =&gt; ['children.children.children']],
      'transformer' =&gt; function (Category $category) {
        $data = ['title' =&gt; $category-&gt;title];
        $children = $category-&gt;getChildren();
        if ($children) {
            $data['children'] = [];
            foreach ($children as $child) {
              $data['children'][] = ['title' =&gt; $child-&gt;title];
            }
        }
        return $data;
      },
  ]);
},


where apiConfig() is just common settings such as pg and paginate