// Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: item/v1/item.proto package itemv1connect import ( connect "connectrpc.com/connect" context "context" errors "errors" v1 "github.com/spotdemo4/trevstack/server/internal/services/item/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 ( // ItemServiceName is the fully-qualified name of the ItemService service. ItemServiceName = "item.v1.ItemService" ) // 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 ( // ItemServiceGetItemProcedure is the fully-qualified name of the ItemService's GetItem RPC. ItemServiceGetItemProcedure = "/item.v1.ItemService/GetItem" // ItemServiceGetItemsProcedure is the fully-qualified name of the ItemService's GetItems RPC. ItemServiceGetItemsProcedure = "/item.v1.ItemService/GetItems" // ItemServiceCreateItemProcedure is the fully-qualified name of the ItemService's CreateItem RPC. ItemServiceCreateItemProcedure = "/item.v1.ItemService/CreateItem" // ItemServiceUpdateItemProcedure is the fully-qualified name of the ItemService's UpdateItem RPC. ItemServiceUpdateItemProcedure = "/item.v1.ItemService/UpdateItem" // ItemServiceDeleteItemProcedure is the fully-qualified name of the ItemService's DeleteItem RPC. ItemServiceDeleteItemProcedure = "/item.v1.ItemService/DeleteItem" ) // ItemServiceClient is a client for the item.v1.ItemService service. type ItemServiceClient interface { GetItem(context.Context, *connect.Request[v1.GetItemRequest]) (*connect.Response[v1.GetItemResponse], error) GetItems(context.Context, *connect.Request[v1.GetItemsRequest]) (*connect.Response[v1.GetItemsResponse], error) CreateItem(context.Context, *connect.Request[v1.CreateItemRequest]) (*connect.Response[v1.CreateItemResponse], error) UpdateItem(context.Context, *connect.Request[v1.UpdateItemRequest]) (*connect.Response[v1.UpdateItemResponse], error) DeleteItem(context.Context, *connect.Request[v1.DeleteItemRequest]) (*connect.Response[v1.DeleteItemResponse], error) } // NewItemServiceClient constructs a client for the item.v1.ItemService 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 NewItemServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ItemServiceClient { baseURL = strings.TrimRight(baseURL, "/") itemServiceMethods := v1.File_item_v1_item_proto.Services().ByName("ItemService").Methods() return &itemServiceClient{ getItem: connect.NewClient[v1.GetItemRequest, v1.GetItemResponse]( httpClient, baseURL+ItemServiceGetItemProcedure, connect.WithSchema(itemServiceMethods.ByName("GetItem")), connect.WithClientOptions(opts...), ), getItems: connect.NewClient[v1.GetItemsRequest, v1.GetItemsResponse]( httpClient, baseURL+ItemServiceGetItemsProcedure, connect.WithSchema(itemServiceMethods.ByName("GetItems")), connect.WithClientOptions(opts...), ), createItem: connect.NewClient[v1.CreateItemRequest, v1.CreateItemResponse]( httpClient, baseURL+ItemServiceCreateItemProcedure, connect.WithSchema(itemServiceMethods.ByName("CreateItem")), connect.WithClientOptions(opts...), ), updateItem: connect.NewClient[v1.UpdateItemRequest, v1.UpdateItemResponse]( httpClient, baseURL+ItemServiceUpdateItemProcedure, connect.WithSchema(itemServiceMethods.ByName("UpdateItem")), connect.WithClientOptions(opts...), ), deleteItem: connect.NewClient[v1.DeleteItemRequest, v1.DeleteItemResponse]( httpClient, baseURL+ItemServiceDeleteItemProcedure, connect.WithSchema(itemServiceMethods.ByName("DeleteItem")), connect.WithClientOptions(opts...), ), } } // itemServiceClient implements ItemServiceClient. type itemServiceClient struct { getItem *connect.Client[v1.GetItemRequest, v1.GetItemResponse] getItems *connect.Client[v1.GetItemsRequest, v1.GetItemsResponse] createItem *connect.Client[v1.CreateItemRequest, v1.CreateItemResponse] updateItem *connect.Client[v1.UpdateItemRequest, v1.UpdateItemResponse] deleteItem *connect.Client[v1.DeleteItemRequest, v1.DeleteItemResponse] } // GetItem calls item.v1.ItemService.GetItem. func (c *itemServiceClient) GetItem(ctx context.Context, req *connect.Request[v1.GetItemRequest]) (*connect.Response[v1.GetItemResponse], error) { return c.getItem.CallUnary(ctx, req) } // GetItems calls item.v1.ItemService.GetItems. func (c *itemServiceClient) GetItems(ctx context.Context, req *connect.Request[v1.GetItemsRequest]) (*connect.Response[v1.GetItemsResponse], error) { return c.getItems.CallUnary(ctx, req) } // CreateItem calls item.v1.ItemService.CreateItem. func (c *itemServiceClient) CreateItem(ctx context.Context, req *connect.Request[v1.CreateItemRequest]) (*connect.Response[v1.CreateItemResponse], error) { return c.createItem.CallUnary(ctx, req) } // UpdateItem calls item.v1.ItemService.UpdateItem. func (c *itemServiceClient) UpdateItem(ctx context.Context, req *connect.Request[v1.UpdateItemRequest]) (*connect.Response[v1.UpdateItemResponse], error) { return c.updateItem.CallUnary(ctx, req) } // DeleteItem calls item.v1.ItemService.DeleteItem. func (c *itemServiceClient) DeleteItem(ctx context.Context, req *connect.Request[v1.DeleteItemRequest]) (*connect.Response[v1.DeleteItemResponse], error) { return c.deleteItem.CallUnary(ctx, req) } // ItemServiceHandler is an implementation of the item.v1.ItemService service. type ItemServiceHandler interface { GetItem(context.Context, *connect.Request[v1.GetItemRequest]) (*connect.Response[v1.GetItemResponse], error) GetItems(context.Context, *connect.Request[v1.GetItemsRequest]) (*connect.Response[v1.GetItemsResponse], error) CreateItem(context.Context, *connect.Request[v1.CreateItemRequest]) (*connect.Response[v1.CreateItemResponse], error) UpdateItem(context.Context, *connect.Request[v1.UpdateItemRequest]) (*connect.Response[v1.UpdateItemResponse], error) DeleteItem(context.Context, *connect.Request[v1.DeleteItemRequest]) (*connect.Response[v1.DeleteItemResponse], error) } // NewItemServiceHandler 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 NewItemServiceHandler(svc ItemServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { itemServiceMethods := v1.File_item_v1_item_proto.Services().ByName("ItemService").Methods() itemServiceGetItemHandler := connect.NewUnaryHandler( ItemServiceGetItemProcedure, svc.GetItem, connect.WithSchema(itemServiceMethods.ByName("GetItem")), connect.WithHandlerOptions(opts...), ) itemServiceGetItemsHandler := connect.NewUnaryHandler( ItemServiceGetItemsProcedure, svc.GetItems, connect.WithSchema(itemServiceMethods.ByName("GetItems")), connect.WithHandlerOptions(opts...), ) itemServiceCreateItemHandler := connect.NewUnaryHandler( ItemServiceCreateItemProcedure, svc.CreateItem, connect.WithSchema(itemServiceMethods.ByName("CreateItem")), connect.WithHandlerOptions(opts...), ) itemServiceUpdateItemHandler := connect.NewUnaryHandler( ItemServiceUpdateItemProcedure, svc.UpdateItem, connect.WithSchema(itemServiceMethods.ByName("UpdateItem")), connect.WithHandlerOptions(opts...), ) itemServiceDeleteItemHandler := connect.NewUnaryHandler( ItemServiceDeleteItemProcedure, svc.DeleteItem, connect.WithSchema(itemServiceMethods.ByName("DeleteItem")), connect.WithHandlerOptions(opts...), ) return "/item.v1.ItemService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case ItemServiceGetItemProcedure: itemServiceGetItemHandler.ServeHTTP(w, r) case ItemServiceGetItemsProcedure: itemServiceGetItemsHandler.ServeHTTP(w, r) case ItemServiceCreateItemProcedure: itemServiceCreateItemHandler.ServeHTTP(w, r) case ItemServiceUpdateItemProcedure: itemServiceUpdateItemHandler.ServeHTTP(w, r) case ItemServiceDeleteItemProcedure: itemServiceDeleteItemHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedItemServiceHandler returns CodeUnimplemented from all methods. type UnimplementedItemServiceHandler struct{} func (UnimplementedItemServiceHandler) GetItem(context.Context, *connect.Request[v1.GetItemRequest]) (*connect.Response[v1.GetItemResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("item.v1.ItemService.GetItem is not implemented")) } func (UnimplementedItemServiceHandler) GetItems(context.Context, *connect.Request[v1.GetItemsRequest]) (*connect.Response[v1.GetItemsResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("item.v1.ItemService.GetItems is not implemented")) } func (UnimplementedItemServiceHandler) CreateItem(context.Context, *connect.Request[v1.CreateItemRequest]) (*connect.Response[v1.CreateItemResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("item.v1.ItemService.CreateItem is not implemented")) } func (UnimplementedItemServiceHandler) UpdateItem(context.Context, *connect.Request[v1.UpdateItemRequest]) (*connect.Response[v1.UpdateItemResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("item.v1.ItemService.UpdateItem is not implemented")) } func (UnimplementedItemServiceHandler) DeleteItem(context.Context, *connect.Request[v1.DeleteItemRequest]) (*connect.Response[v1.DeleteItemResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("item.v1.ItemService.DeleteItem is not implemented")) }