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.
31 lines
841 B
Go
31 lines
841 B
Go
package infra
|
|
|
|
import "fmt"
|
|
|
|
// MetabaseListUsers lista usuarios de Metabase con filtros opcionales.
|
|
// status: "active", "deactivated" o "all" (vacio = "active").
|
|
// query: filtro por nombre o email (vacio = sin filtro).
|
|
// limit/offset: paginacion (0 = valores por defecto de Metabase).
|
|
func MetabaseListUsers(client MetabaseClient, status, query string, limit, offset int) (map[string]any, error) {
|
|
path := "/api/user?"
|
|
if status != "" {
|
|
path += "status=" + status + "&"
|
|
}
|
|
if query != "" {
|
|
path += "query=" + query + "&"
|
|
}
|
|
if limit > 0 {
|
|
path += fmt.Sprintf("limit=%d&", limit)
|
|
}
|
|
if offset > 0 {
|
|
path += fmt.Sprintf("offset=%d&", offset)
|
|
}
|
|
|
|
result, err := metabaseRequest("GET", client.BaseURL, client.Token, path, nil)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("metabase list users: %w", err)
|
|
}
|
|
|
|
return result, nil
|
|
}
|