// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             v3.21.12
// source: yandex/cloud/datasphere/v1/project_data_service.proto

package datasphere

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 (
	ProjectDataService_UploadFile_FullMethodName   = "/yandex.cloud.datasphere.v1.ProjectDataService/UploadFile"
	ProjectDataService_DownloadFile_FullMethodName = "/yandex.cloud.datasphere.v1.ProjectDataService/DownloadFile"
)

// ProjectDataServiceClient is the client API for ProjectDataService 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.
//
// A set of methods for managing data of the Project resource.
type ProjectDataServiceClient interface {
	// Uploads a file to the specified project.
	UploadFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[UploadFileRequest, UploadFileResponse], error)
	// Downloads the specified file from the specified project.
	DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DownloadFileResponse], error)
}

type projectDataServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewProjectDataServiceClient(cc grpc.ClientConnInterface) ProjectDataServiceClient {
	return &projectDataServiceClient{cc}
}

func (c *projectDataServiceClient) UploadFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[UploadFileRequest, UploadFileResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ProjectDataService_ServiceDesc.Streams[0], ProjectDataService_UploadFile_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[UploadFileRequest, UploadFileResponse]{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 ProjectDataService_UploadFileClient = grpc.ClientStreamingClient[UploadFileRequest, UploadFileResponse]

func (c *projectDataServiceClient) DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DownloadFileResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ProjectDataService_ServiceDesc.Streams[1], ProjectDataService_DownloadFile_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[DownloadFileRequest, DownloadFileResponse]{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 ProjectDataService_DownloadFileClient = grpc.ServerStreamingClient[DownloadFileResponse]

// ProjectDataServiceServer is the server API for ProjectDataService service.
// All implementations should embed UnimplementedProjectDataServiceServer
// for forward compatibility.
//
// A set of methods for managing data of the Project resource.
type ProjectDataServiceServer interface {
	// Uploads a file to the specified project.
	UploadFile(grpc.ClientStreamingServer[UploadFileRequest, UploadFileResponse]) error
	// Downloads the specified file from the specified project.
	DownloadFile(*DownloadFileRequest, grpc.ServerStreamingServer[DownloadFileResponse]) error
}

// UnimplementedProjectDataServiceServer should 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 UnimplementedProjectDataServiceServer struct{}

func (UnimplementedProjectDataServiceServer) UploadFile(grpc.ClientStreamingServer[UploadFileRequest, UploadFileResponse]) error {
	return status.Error(codes.Unimplemented, "method UploadFile not implemented")
}
func (UnimplementedProjectDataServiceServer) DownloadFile(*DownloadFileRequest, grpc.ServerStreamingServer[DownloadFileResponse]) error {
	return status.Error(codes.Unimplemented, "method DownloadFile not implemented")
}
func (UnimplementedProjectDataServiceServer) testEmbeddedByValue() {}

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

func RegisterProjectDataServiceServer(s grpc.ServiceRegistrar, srv ProjectDataServiceServer) {
	// If the following call panics, it indicates UnimplementedProjectDataServiceServer 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(&ProjectDataService_ServiceDesc, srv)
}

func _ProjectDataService_UploadFile_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(ProjectDataServiceServer).UploadFile(&grpc.GenericServerStream[UploadFileRequest, UploadFileResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ProjectDataService_UploadFileServer = grpc.ClientStreamingServer[UploadFileRequest, UploadFileResponse]

func _ProjectDataService_DownloadFile_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(DownloadFileRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ProjectDataServiceServer).DownloadFile(m, &grpc.GenericServerStream[DownloadFileRequest, DownloadFileResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ProjectDataService_DownloadFileServer = grpc.ServerStreamingServer[DownloadFileResponse]

// ProjectDataService_ServiceDesc is the grpc.ServiceDesc for ProjectDataService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ProjectDataService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.datasphere.v1.ProjectDataService",
	HandlerType: (*ProjectDataServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "UploadFile",
			Handler:       _ProjectDataService_UploadFile_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "DownloadFile",
			Handler:       _ProjectDataService_DownloadFile_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "yandex/cloud/datasphere/v1/project_data_service.proto",
}
