// Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: mandant/v1/mandant.proto package mandantv1connect import ( connect "connectrpc.com/connect" context "context" errors "errors" v1 "git.kocoder.xyz/kocoded/vt/gen/mandant/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 ( // MandantServiceName is the fully-qualified name of the MandantService service. MandantServiceName = "mandant.v1.MandantService" ) // 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 ( // MandantServiceGetCurrentTenantProcedure is the fully-qualified name of the MandantService's // GetCurrentTenant RPC. MandantServiceGetCurrentTenantProcedure = "/mandant.v1.MandantService/GetCurrentTenant" // MandantServiceGetAllTenantsProcedure is the fully-qualified name of the MandantService's // GetAllTenants RPC. MandantServiceGetAllTenantsProcedure = "/mandant.v1.MandantService/GetAllTenants" // MandantServiceSetCurrentTenantProcedure is the fully-qualified name of the MandantService's // SetCurrentTenant RPC. MandantServiceSetCurrentTenantProcedure = "/mandant.v1.MandantService/SetCurrentTenant" ) // MandantServiceClient is a client for the mandant.v1.MandantService service. type MandantServiceClient interface { GetCurrentTenant(context.Context, *v1.GetCurrentTenantRequest) (*v1.GetTenantResponse, error) GetAllTenants(context.Context, *v1.ListTenantRequest) (*v1.ListProjectsResponse, error) SetCurrentTenant(context.Context, *v1.SetCurrentTenantRequest) (*v1.SetCurrentTenantResponse, error) } // NewMandantServiceClient constructs a client for the mandant.v1.MandantService 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 NewMandantServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) MandantServiceClient { baseURL = strings.TrimRight(baseURL, "/") mandantServiceMethods := v1.File_mandant_v1_mandant_proto.Services().ByName("MandantService").Methods() return &mandantServiceClient{ getCurrentTenant: connect.NewClient[v1.GetCurrentTenantRequest, v1.GetTenantResponse]( httpClient, baseURL+MandantServiceGetCurrentTenantProcedure, connect.WithSchema(mandantServiceMethods.ByName("GetCurrentTenant")), connect.WithClientOptions(opts...), ), getAllTenants: connect.NewClient[v1.ListTenantRequest, v1.ListProjectsResponse]( httpClient, baseURL+MandantServiceGetAllTenantsProcedure, connect.WithSchema(mandantServiceMethods.ByName("GetAllTenants")), connect.WithClientOptions(opts...), ), setCurrentTenant: connect.NewClient[v1.SetCurrentTenantRequest, v1.SetCurrentTenantResponse]( httpClient, baseURL+MandantServiceSetCurrentTenantProcedure, connect.WithSchema(mandantServiceMethods.ByName("SetCurrentTenant")), connect.WithClientOptions(opts...), ), } } // mandantServiceClient implements MandantServiceClient. type mandantServiceClient struct { getCurrentTenant *connect.Client[v1.GetCurrentTenantRequest, v1.GetTenantResponse] getAllTenants *connect.Client[v1.ListTenantRequest, v1.ListProjectsResponse] setCurrentTenant *connect.Client[v1.SetCurrentTenantRequest, v1.SetCurrentTenantResponse] } // GetCurrentTenant calls mandant.v1.MandantService.GetCurrentTenant. func (c *mandantServiceClient) GetCurrentTenant(ctx context.Context, req *v1.GetCurrentTenantRequest) (*v1.GetTenantResponse, error) { response, err := c.getCurrentTenant.CallUnary(ctx, connect.NewRequest(req)) if response != nil { return response.Msg, err } return nil, err } // GetAllTenants calls mandant.v1.MandantService.GetAllTenants. func (c *mandantServiceClient) GetAllTenants(ctx context.Context, req *v1.ListTenantRequest) (*v1.ListProjectsResponse, error) { response, err := c.getAllTenants.CallUnary(ctx, connect.NewRequest(req)) if response != nil { return response.Msg, err } return nil, err } // SetCurrentTenant calls mandant.v1.MandantService.SetCurrentTenant. func (c *mandantServiceClient) SetCurrentTenant(ctx context.Context, req *v1.SetCurrentTenantRequest) (*v1.SetCurrentTenantResponse, error) { response, err := c.setCurrentTenant.CallUnary(ctx, connect.NewRequest(req)) if response != nil { return response.Msg, err } return nil, err } // MandantServiceHandler is an implementation of the mandant.v1.MandantService service. type MandantServiceHandler interface { GetCurrentTenant(context.Context, *v1.GetCurrentTenantRequest) (*v1.GetTenantResponse, error) GetAllTenants(context.Context, *v1.ListTenantRequest) (*v1.ListProjectsResponse, error) SetCurrentTenant(context.Context, *v1.SetCurrentTenantRequest) (*v1.SetCurrentTenantResponse, error) } // NewMandantServiceHandler 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 NewMandantServiceHandler(svc MandantServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { mandantServiceMethods := v1.File_mandant_v1_mandant_proto.Services().ByName("MandantService").Methods() mandantServiceGetCurrentTenantHandler := connect.NewUnaryHandlerSimple( MandantServiceGetCurrentTenantProcedure, svc.GetCurrentTenant, connect.WithSchema(mandantServiceMethods.ByName("GetCurrentTenant")), connect.WithHandlerOptions(opts...), ) mandantServiceGetAllTenantsHandler := connect.NewUnaryHandlerSimple( MandantServiceGetAllTenantsProcedure, svc.GetAllTenants, connect.WithSchema(mandantServiceMethods.ByName("GetAllTenants")), connect.WithHandlerOptions(opts...), ) mandantServiceSetCurrentTenantHandler := connect.NewUnaryHandlerSimple( MandantServiceSetCurrentTenantProcedure, svc.SetCurrentTenant, connect.WithSchema(mandantServiceMethods.ByName("SetCurrentTenant")), connect.WithHandlerOptions(opts...), ) return "/mandant.v1.MandantService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case MandantServiceGetCurrentTenantProcedure: mandantServiceGetCurrentTenantHandler.ServeHTTP(w, r) case MandantServiceGetAllTenantsProcedure: mandantServiceGetAllTenantsHandler.ServeHTTP(w, r) case MandantServiceSetCurrentTenantProcedure: mandantServiceSetCurrentTenantHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedMandantServiceHandler returns CodeUnimplemented from all methods. type UnimplementedMandantServiceHandler struct{} func (UnimplementedMandantServiceHandler) GetCurrentTenant(context.Context, *v1.GetCurrentTenantRequest) (*v1.GetTenantResponse, error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("mandant.v1.MandantService.GetCurrentTenant is not implemented")) } func (UnimplementedMandantServiceHandler) GetAllTenants(context.Context, *v1.ListTenantRequest) (*v1.ListProjectsResponse, error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("mandant.v1.MandantService.GetAllTenants is not implemented")) } func (UnimplementedMandantServiceHandler) SetCurrentTenant(context.Context, *v1.SetCurrentTenantRequest) (*v1.SetCurrentTenantResponse, error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("mandant.v1.MandantService.SetCurrentTenant is not implemented")) }