Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pbrisbin/google-drive
Google Drive API access
https://github.com/pbrisbin/google-drive
Last synced: 2 months ago
JSON representation
Google Drive API access
- Host: GitHub
- URL: https://github.com/pbrisbin/google-drive
- Owner: pbrisbin
- License: mit
- Created: 2014-11-19T00:25:45.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-12T18:02:29.000Z (over 9 years ago)
- Last Synced: 2024-10-10T17:26:12.502Z (3 months ago)
- Language: Haskell
- Homepage:
- Size: 453 KB
- Stars: 10
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Google Drive
Google Drive API access
## Stability
As we are still pre-1.0, I consider all types and interfaces freely changeable
in any way accompanied by only a minor version bump.I apologize if this breaks your code. Update at your own risk.
## Installation
```
% cabal install google-drive
```## Usage
```haskell
-- Top level re-exports all the sub-modules
import Network.Google.Driveimport Control.Monad (forM_)
import Data.Conduit (($$+-))main :: IO ()
main = do
-- See my separate google-oauth2 library
let token = undefined-- runApi would return an Either ApiError a
-- runApi_ discards the a and raises any errors, useful in CLI apps
runApi_ token $ do
-- "root" is an alias for the ID of the Drive itself
Just root <- getFile "root"-- Note: This is already available as listVisibleContents
items <- listFiles $ (fileId root) `qIn` Parents ?&& Trashed ?= FalseforM_ items $ \item -> do
let path = localPath itemdownloadFile item ($$+- sinkFile path)
```See the tests and haddocks for more information.
## Developing and Tests
```
% cp .env{.example,} # and edit it accordingly
% cabal install --dependencies-only --enable-tests -j
% cabal test
```