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/dummy.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/dummy.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
// HelloServiceName is the fully-qualified name of the HelloService service.
29
HelloServiceName = "gitpod.experimental.v1.HelloService"
30
)
31
32
// HelloServiceClient is a client for the gitpod.experimental.v1.HelloService service.
33
type HelloServiceClient interface {
34
// Unary RPCs where the client sends a single request to the server and gets a
35
// single response back, just like a normal function call.
36
SayHello(context.Context, *connect_go.Request[v1.SayHelloRequest]) (*connect_go.Response[v1.SayHelloResponse], error)
37
// Server streaming RPCs where the client sends a request to the server and
38
// gets a stream to read a sequence of messages back.
39
LotsOfReplies(context.Context, *connect_go.Request[v1.LotsOfRepliesRequest]) (*connect_go.ServerStreamForClient[v1.LotsOfRepliesResponse], error)
40
}
41
42
// NewHelloServiceClient constructs a client for the gitpod.experimental.v1.HelloService service. By
43
// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
44
// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
45
// connect.WithGRPC() or connect.WithGRPCWeb() options.
46
//
47
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
48
// http://api.acme.com or https://acme.com/grpc).
49
func NewHelloServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) HelloServiceClient {
50
baseURL = strings.TrimRight(baseURL, "/")
51
return &helloServiceClient{
52
sayHello: connect_go.NewClient[v1.SayHelloRequest, v1.SayHelloResponse](
53
httpClient,
54
baseURL+"/gitpod.experimental.v1.HelloService/SayHello",
55
opts...,
56
),
57
lotsOfReplies: connect_go.NewClient[v1.LotsOfRepliesRequest, v1.LotsOfRepliesResponse](
58
httpClient,
59
baseURL+"/gitpod.experimental.v1.HelloService/LotsOfReplies",
60
opts...,
61
),
62
}
63
}
64
65
// helloServiceClient implements HelloServiceClient.
66
type helloServiceClient struct {
67
sayHello *connect_go.Client[v1.SayHelloRequest, v1.SayHelloResponse]
68
lotsOfReplies *connect_go.Client[v1.LotsOfRepliesRequest, v1.LotsOfRepliesResponse]
69
}
70
71
// SayHello calls gitpod.experimental.v1.HelloService.SayHello.
72
func (c *helloServiceClient) SayHello(ctx context.Context, req *connect_go.Request[v1.SayHelloRequest]) (*connect_go.Response[v1.SayHelloResponse], error) {
73
return c.sayHello.CallUnary(ctx, req)
74
}
75
76
// LotsOfReplies calls gitpod.experimental.v1.HelloService.LotsOfReplies.
77
func (c *helloServiceClient) LotsOfReplies(ctx context.Context, req *connect_go.Request[v1.LotsOfRepliesRequest]) (*connect_go.ServerStreamForClient[v1.LotsOfRepliesResponse], error) {
78
return c.lotsOfReplies.CallServerStream(ctx, req)
79
}
80
81
// HelloServiceHandler is an implementation of the gitpod.experimental.v1.HelloService service.
82
type HelloServiceHandler interface {
83
// Unary RPCs where the client sends a single request to the server and gets a
84
// single response back, just like a normal function call.
85
SayHello(context.Context, *connect_go.Request[v1.SayHelloRequest]) (*connect_go.Response[v1.SayHelloResponse], error)
86
// Server streaming RPCs where the client sends a request to the server and
87
// gets a stream to read a sequence of messages back.
88
LotsOfReplies(context.Context, *connect_go.Request[v1.LotsOfRepliesRequest], *connect_go.ServerStream[v1.LotsOfRepliesResponse]) error
89
}
90
91
// NewHelloServiceHandler builds an HTTP handler from the service implementation. It returns the
92
// path on which to mount the handler and the handler itself.
93
//
94
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
95
// and JSON codecs. They also support gzip compression.
96
func NewHelloServiceHandler(svc HelloServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
97
mux := http.NewServeMux()
98
mux.Handle("/gitpod.experimental.v1.HelloService/SayHello", connect_go.NewUnaryHandler(
99
"/gitpod.experimental.v1.HelloService/SayHello",
100
svc.SayHello,
101
opts...,
102
))
103
mux.Handle("/gitpod.experimental.v1.HelloService/LotsOfReplies", connect_go.NewServerStreamHandler(
104
"/gitpod.experimental.v1.HelloService/LotsOfReplies",
105
svc.LotsOfReplies,
106
opts...,
107
))
108
return "/gitpod.experimental.v1.HelloService/", mux
109
}
110
111
// UnimplementedHelloServiceHandler returns CodeUnimplemented from all methods.
112
type UnimplementedHelloServiceHandler struct{}
113
114
func (UnimplementedHelloServiceHandler) SayHello(context.Context, *connect_go.Request[v1.SayHelloRequest]) (*connect_go.Response[v1.SayHelloResponse], error) {
115
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.HelloService.SayHello is not implemented"))
116
}
117
118
func (UnimplementedHelloServiceHandler) LotsOfReplies(context.Context, *connect_go.Request[v1.LotsOfRepliesRequest], *connect_go.ServerStream[v1.LotsOfRepliesResponse]) error {
119
return connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.HelloService.LotsOfReplies is not implemented"))
120
}
121
122