210 lines
7.8 KiB
Go
210 lines
7.8 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.1
|
|
// - protoc (unknown)
|
|
// source: ha/v1/switch.proto
|
|
|
|
package hav1
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
SwitchService_TurnOn_FullMethodName = "/ha.v1.SwitchService/TurnOn"
|
|
SwitchService_TurnOff_FullMethodName = "/ha.v1.SwitchService/TurnOff"
|
|
SwitchService_Toggle_FullMethodName = "/ha.v1.SwitchService/Toggle"
|
|
)
|
|
|
|
// SwitchServiceClient is the client API for SwitchService service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
//
|
|
// TODO: implement SwitchService. Follow the same pattern as LightService:
|
|
// - domain type in core/domain/switch.go
|
|
// - port interface in core/ports/driving/switch.go
|
|
// - application logic in app/switch.go
|
|
// - gRPC adapter in adapters/primary/grpc/switch.go
|
|
type SwitchServiceClient interface {
|
|
TurnOn(ctx context.Context, in *SwitchRequest, opts ...grpc.CallOption) (*SwitchResponse, error)
|
|
TurnOff(ctx context.Context, in *SwitchRequest, opts ...grpc.CallOption) (*SwitchResponse, error)
|
|
Toggle(ctx context.Context, in *SwitchRequest, opts ...grpc.CallOption) (*SwitchResponse, error)
|
|
}
|
|
|
|
type switchServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewSwitchServiceClient(cc grpc.ClientConnInterface) SwitchServiceClient {
|
|
return &switchServiceClient{cc}
|
|
}
|
|
|
|
func (c *switchServiceClient) TurnOn(ctx context.Context, in *SwitchRequest, opts ...grpc.CallOption) (*SwitchResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SwitchResponse)
|
|
err := c.cc.Invoke(ctx, SwitchService_TurnOn_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *switchServiceClient) TurnOff(ctx context.Context, in *SwitchRequest, opts ...grpc.CallOption) (*SwitchResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SwitchResponse)
|
|
err := c.cc.Invoke(ctx, SwitchService_TurnOff_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *switchServiceClient) Toggle(ctx context.Context, in *SwitchRequest, opts ...grpc.CallOption) (*SwitchResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SwitchResponse)
|
|
err := c.cc.Invoke(ctx, SwitchService_Toggle_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// SwitchServiceServer is the server API for SwitchService service.
|
|
// All implementations must embed UnimplementedSwitchServiceServer
|
|
// for forward compatibility.
|
|
//
|
|
// TODO: implement SwitchService. Follow the same pattern as LightService:
|
|
// - domain type in core/domain/switch.go
|
|
// - port interface in core/ports/driving/switch.go
|
|
// - application logic in app/switch.go
|
|
// - gRPC adapter in adapters/primary/grpc/switch.go
|
|
type SwitchServiceServer interface {
|
|
TurnOn(context.Context, *SwitchRequest) (*SwitchResponse, error)
|
|
TurnOff(context.Context, *SwitchRequest) (*SwitchResponse, error)
|
|
Toggle(context.Context, *SwitchRequest) (*SwitchResponse, error)
|
|
mustEmbedUnimplementedSwitchServiceServer()
|
|
}
|
|
|
|
// UnimplementedSwitchServiceServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedSwitchServiceServer struct{}
|
|
|
|
func (UnimplementedSwitchServiceServer) TurnOn(context.Context, *SwitchRequest) (*SwitchResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method TurnOn not implemented")
|
|
}
|
|
func (UnimplementedSwitchServiceServer) TurnOff(context.Context, *SwitchRequest) (*SwitchResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method TurnOff not implemented")
|
|
}
|
|
func (UnimplementedSwitchServiceServer) Toggle(context.Context, *SwitchRequest) (*SwitchResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Toggle not implemented")
|
|
}
|
|
func (UnimplementedSwitchServiceServer) mustEmbedUnimplementedSwitchServiceServer() {}
|
|
func (UnimplementedSwitchServiceServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeSwitchServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to SwitchServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeSwitchServiceServer interface {
|
|
mustEmbedUnimplementedSwitchServiceServer()
|
|
}
|
|
|
|
func RegisterSwitchServiceServer(s grpc.ServiceRegistrar, srv SwitchServiceServer) {
|
|
// If the following call panics, it indicates UnimplementedSwitchServiceServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&SwitchService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _SwitchService_TurnOn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SwitchRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SwitchServiceServer).TurnOn(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SwitchService_TurnOn_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SwitchServiceServer).TurnOn(ctx, req.(*SwitchRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _SwitchService_TurnOff_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SwitchRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SwitchServiceServer).TurnOff(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SwitchService_TurnOff_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SwitchServiceServer).TurnOff(ctx, req.(*SwitchRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _SwitchService_Toggle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SwitchRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(SwitchServiceServer).Toggle(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: SwitchService_Toggle_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(SwitchServiceServer).Toggle(ctx, req.(*SwitchRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// SwitchService_ServiceDesc is the grpc.ServiceDesc for SwitchService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var SwitchService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "ha.v1.SwitchService",
|
|
HandlerType: (*SwitchServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "TurnOn",
|
|
Handler: _SwitchService_TurnOn_Handler,
|
|
},
|
|
{
|
|
MethodName: "TurnOff",
|
|
Handler: _SwitchService_TurnOff_Handler,
|
|
},
|
|
{
|
|
MethodName: "Toggle",
|
|
Handler: _SwitchService_Toggle_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "ha/v1/switch.proto",
|
|
}
|