9e6bea681f
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.
54 lines
1.6 KiB
Markdown
54 lines
1.6 KiB
Markdown
---
|
|
name: metabase_create_dashboard
|
|
kind: function
|
|
lang: go
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func MetabaseCreateDashboard(client MetabaseClient, name, description string, collectionID int) (map[string]any, error)"
|
|
description: "Crea un nuevo dashboard vacio en Metabase. Para agregar cards usar MetabaseUpdateDashboard con el campo dashcards. Endpoint: POST /api/dashboard."
|
|
tags: [metabase, dashboard, create, 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_create_dashboard.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
// Crear dashboard vacio
|
|
dashboard, err := MetabaseCreateDashboard(client, "Sales Overview", "KPIs de ventas", 5)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
dashboardID := int(dashboard["id"].(float64))
|
|
|
|
// Luego agregar cards con MetabaseUpdateDashboard
|
|
MetabaseUpdateDashboard(client, dashboardID, map[string]any{
|
|
"dashcards": []map[string]any{
|
|
{"id": -1, "card_id": 42, "size_x": 6, "size_y": 4, "col": 0, "row": 0},
|
|
},
|
|
})
|
|
```
|
|
|
|
## Notas
|
|
|
|
### Parametros para un LLM
|
|
|
|
| Parametro | Tipo | Requerido | Descripcion |
|
|
|-----------|------|-----------|-------------|
|
|
| client | MetabaseClient | si | Cliente autenticado |
|
|
| name | string | si | Nombre del dashboard |
|
|
| description | string | no | Descripcion. Vacio = sin descripcion |
|
|
| collectionID | int | no | Coleccion destino. 0 = root |
|
|
|
|
El dashboard se crea vacio. Para agregar cards, usar MetabaseUpdateDashboard con el array dashcards.
|
|
Retorna el objeto dashboard creado.
|