()
| 158 | } |
| 159 | |
| 160 | func (s *Server) registerAttachments() { |
| 161 | huma.Register(s.API, huma.Operation{ |
| 162 | OperationID: "getAttachment", |
| 163 | Method: http.MethodGet, |
| 164 | Path: "/v1/agents/{email}/messages/{id}/attachments/{index}", |
| 165 | Summary: "Get an attachment (metadata + short-lived download URL)", |
| 166 | Description: "Returns one attachment's metadata plus a short-lived `download_url` (+ `expires_at`) to fetch the bytes out of band — so binary content never streams through an agent's context. Pass `?inline=true` to also receive base64 `data` for small attachments (<= 256 KB); larger inline requests are rejected. `index` is the 0-based attachment index from the message's `attachments[]`.", |
| 167 | Tags: []string{"messages"}, |
| 168 | Security: []map[string][]string{{"bearer": {}}}, |
| 169 | }, s.handleGetAttachment) |
| 170 | } |
| 171 | |
| 172 | func (s *Server) handleGetAttachment(ctx context.Context, in *attachmentParam) (*attachmentOutput, error) { |
| 173 | ag, err := s.resolveOwnedAgent(ctx, in.Address) |
no test coverage detected