Copyright | (c) 2021 The closed eye of love |
---|---|
License | BSD-3-Clause |
Maintainer | Poscat <poscat@mail.poscat.moe>, berberman <berberman@yandex.com> |
Stability | alpha |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Authentication pixiv API. Users should not use logics in this module directly, since Web.Pixiv.Types.PixivT takes over token management, providing user friendly operations.
Synopsis
- newtype Token = Token {}
- data Credential
- = Password { }
- | RefreshToken { }
- data OAuth2Token = OAuth2Token {}
- data OAuth2Error = OAuth2Error {
- oa_error :: Errors
- oa_message :: Text
- data OAuth2Result
- data Errors
- auth :: Manager -> Credential -> IO OAuth2Result
- auth' :: Manager -> Credential -> IO OAuth2Token
Documentation
A wrapped Text
represents a token.
data Credential Source #
Authentication credentials for pixiv API.
Normally, users are supposed to create value of this data type using Password
constructor,
then pass it to runPixivT
.
Instances
Eq Credential Source # | |
Defined in Web.Pixiv.Auth (==) :: Credential -> Credential -> Bool # (/=) :: Credential -> Credential -> Bool # | |
Show Credential Source # | |
Defined in Web.Pixiv.Auth showsPrec :: Int -> Credential -> ShowS # show :: Credential -> String # showList :: [Credential] -> ShowS # |
data OAuth2Token Source #
Successful result.
Instances
Eq OAuth2Token Source # | |
Defined in Web.Pixiv.Auth (==) :: OAuth2Token -> OAuth2Token -> Bool # (/=) :: OAuth2Token -> OAuth2Token -> Bool # | |
Read OAuth2Token Source # | |
Defined in Web.Pixiv.Auth readsPrec :: Int -> ReadS OAuth2Token # readList :: ReadS [OAuth2Token] # readPrec :: ReadPrec OAuth2Token # readListPrec :: ReadPrec [OAuth2Token] # | |
Show OAuth2Token Source # | |
Defined in Web.Pixiv.Auth showsPrec :: Int -> OAuth2Token -> ShowS # show :: OAuth2Token -> String # showList :: [OAuth2Token] -> ShowS # | |
ToJSON OAuth2Token Source # | |
Defined in Web.Pixiv.Auth toJSON :: OAuth2Token -> Value # toEncoding :: OAuth2Token -> Encoding # toJSONList :: [OAuth2Token] -> Value # toEncodingList :: [OAuth2Token] -> Encoding # | |
FromJSON OAuth2Token Source # | |
Defined in Web.Pixiv.Auth parseJSON :: Value -> Parser OAuth2Token # parseJSONList :: Value -> Parser [OAuth2Token] # |
data OAuth2Error Source #
Failed result.
OAuth2Error | |
|
Instances
Eq OAuth2Error Source # | |
Defined in Web.Pixiv.Auth (==) :: OAuth2Error -> OAuth2Error -> Bool # (/=) :: OAuth2Error -> OAuth2Error -> Bool # | |
Read OAuth2Error Source # | |
Defined in Web.Pixiv.Auth readsPrec :: Int -> ReadS OAuth2Error # readList :: ReadS [OAuth2Error] # readPrec :: ReadPrec OAuth2Error # readListPrec :: ReadPrec [OAuth2Error] # | |
Show OAuth2Error Source # | |
Defined in Web.Pixiv.Auth showsPrec :: Int -> OAuth2Error -> ShowS # show :: OAuth2Error -> String # showList :: [OAuth2Error] -> ShowS # | |
FromJSON OAuth2Error Source # | |
Defined in Web.Pixiv.Auth parseJSON :: Value -> Parser OAuth2Error # parseJSONList :: Value -> Parser [OAuth2Error] # | |
Exception OAuth2Error Source # | |
Defined in Web.Pixiv.Auth |
data OAuth2Result Source #
Authentication result.
Instances
Eq OAuth2Result Source # | |
Defined in Web.Pixiv.Auth (==) :: OAuth2Result -> OAuth2Result -> Bool # (/=) :: OAuth2Result -> OAuth2Result -> Bool # | |
Show OAuth2Result Source # | |
Defined in Web.Pixiv.Auth showsPrec :: Int -> OAuth2Result -> ShowS # show :: OAuth2Result -> String # showList :: [OAuth2Result] -> ShowS # | |
FromJSON OAuth2Result Source # | |
Defined in Web.Pixiv.Auth parseJSON :: Value -> Parser OAuth2Result # parseJSONList :: Value -> Parser [OAuth2Result] # |
Authentication failure reasions.
auth :: Manager -> Credential -> IO OAuth2Result Source #
Given a credential, performs a authentication request.
auth' :: Manager -> Credential -> IO OAuth2Token Source #
Like auth
, but immediately throws OAuth2Error
if auth failed.