// Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: proto/transaction/v1/transaction.proto package transactionv1connect import ( connect "connectrpc.com/connect" context "context" errors "errors" v1 "git.kocoder.xyz/vt/financial-tracking-service/internal/proto/transaction/v1" 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 ( // TransactionServiceName is the fully-qualified name of the TransactionService service. TransactionServiceName = "proto.transaction.v1.TransactionService" ) // 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 ( // TransactionServiceCreateTransactionProcedure is the fully-qualified name of the // TransactionService's CreateTransaction RPC. TransactionServiceCreateTransactionProcedure = "/proto.transaction.v1.TransactionService/CreateTransaction" // TransactionServiceListTransactionsProcedure is the fully-qualified name of the // TransactionService's ListTransactions RPC. TransactionServiceListTransactionsProcedure = "/proto.transaction.v1.TransactionService/ListTransactions" // TransactionServiceGetTransactionProcedure is the fully-qualified name of the TransactionService's // GetTransaction RPC. TransactionServiceGetTransactionProcedure = "/proto.transaction.v1.TransactionService/GetTransaction" // TransactionServiceDeleteTransactionProcedure is the fully-qualified name of the // TransactionService's DeleteTransaction RPC. TransactionServiceDeleteTransactionProcedure = "/proto.transaction.v1.TransactionService/DeleteTransaction" ) // TransactionServiceClient is a client for the proto.transaction.v1.TransactionService service. type TransactionServiceClient interface { CreateTransaction(context.Context, *v1.CreateTransactionRequest) (*v1.CreateTransactionResponse, error) ListTransactions(context.Context, *v1.ListTransactionsRequest) (*v1.ListTransactionsResponse, error) GetTransaction(context.Context, *v1.GetTransactionRequest) (*v1.GetTransactionResponse, error) DeleteTransaction(context.Context, *v1.DeleteTransactionRequest) (*v1.DeleteTransactionResponse, error) } // NewTransactionServiceClient constructs a client for the proto.transaction.v1.TransactionService // 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 NewTransactionServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) TransactionServiceClient { baseURL = strings.TrimRight(baseURL, "/") transactionServiceMethods := v1.File_proto_transaction_v1_transaction_proto.Services().ByName("TransactionService").Methods() return &transactionServiceClient{ createTransaction: connect.NewClient[v1.CreateTransactionRequest, v1.CreateTransactionResponse]( httpClient, baseURL+TransactionServiceCreateTransactionProcedure, connect.WithSchema(transactionServiceMethods.ByName("CreateTransaction")), connect.WithClientOptions(opts...), ), listTransactions: connect.NewClient[v1.ListTransactionsRequest, v1.ListTransactionsResponse]( httpClient, baseURL+TransactionServiceListTransactionsProcedure, connect.WithSchema(transactionServiceMethods.ByName("ListTransactions")), connect.WithClientOptions(opts...), ), getTransaction: connect.NewClient[v1.GetTransactionRequest, v1.GetTransactionResponse]( httpClient, baseURL+TransactionServiceGetTransactionProcedure, connect.WithSchema(transactionServiceMethods.ByName("GetTransaction")), connect.WithClientOptions(opts...), ), deleteTransaction: connect.NewClient[v1.DeleteTransactionRequest, v1.DeleteTransactionResponse]( httpClient, baseURL+TransactionServiceDeleteTransactionProcedure, connect.WithSchema(transactionServiceMethods.ByName("DeleteTransaction")), connect.WithClientOptions(opts...), ), } } // transactionServiceClient implements TransactionServiceClient. type transactionServiceClient struct { createTransaction *connect.Client[v1.CreateTransactionRequest, v1.CreateTransactionResponse] listTransactions *connect.Client[v1.ListTransactionsRequest, v1.ListTransactionsResponse] getTransaction *connect.Client[v1.GetTransactionRequest, v1.GetTransactionResponse] deleteTransaction *connect.Client[v1.DeleteTransactionRequest, v1.DeleteTransactionResponse] } // CreateTransaction calls proto.transaction.v1.TransactionService.CreateTransaction. func (c *transactionServiceClient) CreateTransaction(ctx context.Context, req *v1.CreateTransactionRequest) (*v1.CreateTransactionResponse, error) { response, err := c.createTransaction.CallUnary(ctx, connect.NewRequest(req)) if response != nil { return response.Msg, err } return nil, err } // ListTransactions calls proto.transaction.v1.TransactionService.ListTransactions. func (c *transactionServiceClient) ListTransactions(ctx context.Context, req *v1.ListTransactionsRequest) (*v1.ListTransactionsResponse, error) { response, err := c.listTransactions.CallUnary(ctx, connect.NewRequest(req)) if response != nil { return response.Msg, err } return nil, err } // GetTransaction calls proto.transaction.v1.TransactionService.GetTransaction. func (c *transactionServiceClient) GetTransaction(ctx context.Context, req *v1.GetTransactionRequest) (*v1.GetTransactionResponse, error) { response, err := c.getTransaction.CallUnary(ctx, connect.NewRequest(req)) if response != nil { return response.Msg, err } return nil, err } // DeleteTransaction calls proto.transaction.v1.TransactionService.DeleteTransaction. func (c *transactionServiceClient) DeleteTransaction(ctx context.Context, req *v1.DeleteTransactionRequest) (*v1.DeleteTransactionResponse, error) { response, err := c.deleteTransaction.CallUnary(ctx, connect.NewRequest(req)) if response != nil { return response.Msg, err } return nil, err } // TransactionServiceHandler is an implementation of the proto.transaction.v1.TransactionService // service. type TransactionServiceHandler interface { CreateTransaction(context.Context, *v1.CreateTransactionRequest) (*v1.CreateTransactionResponse, error) ListTransactions(context.Context, *v1.ListTransactionsRequest) (*v1.ListTransactionsResponse, error) GetTransaction(context.Context, *v1.GetTransactionRequest) (*v1.GetTransactionResponse, error) DeleteTransaction(context.Context, *v1.DeleteTransactionRequest) (*v1.DeleteTransactionResponse, error) } // NewTransactionServiceHandler 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 NewTransactionServiceHandler(svc TransactionServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { transactionServiceMethods := v1.File_proto_transaction_v1_transaction_proto.Services().ByName("TransactionService").Methods() transactionServiceCreateTransactionHandler := connect.NewUnaryHandlerSimple( TransactionServiceCreateTransactionProcedure, svc.CreateTransaction, connect.WithSchema(transactionServiceMethods.ByName("CreateTransaction")), connect.WithHandlerOptions(opts...), ) transactionServiceListTransactionsHandler := connect.NewUnaryHandlerSimple( TransactionServiceListTransactionsProcedure, svc.ListTransactions, connect.WithSchema(transactionServiceMethods.ByName("ListTransactions")), connect.WithHandlerOptions(opts...), ) transactionServiceGetTransactionHandler := connect.NewUnaryHandlerSimple( TransactionServiceGetTransactionProcedure, svc.GetTransaction, connect.WithSchema(transactionServiceMethods.ByName("GetTransaction")), connect.WithHandlerOptions(opts...), ) transactionServiceDeleteTransactionHandler := connect.NewUnaryHandlerSimple( TransactionServiceDeleteTransactionProcedure, svc.DeleteTransaction, connect.WithSchema(transactionServiceMethods.ByName("DeleteTransaction")), connect.WithHandlerOptions(opts...), ) return "/proto.transaction.v1.TransactionService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case TransactionServiceCreateTransactionProcedure: transactionServiceCreateTransactionHandler.ServeHTTP(w, r) case TransactionServiceListTransactionsProcedure: transactionServiceListTransactionsHandler.ServeHTTP(w, r) case TransactionServiceGetTransactionProcedure: transactionServiceGetTransactionHandler.ServeHTTP(w, r) case TransactionServiceDeleteTransactionProcedure: transactionServiceDeleteTransactionHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedTransactionServiceHandler returns CodeUnimplemented from all methods. type UnimplementedTransactionServiceHandler struct{} func (UnimplementedTransactionServiceHandler) CreateTransaction(context.Context, *v1.CreateTransactionRequest) (*v1.CreateTransactionResponse, error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("proto.transaction.v1.TransactionService.CreateTransaction is not implemented")) } func (UnimplementedTransactionServiceHandler) ListTransactions(context.Context, *v1.ListTransactionsRequest) (*v1.ListTransactionsResponse, error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("proto.transaction.v1.TransactionService.ListTransactions is not implemented")) } func (UnimplementedTransactionServiceHandler) GetTransaction(context.Context, *v1.GetTransactionRequest) (*v1.GetTransactionResponse, error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("proto.transaction.v1.TransactionService.GetTransaction is not implemented")) } func (UnimplementedTransactionServiceHandler) DeleteTransaction(context.Context, *v1.DeleteTransactionRequest) (*v1.DeleteTransactionResponse, error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("proto.transaction.v1.TransactionService.DeleteTransaction is not implemented")) }