// Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: mi/mi.proto package miconnect import ( connect "connectrpc.com/connect" context "context" errors "errors" emptypb "google.golang.org/protobuf/types/known/emptypb" http "net/http" strings "strings" mi "within.website/x/buf/mi" ) // 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 ( // SwitchTrackerName is the fully-qualified name of the SwitchTracker service. SwitchTrackerName = "within.website.x.mi.SwitchTracker" // POSSEName is the fully-qualified name of the POSSE service. POSSEName = "within.website.x.mi.POSSE" // EventsName is the fully-qualified name of the Events service. EventsName = "within.website.x.mi.Events" ) // 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 ( // SwitchTrackerMembersProcedure is the fully-qualified name of the SwitchTracker's Members RPC. SwitchTrackerMembersProcedure = "/within.website.x.mi.SwitchTracker/Members" // SwitchTrackerWhoIsFrontProcedure is the fully-qualified name of the SwitchTracker's WhoIsFront // RPC. SwitchTrackerWhoIsFrontProcedure = "/within.website.x.mi.SwitchTracker/WhoIsFront" // SwitchTrackerSwitchProcedure is the fully-qualified name of the SwitchTracker's Switch RPC. SwitchTrackerSwitchProcedure = "/within.website.x.mi.SwitchTracker/Switch" // SwitchTrackerGetSwitchProcedure is the fully-qualified name of the SwitchTracker's GetSwitch RPC. SwitchTrackerGetSwitchProcedure = "/within.website.x.mi.SwitchTracker/GetSwitch" // SwitchTrackerListSwitchesProcedure is the fully-qualified name of the SwitchTracker's // ListSwitches RPC. SwitchTrackerListSwitchesProcedure = "/within.website.x.mi.SwitchTracker/ListSwitches" // POSSERefreshBlogProcedure is the fully-qualified name of the POSSE's RefreshBlog RPC. POSSERefreshBlogProcedure = "/within.website.x.mi.POSSE/RefreshBlog" // EventsGetProcedure is the fully-qualified name of the Events's Get RPC. EventsGetProcedure = "/within.website.x.mi.Events/Get" // EventsAddProcedure is the fully-qualified name of the Events's Add RPC. EventsAddProcedure = "/within.website.x.mi.Events/Add" ) // These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. var ( switchTrackerServiceDescriptor = mi.File_mi_mi_proto.Services().ByName("SwitchTracker") switchTrackerMembersMethodDescriptor = switchTrackerServiceDescriptor.Methods().ByName("Members") switchTrackerWhoIsFrontMethodDescriptor = switchTrackerServiceDescriptor.Methods().ByName("WhoIsFront") switchTrackerSwitchMethodDescriptor = switchTrackerServiceDescriptor.Methods().ByName("Switch") switchTrackerGetSwitchMethodDescriptor = switchTrackerServiceDescriptor.Methods().ByName("GetSwitch") switchTrackerListSwitchesMethodDescriptor = switchTrackerServiceDescriptor.Methods().ByName("ListSwitches") pOSSEServiceDescriptor = mi.File_mi_mi_proto.Services().ByName("POSSE") pOSSERefreshBlogMethodDescriptor = pOSSEServiceDescriptor.Methods().ByName("RefreshBlog") eventsServiceDescriptor = mi.File_mi_mi_proto.Services().ByName("Events") eventsGetMethodDescriptor = eventsServiceDescriptor.Methods().ByName("Get") eventsAddMethodDescriptor = eventsServiceDescriptor.Methods().ByName("Add") ) // SwitchTrackerClient is a client for the within.website.x.mi.SwitchTracker service. type SwitchTrackerClient interface { Members(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.MembersResp], error) WhoIsFront(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.FrontChange], error) Switch(context.Context, *connect.Request[mi.SwitchReq]) (*connect.Response[mi.SwitchResp], error) GetSwitch(context.Context, *connect.Request[mi.GetSwitchReq]) (*connect.Response[mi.FrontChange], error) ListSwitches(context.Context, *connect.Request[mi.ListSwitchesReq]) (*connect.Response[mi.ListSwitchesResp], error) } // NewSwitchTrackerClient constructs a client for the within.website.x.mi.SwitchTracker 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 NewSwitchTrackerClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) SwitchTrackerClient { baseURL = strings.TrimRight(baseURL, "/") return &switchTrackerClient{ members: connect.NewClient[emptypb.Empty, mi.MembersResp]( httpClient, baseURL+SwitchTrackerMembersProcedure, connect.WithSchema(switchTrackerMembersMethodDescriptor), connect.WithClientOptions(opts...), ), whoIsFront: connect.NewClient[emptypb.Empty, mi.FrontChange]( httpClient, baseURL+SwitchTrackerWhoIsFrontProcedure, connect.WithSchema(switchTrackerWhoIsFrontMethodDescriptor), connect.WithClientOptions(opts...), ), _switch: connect.NewClient[mi.SwitchReq, mi.SwitchResp]( httpClient, baseURL+SwitchTrackerSwitchProcedure, connect.WithSchema(switchTrackerSwitchMethodDescriptor), connect.WithClientOptions(opts...), ), getSwitch: connect.NewClient[mi.GetSwitchReq, mi.FrontChange]( httpClient, baseURL+SwitchTrackerGetSwitchProcedure, connect.WithSchema(switchTrackerGetSwitchMethodDescriptor), connect.WithClientOptions(opts...), ), listSwitches: connect.NewClient[mi.ListSwitchesReq, mi.ListSwitchesResp]( httpClient, baseURL+SwitchTrackerListSwitchesProcedure, connect.WithSchema(switchTrackerListSwitchesMethodDescriptor), connect.WithClientOptions(opts...), ), } } // switchTrackerClient implements SwitchTrackerClient. type switchTrackerClient struct { members *connect.Client[emptypb.Empty, mi.MembersResp] whoIsFront *connect.Client[emptypb.Empty, mi.FrontChange] _switch *connect.Client[mi.SwitchReq, mi.SwitchResp] getSwitch *connect.Client[mi.GetSwitchReq, mi.FrontChange] listSwitches *connect.Client[mi.ListSwitchesReq, mi.ListSwitchesResp] } // Members calls within.website.x.mi.SwitchTracker.Members. func (c *switchTrackerClient) Members(ctx context.Context, req *connect.Request[emptypb.Empty]) (*connect.Response[mi.MembersResp], error) { return c.members.CallUnary(ctx, req) } // WhoIsFront calls within.website.x.mi.SwitchTracker.WhoIsFront. func (c *switchTrackerClient) WhoIsFront(ctx context.Context, req *connect.Request[emptypb.Empty]) (*connect.Response[mi.FrontChange], error) { return c.whoIsFront.CallUnary(ctx, req) } // Switch calls within.website.x.mi.SwitchTracker.Switch. func (c *switchTrackerClient) Switch(ctx context.Context, req *connect.Request[mi.SwitchReq]) (*connect.Response[mi.SwitchResp], error) { return c._switch.CallUnary(ctx, req) } // GetSwitch calls within.website.x.mi.SwitchTracker.GetSwitch. func (c *switchTrackerClient) GetSwitch(ctx context.Context, req *connect.Request[mi.GetSwitchReq]) (*connect.Response[mi.FrontChange], error) { return c.getSwitch.CallUnary(ctx, req) } // ListSwitches calls within.website.x.mi.SwitchTracker.ListSwitches. func (c *switchTrackerClient) ListSwitches(ctx context.Context, req *connect.Request[mi.ListSwitchesReq]) (*connect.Response[mi.ListSwitchesResp], error) { return c.listSwitches.CallUnary(ctx, req) } // SwitchTrackerHandler is an implementation of the within.website.x.mi.SwitchTracker service. type SwitchTrackerHandler interface { Members(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.MembersResp], error) WhoIsFront(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.FrontChange], error) Switch(context.Context, *connect.Request[mi.SwitchReq]) (*connect.Response[mi.SwitchResp], error) GetSwitch(context.Context, *connect.Request[mi.GetSwitchReq]) (*connect.Response[mi.FrontChange], error) ListSwitches(context.Context, *connect.Request[mi.ListSwitchesReq]) (*connect.Response[mi.ListSwitchesResp], error) } // NewSwitchTrackerHandler 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 NewSwitchTrackerHandler(svc SwitchTrackerHandler, opts ...connect.HandlerOption) (string, http.Handler) { switchTrackerMembersHandler := connect.NewUnaryHandler( SwitchTrackerMembersProcedure, svc.Members, connect.WithSchema(switchTrackerMembersMethodDescriptor), connect.WithHandlerOptions(opts...), ) switchTrackerWhoIsFrontHandler := connect.NewUnaryHandler( SwitchTrackerWhoIsFrontProcedure, svc.WhoIsFront, connect.WithSchema(switchTrackerWhoIsFrontMethodDescriptor), connect.WithHandlerOptions(opts...), ) switchTrackerSwitchHandler := connect.NewUnaryHandler( SwitchTrackerSwitchProcedure, svc.Switch, connect.WithSchema(switchTrackerSwitchMethodDescriptor), connect.WithHandlerOptions(opts...), ) switchTrackerGetSwitchHandler := connect.NewUnaryHandler( SwitchTrackerGetSwitchProcedure, svc.GetSwitch, connect.WithSchema(switchTrackerGetSwitchMethodDescriptor), connect.WithHandlerOptions(opts...), ) switchTrackerListSwitchesHandler := connect.NewUnaryHandler( SwitchTrackerListSwitchesProcedure, svc.ListSwitches, connect.WithSchema(switchTrackerListSwitchesMethodDescriptor), connect.WithHandlerOptions(opts...), ) return "/within.website.x.mi.SwitchTracker/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case SwitchTrackerMembersProcedure: switchTrackerMembersHandler.ServeHTTP(w, r) case SwitchTrackerWhoIsFrontProcedure: switchTrackerWhoIsFrontHandler.ServeHTTP(w, r) case SwitchTrackerSwitchProcedure: switchTrackerSwitchHandler.ServeHTTP(w, r) case SwitchTrackerGetSwitchProcedure: switchTrackerGetSwitchHandler.ServeHTTP(w, r) case SwitchTrackerListSwitchesProcedure: switchTrackerListSwitchesHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedSwitchTrackerHandler returns CodeUnimplemented from all methods. type UnimplementedSwitchTrackerHandler struct{} func (UnimplementedSwitchTrackerHandler) Members(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.MembersResp], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.mi.SwitchTracker.Members is not implemented")) } func (UnimplementedSwitchTrackerHandler) WhoIsFront(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.FrontChange], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.mi.SwitchTracker.WhoIsFront is not implemented")) } func (UnimplementedSwitchTrackerHandler) Switch(context.Context, *connect.Request[mi.SwitchReq]) (*connect.Response[mi.SwitchResp], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.mi.SwitchTracker.Switch is not implemented")) } func (UnimplementedSwitchTrackerHandler) GetSwitch(context.Context, *connect.Request[mi.GetSwitchReq]) (*connect.Response[mi.FrontChange], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.mi.SwitchTracker.GetSwitch is not implemented")) } func (UnimplementedSwitchTrackerHandler) ListSwitches(context.Context, *connect.Request[mi.ListSwitchesReq]) (*connect.Response[mi.ListSwitchesResp], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.mi.SwitchTracker.ListSwitches is not implemented")) } // POSSEClient is a client for the within.website.x.mi.POSSE service. type POSSEClient interface { RefreshBlog(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[emptypb.Empty], error) } // NewPOSSEClient constructs a client for the within.website.x.mi.POSSE 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 NewPOSSEClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) POSSEClient { baseURL = strings.TrimRight(baseURL, "/") return &pOSSEClient{ refreshBlog: connect.NewClient[emptypb.Empty, emptypb.Empty]( httpClient, baseURL+POSSERefreshBlogProcedure, connect.WithSchema(pOSSERefreshBlogMethodDescriptor), connect.WithClientOptions(opts...), ), } } // pOSSEClient implements POSSEClient. type pOSSEClient struct { refreshBlog *connect.Client[emptypb.Empty, emptypb.Empty] } // RefreshBlog calls within.website.x.mi.POSSE.RefreshBlog. func (c *pOSSEClient) RefreshBlog(ctx context.Context, req *connect.Request[emptypb.Empty]) (*connect.Response[emptypb.Empty], error) { return c.refreshBlog.CallUnary(ctx, req) } // POSSEHandler is an implementation of the within.website.x.mi.POSSE service. type POSSEHandler interface { RefreshBlog(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[emptypb.Empty], error) } // NewPOSSEHandler 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 NewPOSSEHandler(svc POSSEHandler, opts ...connect.HandlerOption) (string, http.Handler) { pOSSERefreshBlogHandler := connect.NewUnaryHandler( POSSERefreshBlogProcedure, svc.RefreshBlog, connect.WithSchema(pOSSERefreshBlogMethodDescriptor), connect.WithHandlerOptions(opts...), ) return "/within.website.x.mi.POSSE/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case POSSERefreshBlogProcedure: pOSSERefreshBlogHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedPOSSEHandler returns CodeUnimplemented from all methods. type UnimplementedPOSSEHandler struct{} func (UnimplementedPOSSEHandler) RefreshBlog(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[emptypb.Empty], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.mi.POSSE.RefreshBlog is not implemented")) } // EventsClient is a client for the within.website.x.mi.Events service. type EventsClient interface { // Get fetches the current feed of upcoming events. Get(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.EventFeed], error) // Add adds an event to the feed. Add(context.Context, *connect.Request[mi.Event]) (*connect.Response[emptypb.Empty], error) } // NewEventsClient constructs a client for the within.website.x.mi.Events 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 NewEventsClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) EventsClient { baseURL = strings.TrimRight(baseURL, "/") return &eventsClient{ get: connect.NewClient[emptypb.Empty, mi.EventFeed]( httpClient, baseURL+EventsGetProcedure, connect.WithSchema(eventsGetMethodDescriptor), connect.WithClientOptions(opts...), ), add: connect.NewClient[mi.Event, emptypb.Empty]( httpClient, baseURL+EventsAddProcedure, connect.WithSchema(eventsAddMethodDescriptor), connect.WithClientOptions(opts...), ), } } // eventsClient implements EventsClient. type eventsClient struct { get *connect.Client[emptypb.Empty, mi.EventFeed] add *connect.Client[mi.Event, emptypb.Empty] } // Get calls within.website.x.mi.Events.Get. func (c *eventsClient) Get(ctx context.Context, req *connect.Request[emptypb.Empty]) (*connect.Response[mi.EventFeed], error) { return c.get.CallUnary(ctx, req) } // Add calls within.website.x.mi.Events.Add. func (c *eventsClient) Add(ctx context.Context, req *connect.Request[mi.Event]) (*connect.Response[emptypb.Empty], error) { return c.add.CallUnary(ctx, req) } // EventsHandler is an implementation of the within.website.x.mi.Events service. type EventsHandler interface { // Get fetches the current feed of upcoming events. Get(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.EventFeed], error) // Add adds an event to the feed. Add(context.Context, *connect.Request[mi.Event]) (*connect.Response[emptypb.Empty], error) } // NewEventsHandler 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 NewEventsHandler(svc EventsHandler, opts ...connect.HandlerOption) (string, http.Handler) { eventsGetHandler := connect.NewUnaryHandler( EventsGetProcedure, svc.Get, connect.WithSchema(eventsGetMethodDescriptor), connect.WithHandlerOptions(opts...), ) eventsAddHandler := connect.NewUnaryHandler( EventsAddProcedure, svc.Add, connect.WithSchema(eventsAddMethodDescriptor), connect.WithHandlerOptions(opts...), ) return "/within.website.x.mi.Events/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case EventsGetProcedure: eventsGetHandler.ServeHTTP(w, r) case EventsAddProcedure: eventsAddHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedEventsHandler returns CodeUnimplemented from all methods. type UnimplementedEventsHandler struct{} func (UnimplementedEventsHandler) Get(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[mi.EventFeed], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.mi.Events.Get is not implemented")) } func (UnimplementedEventsHandler) Add(context.Context, *connect.Request[mi.Event]) (*connect.Response[emptypb.Empty], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.mi.Events.Add is not implemented")) }