# connections.list

Listar as conexões do Google. Conexões ativas de Google Calendar (`provider: google`, agendamentos e links do Google Meet) e Google Drive (`google_drive`) dos atendentes. Sem `attendantId` vêm as da conta toda; com ele, só as daquele atendente. `canWrite` (Drive) = autorizou escrita. `calendars` traz os calendários do Google Calendar e se cada um bloqueia horários (`selected`). `available` = o servidor tem `GOOGLE_CLIENT_ID` e `GOOGLE_CLIENT_SECRET` (sem eles `connections.google_authorize` responde `credencial_ausente`). Nunca devolve tokens. Microsoft Teams está "em breve" no original e não tem operação. Sem a migration a lista vem vazia.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/connections.list` (corpo JSON)
- Quem pode chamar: membro da conta
- Escopo da chave: `crm:read`
- Grava dados: não
- Pela chave de API: sim
- Ferramenta MCP: `connections_list`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `connections.list`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `attendantId` | string (uuid) | não |  |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "attendantId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    }
  }
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/connections.list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

CLI:

```bash
node cli/atomiks.mjs connections.list --json '{}'
```

MCP: ferramenta `connections_list` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "available": {
      "type": "boolean"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "attendantId": {
            "type": "string"
          },
          "attendantName": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "google",
              "google_drive"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "canWrite": {
            "type": "boolean"
          },
          "connectedAt": {
            "type": "string"
          },
          "calendars": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "provider": {
                  "type": "string",
                  "const": "google"
                },
                "calendarId": {
                  "type": "string"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "primary": {
                  "type": "boolean"
                },
                "selected": {
                  "type": "boolean"
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "provider",
                "calendarId",
                "name",
                "primary",
                "selected",
                "email"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "attendantId",
          "attendantName",
          "provider",
          "email",
          "canWrite",
          "connectedAt",
          "calendars"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "available",
    "items"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
