mirror of
https://github.com/dstotijn/hetty.git
synced 2025-07-01 18:47:29 -04:00
Replace GraphQL server with Connect RPC
This commit is contained in:
311
pkg/sender/sender.connect.go
Normal file
311
pkg/sender/sender.connect.go
Normal file
@ -0,0 +1,311 @@
|
||||
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
||||
//
|
||||
// Source: sender/sender.proto
|
||||
|
||||
package sender
|
||||
|
||||
import (
|
||||
connect "connectrpc.com/connect"
|
||||
context "context"
|
||||
errors "errors"
|
||||
http "net/http"
|
||||
strings "strings"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file and the connect package are
|
||||
// compatible. If you get a compiler error that this constant is not defined, this code was
|
||||
// generated with a version of connect newer than the one compiled into your binary. You can fix the
|
||||
// problem by either regenerating this code with an older version of connect or updating the connect
|
||||
// version compiled into your binary.
|
||||
const _ = connect.IsAtLeastVersion1_13_0
|
||||
|
||||
const (
|
||||
// SenderServiceName is the fully-qualified name of the SenderService service.
|
||||
SenderServiceName = "sender.SenderService"
|
||||
)
|
||||
|
||||
// These constants are the fully-qualified names of the RPCs defined in this package. They're
|
||||
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
|
||||
//
|
||||
// Note that these are different from the fully-qualified method names used by
|
||||
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
|
||||
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
||||
// period.
|
||||
const (
|
||||
// SenderServiceGetRequestByIDProcedure is the fully-qualified name of the SenderService's
|
||||
// GetRequestByID RPC.
|
||||
SenderServiceGetRequestByIDProcedure = "/sender.SenderService/GetRequestByID"
|
||||
// SenderServiceListRequestsProcedure is the fully-qualified name of the SenderService's
|
||||
// ListRequests RPC.
|
||||
SenderServiceListRequestsProcedure = "/sender.SenderService/ListRequests"
|
||||
// SenderServiceSetRequestsFilterProcedure is the fully-qualified name of the SenderService's
|
||||
// SetRequestsFilter RPC.
|
||||
SenderServiceSetRequestsFilterProcedure = "/sender.SenderService/SetRequestsFilter"
|
||||
// SenderServiceGetRequestsFilterProcedure is the fully-qualified name of the SenderService's
|
||||
// GetRequestsFilter RPC.
|
||||
SenderServiceGetRequestsFilterProcedure = "/sender.SenderService/GetRequestsFilter"
|
||||
// SenderServiceCreateOrUpdateRequestProcedure is the fully-qualified name of the SenderService's
|
||||
// CreateOrUpdateRequest RPC.
|
||||
SenderServiceCreateOrUpdateRequestProcedure = "/sender.SenderService/CreateOrUpdateRequest"
|
||||
// SenderServiceCloneFromRequestLogProcedure is the fully-qualified name of the SenderService's
|
||||
// CloneFromRequestLog RPC.
|
||||
SenderServiceCloneFromRequestLogProcedure = "/sender.SenderService/CloneFromRequestLog"
|
||||
// SenderServiceSendRequestProcedure is the fully-qualified name of the SenderService's SendRequest
|
||||
// RPC.
|
||||
SenderServiceSendRequestProcedure = "/sender.SenderService/SendRequest"
|
||||
// SenderServiceDeleteRequestsProcedure is the fully-qualified name of the SenderService's
|
||||
// DeleteRequests RPC.
|
||||
SenderServiceDeleteRequestsProcedure = "/sender.SenderService/DeleteRequests"
|
||||
)
|
||||
|
||||
// SenderServiceClient is a client for the sender.SenderService service.
|
||||
type SenderServiceClient interface {
|
||||
GetRequestByID(context.Context, *connect.Request[GetRequestByIDRequest]) (*connect.Response[GetRequestByIDResponse], error)
|
||||
ListRequests(context.Context, *connect.Request[ListRequestsRequest]) (*connect.Response[ListRequestsResponse], error)
|
||||
SetRequestsFilter(context.Context, *connect.Request[SetRequestsFilterRequest]) (*connect.Response[SetRequestsFilterResponse], error)
|
||||
GetRequestsFilter(context.Context, *connect.Request[GetRequestsFilterRequest]) (*connect.Response[GetRequestsFilterResponse], error)
|
||||
CreateOrUpdateRequest(context.Context, *connect.Request[CreateOrUpdateRequestRequest]) (*connect.Response[CreateOrUpdateRequestResponse], error)
|
||||
CloneFromRequestLog(context.Context, *connect.Request[CloneFromRequestLogRequest]) (*connect.Response[CloneFromRequestLogResponse], error)
|
||||
SendRequest(context.Context, *connect.Request[SendRequestRequest]) (*connect.Response[SendRequestResponse], error)
|
||||
DeleteRequests(context.Context, *connect.Request[DeleteRequestsRequest]) (*connect.Response[DeleteRequestsResponse], error)
|
||||
}
|
||||
|
||||
// NewSenderServiceClient constructs a client for the sender.SenderService service. By default, it
|
||||
// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
|
||||
// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
|
||||
// connect.WithGRPCWeb() options.
|
||||
//
|
||||
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
|
||||
// http://api.acme.com or https://acme.com/grpc).
|
||||
func NewSenderServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) SenderServiceClient {
|
||||
baseURL = strings.TrimRight(baseURL, "/")
|
||||
senderServiceMethods := File_sender_sender_proto.Services().ByName("SenderService").Methods()
|
||||
return &senderServiceClient{
|
||||
getRequestByID: connect.NewClient[GetRequestByIDRequest, GetRequestByIDResponse](
|
||||
httpClient,
|
||||
baseURL+SenderServiceGetRequestByIDProcedure,
|
||||
connect.WithSchema(senderServiceMethods.ByName("GetRequestByID")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
listRequests: connect.NewClient[ListRequestsRequest, ListRequestsResponse](
|
||||
httpClient,
|
||||
baseURL+SenderServiceListRequestsProcedure,
|
||||
connect.WithSchema(senderServiceMethods.ByName("ListRequests")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
setRequestsFilter: connect.NewClient[SetRequestsFilterRequest, SetRequestsFilterResponse](
|
||||
httpClient,
|
||||
baseURL+SenderServiceSetRequestsFilterProcedure,
|
||||
connect.WithSchema(senderServiceMethods.ByName("SetRequestsFilter")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
getRequestsFilter: connect.NewClient[GetRequestsFilterRequest, GetRequestsFilterResponse](
|
||||
httpClient,
|
||||
baseURL+SenderServiceGetRequestsFilterProcedure,
|
||||
connect.WithSchema(senderServiceMethods.ByName("GetRequestsFilter")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
createOrUpdateRequest: connect.NewClient[CreateOrUpdateRequestRequest, CreateOrUpdateRequestResponse](
|
||||
httpClient,
|
||||
baseURL+SenderServiceCreateOrUpdateRequestProcedure,
|
||||
connect.WithSchema(senderServiceMethods.ByName("CreateOrUpdateRequest")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
cloneFromRequestLog: connect.NewClient[CloneFromRequestLogRequest, CloneFromRequestLogResponse](
|
||||
httpClient,
|
||||
baseURL+SenderServiceCloneFromRequestLogProcedure,
|
||||
connect.WithSchema(senderServiceMethods.ByName("CloneFromRequestLog")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
sendRequest: connect.NewClient[SendRequestRequest, SendRequestResponse](
|
||||
httpClient,
|
||||
baseURL+SenderServiceSendRequestProcedure,
|
||||
connect.WithSchema(senderServiceMethods.ByName("SendRequest")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
deleteRequests: connect.NewClient[DeleteRequestsRequest, DeleteRequestsResponse](
|
||||
httpClient,
|
||||
baseURL+SenderServiceDeleteRequestsProcedure,
|
||||
connect.WithSchema(senderServiceMethods.ByName("DeleteRequests")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// senderServiceClient implements SenderServiceClient.
|
||||
type senderServiceClient struct {
|
||||
getRequestByID *connect.Client[GetRequestByIDRequest, GetRequestByIDResponse]
|
||||
listRequests *connect.Client[ListRequestsRequest, ListRequestsResponse]
|
||||
setRequestsFilter *connect.Client[SetRequestsFilterRequest, SetRequestsFilterResponse]
|
||||
getRequestsFilter *connect.Client[GetRequestsFilterRequest, GetRequestsFilterResponse]
|
||||
createOrUpdateRequest *connect.Client[CreateOrUpdateRequestRequest, CreateOrUpdateRequestResponse]
|
||||
cloneFromRequestLog *connect.Client[CloneFromRequestLogRequest, CloneFromRequestLogResponse]
|
||||
sendRequest *connect.Client[SendRequestRequest, SendRequestResponse]
|
||||
deleteRequests *connect.Client[DeleteRequestsRequest, DeleteRequestsResponse]
|
||||
}
|
||||
|
||||
// GetRequestByID calls sender.SenderService.GetRequestByID.
|
||||
func (c *senderServiceClient) GetRequestByID(ctx context.Context, req *connect.Request[GetRequestByIDRequest]) (*connect.Response[GetRequestByIDResponse], error) {
|
||||
return c.getRequestByID.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// ListRequests calls sender.SenderService.ListRequests.
|
||||
func (c *senderServiceClient) ListRequests(ctx context.Context, req *connect.Request[ListRequestsRequest]) (*connect.Response[ListRequestsResponse], error) {
|
||||
return c.listRequests.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// SetRequestsFilter calls sender.SenderService.SetRequestsFilter.
|
||||
func (c *senderServiceClient) SetRequestsFilter(ctx context.Context, req *connect.Request[SetRequestsFilterRequest]) (*connect.Response[SetRequestsFilterResponse], error) {
|
||||
return c.setRequestsFilter.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// GetRequestsFilter calls sender.SenderService.GetRequestsFilter.
|
||||
func (c *senderServiceClient) GetRequestsFilter(ctx context.Context, req *connect.Request[GetRequestsFilterRequest]) (*connect.Response[GetRequestsFilterResponse], error) {
|
||||
return c.getRequestsFilter.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// CreateOrUpdateRequest calls sender.SenderService.CreateOrUpdateRequest.
|
||||
func (c *senderServiceClient) CreateOrUpdateRequest(ctx context.Context, req *connect.Request[CreateOrUpdateRequestRequest]) (*connect.Response[CreateOrUpdateRequestResponse], error) {
|
||||
return c.createOrUpdateRequest.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// CloneFromRequestLog calls sender.SenderService.CloneFromRequestLog.
|
||||
func (c *senderServiceClient) CloneFromRequestLog(ctx context.Context, req *connect.Request[CloneFromRequestLogRequest]) (*connect.Response[CloneFromRequestLogResponse], error) {
|
||||
return c.cloneFromRequestLog.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// SendRequest calls sender.SenderService.SendRequest.
|
||||
func (c *senderServiceClient) SendRequest(ctx context.Context, req *connect.Request[SendRequestRequest]) (*connect.Response[SendRequestResponse], error) {
|
||||
return c.sendRequest.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteRequests calls sender.SenderService.DeleteRequests.
|
||||
func (c *senderServiceClient) DeleteRequests(ctx context.Context, req *connect.Request[DeleteRequestsRequest]) (*connect.Response[DeleteRequestsResponse], error) {
|
||||
return c.deleteRequests.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// SenderServiceHandler is an implementation of the sender.SenderService service.
|
||||
type SenderServiceHandler interface {
|
||||
GetRequestByID(context.Context, *connect.Request[GetRequestByIDRequest]) (*connect.Response[GetRequestByIDResponse], error)
|
||||
ListRequests(context.Context, *connect.Request[ListRequestsRequest]) (*connect.Response[ListRequestsResponse], error)
|
||||
SetRequestsFilter(context.Context, *connect.Request[SetRequestsFilterRequest]) (*connect.Response[SetRequestsFilterResponse], error)
|
||||
GetRequestsFilter(context.Context, *connect.Request[GetRequestsFilterRequest]) (*connect.Response[GetRequestsFilterResponse], error)
|
||||
CreateOrUpdateRequest(context.Context, *connect.Request[CreateOrUpdateRequestRequest]) (*connect.Response[CreateOrUpdateRequestResponse], error)
|
||||
CloneFromRequestLog(context.Context, *connect.Request[CloneFromRequestLogRequest]) (*connect.Response[CloneFromRequestLogResponse], error)
|
||||
SendRequest(context.Context, *connect.Request[SendRequestRequest]) (*connect.Response[SendRequestResponse], error)
|
||||
DeleteRequests(context.Context, *connect.Request[DeleteRequestsRequest]) (*connect.Response[DeleteRequestsResponse], error)
|
||||
}
|
||||
|
||||
// NewSenderServiceHandler builds an HTTP handler from the service implementation. It returns the
|
||||
// path on which to mount the handler and the handler itself.
|
||||
//
|
||||
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
|
||||
// and JSON codecs. They also support gzip compression.
|
||||
func NewSenderServiceHandler(svc SenderServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
||||
senderServiceMethods := File_sender_sender_proto.Services().ByName("SenderService").Methods()
|
||||
senderServiceGetRequestByIDHandler := connect.NewUnaryHandler(
|
||||
SenderServiceGetRequestByIDProcedure,
|
||||
svc.GetRequestByID,
|
||||
connect.WithSchema(senderServiceMethods.ByName("GetRequestByID")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
senderServiceListRequestsHandler := connect.NewUnaryHandler(
|
||||
SenderServiceListRequestsProcedure,
|
||||
svc.ListRequests,
|
||||
connect.WithSchema(senderServiceMethods.ByName("ListRequests")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
senderServiceSetRequestsFilterHandler := connect.NewUnaryHandler(
|
||||
SenderServiceSetRequestsFilterProcedure,
|
||||
svc.SetRequestsFilter,
|
||||
connect.WithSchema(senderServiceMethods.ByName("SetRequestsFilter")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
senderServiceGetRequestsFilterHandler := connect.NewUnaryHandler(
|
||||
SenderServiceGetRequestsFilterProcedure,
|
||||
svc.GetRequestsFilter,
|
||||
connect.WithSchema(senderServiceMethods.ByName("GetRequestsFilter")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
senderServiceCreateOrUpdateRequestHandler := connect.NewUnaryHandler(
|
||||
SenderServiceCreateOrUpdateRequestProcedure,
|
||||
svc.CreateOrUpdateRequest,
|
||||
connect.WithSchema(senderServiceMethods.ByName("CreateOrUpdateRequest")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
senderServiceCloneFromRequestLogHandler := connect.NewUnaryHandler(
|
||||
SenderServiceCloneFromRequestLogProcedure,
|
||||
svc.CloneFromRequestLog,
|
||||
connect.WithSchema(senderServiceMethods.ByName("CloneFromRequestLog")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
senderServiceSendRequestHandler := connect.NewUnaryHandler(
|
||||
SenderServiceSendRequestProcedure,
|
||||
svc.SendRequest,
|
||||
connect.WithSchema(senderServiceMethods.ByName("SendRequest")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
senderServiceDeleteRequestsHandler := connect.NewUnaryHandler(
|
||||
SenderServiceDeleteRequestsProcedure,
|
||||
svc.DeleteRequests,
|
||||
connect.WithSchema(senderServiceMethods.ByName("DeleteRequests")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
return "/sender.SenderService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case SenderServiceGetRequestByIDProcedure:
|
||||
senderServiceGetRequestByIDHandler.ServeHTTP(w, r)
|
||||
case SenderServiceListRequestsProcedure:
|
||||
senderServiceListRequestsHandler.ServeHTTP(w, r)
|
||||
case SenderServiceSetRequestsFilterProcedure:
|
||||
senderServiceSetRequestsFilterHandler.ServeHTTP(w, r)
|
||||
case SenderServiceGetRequestsFilterProcedure:
|
||||
senderServiceGetRequestsFilterHandler.ServeHTTP(w, r)
|
||||
case SenderServiceCreateOrUpdateRequestProcedure:
|
||||
senderServiceCreateOrUpdateRequestHandler.ServeHTTP(w, r)
|
||||
case SenderServiceCloneFromRequestLogProcedure:
|
||||
senderServiceCloneFromRequestLogHandler.ServeHTTP(w, r)
|
||||
case SenderServiceSendRequestProcedure:
|
||||
senderServiceSendRequestHandler.ServeHTTP(w, r)
|
||||
case SenderServiceDeleteRequestsProcedure:
|
||||
senderServiceDeleteRequestsHandler.ServeHTTP(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// UnimplementedSenderServiceHandler returns CodeUnimplemented from all methods.
|
||||
type UnimplementedSenderServiceHandler struct{}
|
||||
|
||||
func (UnimplementedSenderServiceHandler) GetRequestByID(context.Context, *connect.Request[GetRequestByIDRequest]) (*connect.Response[GetRequestByIDResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("sender.SenderService.GetRequestByID is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedSenderServiceHandler) ListRequests(context.Context, *connect.Request[ListRequestsRequest]) (*connect.Response[ListRequestsResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("sender.SenderService.ListRequests is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedSenderServiceHandler) SetRequestsFilter(context.Context, *connect.Request[SetRequestsFilterRequest]) (*connect.Response[SetRequestsFilterResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("sender.SenderService.SetRequestsFilter is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedSenderServiceHandler) GetRequestsFilter(context.Context, *connect.Request[GetRequestsFilterRequest]) (*connect.Response[GetRequestsFilterResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("sender.SenderService.GetRequestsFilter is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedSenderServiceHandler) CreateOrUpdateRequest(context.Context, *connect.Request[CreateOrUpdateRequestRequest]) (*connect.Response[CreateOrUpdateRequestResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("sender.SenderService.CreateOrUpdateRequest is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedSenderServiceHandler) CloneFromRequestLog(context.Context, *connect.Request[CloneFromRequestLogRequest]) (*connect.Response[CloneFromRequestLogResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("sender.SenderService.CloneFromRequestLog is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedSenderServiceHandler) SendRequest(context.Context, *connect.Request[SendRequestRequest]) (*connect.Response[SendRequestResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("sender.SenderService.SendRequest is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedSenderServiceHandler) DeleteRequests(context.Context, *connect.Request[DeleteRequestsRequest]) (*connect.Response[DeleteRequestsResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("sender.SenderService.DeleteRequests is not implemented"))
|
||||
}
|
Reference in New Issue
Block a user