Path: blob/main/components/public-api/go/experimental/v1/v1connect/dummy.connect.go
2501 views
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34// Code generated by protoc-gen-connect-go. DO NOT EDIT.5//6// Source: gitpod/experimental/v1/dummy.proto78package v1connect910import (11context "context"12errors "errors"13connect_go "github.com/bufbuild/connect-go"14v1 "github.com/gitpod-io/gitpod/components/public-api/go/experimental/v1"15http "net/http"16strings "strings"17)1819// This is a compile-time assertion to ensure that this generated file and the connect package are20// compatible. If you get a compiler error that this constant is not defined, this code was21// generated with a version of connect newer than the one compiled into your binary. You can fix the22// problem by either regenerating this code with an older version of connect or updating the connect23// version compiled into your binary.24const _ = connect_go.IsAtLeastVersion0_1_02526const (27// HelloServiceName is the fully-qualified name of the HelloService service.28HelloServiceName = "gitpod.experimental.v1.HelloService"29)3031// HelloServiceClient is a client for the gitpod.experimental.v1.HelloService service.32type HelloServiceClient interface {33// Unary RPCs where the client sends a single request to the server and gets a34// single response back, just like a normal function call.35SayHello(context.Context, *connect_go.Request[v1.SayHelloRequest]) (*connect_go.Response[v1.SayHelloResponse], error)36// Server streaming RPCs where the client sends a request to the server and37// gets a stream to read a sequence of messages back.38LotsOfReplies(context.Context, *connect_go.Request[v1.LotsOfRepliesRequest]) (*connect_go.ServerStreamForClient[v1.LotsOfRepliesResponse], error)39}4041// NewHelloServiceClient constructs a client for the gitpod.experimental.v1.HelloService service. By42// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,43// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the44// connect.WithGRPC() or connect.WithGRPCWeb() options.45//46// The URL supplied here should be the base URL for the Connect or gRPC server (for example,47// http://api.acme.com or https://acme.com/grpc).48func NewHelloServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) HelloServiceClient {49baseURL = strings.TrimRight(baseURL, "/")50return &helloServiceClient{51sayHello: connect_go.NewClient[v1.SayHelloRequest, v1.SayHelloResponse](52httpClient,53baseURL+"/gitpod.experimental.v1.HelloService/SayHello",54opts...,55),56lotsOfReplies: connect_go.NewClient[v1.LotsOfRepliesRequest, v1.LotsOfRepliesResponse](57httpClient,58baseURL+"/gitpod.experimental.v1.HelloService/LotsOfReplies",59opts...,60),61}62}6364// helloServiceClient implements HelloServiceClient.65type helloServiceClient struct {66sayHello *connect_go.Client[v1.SayHelloRequest, v1.SayHelloResponse]67lotsOfReplies *connect_go.Client[v1.LotsOfRepliesRequest, v1.LotsOfRepliesResponse]68}6970// SayHello calls gitpod.experimental.v1.HelloService.SayHello.71func (c *helloServiceClient) SayHello(ctx context.Context, req *connect_go.Request[v1.SayHelloRequest]) (*connect_go.Response[v1.SayHelloResponse], error) {72return c.sayHello.CallUnary(ctx, req)73}7475// LotsOfReplies calls gitpod.experimental.v1.HelloService.LotsOfReplies.76func (c *helloServiceClient) LotsOfReplies(ctx context.Context, req *connect_go.Request[v1.LotsOfRepliesRequest]) (*connect_go.ServerStreamForClient[v1.LotsOfRepliesResponse], error) {77return c.lotsOfReplies.CallServerStream(ctx, req)78}7980// HelloServiceHandler is an implementation of the gitpod.experimental.v1.HelloService service.81type HelloServiceHandler interface {82// Unary RPCs where the client sends a single request to the server and gets a83// single response back, just like a normal function call.84SayHello(context.Context, *connect_go.Request[v1.SayHelloRequest]) (*connect_go.Response[v1.SayHelloResponse], error)85// Server streaming RPCs where the client sends a request to the server and86// gets a stream to read a sequence of messages back.87LotsOfReplies(context.Context, *connect_go.Request[v1.LotsOfRepliesRequest], *connect_go.ServerStream[v1.LotsOfRepliesResponse]) error88}8990// NewHelloServiceHandler builds an HTTP handler from the service implementation. It returns the91// path on which to mount the handler and the handler itself.92//93// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf94// and JSON codecs. They also support gzip compression.95func NewHelloServiceHandler(svc HelloServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {96mux := http.NewServeMux()97mux.Handle("/gitpod.experimental.v1.HelloService/SayHello", connect_go.NewUnaryHandler(98"/gitpod.experimental.v1.HelloService/SayHello",99svc.SayHello,100opts...,101))102mux.Handle("/gitpod.experimental.v1.HelloService/LotsOfReplies", connect_go.NewServerStreamHandler(103"/gitpod.experimental.v1.HelloService/LotsOfReplies",104svc.LotsOfReplies,105opts...,106))107return "/gitpod.experimental.v1.HelloService/", mux108}109110// UnimplementedHelloServiceHandler returns CodeUnimplemented from all methods.111type UnimplementedHelloServiceHandler struct{}112113func (UnimplementedHelloServiceHandler) SayHello(context.Context, *connect_go.Request[v1.SayHelloRequest]) (*connect_go.Response[v1.SayHelloResponse], error) {114return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.HelloService.SayHello is not implemented"))115}116117func (UnimplementedHelloServiceHandler) LotsOfReplies(context.Context, *connect_go.Request[v1.LotsOfRepliesRequest], *connect_go.ServerStream[v1.LotsOfRepliesResponse]) error {118return connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.HelloService.LotsOfReplies is not implemented"))119}120121122