350 lines
14 KiB
Go
350 lines
14 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.2
|
|
// - protoc v5.27.2
|
|
// source: protoapi.proto
|
|
|
|
package protoapi
|
|
|
|
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 (
|
|
IoTService_GetDate_FullMethodName = "/IoTService/GetDate"
|
|
IoTService_UpdateSensingData_FullMethodName = "/IoTService/UpdateSensingData"
|
|
IoTService_GetRandomPass_FullMethodName = "/IoTService/GetRandomPass"
|
|
IoTService_UploadFile_FullMethodName = "/IoTService/UploadFile"
|
|
IoTService_ListFiles_FullMethodName = "/IoTService/ListFiles"
|
|
IoTService_DownloadFile_FullMethodName = "/IoTService/DownloadFile"
|
|
IoTService_SubscribeAlerts_FullMethodName = "/IoTService/SubscribeAlerts"
|
|
)
|
|
|
|
// IoTServiceClient is the client API for IoTService 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.
|
|
type IoTServiceClient interface {
|
|
GetDate(ctx context.Context, in *RequestDateTime, opts ...grpc.CallOption) (*DateTime, error)
|
|
UpdateSensingData(ctx context.Context, in *SensingData, opts ...grpc.CallOption) (*SensingResponse, error)
|
|
GetRandomPass(ctx context.Context, in *RequestPass, opts ...grpc.CallOption) (*RandomPass, error)
|
|
UploadFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[FileChunk, UploadStatus], error)
|
|
ListFiles(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*FileList, error)
|
|
DownloadFile(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileChunk], error)
|
|
SubscribeAlerts(ctx context.Context, in *AlertSubscription, opts ...grpc.CallOption) (grpc.ServerStreamingClient[AlertMessage], error)
|
|
}
|
|
|
|
type ioTServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewIoTServiceClient(cc grpc.ClientConnInterface) IoTServiceClient {
|
|
return &ioTServiceClient{cc}
|
|
}
|
|
|
|
func (c *ioTServiceClient) GetDate(ctx context.Context, in *RequestDateTime, opts ...grpc.CallOption) (*DateTime, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(DateTime)
|
|
err := c.cc.Invoke(ctx, IoTService_GetDate_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *ioTServiceClient) UpdateSensingData(ctx context.Context, in *SensingData, opts ...grpc.CallOption) (*SensingResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SensingResponse)
|
|
err := c.cc.Invoke(ctx, IoTService_UpdateSensingData_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *ioTServiceClient) GetRandomPass(ctx context.Context, in *RequestPass, opts ...grpc.CallOption) (*RandomPass, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(RandomPass)
|
|
err := c.cc.Invoke(ctx, IoTService_GetRandomPass_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *ioTServiceClient) UploadFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[FileChunk, UploadStatus], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &IoTService_ServiceDesc.Streams[0], IoTService_UploadFile_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[FileChunk, UploadStatus]{ClientStream: stream}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type IoTService_UploadFileClient = grpc.ClientStreamingClient[FileChunk, UploadStatus]
|
|
|
|
func (c *ioTServiceClient) ListFiles(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*FileList, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(FileList)
|
|
err := c.cc.Invoke(ctx, IoTService_ListFiles_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *ioTServiceClient) DownloadFile(ctx context.Context, in *DownloadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileChunk], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &IoTService_ServiceDesc.Streams[1], IoTService_DownloadFile_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[DownloadRequest, FileChunk]{ClientStream: stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type IoTService_DownloadFileClient = grpc.ServerStreamingClient[FileChunk]
|
|
|
|
func (c *ioTServiceClient) SubscribeAlerts(ctx context.Context, in *AlertSubscription, opts ...grpc.CallOption) (grpc.ServerStreamingClient[AlertMessage], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &IoTService_ServiceDesc.Streams[2], IoTService_SubscribeAlerts_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[AlertSubscription, AlertMessage]{ClientStream: stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type IoTService_SubscribeAlertsClient = grpc.ServerStreamingClient[AlertMessage]
|
|
|
|
// IoTServiceServer is the server API for IoTService service.
|
|
// All implementations must embed UnimplementedIoTServiceServer
|
|
// for forward compatibility.
|
|
type IoTServiceServer interface {
|
|
GetDate(context.Context, *RequestDateTime) (*DateTime, error)
|
|
UpdateSensingData(context.Context, *SensingData) (*SensingResponse, error)
|
|
GetRandomPass(context.Context, *RequestPass) (*RandomPass, error)
|
|
UploadFile(grpc.ClientStreamingServer[FileChunk, UploadStatus]) error
|
|
ListFiles(context.Context, *EmptyRequest) (*FileList, error)
|
|
DownloadFile(*DownloadRequest, grpc.ServerStreamingServer[FileChunk]) error
|
|
SubscribeAlerts(*AlertSubscription, grpc.ServerStreamingServer[AlertMessage]) error
|
|
mustEmbedUnimplementedIoTServiceServer()
|
|
}
|
|
|
|
// UnimplementedIoTServiceServer 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 UnimplementedIoTServiceServer struct{}
|
|
|
|
func (UnimplementedIoTServiceServer) GetDate(context.Context, *RequestDateTime) (*DateTime, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetDate not implemented")
|
|
}
|
|
func (UnimplementedIoTServiceServer) UpdateSensingData(context.Context, *SensingData) (*SensingResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method UpdateSensingData not implemented")
|
|
}
|
|
func (UnimplementedIoTServiceServer) GetRandomPass(context.Context, *RequestPass) (*RandomPass, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetRandomPass not implemented")
|
|
}
|
|
func (UnimplementedIoTServiceServer) UploadFile(grpc.ClientStreamingServer[FileChunk, UploadStatus]) error {
|
|
return status.Error(codes.Unimplemented, "method UploadFile not implemented")
|
|
}
|
|
func (UnimplementedIoTServiceServer) ListFiles(context.Context, *EmptyRequest) (*FileList, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ListFiles not implemented")
|
|
}
|
|
func (UnimplementedIoTServiceServer) DownloadFile(*DownloadRequest, grpc.ServerStreamingServer[FileChunk]) error {
|
|
return status.Error(codes.Unimplemented, "method DownloadFile not implemented")
|
|
}
|
|
func (UnimplementedIoTServiceServer) SubscribeAlerts(*AlertSubscription, grpc.ServerStreamingServer[AlertMessage]) error {
|
|
return status.Error(codes.Unimplemented, "method SubscribeAlerts not implemented")
|
|
}
|
|
func (UnimplementedIoTServiceServer) mustEmbedUnimplementedIoTServiceServer() {}
|
|
func (UnimplementedIoTServiceServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeIoTServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to IoTServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeIoTServiceServer interface {
|
|
mustEmbedUnimplementedIoTServiceServer()
|
|
}
|
|
|
|
func RegisterIoTServiceServer(s grpc.ServiceRegistrar, srv IoTServiceServer) {
|
|
// If the following call panics, it indicates UnimplementedIoTServiceServer 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(&IoTService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _IoTService_GetDate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(RequestDateTime)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(IoTServiceServer).GetDate(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: IoTService_GetDate_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(IoTServiceServer).GetDate(ctx, req.(*RequestDateTime))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _IoTService_UpdateSensingData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SensingData)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(IoTServiceServer).UpdateSensingData(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: IoTService_UpdateSensingData_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(IoTServiceServer).UpdateSensingData(ctx, req.(*SensingData))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _IoTService_GetRandomPass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(RequestPass)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(IoTServiceServer).GetRandomPass(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: IoTService_GetRandomPass_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(IoTServiceServer).GetRandomPass(ctx, req.(*RequestPass))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _IoTService_UploadFile_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
return srv.(IoTServiceServer).UploadFile(&grpc.GenericServerStream[FileChunk, UploadStatus]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type IoTService_UploadFileServer = grpc.ClientStreamingServer[FileChunk, UploadStatus]
|
|
|
|
func _IoTService_ListFiles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(EmptyRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(IoTServiceServer).ListFiles(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: IoTService_ListFiles_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(IoTServiceServer).ListFiles(ctx, req.(*EmptyRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _IoTService_DownloadFile_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(DownloadRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(IoTServiceServer).DownloadFile(m, &grpc.GenericServerStream[DownloadRequest, FileChunk]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type IoTService_DownloadFileServer = grpc.ServerStreamingServer[FileChunk]
|
|
|
|
func _IoTService_SubscribeAlerts_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(AlertSubscription)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(IoTServiceServer).SubscribeAlerts(m, &grpc.GenericServerStream[AlertSubscription, AlertMessage]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type IoTService_SubscribeAlertsServer = grpc.ServerStreamingServer[AlertMessage]
|
|
|
|
// IoTService_ServiceDesc is the grpc.ServiceDesc for IoTService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var IoTService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "IoTService",
|
|
HandlerType: (*IoTServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "GetDate",
|
|
Handler: _IoTService_GetDate_Handler,
|
|
},
|
|
{
|
|
MethodName: "UpdateSensingData",
|
|
Handler: _IoTService_UpdateSensingData_Handler,
|
|
},
|
|
{
|
|
MethodName: "GetRandomPass",
|
|
Handler: _IoTService_GetRandomPass_Handler,
|
|
},
|
|
{
|
|
MethodName: "ListFiles",
|
|
Handler: _IoTService_ListFiles_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "UploadFile",
|
|
Handler: _IoTService_UploadFile_Handler,
|
|
ClientStreams: true,
|
|
},
|
|
{
|
|
StreamName: "DownloadFile",
|
|
Handler: _IoTService_DownloadFile_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
{
|
|
StreamName: "SubscribeAlerts",
|
|
Handler: _IoTService_SubscribeAlerts_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "protoapi.proto",
|
|
}
|