module Galley.Intra.Spar
( deleteTeam,
lookupScimUserInfo,
)
where
import Bilge
import Data.ByteString.Conversion
import Data.Id
import Galley.Intra.Util
import Galley.Monad
import Imports
import Network.HTTP.Types.Method
import Wire.API.User (ScimUserInfo)
deleteTeam :: TeamId -> App ()
deleteTeam :: TeamId -> App ()
deleteTeam TeamId
tid = do
App (Response (Maybe ByteString)) -> App ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (App (Response (Maybe ByteString)) -> App ())
-> ((Request -> Request) -> App (Response (Maybe ByteString)))
-> (Request -> Request)
-> App ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IntraComponent
-> (Request -> Request) -> App (Response (Maybe ByteString))
call IntraComponent
Spar ((Request -> Request) -> App ()) -> (Request -> Request) -> App ()
forall a b. (a -> b) -> a -> b
$
StdMethod -> Request -> Request
method StdMethod
DELETE
(Request -> Request) -> (Request -> Request) -> Request -> Request
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ByteString] -> Request -> Request
paths [ByteString
"i", ByteString
"teams", TeamId -> ByteString
forall a. ToByteString a => a -> ByteString
toByteString' TeamId
tid]
(Request -> Request) -> (Request -> Request) -> Request -> Request
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Request -> Request
expect2xx
lookupScimUserInfo :: UserId -> App ScimUserInfo
lookupScimUserInfo :: UserId -> App ScimUserInfo
lookupScimUserInfo UserId
uid = do
Response (Maybe ByteString)
response <-
IntraComponent
-> (Request -> Request) -> App (Response (Maybe ByteString))
call IntraComponent
Spar ((Request -> Request) -> App (Response (Maybe ByteString)))
-> (Request -> Request) -> App (Response (Maybe ByteString))
forall a b. (a -> b) -> a -> b
$
StdMethod -> Request -> Request
method StdMethod
POST
(Request -> Request) -> (Request -> Request) -> Request -> Request
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ByteString] -> Request -> Request
paths [ByteString
"i", ByteString
"scim", ByteString
"userinfo", UserId -> ByteString
forall a. ToByteString a => a -> ByteString
toByteString' UserId
uid]
Response (Maybe ByteString) -> App ScimUserInfo
forall (m :: * -> *) a.
(HasCallStack, MonadThrow m, Typeable a, FromJSON a) =>
Response (Maybe ByteString) -> m a
responseJsonError Response (Maybe ByteString)
response