module IHP.FileStorage.Types
( FileStorage (..)
, StoredFile (..)
, StoreFileOptions (..)
, TemporaryDownloadUrl (..)
) where
import IHP.Prelude
import qualified Network.Minio as Minio
import qualified Network.Wai.Parse as Wai
data FileStorage
= StaticDirStorage
| S3Storage { FileStorage -> ConnectInfo
connectInfo :: Minio.ConnectInfo, FileStorage -> Text
bucket :: Text, FileStorage -> Text
baseUrl :: Text }
data StoredFile = StoredFile { StoredFile -> Text
path :: Text, StoredFile -> Text
url :: Text }
data StoreFileOptions = StoreFileOptions
{ StoreFileOptions -> Text
directory :: Text
, StoreFileOptions -> FileInfo LByteString -> IO (Maybe Text)
contentDisposition :: Wai.FileInfo LByteString -> IO (Maybe Text)
, StoreFileOptions
-> FileInfo LByteString -> IO (FileInfo LByteString)
preprocess :: Wai.FileInfo LByteString -> IO (Wai.FileInfo LByteString)
, StoreFileOptions -> Maybe UUID
fileName :: Maybe UUID
}
instance Default StoreFileOptions where
def :: StoreFileOptions
def = StoreFileOptions
{ directory :: Text
directory = Text
""
, contentDisposition :: FileInfo LByteString -> IO (Maybe Text)
contentDisposition = IO (Maybe Text) -> FileInfo LByteString -> IO (Maybe Text)
forall a b. a -> b -> a
const (Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Text
forall a. Maybe a
Nothing)
, preprocess :: FileInfo LByteString -> IO (FileInfo LByteString)
preprocess = FileInfo LByteString -> IO (FileInfo LByteString)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
, fileName :: Maybe UUID
fileName = Maybe UUID
forall a. Maybe a
Nothing
}
data TemporaryDownloadUrl = TemporaryDownloadUrl { TemporaryDownloadUrl -> Text
url :: Text, TemporaryDownloadUrl -> UTCTime
expiredAt :: UTCTime }