()
| 50 | type accountOutput struct{ Body AccountView } |
| 51 | |
| 52 | func (s *Server) registerAccount() { |
| 53 | huma.Register(s.API, huma.Operation{ |
| 54 | OperationID: "getAccount", Method: http.MethodGet, Path: "/v1/account", |
| 55 | Summary: "Get account: identity + plan limits + usage (whoami)", Tags: []string{"account"}, |
| 56 | Description: "The authenticated principal's identity (user + scope; agent_address for agent-scoped credentials), plan caps, and current usage. Works for both account- and agent-scoped credentials. (Deployment discovery — shared domain, slug registration — is the separate public GET /v1/info.)", |
| 57 | Security: []map[string][]string{{"bearer": {}}}, |
| 58 | }, s.handleGetMyLimits) |
| 59 | |
| 60 | huma.Register(s.API, huma.Operation{ |
| 61 | OperationID: "exportAccount", Method: http.MethodGet, Path: "/v1/account/export", |
| 62 | Summary: "Export your data (GDPR right-of-access)", Tags: []string{"account"}, |
| 63 | Description: "A JSON dump of every record the authenticated account owns.", |
| 64 | Security: []map[string][]string{{"bearer": {}}}, |
| 65 | }, s.handleExportUserData) |
| 66 | |
| 67 | huma.Register(s.API, huma.Operation{ |
| 68 | OperationID: "deleteAccount", Method: http.MethodDelete, Path: "/v1/account", |
| 69 | Summary: "Delete your account + all data (irreversible)", Tags: []string{"account"}, |
| 70 | Description: "Permanently deletes the account and cascades all owned data. Requires ?confirm=DELETE.", |
| 71 | Security: []map[string][]string{{"bearer": {}}}, |
| 72 | }, s.handleDeleteAccount) |
| 73 | |
| 74 | huma.Register(s.API, huma.Operation{ |
| 75 | OperationID: "listSuppressions", Method: http.MethodGet, Path: "/v1/account/suppressions", |
| 76 | Summary: "List suppressed recipient addresses", Tags: []string{"account"}, |
| 77 | Description: "Addresses e2a will refuse to send to (auto-added on a hard bounce or complaint, or added manually). Sends to a suppressed address fail with recipient_suppressed.", |
| 78 | Security: []map[string][]string{{"bearer": {}}}, |
| 79 | }, s.handleListSuppressions) |
| 80 | |
| 81 | huma.Register(s.API, huma.Operation{ |
| 82 | OperationID: "deleteSuppression", Method: http.MethodDelete, Path: "/v1/account/suppressions/{address}", |
| 83 | Summary: "Remove an address from the suppression list", Tags: []string{"account"}, |
| 84 | Description: "Un-suppress a recipient. A previously-blocked send to it then succeeds (idempotency keys are released, so no fresh key is needed).", |
| 85 | Security: []map[string][]string{{"bearer": {}}}, DefaultStatus: http.StatusNoContent, |
| 86 | }, s.handleDeleteSuppression) |
| 87 | } |
| 88 | |
| 89 | // suppressionsOutput uses the shared Page[T] envelope (items + next_cursor); |
| 90 | // next_cursor is null at launch. Suppressions auto-grow on every bounce/ |
no test coverage detected