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

Method handleListAPIKeys

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

Source from the content-addressed store, hash-verified

91}
92
93func (s *Server) handleListAPIKeys(ctx context.Context, _ *struct{}) (*listAPIKeysOutput, error) {
94 user, err := s.requireAccountUser(ctx)
95 if err != nil {
96 return nil, err
97 }
98 if s.deps.ListAPIKeys == nil {
99 return nil, NewError(http.StatusNotImplemented, "not_implemented", "API keys are not available on this deployment")
100 }
101 keys, err := s.deps.ListAPIKeys(ctx, user.ID)
102 if err != nil {
103 return nil, NewError(http.StatusInternalServerError, "internal_error", "failed to list API keys")
104 }
105 views := make([]APIKeyView, 0, len(keys))
106 for _, k := range keys {
107 views = append(views, apiKeyView(k))
108 }
109 return &listAPIKeysOutput{Body: NewPage(views, "")}, nil
110}
111
112func (s *Server) handleCreateAPIKey(ctx context.Context, in *createAPIKeyInput) (*createAPIKeyOutput, error) {
113 user, err := s.requireAccountUser(ctx)

Callers

nothing calls this directly

Calls 6

requireAccountUserMethod · 0.95
NewErrorFunction · 0.85
makeFunction · 0.85
apiKeyViewFunction · 0.85
NewPageFunction · 0.85
ListAPIKeysMethod · 0.80

Tested by

no test coverage detected