(ctx context.Context, _ *struct{})
| 91 | } |
| 92 | |
| 93 | func (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 | |
| 112 | func (s *Server) handleCreateAPIKey(ctx context.Context, in *createAPIKeyInput) (*createAPIKeyOutput, error) { |
| 113 | user, err := s.requireAccountUser(ctx) |
nothing calls this directly
no test coverage detected