{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE NoFieldSelectors #-}
module WikiMusic.Servant.ArtistRoutes
( fetchArtistsRoute,
fetchArtistRoute,
insertArtistsRoute,
insertArtistCommentsRoute,
insertArtistArtworksRoute,
upsertArtistOpinionsRoute,
deleteArtistsByIdentifierRoute,
deleteArtistCommentsByIdentifierRoute,
deleteArtistOpinionsByIdentifierRoute,
deleteArtistArtworksByIdentifierRoute,
updateArtistArtworksOrderRoute,
updateArtistRoute,
searchArtistsRoute,
)
where
import Servant
import WikiMusic.Free.ArtistCommand
import WikiMusic.Free.ArtistQuery
import WikiMusic.Interaction.Artist
import WikiMusic.Interaction.Model.Artist
import WikiMusic.Model.Other
import WikiMusic.Protolude
import WikiMusic.Servant.Utilities
import WikiMusic.Sqlite.ArtistCommand ()
import WikiMusic.Sqlite.ArtistQuery ()
fetchArtistsRoute :: Env -> Maybe Text -> Maybe Int -> Maybe Int -> Maybe Text -> Maybe Text -> Handler GetArtistsQueryResponse
fetchArtistsRoute :: Env
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Handler GetArtistsQueryResponse
fetchArtistsRoute Env
env Maybe Text
authToken Maybe Int
limit Maybe Int
offset Maybe Text
sort' Maybe Text
include =
Env
-> Maybe Text
-> (WikiMusicUser -> Handler GetArtistsQueryResponse)
-> Handler GetArtistsQueryResponse
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError GetArtistsQueryResponse)
-> Handler (Either ArtistError GetArtistsQueryResponse)
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @(ArtistQuery :+: ArtistCommand) (Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
-> IO (Either ArtistError GetArtistsQueryResponse))
-> Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
-> IO (Either ArtistError GetArtistsQueryResponse)
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> Limit
-> Offset
-> Maybe Text
-> Maybe Text
-> Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
forall (f :: * -> *).
(ArtistQuery :<: f, ArtistCommand :<: f) =>
Env
-> WikiMusicUser
-> Limit
-> Offset
-> Maybe Text
-> Maybe Text
-> Free f (Either ArtistError GetArtistsQueryResponse)
fetchArtistsAction Env
env WikiMusicUser
authUser (Limit -> (Int -> Limit) -> Maybe Int -> Limit
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Int -> Limit
Limit Int
25) Int -> Limit
Limit Maybe Int
limit) (Offset -> (Int -> Offset) -> Maybe Int -> Offset
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Int -> Offset
Offset Int
0) Int -> Offset
Offset Maybe Int
offset) Maybe Text
sort' Maybe Text
include) Handler (Either ArtistError GetArtistsQueryResponse)
-> (Either ArtistError GetArtistsQueryResponse
-> Handler GetArtistsQueryResponse)
-> Handler GetArtistsQueryResponse
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError GetArtistsQueryResponse
-> Handler GetArtistsQueryResponse
forall s b. Show s => Either s b -> Handler b
maybe200
)
searchArtistsRoute :: Env -> Maybe Text -> Text -> Maybe Int -> Maybe Int -> Maybe Text -> Maybe Text -> Handler GetArtistsQueryResponse
searchArtistsRoute :: Env
-> Maybe Text
-> Text
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Handler GetArtistsQueryResponse
searchArtistsRoute Env
env Maybe Text
authToken Text
searchInput Maybe Int
limit Maybe Int
offset Maybe Text
sort' Maybe Text
include =
Env
-> Maybe Text
-> (WikiMusicUser -> Handler GetArtistsQueryResponse)
-> Handler GetArtistsQueryResponse
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError GetArtistsQueryResponse)
-> Handler (Either ArtistError GetArtistsQueryResponse)
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @(ArtistQuery :+: ArtistCommand) (Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
-> IO (Either ArtistError GetArtistsQueryResponse))
-> Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
-> IO (Either ArtistError GetArtistsQueryResponse)
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> Limit
-> Offset
-> Maybe Text
-> Maybe Text
-> Text
-> Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
forall (f :: * -> *).
(ArtistQuery :<: f, ArtistCommand :<: f) =>
Env
-> WikiMusicUser
-> Limit
-> Offset
-> Maybe Text
-> Maybe Text
-> Text
-> Free f (Either ArtistError GetArtistsQueryResponse)
searchArtistsAction Env
env WikiMusicUser
authUser (Limit -> (Int -> Limit) -> Maybe Int -> Limit
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Int -> Limit
Limit Int
25) Int -> Limit
Limit Maybe Int
limit) (Offset -> (Int -> Offset) -> Maybe Int -> Offset
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Int -> Offset
Offset Int
0) Int -> Offset
Offset Maybe Int
offset) Maybe Text
sort' Maybe Text
include Text
searchInput) Handler (Either ArtistError GetArtistsQueryResponse)
-> (Either ArtistError GetArtistsQueryResponse
-> Handler GetArtistsQueryResponse)
-> Handler GetArtistsQueryResponse
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError GetArtistsQueryResponse
-> Handler GetArtistsQueryResponse
forall s b. Show s => Either s b -> Handler b
maybe200
)
fetchArtistRoute :: Env -> Maybe Text -> UUID -> Handler GetArtistsQueryResponse
fetchArtistRoute :: Env -> Maybe Text -> UUID -> Handler GetArtistsQueryResponse
fetchArtistRoute Env
env Maybe Text
authToken UUID
identifier =
Env
-> Maybe Text
-> (WikiMusicUser -> Handler GetArtistsQueryResponse)
-> Handler GetArtistsQueryResponse
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError GetArtistsQueryResponse)
-> Handler (Either ArtistError GetArtistsQueryResponse)
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @(ArtistQuery :+: ArtistCommand) (Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
-> IO (Either ArtistError GetArtistsQueryResponse))
-> Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
-> IO (Either ArtistError GetArtistsQueryResponse)
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> UUID
-> Maybe Text
-> Maybe Text
-> Free
(ArtistQuery :+: ArtistCommand)
(Either ArtistError GetArtistsQueryResponse)
forall (f :: * -> *).
(ArtistQuery :<: f, ArtistCommand :<: f) =>
Env
-> WikiMusicUser
-> UUID
-> Maybe Text
-> Maybe Text
-> Free f (Either ArtistError GetArtistsQueryResponse)
fetchArtistAction Env
env WikiMusicUser
authUser UUID
identifier (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"created-at-desc") (Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"artworks,opinions,comments")) Handler (Either ArtistError GetArtistsQueryResponse)
-> (Either ArtistError GetArtistsQueryResponse
-> Handler GetArtistsQueryResponse)
-> Handler GetArtistsQueryResponse
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError GetArtistsQueryResponse
-> Handler GetArtistsQueryResponse
forall s b. Show s => Either s b -> Handler b
maybe200
)
insertArtistsRoute :: Env -> Maybe Text -> InsertArtistsRequest -> Handler InsertArtistsCommandResponse
insertArtistsRoute :: Env
-> Maybe Text
-> InsertArtistsRequest
-> Handler InsertArtistsCommandResponse
insertArtistsRoute Env
env Maybe Text
authToken InsertArtistsRequest
req =
Env
-> Maybe Text
-> (WikiMusicUser -> Handler InsertArtistsCommandResponse)
-> Handler InsertArtistsCommandResponse
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError InsertArtistsCommandResponse)
-> Handler (Either ArtistError InsertArtistsCommandResponse)
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @(ArtistCommand :+: ArtistQuery) (Free
(ArtistCommand :+: ArtistQuery)
(Either ArtistError InsertArtistsCommandResponse)
-> IO (Either ArtistError InsertArtistsCommandResponse))
-> Free
(ArtistCommand :+: ArtistQuery)
(Either ArtistError InsertArtistsCommandResponse)
-> IO (Either ArtistError InsertArtistsCommandResponse)
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> InsertArtistsRequest
-> Free
(ArtistCommand :+: ArtistQuery)
(Either ArtistError InsertArtistsCommandResponse)
forall (f :: * -> *).
(ArtistCommand :<: f, ArtistQuery :<: f) =>
Env
-> WikiMusicUser
-> InsertArtistsRequest
-> Free f (Either ArtistError InsertArtistsCommandResponse)
insertArtistsAction Env
env WikiMusicUser
authUser InsertArtistsRequest
req) Handler (Either ArtistError InsertArtistsCommandResponse)
-> (Either ArtistError InsertArtistsCommandResponse
-> Handler InsertArtistsCommandResponse)
-> Handler InsertArtistsCommandResponse
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError InsertArtistsCommandResponse
-> Handler InsertArtistsCommandResponse
forall s b. Show s => Either s b -> Handler b
maybe204
)
insertArtistCommentsRoute :: Env -> Maybe Text -> InsertArtistCommentsRequest -> Handler InsertArtistCommentsCommandResponse
Env
env Maybe Text
authToken InsertArtistCommentsRequest
req =
Env
-> Maybe Text
-> (WikiMusicUser -> Handler InsertArtistCommentsCommandResponse)
-> Handler InsertArtistCommentsCommandResponse
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError InsertArtistCommentsCommandResponse)
-> Handler (Either ArtistError InsertArtistCommentsCommandResponse)
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @ArtistCommand (Free
ArtistCommand
(Either ArtistError InsertArtistCommentsCommandResponse)
-> IO (Either ArtistError InsertArtistCommentsCommandResponse))
-> Free
ArtistCommand
(Either ArtistError InsertArtistCommentsCommandResponse)
-> IO (Either ArtistError InsertArtistCommentsCommandResponse)
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> InsertArtistCommentsRequest
-> Free
ArtistCommand
(Either ArtistError InsertArtistCommentsCommandResponse)
forall (f :: * -> *).
(ArtistCommand :<: f) =>
Env
-> WikiMusicUser
-> InsertArtistCommentsRequest
-> Free f (Either ArtistError InsertArtistCommentsCommandResponse)
insertArtistCommentsAction Env
env WikiMusicUser
authUser InsertArtistCommentsRequest
req) Handler (Either ArtistError InsertArtistCommentsCommandResponse)
-> (Either ArtistError InsertArtistCommentsCommandResponse
-> Handler InsertArtistCommentsCommandResponse)
-> Handler InsertArtistCommentsCommandResponse
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError InsertArtistCommentsCommandResponse
-> Handler InsertArtistCommentsCommandResponse
forall s b. Show s => Either s b -> Handler b
maybe204
)
upsertArtistOpinionsRoute :: Env -> Maybe Text -> UpsertArtistOpinionsRequest -> Handler UpsertArtistOpinionsCommandResponse
upsertArtistOpinionsRoute :: Env
-> Maybe Text
-> UpsertArtistOpinionsRequest
-> Handler UpsertArtistOpinionsCommandResponse
upsertArtistOpinionsRoute Env
env Maybe Text
authToken UpsertArtistOpinionsRequest
req =
Env
-> Maybe Text
-> (WikiMusicUser -> Handler UpsertArtistOpinionsCommandResponse)
-> Handler UpsertArtistOpinionsCommandResponse
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError UpsertArtistOpinionsCommandResponse)
-> Handler (Either ArtistError UpsertArtistOpinionsCommandResponse)
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @ArtistCommand (Free
ArtistCommand
(Either ArtistError UpsertArtistOpinionsCommandResponse)
-> IO (Either ArtistError UpsertArtistOpinionsCommandResponse))
-> Free
ArtistCommand
(Either ArtistError UpsertArtistOpinionsCommandResponse)
-> IO (Either ArtistError UpsertArtistOpinionsCommandResponse)
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> UpsertArtistOpinionsRequest
-> Free
ArtistCommand
(Either ArtistError UpsertArtistOpinionsCommandResponse)
forall (f :: * -> *).
(ArtistCommand :<: f) =>
Env
-> WikiMusicUser
-> UpsertArtistOpinionsRequest
-> Free f (Either ArtistError UpsertArtistOpinionsCommandResponse)
upsertArtistOpinionsAction Env
env WikiMusicUser
authUser UpsertArtistOpinionsRequest
req) Handler (Either ArtistError UpsertArtistOpinionsCommandResponse)
-> (Either ArtistError UpsertArtistOpinionsCommandResponse
-> Handler UpsertArtistOpinionsCommandResponse)
-> Handler UpsertArtistOpinionsCommandResponse
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError UpsertArtistOpinionsCommandResponse
-> Handler UpsertArtistOpinionsCommandResponse
forall s b. Show s => Either s b -> Handler b
maybe204
)
insertArtistArtworksRoute :: Env -> Maybe Text -> InsertArtistArtworksRequest -> Handler InsertArtistArtworksCommandResponse
insertArtistArtworksRoute :: Env
-> Maybe Text
-> InsertArtistArtworksRequest
-> Handler InsertArtistArtworksCommandResponse
insertArtistArtworksRoute Env
env Maybe Text
authToken InsertArtistArtworksRequest
req =
Env
-> Maybe Text
-> (WikiMusicUser -> Handler InsertArtistArtworksCommandResponse)
-> Handler InsertArtistArtworksCommandResponse
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError InsertArtistArtworksCommandResponse)
-> Handler (Either ArtistError InsertArtistArtworksCommandResponse)
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @ArtistCommand (Free
ArtistCommand
(Either ArtistError InsertArtistArtworksCommandResponse)
-> IO (Either ArtistError InsertArtistArtworksCommandResponse))
-> Free
ArtistCommand
(Either ArtistError InsertArtistArtworksCommandResponse)
-> IO (Either ArtistError InsertArtistArtworksCommandResponse)
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> InsertArtistArtworksRequest
-> Free
ArtistCommand
(Either ArtistError InsertArtistArtworksCommandResponse)
forall (f :: * -> *).
(ArtistCommand :<: f) =>
Env
-> WikiMusicUser
-> InsertArtistArtworksRequest
-> Free f (Either ArtistError InsertArtistArtworksCommandResponse)
insertArtistArtworksAction Env
env WikiMusicUser
authUser InsertArtistArtworksRequest
req) Handler (Either ArtistError InsertArtistArtworksCommandResponse)
-> (Either ArtistError InsertArtistArtworksCommandResponse
-> Handler InsertArtistArtworksCommandResponse)
-> Handler InsertArtistArtworksCommandResponse
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError InsertArtistArtworksCommandResponse
-> Handler InsertArtistArtworksCommandResponse
forall s b. Show s => Either s b -> Handler b
maybe204
)
deleteArtistsByIdentifierRoute :: Env -> Maybe Text -> UUID -> Handler ()
deleteArtistsByIdentifierRoute :: Env -> Maybe Text -> UUID -> Handler ()
deleteArtistsByIdentifierRoute Env
env Maybe Text
authToken UUID
uid =
Env -> Maybe Text -> (WikiMusicUser -> Handler ()) -> Handler ()
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError ()) -> Handler (Either ArtistError ())
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @ArtistCommand (Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ()))
-> Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ())
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> UUID
-> Free ArtistCommand (Either ArtistError ())
forall (f :: * -> *).
(ArtistCommand :<: f) =>
Env -> WikiMusicUser -> UUID -> Free f (Either ArtistError ())
deleteArtistsByIdentifierAction Env
env WikiMusicUser
authUser UUID
uid) Handler (Either ArtistError ())
-> (Either ArtistError () -> Handler ()) -> Handler ()
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError () -> Handler ()
forall s b. Show s => Either s b -> Handler b
maybe204
)
deleteArtistCommentsByIdentifierRoute :: Env -> Maybe Text -> UUID -> Handler ()
Env
env Maybe Text
authToken UUID
uid =
Env -> Maybe Text -> (WikiMusicUser -> Handler ()) -> Handler ()
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError ()) -> Handler (Either ArtistError ())
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @ArtistCommand (Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ()))
-> Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ())
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> UUID
-> Free ArtistCommand (Either ArtistError ())
forall (f :: * -> *).
(ArtistCommand :<: f) =>
Env -> WikiMusicUser -> UUID -> Free f (Either ArtistError ())
deleteArtistCommentsByIdentifierAction Env
env WikiMusicUser
authUser UUID
uid) Handler (Either ArtistError ())
-> (Either ArtistError () -> Handler ()) -> Handler ()
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError () -> Handler ()
forall s b. Show s => Either s b -> Handler b
maybe204
)
deleteArtistOpinionsByIdentifierRoute :: Env -> Maybe Text -> UUID -> Handler ()
deleteArtistOpinionsByIdentifierRoute :: Env -> Maybe Text -> UUID -> Handler ()
deleteArtistOpinionsByIdentifierRoute Env
env Maybe Text
authToken UUID
uid =
Env -> Maybe Text -> (WikiMusicUser -> Handler ()) -> Handler ()
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError ()) -> Handler (Either ArtistError ())
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @ArtistCommand (Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ()))
-> Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ())
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> UUID
-> Free ArtistCommand (Either ArtistError ())
forall (f :: * -> *).
(ArtistCommand :<: f) =>
Env -> WikiMusicUser -> UUID -> Free f (Either ArtistError ())
deleteArtistOpinionsByIdentifierAction Env
env WikiMusicUser
authUser UUID
uid) Handler (Either ArtistError ())
-> (Either ArtistError () -> Handler ()) -> Handler ()
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError () -> Handler ()
forall s b. Show s => Either s b -> Handler b
maybe204
)
deleteArtistArtworksByIdentifierRoute :: Env -> Maybe Text -> UUID -> Handler ()
deleteArtistArtworksByIdentifierRoute :: Env -> Maybe Text -> UUID -> Handler ()
deleteArtistArtworksByIdentifierRoute Env
env Maybe Text
authToken UUID
uid =
Env -> Maybe Text -> (WikiMusicUser -> Handler ()) -> Handler ()
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError ()) -> Handler (Either ArtistError ())
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @ArtistCommand (Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ()))
-> Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ())
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> UUID
-> Free ArtistCommand (Either ArtistError ())
forall (f :: * -> *).
(ArtistCommand :<: f) =>
Env -> WikiMusicUser -> UUID -> Free f (Either ArtistError ())
deleteArtistArtworksByIdentifierAction Env
env WikiMusicUser
authUser UUID
uid) Handler (Either ArtistError ())
-> (Either ArtistError () -> Handler ()) -> Handler ()
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError () -> Handler ()
forall s b. Show s => Either s b -> Handler b
maybe204
)
updateArtistArtworksOrderRoute :: Env -> Maybe Text -> ArtistArtworkOrderUpdateRequest -> Handler ()
updateArtistArtworksOrderRoute :: Env -> Maybe Text -> ArtistArtworkOrderUpdateRequest -> Handler ()
updateArtistArtworksOrderRoute Env
env Maybe Text
authToken ArtistArtworkOrderUpdateRequest
req =
Env -> Maybe Text -> (WikiMusicUser -> Handler ()) -> Handler ()
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError ()) -> Handler (Either ArtistError ())
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @ArtistCommand (Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ()))
-> Free ArtistCommand (Either ArtistError ())
-> IO (Either ArtistError ())
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> ArtistArtworkOrderUpdateRequest
-> Free ArtistCommand (Either ArtistError ())
forall (f :: * -> *).
(ArtistCommand :<: f) =>
Env
-> WikiMusicUser
-> ArtistArtworkOrderUpdateRequest
-> Free f (Either ArtistError ())
updateArtistArtworksOrderAction Env
env WikiMusicUser
authUser ArtistArtworkOrderUpdateRequest
req) Handler (Either ArtistError ())
-> (Either ArtistError () -> Handler ()) -> Handler ()
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError () -> Handler ()
forall s b. Show s => Either s b -> Handler b
maybe204
)
updateArtistRoute :: Env -> Maybe Text -> ArtistDeltaRequest -> Handler ()
updateArtistRoute :: Env -> Maybe Text -> ArtistDeltaRequest -> Handler ()
updateArtistRoute Env
env Maybe Text
authToken ArtistDeltaRequest
req =
Env -> Maybe Text -> (WikiMusicUser -> Handler ()) -> Handler ()
forall a.
Env -> Maybe Text -> (WikiMusicUser -> Handler a) -> Handler a
doWithAuth
Env
env
Maybe Text
authToken
( \WikiMusicUser
authUser ->
IO (Either ArtistError ()) -> Handler (Either ArtistError ())
forall a. IO a -> Handler a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (forall (f :: * -> *) a. Exec f => Free f a -> IO a
exec @(ArtistCommand :+: ArtistQuery) (Free (ArtistCommand :+: ArtistQuery) (Either ArtistError ())
-> IO (Either ArtistError ()))
-> Free (ArtistCommand :+: ArtistQuery) (Either ArtistError ())
-> IO (Either ArtistError ())
forall a b. (a -> b) -> a -> b
$ Env
-> WikiMusicUser
-> ArtistDeltaRequest
-> Free (ArtistCommand :+: ArtistQuery) (Either ArtistError ())
forall (f :: * -> *).
(ArtistCommand :<: f, ArtistQuery :<: f) =>
Env
-> WikiMusicUser
-> ArtistDeltaRequest
-> Free f (Either ArtistError ())
updateArtistAction Env
env WikiMusicUser
authUser ArtistDeltaRequest
req) Handler (Either ArtistError ())
-> (Either ArtistError () -> Handler ()) -> Handler ()
forall a b. Handler a -> (a -> Handler b) -> Handler b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Either ArtistError () -> Handler ()
forall s b. Show s => Either s b -> Handler b
maybe204
)