GetCurrentProject implements localv1connect.LocalServiceHandler. Remove this endpoint once UI cleans up code referring to it.
(ctx context.Context, r *connect.Request[localv1.GetCurrentProjectRequest])
| 654 | // GetCurrentProject implements localv1connect.LocalServiceHandler. |
| 655 | // Remove this endpoint once UI cleans up code referring to it. |
| 656 | func (s *Server) GetCurrentProject(ctx context.Context, r *connect.Request[localv1.GetCurrentProjectRequest]) (*connect.Response[localv1.GetCurrentProjectResponse], error) { |
| 657 | localProjectName := filepath.Base(s.app.ProjectPath) |
| 658 | |
| 659 | // Return early if the user isn't logged in |
| 660 | if !s.app.ch.IsAuthenticated() { |
| 661 | return connect.NewResponse(&localv1.GetCurrentProjectResponse{ |
| 662 | LocalProjectName: localProjectName, |
| 663 | }), nil |
| 664 | } |
| 665 | |
| 666 | projects, err := s.app.ch.InferProjects(ctx, s.app.ch.Org, s.app.ProjectPath) |
| 667 | if err != nil { |
| 668 | if errors.Is(err, cmdutil.ErrInferProjectFailed) { |
| 669 | return connect.NewResponse(&localv1.GetCurrentProjectResponse{ |
| 670 | LocalProjectName: localProjectName, |
| 671 | }), nil |
| 672 | } |
| 673 | return nil, err |
| 674 | } |
| 675 | |
| 676 | return connect.NewResponse(&localv1.GetCurrentProjectResponse{ |
| 677 | LocalProjectName: localProjectName, |
| 678 | Project: projects[0], |
| 679 | }), nil |
| 680 | } |
| 681 | |
| 682 | func (s *Server) ListOrganizationsAndBillingMetadata(ctx context.Context, r *connect.Request[localv1.ListOrganizationsAndBillingMetadataRequest]) (*connect.Response[localv1.ListOrganizationsAndBillingMetadataResponse], error) { |
| 683 | // Get authenticated admin client |
nothing calls this directly
no test coverage detected