47fac22230
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
78 lines
2.3 KiB
Markdown
78 lines
2.3 KiB
Markdown
---
|
|
name: metabase_update_card
|
|
kind: function
|
|
lang: go
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func MetabaseUpdateCard(client MetabaseClient, cardID int, fields map[string]any) (map[string]any, error)"
|
|
description: "Actualiza campos de una card/pregunta en Metabase. Solo se modifican los campos incluidos en el map. Endpoint: PUT /api/card/:id."
|
|
tags: [metabase, card, question, update, api, pendiente-usar]
|
|
uses_functions: []
|
|
uses_types: [MetabaseClient_go_infra]
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt]
|
|
params:
|
|
- name: client
|
|
desc: "cliente MetabaseClient autenticado"
|
|
- name: cardID
|
|
desc: "ID de la card/pregunta a actualizar"
|
|
- name: fields
|
|
desc: "mapa con los campos a modificar (name, description, display, dataset_query, archived, etc.)"
|
|
output: "mapa con los detalles de la card actualizada"
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "functions/infra/metabase_update_card.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
// Cambiar nombre y descripcion
|
|
card, err := MetabaseUpdateCard(client, 42, map[string]any{
|
|
"name": "Updated Revenue Chart",
|
|
"description": "Now includes refunds",
|
|
})
|
|
|
|
// Archivar una card (soft-delete)
|
|
card, err := MetabaseUpdateCard(client, 42, map[string]any{
|
|
"archived": true,
|
|
})
|
|
|
|
// Mover a otra coleccion
|
|
card, err := MetabaseUpdateCard(client, 42, map[string]any{
|
|
"collection_id": 10,
|
|
})
|
|
|
|
// Cambiar la query SQL
|
|
card, err := MetabaseUpdateCard(client, 42, map[string]any{
|
|
"dataset_query": map[string]any{
|
|
"database": 1,
|
|
"type": "native",
|
|
"native": map[string]any{"query": "SELECT * FROM users LIMIT 100"},
|
|
},
|
|
})
|
|
```
|
|
|
|
## Notas
|
|
|
|
### Campos actualizables
|
|
|
|
| Campo | Tipo | Descripcion |
|
|
|-------|------|-------------|
|
|
| name | string | Nombre de la pregunta |
|
|
| description | string | Descripcion |
|
|
| display | string | Tipo de visualizacion |
|
|
| dataset_query | map | Query SQL o MBQL |
|
|
| visualization_settings | map | Config de visualizacion |
|
|
| collection_id | int | Mover a otra coleccion |
|
|
| archived | bool | Archivar/desarchivar (soft-delete) |
|
|
| enable_embedding | bool | Habilitar embedding publico |
|
|
| embedding_params | map | Parametros de embedding |
|
|
|
|
Solo incluir los campos que se quieren cambiar.
|
|
Para eliminar permanentemente usar MetabaseDeleteCard. Para soft-delete usar archived: true.
|