v0.1.0 4db3b8b

server.connect.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4//
5// Source: ermite/server.proto
6
7package ermiteconnect
8
9import (
10	ermite "bnema.dev/ermite-api/gen/ermite"
11	connect "connectrpc.com/connect"
12	context "context"
13	errors "errors"
14	http "net/http"
15	strings "strings"
16)
17
18// This is a compile-time assertion to ensure that this generated file and the connect package are
19// compatible. If you get a compiler error that this constant is not defined, this code was
20// generated with a version of connect newer than the one compiled into your binary. You can fix the
21// problem by either regenerating this code with an older version of connect or updating the connect
22// version compiled into your binary.
23const _ = connect.IsAtLeastVersion1_13_0
24
25const (
26	// ServerServiceName is the fully-qualified name of the ServerService service.
27	ServerServiceName = "ermite.ServerService"
28)
29
30// These constants are the fully-qualified names of the RPCs defined in this package. They're
31// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32//
33// Note that these are different from the fully-qualified method names used by
34// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36// period.
37const (
38	// ServerServiceGetVersionProcedure is the fully-qualified name of the ServerService's GetVersion
39	// RPC.
40	ServerServiceGetVersionProcedure = "/ermite.ServerService/GetVersion"
41	// ServerServiceGetSigningKeyProcedure is the fully-qualified name of the ServerService's
42	// GetSigningKey RPC.
43	ServerServiceGetSigningKeyProcedure = "/ermite.ServerService/GetSigningKey"
44)
45
46// ServerServiceClient is a client for the ermite.ServerService service.
47type ServerServiceClient interface {
48	// GetVersion returns the server version and the optional capabilities of the
49	// contract it implements. It needs no authentication, so a client can call
50	// it first to check compatibility.
51	GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error)
52	// GetSigningKey returns the public key with which the server signs the
53	// commits it creates (squash merges, see MergeMode). It needs no
54	// authentication: the key is public, and anyone verifying a commit needs it.
55	// Servers that implement it list "signing_key" in
56	// GetVersionResponse.features.
57	GetSigningKey(context.Context, *connect.Request[ermite.GetSigningKeyRequest]) (*connect.Response[ermite.GetSigningKeyResponse], error)
58}
59
60// NewServerServiceClient constructs a client for the ermite.ServerService service. By default, it
61// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
62// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
63// connect.WithGRPCWeb() options.
64//
65// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
66// http://api.acme.com or https://acme.com/grpc).
67func NewServerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ServerServiceClient {
68	baseURL = strings.TrimRight(baseURL, "/")
69	serverServiceMethods := ermite.File_ermite_server_proto.Services().ByName("ServerService").Methods()
70	return &serverServiceClient{
71		getVersion: connect.NewClient[ermite.GetVersionRequest, ermite.GetVersionResponse](
72			httpClient,
73			baseURL+ServerServiceGetVersionProcedure,
74			connect.WithSchema(serverServiceMethods.ByName("GetVersion")),
75			connect.WithClientOptions(opts...),
76		),
77		getSigningKey: connect.NewClient[ermite.GetSigningKeyRequest, ermite.GetSigningKeyResponse](
78			httpClient,
79			baseURL+ServerServiceGetSigningKeyProcedure,
80			connect.WithSchema(serverServiceMethods.ByName("GetSigningKey")),
81			connect.WithClientOptions(opts...),
82		),
83	}
84}
85
86// serverServiceClient implements ServerServiceClient.
87type serverServiceClient struct {
88	getVersion    *connect.Client[ermite.GetVersionRequest, ermite.GetVersionResponse]
89	getSigningKey *connect.Client[ermite.GetSigningKeyRequest, ermite.GetSigningKeyResponse]
90}
91
92// GetVersion calls ermite.ServerService.GetVersion.
93func (c *serverServiceClient) GetVersion(ctx context.Context, req *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error) {
94	return c.getVersion.CallUnary(ctx, req)
95}
96
97// GetSigningKey calls ermite.ServerService.GetSigningKey.
98func (c *serverServiceClient) GetSigningKey(ctx context.Context, req *connect.Request[ermite.GetSigningKeyRequest]) (*connect.Response[ermite.GetSigningKeyResponse], error) {
99	return c.getSigningKey.CallUnary(ctx, req)
100}
101
102// ServerServiceHandler is an implementation of the ermite.ServerService service.
103type ServerServiceHandler interface {
104	// GetVersion returns the server version and the optional capabilities of the
105	// contract it implements. It needs no authentication, so a client can call
106	// it first to check compatibility.
107	GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error)
108	// GetSigningKey returns the public key with which the server signs the
109	// commits it creates (squash merges, see MergeMode). It needs no
110	// authentication: the key is public, and anyone verifying a commit needs it.
111	// Servers that implement it list "signing_key" in
112	// GetVersionResponse.features.
113	GetSigningKey(context.Context, *connect.Request[ermite.GetSigningKeyRequest]) (*connect.Response[ermite.GetSigningKeyResponse], error)
114}
115
116// NewServerServiceHandler builds an HTTP handler from the service implementation. It returns the
117// path on which to mount the handler and the handler itself.
118//
119// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
120// and JSON codecs. They also support gzip compression.
121func NewServerServiceHandler(svc ServerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
122	serverServiceMethods := ermite.File_ermite_server_proto.Services().ByName("ServerService").Methods()
123	serverServiceGetVersionHandler := connect.NewUnaryHandler(
124		ServerServiceGetVersionProcedure,
125		svc.GetVersion,
126		connect.WithSchema(serverServiceMethods.ByName("GetVersion")),
127		connect.WithHandlerOptions(opts...),
128	)
129	serverServiceGetSigningKeyHandler := connect.NewUnaryHandler(
130		ServerServiceGetSigningKeyProcedure,
131		svc.GetSigningKey,
132		connect.WithSchema(serverServiceMethods.ByName("GetSigningKey")),
133		connect.WithHandlerOptions(opts...),
134	)
135	return "/ermite.ServerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
136		switch r.URL.Path {
137		case ServerServiceGetVersionProcedure:
138			serverServiceGetVersionHandler.ServeHTTP(w, r)
139		case ServerServiceGetSigningKeyProcedure:
140			serverServiceGetSigningKeyHandler.ServeHTTP(w, r)
141		default:
142			http.NotFound(w, r)
143		}
144	})
145}
146
147// UnimplementedServerServiceHandler returns CodeUnimplemented from all methods.
148type UnimplementedServerServiceHandler struct{}
149
150func (UnimplementedServerServiceHandler) GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error) {
151	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ServerService.GetVersion is not implemented"))
152}
153
154func (UnimplementedServerServiceHandler) GetSigningKey(context.Context, *connect.Request[ermite.GetSigningKeyRequest]) (*connect.Response[ermite.GetSigningKeyResponse], error) {
155	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ServerService.GetSigningKey is not implemented"))
156}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 18

↑↓ moveenter openesc close