// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             (unknown)
// source: zoekt/webserver/v1/webserver.proto

package v1

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

const (
	WebserverService_Search_FullMethodName       = "/zoekt.webserver.v1.WebserverService/Search"
	WebserverService_StreamSearch_FullMethodName = "/zoekt.webserver.v1.WebserverService/StreamSearch"
	WebserverService_List_FullMethodName         = "/zoekt.webserver.v1.WebserverService/List"
)

// WebserverServiceClient is the client API for WebserverService 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 WebserverServiceClient interface {
	Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error)
	StreamSearch(ctx context.Context, in *StreamSearchRequest, opts ...grpc.CallOption) (WebserverService_StreamSearchClient, error)
	// List lists repositories. The query `q` can only contain
	// query.Repo atoms.
	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
}

type webserverServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewWebserverServiceClient(cc grpc.ClientConnInterface) WebserverServiceClient {
	return &webserverServiceClient{cc}
}

func (c *webserverServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) {
	out := new(SearchResponse)
	err := c.cc.Invoke(ctx, WebserverService_Search_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *webserverServiceClient) StreamSearch(ctx context.Context, in *StreamSearchRequest, opts ...grpc.CallOption) (WebserverService_StreamSearchClient, error) {
	stream, err := c.cc.NewStream(ctx, &WebserverService_ServiceDesc.Streams[0], WebserverService_StreamSearch_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &webserverServiceStreamSearchClient{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 WebserverService_StreamSearchClient interface {
	Recv() (*StreamSearchResponse, error)
	grpc.ClientStream
}

type webserverServiceStreamSearchClient struct {
	grpc.ClientStream
}

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

func (c *webserverServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) {
	out := new(ListResponse)
	err := c.cc.Invoke(ctx, WebserverService_List_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// WebserverServiceServer is the server API for WebserverService service.
// All implementations must embed UnimplementedWebserverServiceServer
// for forward compatibility
type WebserverServiceServer interface {
	Search(context.Context, *SearchRequest) (*SearchResponse, error)
	StreamSearch(*StreamSearchRequest, WebserverService_StreamSearchServer) error
	// List lists repositories. The query `q` can only contain
	// query.Repo atoms.
	List(context.Context, *ListRequest) (*ListResponse, error)
	mustEmbedUnimplementedWebserverServiceServer()
}

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

func (UnimplementedWebserverServiceServer) Search(context.Context, *SearchRequest) (*SearchResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
}
func (UnimplementedWebserverServiceServer) StreamSearch(*StreamSearchRequest, WebserverService_StreamSearchServer) error {
	return status.Errorf(codes.Unimplemented, "method StreamSearch not implemented")
}
func (UnimplementedWebserverServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedWebserverServiceServer) mustEmbedUnimplementedWebserverServiceServer() {}

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

func RegisterWebserverServiceServer(s grpc.ServiceRegistrar, srv WebserverServiceServer) {
	s.RegisterService(&WebserverService_ServiceDesc, srv)
}

func _WebserverService_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SearchRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(WebserverServiceServer).Search(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: WebserverService_Search_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(WebserverServiceServer).Search(ctx, req.(*SearchRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _WebserverService_StreamSearch_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(StreamSearchRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(WebserverServiceServer).StreamSearch(m, &webserverServiceStreamSearchServer{stream})
}

type WebserverService_StreamSearchServer interface {
	Send(*StreamSearchResponse) error
	grpc.ServerStream
}

type webserverServiceStreamSearchServer struct {
	grpc.ServerStream
}

func (x *webserverServiceStreamSearchServer) Send(m *StreamSearchResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _WebserverService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(WebserverServiceServer).List(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: WebserverService_List_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(WebserverServiceServer).List(ctx, req.(*ListRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// WebserverService_ServiceDesc is the grpc.ServiceDesc for WebserverService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var WebserverService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "zoekt.webserver.v1.WebserverService",
	HandlerType: (*WebserverServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Search",
			Handler:    _WebserverService_Search_Handler,
		},
		{
			MethodName: "List",
			Handler:    _WebserverService_List_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamSearch",
			Handler:       _WebserverService_StreamSearch_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "zoekt/webserver/v1/webserver.proto",
}
