348 lines
19 KiB
Go
348 lines
19 KiB
Go
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
|
//
|
|
// Source: signaler_service.proto
|
|
|
|
package genconnect
|
|
|
|
import (
|
|
connect "connectrpc.com/connect"
|
|
context "context"
|
|
errors "errors"
|
|
gen "github.com/chathaway-codes/home-sensors/v2/gen"
|
|
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.IsAtLeastVersion0_1_0
|
|
|
|
const (
|
|
// SignalerServiceName is the fully-qualified name of the SignalerService service.
|
|
SignalerServiceName = "signaler.SignalerService"
|
|
)
|
|
|
|
// 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 (
|
|
// SignalerServiceCreateAuthTokenProcedure is the fully-qualified name of the SignalerService's
|
|
// CreateAuthToken RPC.
|
|
SignalerServiceCreateAuthTokenProcedure = "/signaler.SignalerService/CreateAuthToken"
|
|
// SignalerServiceListCamerasProcedure is the fully-qualified name of the SignalerService's
|
|
// ListCameras RPC.
|
|
SignalerServiceListCamerasProcedure = "/signaler.SignalerService/ListCameras"
|
|
// SignalerServiceCreateSessionProcedure is the fully-qualified name of the SignalerService's
|
|
// CreateSession RPC.
|
|
SignalerServiceCreateSessionProcedure = "/signaler.SignalerService/CreateSession"
|
|
// SignalerServiceUpdateSessionProcedure is the fully-qualified name of the SignalerService's
|
|
// UpdateSession RPC.
|
|
SignalerServiceUpdateSessionProcedure = "/signaler.SignalerService/UpdateSession"
|
|
// SignalerServiceListSessionsProcedure is the fully-qualified name of the SignalerService's
|
|
// ListSessions RPC.
|
|
SignalerServiceListSessionsProcedure = "/signaler.SignalerService/ListSessions"
|
|
// SignalerServiceCreateIceCandidateProcedure is the fully-qualified name of the SignalerService's
|
|
// CreateIceCandidate RPC.
|
|
SignalerServiceCreateIceCandidateProcedure = "/signaler.SignalerService/CreateIceCandidate"
|
|
// SignalerServicePopIceCandidateProcedure is the fully-qualified name of the SignalerService's
|
|
// PopIceCandidate RPC.
|
|
SignalerServicePopIceCandidateProcedure = "/signaler.SignalerService/PopIceCandidate"
|
|
// SignalerServiceCreateIceSessionDescriptionProcedure is the fully-qualified name of the
|
|
// SignalerService's CreateIceSessionDescription RPC.
|
|
SignalerServiceCreateIceSessionDescriptionProcedure = "/signaler.SignalerService/CreateIceSessionDescription"
|
|
// SignalerServicePopIceSessionDescriptionProcedure is the fully-qualified name of the
|
|
// SignalerService's PopIceSessionDescription RPC.
|
|
SignalerServicePopIceSessionDescriptionProcedure = "/signaler.SignalerService/PopIceSessionDescription"
|
|
)
|
|
|
|
// SignalerServiceClient is a client for the signaler.SignalerService service.
|
|
type SignalerServiceClient interface {
|
|
CreateAuthToken(context.Context, *connect.Request[gen.CreateAuthTokenRequest]) (*connect.Response[gen.AuthToken], error)
|
|
ListCameras(context.Context, *connect.Request[gen.ListCamerasRequest]) (*connect.Response[gen.ListCamerasResponse], error)
|
|
// CreateSession creates a new session that can be seen bv the provided Camera and Peer.
|
|
//
|
|
// Optionally, wait_for_update can be set to prevent returning until the Camera has seen the
|
|
// session request, populated candidates, and returned a session offer.
|
|
CreateSession(context.Context, *connect.Request[gen.CreateSessionRequest]) (*connect.Response[gen.Session], error)
|
|
// UpdateSession updates the session
|
|
UpdateSession(context.Context, *connect.Request[gen.UpdateSessionRequest]) (*connect.Response[gen.Session], error)
|
|
// ListSessions lists all sessions the client should consider.
|
|
//
|
|
// TODO: it would be better if we could alert a camera to poll for sessions
|
|
// i.e., with websockets (or streaming RPCs).
|
|
ListSessions(context.Context, *connect.Request[gen.ListSessionsRequest]) (*connect.Response[gen.ListSessionsResponse], error)
|
|
// CreateIceCandidate adds the provided candidate to the list of candidates.
|
|
CreateIceCandidate(context.Context, *connect.Request[gen.CreateIceCandidateRequest]) (*connect.Response[gen.IceCandidate], error)
|
|
// PopIceCandidate delete a candidate from the list of candidates and returns it.
|
|
//
|
|
// If there are no candidates, this blocks until one becomes available.
|
|
PopIceCandidate(context.Context, *connect.Request[gen.PopIceCandidateRequest]) (*connect.Response[gen.IceCandidate], error)
|
|
CreateIceSessionDescription(context.Context, *connect.Request[gen.CreateIceSessionDescriptionRequest]) (*connect.Response[gen.IceSessionDescription], error)
|
|
PopIceSessionDescription(context.Context, *connect.Request[gen.PopIceSessionDescriptionRequest]) (*connect.Response[gen.IceSessionDescription], error)
|
|
}
|
|
|
|
// NewSignalerServiceClient constructs a client for the signaler.SignalerService 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 NewSignalerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) SignalerServiceClient {
|
|
baseURL = strings.TrimRight(baseURL, "/")
|
|
return &signalerServiceClient{
|
|
createAuthToken: connect.NewClient[gen.CreateAuthTokenRequest, gen.AuthToken](
|
|
httpClient,
|
|
baseURL+SignalerServiceCreateAuthTokenProcedure,
|
|
opts...,
|
|
),
|
|
listCameras: connect.NewClient[gen.ListCamerasRequest, gen.ListCamerasResponse](
|
|
httpClient,
|
|
baseURL+SignalerServiceListCamerasProcedure,
|
|
opts...,
|
|
),
|
|
createSession: connect.NewClient[gen.CreateSessionRequest, gen.Session](
|
|
httpClient,
|
|
baseURL+SignalerServiceCreateSessionProcedure,
|
|
opts...,
|
|
),
|
|
updateSession: connect.NewClient[gen.UpdateSessionRequest, gen.Session](
|
|
httpClient,
|
|
baseURL+SignalerServiceUpdateSessionProcedure,
|
|
opts...,
|
|
),
|
|
listSessions: connect.NewClient[gen.ListSessionsRequest, gen.ListSessionsResponse](
|
|
httpClient,
|
|
baseURL+SignalerServiceListSessionsProcedure,
|
|
opts...,
|
|
),
|
|
createIceCandidate: connect.NewClient[gen.CreateIceCandidateRequest, gen.IceCandidate](
|
|
httpClient,
|
|
baseURL+SignalerServiceCreateIceCandidateProcedure,
|
|
opts...,
|
|
),
|
|
popIceCandidate: connect.NewClient[gen.PopIceCandidateRequest, gen.IceCandidate](
|
|
httpClient,
|
|
baseURL+SignalerServicePopIceCandidateProcedure,
|
|
opts...,
|
|
),
|
|
createIceSessionDescription: connect.NewClient[gen.CreateIceSessionDescriptionRequest, gen.IceSessionDescription](
|
|
httpClient,
|
|
baseURL+SignalerServiceCreateIceSessionDescriptionProcedure,
|
|
opts...,
|
|
),
|
|
popIceSessionDescription: connect.NewClient[gen.PopIceSessionDescriptionRequest, gen.IceSessionDescription](
|
|
httpClient,
|
|
baseURL+SignalerServicePopIceSessionDescriptionProcedure,
|
|
opts...,
|
|
),
|
|
}
|
|
}
|
|
|
|
// signalerServiceClient implements SignalerServiceClient.
|
|
type signalerServiceClient struct {
|
|
createAuthToken *connect.Client[gen.CreateAuthTokenRequest, gen.AuthToken]
|
|
listCameras *connect.Client[gen.ListCamerasRequest, gen.ListCamerasResponse]
|
|
createSession *connect.Client[gen.CreateSessionRequest, gen.Session]
|
|
updateSession *connect.Client[gen.UpdateSessionRequest, gen.Session]
|
|
listSessions *connect.Client[gen.ListSessionsRequest, gen.ListSessionsResponse]
|
|
createIceCandidate *connect.Client[gen.CreateIceCandidateRequest, gen.IceCandidate]
|
|
popIceCandidate *connect.Client[gen.PopIceCandidateRequest, gen.IceCandidate]
|
|
createIceSessionDescription *connect.Client[gen.CreateIceSessionDescriptionRequest, gen.IceSessionDescription]
|
|
popIceSessionDescription *connect.Client[gen.PopIceSessionDescriptionRequest, gen.IceSessionDescription]
|
|
}
|
|
|
|
// CreateAuthToken calls signaler.SignalerService.CreateAuthToken.
|
|
func (c *signalerServiceClient) CreateAuthToken(ctx context.Context, req *connect.Request[gen.CreateAuthTokenRequest]) (*connect.Response[gen.AuthToken], error) {
|
|
return c.createAuthToken.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ListCameras calls signaler.SignalerService.ListCameras.
|
|
func (c *signalerServiceClient) ListCameras(ctx context.Context, req *connect.Request[gen.ListCamerasRequest]) (*connect.Response[gen.ListCamerasResponse], error) {
|
|
return c.listCameras.CallUnary(ctx, req)
|
|
}
|
|
|
|
// CreateSession calls signaler.SignalerService.CreateSession.
|
|
func (c *signalerServiceClient) CreateSession(ctx context.Context, req *connect.Request[gen.CreateSessionRequest]) (*connect.Response[gen.Session], error) {
|
|
return c.createSession.CallUnary(ctx, req)
|
|
}
|
|
|
|
// UpdateSession calls signaler.SignalerService.UpdateSession.
|
|
func (c *signalerServiceClient) UpdateSession(ctx context.Context, req *connect.Request[gen.UpdateSessionRequest]) (*connect.Response[gen.Session], error) {
|
|
return c.updateSession.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ListSessions calls signaler.SignalerService.ListSessions.
|
|
func (c *signalerServiceClient) ListSessions(ctx context.Context, req *connect.Request[gen.ListSessionsRequest]) (*connect.Response[gen.ListSessionsResponse], error) {
|
|
return c.listSessions.CallUnary(ctx, req)
|
|
}
|
|
|
|
// CreateIceCandidate calls signaler.SignalerService.CreateIceCandidate.
|
|
func (c *signalerServiceClient) CreateIceCandidate(ctx context.Context, req *connect.Request[gen.CreateIceCandidateRequest]) (*connect.Response[gen.IceCandidate], error) {
|
|
return c.createIceCandidate.CallUnary(ctx, req)
|
|
}
|
|
|
|
// PopIceCandidate calls signaler.SignalerService.PopIceCandidate.
|
|
func (c *signalerServiceClient) PopIceCandidate(ctx context.Context, req *connect.Request[gen.PopIceCandidateRequest]) (*connect.Response[gen.IceCandidate], error) {
|
|
return c.popIceCandidate.CallUnary(ctx, req)
|
|
}
|
|
|
|
// CreateIceSessionDescription calls signaler.SignalerService.CreateIceSessionDescription.
|
|
func (c *signalerServiceClient) CreateIceSessionDescription(ctx context.Context, req *connect.Request[gen.CreateIceSessionDescriptionRequest]) (*connect.Response[gen.IceSessionDescription], error) {
|
|
return c.createIceSessionDescription.CallUnary(ctx, req)
|
|
}
|
|
|
|
// PopIceSessionDescription calls signaler.SignalerService.PopIceSessionDescription.
|
|
func (c *signalerServiceClient) PopIceSessionDescription(ctx context.Context, req *connect.Request[gen.PopIceSessionDescriptionRequest]) (*connect.Response[gen.IceSessionDescription], error) {
|
|
return c.popIceSessionDescription.CallUnary(ctx, req)
|
|
}
|
|
|
|
// SignalerServiceHandler is an implementation of the signaler.SignalerService service.
|
|
type SignalerServiceHandler interface {
|
|
CreateAuthToken(context.Context, *connect.Request[gen.CreateAuthTokenRequest]) (*connect.Response[gen.AuthToken], error)
|
|
ListCameras(context.Context, *connect.Request[gen.ListCamerasRequest]) (*connect.Response[gen.ListCamerasResponse], error)
|
|
// CreateSession creates a new session that can be seen bv the provided Camera and Peer.
|
|
//
|
|
// Optionally, wait_for_update can be set to prevent returning until the Camera has seen the
|
|
// session request, populated candidates, and returned a session offer.
|
|
CreateSession(context.Context, *connect.Request[gen.CreateSessionRequest]) (*connect.Response[gen.Session], error)
|
|
// UpdateSession updates the session
|
|
UpdateSession(context.Context, *connect.Request[gen.UpdateSessionRequest]) (*connect.Response[gen.Session], error)
|
|
// ListSessions lists all sessions the client should consider.
|
|
//
|
|
// TODO: it would be better if we could alert a camera to poll for sessions
|
|
// i.e., with websockets (or streaming RPCs).
|
|
ListSessions(context.Context, *connect.Request[gen.ListSessionsRequest]) (*connect.Response[gen.ListSessionsResponse], error)
|
|
// CreateIceCandidate adds the provided candidate to the list of candidates.
|
|
CreateIceCandidate(context.Context, *connect.Request[gen.CreateIceCandidateRequest]) (*connect.Response[gen.IceCandidate], error)
|
|
// PopIceCandidate delete a candidate from the list of candidates and returns it.
|
|
//
|
|
// If there are no candidates, this blocks until one becomes available.
|
|
PopIceCandidate(context.Context, *connect.Request[gen.PopIceCandidateRequest]) (*connect.Response[gen.IceCandidate], error)
|
|
CreateIceSessionDescription(context.Context, *connect.Request[gen.CreateIceSessionDescriptionRequest]) (*connect.Response[gen.IceSessionDescription], error)
|
|
PopIceSessionDescription(context.Context, *connect.Request[gen.PopIceSessionDescriptionRequest]) (*connect.Response[gen.IceSessionDescription], error)
|
|
}
|
|
|
|
// NewSignalerServiceHandler 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 NewSignalerServiceHandler(svc SignalerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
|
signalerServiceCreateAuthTokenHandler := connect.NewUnaryHandler(
|
|
SignalerServiceCreateAuthTokenProcedure,
|
|
svc.CreateAuthToken,
|
|
opts...,
|
|
)
|
|
signalerServiceListCamerasHandler := connect.NewUnaryHandler(
|
|
SignalerServiceListCamerasProcedure,
|
|
svc.ListCameras,
|
|
opts...,
|
|
)
|
|
signalerServiceCreateSessionHandler := connect.NewUnaryHandler(
|
|
SignalerServiceCreateSessionProcedure,
|
|
svc.CreateSession,
|
|
opts...,
|
|
)
|
|
signalerServiceUpdateSessionHandler := connect.NewUnaryHandler(
|
|
SignalerServiceUpdateSessionProcedure,
|
|
svc.UpdateSession,
|
|
opts...,
|
|
)
|
|
signalerServiceListSessionsHandler := connect.NewUnaryHandler(
|
|
SignalerServiceListSessionsProcedure,
|
|
svc.ListSessions,
|
|
opts...,
|
|
)
|
|
signalerServiceCreateIceCandidateHandler := connect.NewUnaryHandler(
|
|
SignalerServiceCreateIceCandidateProcedure,
|
|
svc.CreateIceCandidate,
|
|
opts...,
|
|
)
|
|
signalerServicePopIceCandidateHandler := connect.NewUnaryHandler(
|
|
SignalerServicePopIceCandidateProcedure,
|
|
svc.PopIceCandidate,
|
|
opts...,
|
|
)
|
|
signalerServiceCreateIceSessionDescriptionHandler := connect.NewUnaryHandler(
|
|
SignalerServiceCreateIceSessionDescriptionProcedure,
|
|
svc.CreateIceSessionDescription,
|
|
opts...,
|
|
)
|
|
signalerServicePopIceSessionDescriptionHandler := connect.NewUnaryHandler(
|
|
SignalerServicePopIceSessionDescriptionProcedure,
|
|
svc.PopIceSessionDescription,
|
|
opts...,
|
|
)
|
|
return "/signaler.SignalerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
switch r.URL.Path {
|
|
case SignalerServiceCreateAuthTokenProcedure:
|
|
signalerServiceCreateAuthTokenHandler.ServeHTTP(w, r)
|
|
case SignalerServiceListCamerasProcedure:
|
|
signalerServiceListCamerasHandler.ServeHTTP(w, r)
|
|
case SignalerServiceCreateSessionProcedure:
|
|
signalerServiceCreateSessionHandler.ServeHTTP(w, r)
|
|
case SignalerServiceUpdateSessionProcedure:
|
|
signalerServiceUpdateSessionHandler.ServeHTTP(w, r)
|
|
case SignalerServiceListSessionsProcedure:
|
|
signalerServiceListSessionsHandler.ServeHTTP(w, r)
|
|
case SignalerServiceCreateIceCandidateProcedure:
|
|
signalerServiceCreateIceCandidateHandler.ServeHTTP(w, r)
|
|
case SignalerServicePopIceCandidateProcedure:
|
|
signalerServicePopIceCandidateHandler.ServeHTTP(w, r)
|
|
case SignalerServiceCreateIceSessionDescriptionProcedure:
|
|
signalerServiceCreateIceSessionDescriptionHandler.ServeHTTP(w, r)
|
|
case SignalerServicePopIceSessionDescriptionProcedure:
|
|
signalerServicePopIceSessionDescriptionHandler.ServeHTTP(w, r)
|
|
default:
|
|
http.NotFound(w, r)
|
|
}
|
|
})
|
|
}
|
|
|
|
// UnimplementedSignalerServiceHandler returns CodeUnimplemented from all methods.
|
|
type UnimplementedSignalerServiceHandler struct{}
|
|
|
|
func (UnimplementedSignalerServiceHandler) CreateAuthToken(context.Context, *connect.Request[gen.CreateAuthTokenRequest]) (*connect.Response[gen.AuthToken], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.CreateAuthToken is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedSignalerServiceHandler) ListCameras(context.Context, *connect.Request[gen.ListCamerasRequest]) (*connect.Response[gen.ListCamerasResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.ListCameras is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedSignalerServiceHandler) CreateSession(context.Context, *connect.Request[gen.CreateSessionRequest]) (*connect.Response[gen.Session], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.CreateSession is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedSignalerServiceHandler) UpdateSession(context.Context, *connect.Request[gen.UpdateSessionRequest]) (*connect.Response[gen.Session], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.UpdateSession is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedSignalerServiceHandler) ListSessions(context.Context, *connect.Request[gen.ListSessionsRequest]) (*connect.Response[gen.ListSessionsResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.ListSessions is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedSignalerServiceHandler) CreateIceCandidate(context.Context, *connect.Request[gen.CreateIceCandidateRequest]) (*connect.Response[gen.IceCandidate], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.CreateIceCandidate is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedSignalerServiceHandler) PopIceCandidate(context.Context, *connect.Request[gen.PopIceCandidateRequest]) (*connect.Response[gen.IceCandidate], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.PopIceCandidate is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedSignalerServiceHandler) CreateIceSessionDescription(context.Context, *connect.Request[gen.CreateIceSessionDescriptionRequest]) (*connect.Response[gen.IceSessionDescription], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.CreateIceSessionDescription is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedSignalerServiceHandler) PopIceSessionDescription(context.Context, *connect.Request[gen.PopIceSessionDescriptionRequest]) (*connect.Response[gen.IceSessionDescription], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.PopIceSessionDescription is not implemented"))
|
|
}
|