feat: funciones Go para API Metabase y tipo MetabaseClient

Añade funciones Go stub para la API de Metabase en dominio infra:
auth, CRUD de cards, dashboards y users, execute_query y execute_card.
Incluye tipo MetabaseClient y helper HTTP compartido.
Todas las funciones son impuras con stubs not-implemented.
This commit is contained in:
2026-03-28 20:32:24 +01:00
parent 49eecd0c87
commit 9e6bea681f
40 changed files with 1640 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
---
name: metabase_list_users
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func MetabaseListUsers(client MetabaseClient, status, query string, limit, offset int) (map[string]any, error)"
description: "Lista usuarios de una instancia Metabase con filtros opcionales por estado, nombre/email y paginacion. Endpoint: GET /api/user. Requiere permisos de superusuario."
tags: [metabase, user, list, api]
uses_functions: []
uses_types: [MetabaseClient_go_infra]
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [fmt]
tested: false
tests: []
test_file_path: ""
file_path: "functions/infra/metabase_list_users.go"
---
## Ejemplo
```go
client, _ := MetabaseAuth("http://localhost:3000", "admin@example.com", "pass")
// Listar todos los usuarios activos
users, err := MetabaseListUsers(client, "active", "", 0, 0)
// Buscar usuario por email
users, err := MetabaseListUsers(client, "", "john@", 10, 0)
// Listar desactivados
users, err := MetabaseListUsers(client, "deactivated", "", 25, 0)
```
## Notas
Retorna un map con la estructura paginada de Metabase:
- `data`: array de objetos usuario (id, email, first_name, last_name, is_superuser, etc.)
- `total`: numero total de usuarios que coinciden
- `limit`: tamanio de pagina usado
- `offset`: offset usado
### Parametros para un LLM
| Parametro | Tipo | Requerido | Descripcion |
|-----------|------|-----------|-------------|
| client | MetabaseClient | si | Cliente autenticado |
| status | string | no | "active" (default), "deactivated", "all" |
| query | string | no | Filtro por nombre o email |
| limit | int | no | Tamanio de pagina (0 = default Metabase) |
| offset | int | no | Offset para paginacion (0 = inicio) |
### Campos del usuario retornado
| Campo | Tipo | Descripcion |
|-------|------|-------------|
| id | float64 | ID numerico del usuario |
| email | string | Email unico |
| first_name | string | Nombre |
| last_name | string | Apellido |
| is_superuser | bool | Es admin |
| is_active | bool | Esta activo |
| common_name | string | Nombre completo |
| last_login | string | Fecha ultimo login |