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.
1.7 KiB
1.7 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| metabase_auth | function | go | infra | 1.0.0 | impure | func MetabaseAuth(baseURL, email, password string) (MetabaseClient, error) | Autentica contra la API de Metabase con email y password. Retorna un MetabaseClient con session token valido por 14 dias (configurable con MAX_SESSION_AGE en Metabase). Endpoint: POST /api/session. |
|
|
|
false | error_go_core |
|
false | functions/infra/metabase_auth.go |
Ejemplo
// Autenticar con credenciales
client, err := MetabaseAuth("http://localhost:3000", "admin@example.com", "password123")
if err != nil {
log.Fatal(err)
}
// client.Token contiene el session token
// Alternativa: usar API key directamente
client := MetabaseNewClient("http://localhost:3000", "mb_api_key_xxxxx")
Notas
Dos formas de obtener un MetabaseClient:
MetabaseAuth: login con email/password, obtiene session token via POST /api/session. Token expira en 14 dias por defecto.MetabaseNewClient: usa una API key creada en el admin UI. No expira. Recomendado para automatizacion.
El token se envia como header X-Metabase-Session en todas las llamadas subsiguientes.
Para un LLM que use estas funciones
- Primero obtener un client con
MetabaseAuth()oMetabaseNewClient() - Pasar el client a todas las funciones CRUD (usuarios, cards, dashboards)
- Si recibes error 401, el token expiro — re-autenticar
- Rate limiting: Metabase limita intentos de login fallidos