blob: cd1ecbaff6177b0e3cfbd796c2729503de0211a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package wiki
import (
"fmt"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/rubyserver"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func (s *server) WikiDeletePage(ctx context.Context, request *gitalypb.WikiDeletePageRequest) (*gitalypb.WikiDeletePageResponse, error) {
if err := validateWikiDeletePageRequest(request); err != nil {
return nil, status.Errorf(codes.InvalidArgument, "WikiDeletePage: %v", err)
}
client, err := s.WikiServiceClient(ctx)
if err != nil {
return nil, err
}
clientCtx, err := rubyserver.SetHeaders(ctx, request.GetRepository())
if err != nil {
return nil, err
}
return client.WikiDeletePage(clientCtx, request)
}
func validateWikiDeletePageRequest(request *gitalypb.WikiDeletePageRequest) error {
if len(request.GetPagePath()) == 0 {
return fmt.Errorf("empty PagePath")
}
return validateRequestCommitDetails(request)
}
|