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:
@@ -0,0 +1,26 @@
|
||||
package infra
|
||||
|
||||
import "fmt"
|
||||
|
||||
// MetabaseCreateDashboard crea un nuevo dashboard en Metabase.
|
||||
// name: nombre del dashboard (obligatorio).
|
||||
// description: descripcion opcional (vacio = sin descripcion).
|
||||
// collectionID: ID de la coleccion/carpeta (0 = root).
|
||||
func MetabaseCreateDashboard(client MetabaseClient, name, description string, collectionID int) (map[string]any, error) {
|
||||
body := map[string]any{
|
||||
"name": name,
|
||||
}
|
||||
if description != "" {
|
||||
body["description"] = description
|
||||
}
|
||||
if collectionID > 0 {
|
||||
body["collection_id"] = collectionID
|
||||
}
|
||||
|
||||
result, err := metabaseRequest("POST", client.BaseURL, client.Token, "/api/dashboard", body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("metabase create dashboard: %w", err)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user