()
| 70 | func (e *slugError) Error() string { return e.msg } |
| 71 | |
| 72 | func (s *Server) registerAgentWrites() { |
| 73 | huma.Register(s.API, huma.Operation{ |
| 74 | OperationID: "createAgent", |
| 75 | Method: http.MethodPost, |
| 76 | Path: "/v1/agents", |
| 77 | Summary: "Create an agent", |
| 78 | Description: "Register an agent by full email. A custom-domain agent's domain must be a verified domain the caller owns; an email on the deployment's shared domain (e.g. xyz@agents.e2a.dev) is registered as a shared-domain agent. Returns the full agent.", |
| 79 | Tags: []string{"agents"}, |
| 80 | Security: []map[string][]string{{"bearer": {}}}, |
| 81 | DefaultStatus: http.StatusCreated, |
| 82 | }, s.handleCreateAgent) |
| 83 | |
| 84 | huma.Register(s.API, huma.Operation{ |
| 85 | OperationID: "updateAgent", |
| 86 | Method: http.MethodPatch, |
| 87 | Path: "/v1/agents/{email}", |
| 88 | Summary: "Update an agent", |
| 89 | Description: "Update an agent's display name. The screening/protection config lives on the /v1/agents/{email}/protection sub-resource. Returns the post-update agent.", |
| 90 | Tags: []string{"agents"}, |
| 91 | Security: []map[string][]string{{"bearer": {}}}, |
| 92 | }, s.handleUpdateAgent) |
| 93 | |
| 94 | huma.Register(s.API, huma.Operation{ |
| 95 | OperationID: "deleteAgent", |
| 96 | Method: http.MethodDelete, |
| 97 | Path: "/v1/agents/{email}", |
| 98 | Summary: "Delete an agent", |
| 99 | Description: "Delete an agent the caller owns.", |
| 100 | Tags: []string{"agents"}, |
| 101 | Security: []map[string][]string{{"bearer": {}}}, |
| 102 | DefaultStatus: http.StatusNoContent, |
| 103 | }, s.handleDeleteAgent) |
| 104 | } |
| 105 | |
| 106 | // UpdateAgentRequest is the /v1 agent PATCH body. The per-agent screening/HITL |
| 107 | // config moved to the /v1/agents/{email}/protection sub-resource (design |
no test coverage detected