# apis/

This guide was generated by `xuda-cli`.

You can remove all generated folder guides later with:

~~~bash
npm run clean:readmes
~~~

Use this folder for Xuda `api` units.

## What belongs here

- API-style response builders
- data summaries for external callers
- reusable response-oriented logic that should not live in UI components

## Recommended blocks

- `<meta lang="json5">`
- optional `<params lang="json5">`
- optional `<fields lang="json5">`
- optional `<events lang="json5">`
- optional `<datasource lang="json5">`
- `<response>`

## Important rules

- the response body lives in `<response>`
- if the API needs data, model that with a datasource or fields first
- keep the API response format explicit and easy to test

## Example

~~~xml
<meta lang="json5">
{
  id: "student_classes_api",
  menuTitle: "Student Classes API"
}
</meta>

<params lang="json5">
{
  out: {
    students_out: "array"
  }
}
</params>

<datasource lang="json5">
{
  type: "table",
  table: "student_profiles_table",
  output: "students_out"
}
</datasource>

<response>
({ ok: true, count: (@students_out || []).length, rows: @students_out })
</response>
~~~
