MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / handleExportUserData

Method handleExportUserData

internal/httpapi/account.go:178–203  ·  view source on GitHub ↗
(ctx context.Context, _ *struct{})

Source from the content-addressed store, hash-verified

176}
177
178func (s *Server) handleExportUserData(ctx context.Context, _ *struct{}) (*exportOutput, error) {
179 user, err := s.requireAccountUser(ctx)
180 if err != nil {
181 return nil, err
182 }
183 if s.deps.ExportUserData == nil {
184 return nil, NewError(http.StatusInternalServerError, "internal_error", "export unavailable")
185 }
186 dump, err := s.deps.ExportUserData(ctx, user.ID)
187 if err != nil {
188 return nil, NewError(http.StatusInternalServerError, "internal_error", "failed to export user data")
189 }
190 // A-3: top-level export collections render as [] not null when empty.
191 if dump != nil {
192 dump.Domains = orEmpty(dump.Domains)
193 dump.Agents = orEmpty(dump.Agents)
194 dump.APIKeys = orEmpty(dump.APIKeys)
195 dump.Messages = orEmpty(dump.Messages)
196 dump.UsageEvents = orEmpty(dump.UsageEvents)
197 dump.OAuthConnections = orEmpty(dump.OAuthConnections)
198 }
199 return &exportOutput{
200 ContentDisposition: `attachment; filename="e2a-export-` + user.ID + `.json"`,
201 Body: dump,
202 }, nil
203}
204
205type deleteAccountInput struct {
206 Confirm string `query:"confirm" doc:"Must be DELETE — this is irreversible."`

Callers

nothing calls this directly

Calls 4

requireAccountUserMethod · 0.95
NewErrorFunction · 0.85
orEmptyFunction · 0.85
ExportUserDataMethod · 0.80

Tested by

no test coverage detected