lookupField
    :: Text
    -> Response LB.ByteString
    -> Either CreateFailure Text
lookupField field r = case r ^. responseStatus . statusCode of
    201 -> case A.decode (r ^. responseBody) of
        Nothing -> Left DecodeFail
        Just v -> case v of
            A.Object obj -> case field `H.lookup` obj of
                Nothing -> Left (MissingField field)
                Just v2 -> case v2 of
                    A.String url -> Right url
                    _ -> Left FieldTypeMismatch
            _ -> Left NotObject
    401 -> Left AuthFail
    x -> Left (CreateFailure x)
lookupField
    :: Text
    -> Response LB.ByteString
    -> Either CreateFailure Text
lookupField field r = case r ^. responseStatus . statusCode of
    201 -> case A.decode (r ^. responseBody) of
        Nothing -> Left DecodeFail
        Just v -> case v of
            A.Object obj -> case field `H.lookup` obj of
                Nothing -> Left (MissingField field)
                Just v2 -> case v2 of
                    A.String url -> Right url
                    _ -> Left FieldTypeMismatch
            _ -> Left NotObject
    401 -> Left AuthFail
    x -> Left (CreateFailure x)
lookupField field r = case r ^. responseStatus . statusCode of
    201 -> case A.decode (r ^. responseBody) of
        Nothing -> Left DecodeFail
        Just v -> case v of
            A.Object obj -> case field `H.lookup` obj of
                Nothing -> Left (MissingField field)
                Just v2 -> case v2 of
                    A.String url -> Right url
                    _ -> Left FieldTypeMismatch
            _ -> Left NotObject
    401 -> Left AuthFail
    x -> Left (CreateFailure x)