Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/public-api/go/experimental/v1/v1connect/scm.connect.go
2501 views
1
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
6
//
7
// Source: gitpod/experimental/v1/scm.proto
8
9
package v1connect
10
11
import (
12
context "context"
13
errors "errors"
14
connect_go "github.com/bufbuild/connect-go"
15
v1 "github.com/gitpod-io/gitpod/components/public-api/go/experimental/v1"
16
http "net/http"
17
strings "strings"
18
)
19
20
// This is a compile-time assertion to ensure that this generated file and the connect package are
21
// compatible. If you get a compiler error that this constant is not defined, this code was
22
// generated with a version of connect newer than the one compiled into your binary. You can fix the
23
// problem by either regenerating this code with an older version of connect or updating the connect
24
// version compiled into your binary.
25
const _ = connect_go.IsAtLeastVersion0_1_0
26
27
const (
28
// SCMServiceName is the fully-qualified name of the SCMService service.
29
SCMServiceName = "gitpod.experimental.v1.SCMService"
30
)
31
32
// SCMServiceClient is a client for the gitpod.experimental.v1.SCMService service.
33
type SCMServiceClient interface {
34
// GetSuggestedRepoURLs returns a list of suggested repositories to open for
35
// the user.
36
GetSuggestedRepoURLs(context.Context, *connect_go.Request[v1.GetSuggestedRepoURLsRequest]) (*connect_go.Response[v1.GetSuggestedRepoURLsResponse], error)
37
}
38
39
// NewSCMServiceClient constructs a client for the gitpod.experimental.v1.SCMService service. By
40
// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
41
// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
42
// connect.WithGRPC() or connect.WithGRPCWeb() options.
43
//
44
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
45
// http://api.acme.com or https://acme.com/grpc).
46
func NewSCMServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SCMServiceClient {
47
baseURL = strings.TrimRight(baseURL, "/")
48
return &sCMServiceClient{
49
getSuggestedRepoURLs: connect_go.NewClient[v1.GetSuggestedRepoURLsRequest, v1.GetSuggestedRepoURLsResponse](
50
httpClient,
51
baseURL+"/gitpod.experimental.v1.SCMService/GetSuggestedRepoURLs",
52
opts...,
53
),
54
}
55
}
56
57
// sCMServiceClient implements SCMServiceClient.
58
type sCMServiceClient struct {
59
getSuggestedRepoURLs *connect_go.Client[v1.GetSuggestedRepoURLsRequest, v1.GetSuggestedRepoURLsResponse]
60
}
61
62
// GetSuggestedRepoURLs calls gitpod.experimental.v1.SCMService.GetSuggestedRepoURLs.
63
func (c *sCMServiceClient) GetSuggestedRepoURLs(ctx context.Context, req *connect_go.Request[v1.GetSuggestedRepoURLsRequest]) (*connect_go.Response[v1.GetSuggestedRepoURLsResponse], error) {
64
return c.getSuggestedRepoURLs.CallUnary(ctx, req)
65
}
66
67
// SCMServiceHandler is an implementation of the gitpod.experimental.v1.SCMService service.
68
type SCMServiceHandler interface {
69
// GetSuggestedRepoURLs returns a list of suggested repositories to open for
70
// the user.
71
GetSuggestedRepoURLs(context.Context, *connect_go.Request[v1.GetSuggestedRepoURLsRequest]) (*connect_go.Response[v1.GetSuggestedRepoURLsResponse], error)
72
}
73
74
// NewSCMServiceHandler builds an HTTP handler from the service implementation. It returns the path
75
// on which to mount the handler and the handler itself.
76
//
77
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
78
// and JSON codecs. They also support gzip compression.
79
func NewSCMServiceHandler(svc SCMServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
80
mux := http.NewServeMux()
81
mux.Handle("/gitpod.experimental.v1.SCMService/GetSuggestedRepoURLs", connect_go.NewUnaryHandler(
82
"/gitpod.experimental.v1.SCMService/GetSuggestedRepoURLs",
83
svc.GetSuggestedRepoURLs,
84
opts...,
85
))
86
return "/gitpod.experimental.v1.SCMService/", mux
87
}
88
89
// UnimplementedSCMServiceHandler returns CodeUnimplemented from all methods.
90
type UnimplementedSCMServiceHandler struct{}
91
92
func (UnimplementedSCMServiceHandler) GetSuggestedRepoURLs(context.Context, *connect_go.Request[v1.GetSuggestedRepoURLsRequest]) (*connect_go.Response[v1.GetSuggestedRepoURLsResponse], error) {
93
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.SCMService.GetSuggestedRepoURLs is not implemented"))
94
}
95
96