module Web.Telegram.API.Bot.API.Chats
(
kickChatMember
, kickChatMemberM
, kickChatMemberUntilM
, leaveChat
, leaveChatM
, unbanChatMember
, unbanChatMemberM
, restrictChatMemberM
, promoteChatMemberM
, exportChatInviteLinkM
, setChatPhotoM
, deleteChatPhotoM
, setChatTitleM
, setChatDescriptionM
, pinChatMessageM
, unpinChatMessageM
, getChat
, getChatM
, getChatAdministrators
, getChatAdministratorsM
, getChatMembersCount
, getChatMembersCountM
, getChatMember
, getChatMemberM
, setChatStickerSetM
, deleteChatStickerSetM
, TelegramBotChatsAPI
, chatsApi
) where
import Data.Proxy
import Data.Text (Text)
import Network.HTTP.Client (Manager)
import Servant.API
import Servant.Client
import Servant.Client.MultipartFormData
import Web.Telegram.API.Bot.API.Core
import Web.Telegram.API.Bot.Requests
import Web.Telegram.API.Bot.Responses
type TelegramBotChatsAPI =
TelegramToken :> "kickChatMember"
:> QueryParam "chat_id" Text
:> QueryParam "user_id" Int
:> QueryParam "until_date" Int
:> Post '[JSON] KickChatMemberResponse
:<|> TelegramToken :> "leaveChat"
:> QueryParam "chat_id" Text
:> Post '[JSON] LeaveChatResponse
:<|> TelegramToken :> "unbanChatMember"
:> QueryParam "chat_id" Text
:> QueryParam "user_id" Int
:> Post '[JSON] UnbanChatMemberResponse
:<|> TelegramToken :> "restrictChatMember"
:> ReqBody '[JSON] RestrictChatMemberRequest
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "promoteChatMember"
:> ReqBody '[JSON] PromoteChatMemberRequest
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "exportChatInviteLink"
:> QueryParam "chat_id" Text
:> Post '[JSON] (Response Text)
:<|> TelegramToken :> "setChatPhoto"
:> MultipartFormDataReqBody SetChatPhotoRequest
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "deleteChatPhoto"
:> QueryParam "chat_id" Text
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "setChatTitle"
:> QueryParam "chat_id" Text
:> QueryParam "title" Text
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "setChatDescription"
:> QueryParam "chat_id" Text
:> QueryParam "description" Text
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "pinChatMessage"
:> QueryParam "chat_id" Text
:> QueryParam "message_id" Int
:> QueryParam "disable_notification" Bool
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "unpinChatMessage"
:> QueryParam "chat_id" Text
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "getChat"
:> QueryParam "chat_id" Text
:> Post '[JSON] GetChatResponse
:<|> TelegramToken :> "getChatAdministrators"
:> QueryParam "chat_id" Text
:> Post '[JSON] GetChatAdministratorsResponse
:<|> TelegramToken :> "getChatMembersCount"
:> QueryParam "chat_id" Text
:> Post '[JSON] GetChatMembersCountResponse
:<|> TelegramToken :> "getChatMember"
:> QueryParam "chat_id" Text
:> QueryParam "user_id" Int
:> Post '[JSON] GetChatMemberResponse
:<|> TelegramToken :> "setChatStickerSet"
:> QueryParam "chat_id" Text
:> QueryParam "sticker_set_name" Text
:> Post '[JSON] (Response Bool)
:<|> TelegramToken :> "deleteChatStickerSet"
:> QueryParam "chat_id" Text
:> Post '[JSON] (Response Bool)
chatsApi :: Proxy TelegramBotChatsAPI
chatsApi = Proxy
kickChatMember_ :: Token -> Maybe Text -> Maybe Int -> Maybe Int -> ClientM KickChatMemberResponse
leaveChat_ :: Token -> Maybe Text -> ClientM LeaveChatResponse
unbanChatMember_ :: Token -> Maybe Text -> Maybe Int -> ClientM UnbanChatMemberResponse
restrictChatMember_ :: Token -> RestrictChatMemberRequest -> ClientM (Response Bool)
promoteChatMember_ :: Token -> PromoteChatMemberRequest -> ClientM (Response Bool)
exportChatInviteLink_ :: Token -> Maybe Text -> ClientM (Response Text)
setChatPhoto_ :: Token -> SetChatPhotoRequest -> ClientM (Response Bool)
deleteChatPhoto_ :: Token -> Maybe Text -> ClientM (Response Bool)
setChatTitle_ :: Token -> Maybe Text -> Maybe Text -> ClientM (Response Bool)
setChatDescription_ :: Token -> Maybe Text -> Maybe Text -> ClientM (Response Bool)
pinChatMessage_ :: Token -> Maybe Text -> Maybe Int -> Maybe Bool -> ClientM (Response Bool)
unpinChatMessage_ :: Token -> Maybe Text -> ClientM (Response Bool)
getChat_ :: Token -> Maybe Text -> ClientM GetChatResponse
getChatAdministrators_ :: Token -> Maybe Text -> ClientM GetChatAdministratorsResponse
getChatMembersCount_ :: Token -> Maybe Text -> ClientM GetChatMembersCountResponse
getChatMember_ :: Token -> Maybe Text -> Maybe Int -> ClientM GetChatMemberResponse
setChatStickerSet_ :: Token -> Maybe Text -> Maybe Text -> ClientM (Response Bool)
deleteChatStickerSet_ :: Token -> Maybe Text -> ClientM (Response Bool)
kickChatMember_
:<|> leaveChat_
:<|> unbanChatMember_
:<|> restrictChatMember_
:<|> promoteChatMember_
:<|> exportChatInviteLink_
:<|> setChatPhoto_
:<|> deleteChatPhoto_
:<|> setChatTitle_
:<|> setChatDescription_
:<|> pinChatMessage_
:<|> unpinChatMessage_
:<|> getChat_
:<|> getChatAdministrators_
:<|> getChatMembersCount_
:<|> getChatMember_
:<|> setChatStickerSet_
:<|> deleteChatStickerSet_
= client chatsApi
kickChatMember :: Token
-> Text
-> Int
-> Manager -> IO (Either ServantError KickChatMemberResponse)
kickChatMember token chatId userId = runClient (kickChatMemberM chatId userId) token
kickChatMemberM :: Text -> Int -> TelegramClient KickChatMemberResponse
kickChatMemberM chatId userId = asking $ \t -> kickChatMember_ t (Just chatId) (Just userId) Nothing
kickChatMemberUntilM :: Text
-> Int
-> Int
-> TelegramClient KickChatMemberResponse
kickChatMemberUntilM chatId userId untilDate = asking $ \t -> kickChatMember_ t (Just chatId) (Just userId) (Just untilDate)
leaveChat :: Token -> Text -> Manager -> IO (Either ServantError LeaveChatResponse)
leaveChat = runM leaveChatM
leaveChatM :: Text -> TelegramClient LeaveChatResponse
leaveChatM chatId = run_ leaveChat_ (Just chatId)
unbanChatMember :: Token -> Text -> Int -> Manager -> IO (Either ServantError UnbanChatMemberResponse)
unbanChatMember token chatId userId = runClient (unbanChatMemberM chatId userId) token
unbanChatMemberM :: Text -> Int -> TelegramClient UnbanChatMemberResponse
unbanChatMemberM chatId userId = asking $ \t -> unbanChatMember_ t (Just chatId) (Just userId)
restrictChatMemberM :: RestrictChatMemberRequest -> TelegramClient (Response Bool)
restrictChatMemberM = run_ restrictChatMember_
promoteChatMemberM :: PromoteChatMemberRequest -> TelegramClient (Response Bool)
promoteChatMemberM = run_ promoteChatMember_
exportChatInviteLinkM :: Text -> TelegramClient (Response Text)
exportChatInviteLinkM chatId = run_ exportChatInviteLink_ (Just chatId)
setChatPhotoM :: SetChatPhotoRequest -> TelegramClient (Response Bool)
setChatPhotoM = run_ setChatPhoto_
deleteChatPhotoM :: Text -> TelegramClient (Response Bool)
deleteChatPhotoM chatId = run_ deleteChatPhoto_ (Just chatId)
setChatTitleM :: Text -> Maybe Text -> TelegramClient (Response Bool)
setChatTitleM chatId title = asking $ \t -> setChatTitle_ t (Just chatId) title
setChatDescriptionM :: Text -> Maybe Text -> TelegramClient (Response Bool)
setChatDescriptionM chatId description = asking $ \t -> setChatDescription_ t (Just chatId) description
pinChatMessageM :: Text -> Int -> Maybe Bool -> TelegramClient (Response Bool)
pinChatMessageM chatId messageId disableNotifications = asking $ \tkn -> pinChatMessage_ tkn (Just chatId) (Just messageId) disableNotifications
unpinChatMessageM :: Text -> TelegramClient (Response Bool)
unpinChatMessageM chatId = run_ unpinChatMessage_ (Just chatId)
getChat :: Token -> Text -> Manager -> IO (Either ServantError GetChatResponse)
getChat = runM getChatM
getChatM :: Text -> TelegramClient GetChatResponse
getChatM chatId = run_ getChat_ (Just chatId)
getChatAdministrators :: Token -> Text -> Manager -> IO (Either ServantError GetChatAdministratorsResponse)
getChatAdministrators = runM getChatAdministratorsM
getChatAdministratorsM :: Text -> TelegramClient GetChatAdministratorsResponse
getChatAdministratorsM chatId = run_ getChatAdministrators_ (Just chatId)
getChatMembersCount :: Token -> Text -> Manager -> IO (Either ServantError GetChatMembersCountResponse)
getChatMembersCount = runM getChatMembersCountM
getChatMembersCountM :: Text -> TelegramClient GetChatMembersCountResponse
getChatMembersCountM chatId = run_ getChatMembersCount_ (Just chatId)
getChatMember :: Token -> Text -> Int -> Manager -> IO (Either ServantError GetChatMemberResponse)
getChatMember token chatId userId = runClient (getChatMemberM chatId userId) token
getChatMemberM :: Text -> Int -> TelegramClient GetChatMemberResponse
getChatMemberM chatId userId = asking $ \t -> getChatMember_ t (Just chatId) (Just userId)
setChatStickerSetM :: Text
-> Text
-> TelegramClient (Response Bool)
setChatStickerSetM chatId stickerSetName = asking $ \t -> setChatStickerSet_ t (Just chatId) (Just stickerSetName)
deleteChatStickerSetM :: Text
-> TelegramClient (Response Bool)
deleteChatStickerSetM chatId = run_ deleteChatStickerSet_ (Just chatId)