{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Network.GRPC.Server (
runGrpc
, UnaryHandler
, ServerStreamHandler
, ServerStream(..)
, ClientStreamHandler
, ClientStream(..)
, BiDiStreamHandler
, BiDiStream(..)
, BiDiStep(..)
, GeneralStreamHandler
, IncomingStream(..)
, OutgoingStream(..)
, ServiceHandler
, unary
, serverStream
, clientStream
, bidiStream
, generalStream
, GRPCStatus (..)
, throwIO
, GRPCStatusMessage
, GRPCStatusCode (..)
, grpcApp
, grpcService
) where
import Control.Exception (throwIO)
import Network.GRPC.HTTP2.Encoding (Compression)
import Network.GRPC.HTTP2.Types (GRPCStatus(..), GRPCStatusCode(..), GRPCStatusMessage)
import Network.Wai.Handler.WarpTLS (TLSSettings, runTLS)
import Network.Wai.Handler.Warp (Settings)
import Network.GRPC.Server.Handlers (UnaryHandler, unary, ServerStreamHandler, ServerStream(..), serverStream, ClientStreamHandler, ClientStream(..), clientStream, BiDiStreamHandler, BiDiStream(..), BiDiStep(..), bidiStream, GeneralStreamHandler, IncomingStream(..), OutgoingStream(..), generalStream)
import Network.GRPC.Server.Wai (ServiceHandler(..), grpcApp, grpcService)
runGrpc
:: TLSSettings
-> Settings
-> [ServiceHandler]
-> [Compression]
-> IO ()
runGrpc tlsSettings settings handlers compressions =
runTLS tlsSettings settings (grpcApp compressions handlers)