Safe Haskell | None |
---|
- consumer :: ByteString -> ByteString -> OAuth
- getRequestToken :: (MonadResource m, MonadBaseControl IO m) => OAuth -> Manager -> m (RequestToken, URL)
- authorizeUrl :: OAuth -> Credential -> ByteString
- getAccessToken :: (MonadResource m, MonadBaseControl IO m) => RequestToken -> Verifier -> OAuth -> Manager -> m (Credential, ByteString)
- token :: Credential -> ByteString
- tokenSecret :: Credential -> ByteString
- newCredential :: ByteString -> ByteString -> Credential
- oauthCallback :: OAuth -> Maybe ByteString
- apiRequest :: (MonadResource m, MonadBaseControl IO m) => OAuth -> Manager -> AccessToken -> Method -> ByteString -> m (Response ByteString)
- data APIError
- = OAuthError String
- | TokenError String
- | CallError String
- | Throttled
- | Mapping
- type RequestToken = Credential
- type Verifier = ByteString
- type AccessToken = Credential
- type URL = ByteString
- data Manager
- data OAuth
- data Credential = Credential {
- unCredential :: [(ByteString, ByteString)]
- data Status
- data Address = Address {}
- data Award = Award Text Int (Maybe Text)
- data BirthDate
- data ProfessionalExperience = ProfessionalExperience {
- pe_title :: Maybe Text
- pe_beginDate :: Maybe Text
- pe_endDate :: Maybe Text
- pe_careerLevel :: Maybe Text
- pe_description :: Maybe Text
- pe_name :: Maybe Text
- pe_tag :: Maybe Text
- pe_companySize :: Maybe Text
- pe_url :: Maybe Text
- pe_industry :: Text
- class User a where
- type UserId = Text
- type PhotoUrls = Map Text Text
- data FullUser
- newtype UserList = UserList {
- unUserList :: [FullUser]
- data Gender
- type Language = Text
- type Skill = Text
- birthDate :: FullUser -> Maybe BirthDate
- gender :: FullUser -> Gender
- firstName :: FullUser -> Text
- lastName :: FullUser -> Text
- activeEmail :: FullUser -> Maybe Text
- premiumServices :: FullUser -> [Text]
- badges :: FullUser -> [Text]
- languages :: FullUser -> Map Language (Maybe Skill)
- wants :: FullUser -> Maybe Text
- haves :: FullUser -> Maybe Text
- interests :: FullUser -> Maybe Text
- organisations :: FullUser -> Maybe Text
- pageName :: FullUser -> Text
- privateAddress :: FullUser -> Address
- businessAddress :: FullUser -> Address
- data MinimalUser = MinimalUser UserId Text Text PhotoUrls
- getIdCard :: (MonadResource m, MonadBaseControl IO m) => OAuth -> Manager -> AccessToken -> m MinimalUser
- demoIdCard :: Value
- demoIdCard' :: ByteString
- demoUser :: Value
- demoUser' :: ByteString
- demoUsers :: Value
- demoUsers' :: ByteString
- getUsers :: (MonadResource m, MonadBaseControl IO m) => OAuth -> Manager -> AccessToken -> [UserId] -> m UserList
- liftIO :: MonadIO m => forall a. IO a -> m a
- withManager :: (MonadIO m, MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m) => (Manager -> ResourceT m a) -> m a
OAuth
:: ByteString | consumer key |
-> ByteString | consumer secret |
-> OAuth |
Create an OAuth consumer
:: (MonadResource m, MonadBaseControl IO m) | |
=> OAuth | OAuth consumer |
-> Manager | |
-> m (RequestToken, URL) | request token and authorize URL |
Create a request token (temporary credentials)
:: OAuth | OAuth consumer |
-> Credential | request token |
-> ByteString | URL to send the user to |
URL to obtain OAuth verifier
:: (MonadResource m, MonadBaseControl IO m) | |
=> RequestToken | request token obtained from |
-> Verifier | verifier obtained by calling |
-> OAuth | OAuth consumer (see |
-> Manager | |
-> m (Credential, ByteString) |
Exchange request token for an access token (token credentials)
token :: Credential -> ByteStringSource
extract the token from the Credential
tokenSecret :: Credential -> ByteStringSource
extract the secret from the Credential
:: ByteString | value for oauth_token |
-> ByteString | value for oauth_token_secret |
-> Credential |
Convenient function to create Credential
with OAuth Token and Token Secret.
(re)create an OAuth token (for example access token)
oauthCallback :: OAuth -> Maybe ByteString
Callback uri to redirect after authentication (default: Nothing
)
extract the OAuth callback from a consumer
API request interface
:: (MonadResource m, MonadBaseControl IO m) | |
=> OAuth | OAuth consumer |
-> Manager | |
-> AccessToken | |
-> Method | HTTP verb |
-> ByteString | HTTP path |
-> m (Response ByteString) |
Low level API request interface
type RequestToken = CredentialSource
type Verifier = ByteStringSource
type AccessToken = CredentialSource
type URL = ByteStringSource
data Manager
Keeps track of open connections for keep-alive.
If possible, you should share a single Manager
between multiple threads and requests.
data OAuth
Data type for OAuth client (consumer).
The constructor for this data type is not exposed.
Instead, you should use the def
method or newOAuth
function to retrieve a default instance,
and then use the records below to make modifications.
This approach allows us to add configuration options without breaking backwards compatibility.
data Status
HTTP Status.
Only the statusCode
is used for comparisons.
Please use mkStatus
to create status codes from code and message, or the Enum
instance or the
status code constants (like ok200
). There might be additional record members in the future.
Note that the Show instance is only for debugging.
XING data types
data ProfessionalExperience Source
ProfessionalExperience | |
|
displayName :: a -> TextSource
activeEmail :: FullUser -> Maybe TextSource
premiumServices :: FullUser -> [Text]Source
organisations :: FullUser -> Maybe TextSource
data MinimalUser Source
Calls
getIdCard :: (MonadResource m, MonadBaseControl IO m) => OAuth -> Manager -> AccessToken -> m MinimalUserSource
Get your id card https://dev.xing.com/docs/get/users/me/id_card
getUsers :: (MonadResource m, MonadBaseControl IO m) => OAuth -> Manager -> AccessToken -> [UserId] -> m UserListSource
Get user details https://dev.xing.com/docs/get/users/:id
Common used functions (re-exports)
withManager :: (MonadIO m, MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m) => (Manager -> ResourceT m a) -> m a
Create a new manager, use it in the provided function, and then release it.
This function uses the default manager settings. For more control, use
withManagerSettings
.