// Code generated by protoc-gen-go-grpc. DO NOT EDIT.

package unistream

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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// CentrifugoUniStreamClient is the client API for CentrifugoUniStream 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 CentrifugoUniStreamClient interface {
	Consume(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (CentrifugoUniStream_ConsumeClient, error)
}

type centrifugoUniStreamClient struct {
	cc grpc.ClientConnInterface
}

func NewCentrifugoUniStreamClient(cc grpc.ClientConnInterface) CentrifugoUniStreamClient {
	return &centrifugoUniStreamClient{cc}
}

func (c *centrifugoUniStreamClient) Consume(ctx context.Context, in *ConnectRequest, opts ...grpc.CallOption) (CentrifugoUniStream_ConsumeClient, error) {
	stream, err := c.cc.NewStream(ctx, &CentrifugoUniStream_ServiceDesc.Streams[0], "/centrifugal.centrifugo.unistream.CentrifugoUniStream/Consume", opts...)
	if err != nil {
		return nil, err
	}
	x := &centrifugoUniStreamConsumeClient{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
}

type CentrifugoUniStream_ConsumeClient interface {
	Recv() (*Push, error)
	grpc.ClientStream
}

type centrifugoUniStreamConsumeClient struct {
	grpc.ClientStream
}

func (x *centrifugoUniStreamConsumeClient) Recv() (*Push, error) {
	m := new(Push)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// CentrifugoUniStreamServer is the server API for CentrifugoUniStream service.
// All implementations must embed UnimplementedCentrifugoUniStreamServer
// for forward compatibility
type CentrifugoUniStreamServer interface {
	Consume(*ConnectRequest, CentrifugoUniStream_ConsumeServer) error
	mustEmbedUnimplementedCentrifugoUniStreamServer()
}

// UnimplementedCentrifugoUniStreamServer must be embedded to have forward compatible implementations.
type UnimplementedCentrifugoUniStreamServer struct {
}

func (UnimplementedCentrifugoUniStreamServer) Consume(*ConnectRequest, CentrifugoUniStream_ConsumeServer) error {
	return status.Errorf(codes.Unimplemented, "method Consume not implemented")
}
func (UnimplementedCentrifugoUniStreamServer) mustEmbedUnimplementedCentrifugoUniStreamServer() {}

// UnsafeCentrifugoUniStreamServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CentrifugoUniStreamServer will
// result in compilation errors.
type UnsafeCentrifugoUniStreamServer interface {
	mustEmbedUnimplementedCentrifugoUniStreamServer()
}

func RegisterCentrifugoUniStreamServer(s grpc.ServiceRegistrar, srv CentrifugoUniStreamServer) {
	s.RegisterService(&CentrifugoUniStream_ServiceDesc, srv)
}

func _CentrifugoUniStream_Consume_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ConnectRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(CentrifugoUniStreamServer).Consume(m, &centrifugoUniStreamConsumeServer{stream})
}

type CentrifugoUniStream_ConsumeServer interface {
	Send(*Push) error
	grpc.ServerStream
}

type centrifugoUniStreamConsumeServer struct {
	grpc.ServerStream
}

func (x *centrifugoUniStreamConsumeServer) Send(m *Push) error {
	return x.ServerStream.SendMsg(m)
}

// CentrifugoUniStream_ServiceDesc is the grpc.ServiceDesc for CentrifugoUniStream service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var CentrifugoUniStream_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "centrifugal.centrifugo.unistream.CentrifugoUniStream",
	HandlerType: (*CentrifugoUniStreamServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Consume",
			Handler:       _CentrifugoUniStream_Consume_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "unistream.proto",
}
