Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bbyalcinkaya/putio-haskell
Haskell API client for Put.io cloud storage service
https://github.com/bbyalcinkaya/putio-haskell
Last synced: about 14 hours ago
JSON representation
Haskell API client for Put.io cloud storage service
- Host: GitHub
- URL: https://github.com/bbyalcinkaya/putio-haskell
- Owner: bbyalcinkaya
- License: bsd-3-clause
- Created: 2022-01-29T22:32:54.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-07T20:14:30.000Z (9 months ago)
- Last Synced: 2024-11-07T18:53:03.617Z (about 2 months ago)
- Language: Haskell
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# putio-haskell
Haskell client library for [Put.io API v2](https://api.put.io/v2/docs) powered by [servant-client](https://hackage.haskell.org/package/servant-client).
## Usage
### Example
```haskell
{-# LANGUAGE OverloadedStrings #-}module Main where
import Putio
import qualified Putio.Account as Account
import qualified Putio.File as File
import Putio.File (ListArgs (..), withArgs)
import qualified Putio.Transfer as Transferimport Network.HTTP.Client (newManager)
import Network.HTTP.Client.TLS (tlsManagerSettings)import Control.Monad.IO.Class (liftIO)
authToken :: Text
authToken = "YOUR_OAUTH_TOKEN"main :: IO ()
main = do
manager <- newManager tlsManagerSettings
res <- runPutio action manager authToken
case res of
Left err -> putStrLn $ "Error: " ++ show err
Right _ -> return ()action :: PutioM ()
action = do
-- GET /account/info
accInfo <- Account.getInfo
liftIO $ print accInfo
-- GET /files/list
files <- File.list withArgs { per_page = Just 10 }
liftIO $ print files
-- GET /transfers/list
transfers <- Transfer.list
liftIO $ print transfers
```