-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Google Drive API access -- @package google-drive @version 0.2.0 -- | Actions for working with any of Google's APIs -- -- Note: this module may become a standalone package at some point. module Network.Google.Api -- | A transformer stack for providing the access token and rescuing errors type Api = ReaderT (String, Manager) (ErrorT ApiError IO) data ApiError -- | Exceptions raised by http-conduit HttpError :: HttpException -> ApiError -- | Failure to parse a response as JSON InvalidJSON :: String -> ApiError -- | All other errors GenericError :: String -> ApiError -- | Run an Api computation with the given Access token runApi :: String -> Api a -> IO (Either ApiError a) -- | Like runApi but discards the result and raises -- ApiErrors as exceptions runApi_ :: String -> Api a -> IO () -- | Abort an Api computation with the given message throwApiError :: String -> Api a type URL = String type Path = String type Params = [(ByteString, Maybe ByteString)] -- | Downloads use sinks for space efficiency and so that callers can -- implement things like throttling or progress output themselves. If you -- just want to download to a file, use the re-exported -- sinkFile type DownloadSink a = ResumableSource (ResourceT IO) ByteString -> ResourceT IO a -- | Make an authorized GET request for JSON getJSON :: FromJSON a => URL -> Params -> Api a -- | Make an authorized GET request, sending the response to the given sink getSource :: URL -> Params -> DownloadSink a -> Api a -- | Make an authorized POST request for JSON postJSON :: (ToJSON a, FromJSON b) => URL -> Params -> a -> Api b -- | Make an authorized request for JSON, first modifying it via the passed -- function requestJSON :: FromJSON a => URL -> (Request -> Request) -> Api a -- | Make an authorized request, first modifying it via the passed -- function, and returning the raw response content requestLbs :: URL -> (Request -> Request) -> Api (Response ByteString) -- | Create an authorized request for the given URL authorize :: URL -> Api Request -- | Decode a JSON body, capturing failure as an ApiError decodeBody :: FromJSON a => Response ByteString -> Api a addHeader :: Header -> Request -> Request -- | Modify the Request's status check to not treat the given status as an -- error allowStatus :: Status -> Request -> Request setBody :: ByteString -> Request -> Request setBodySource :: Int64 -> Source (ResourceT IO) ByteString -> Request -> Request setMethod :: Method -> Request -> Request -- | Lift a computation from the IO monad. liftIO :: MonadIO m => forall a. IO a -> m a -- | Is used within a monadic computation to begin exception processing. throwError :: MonadError e m => forall a. e -> m a -- | A handler function to handle previous errors and return to normal -- execution. A common idiom is: -- --
--   do { action1; action2; action3 } `catchError` handler
--   
-- -- where the action functions can call throwError. Note -- that handler and the do-block must have the same return type. catchError :: MonadError e m => forall a. m a -> (e -> m a) -> m a -- | Stream all incoming data to the given file. -- -- Since 0.3.0 sinkFile :: MonadResource m => FilePath -> Consumer ByteString m () instance Typeable ApiError instance Exception ApiError instance Error ApiError instance Show ApiError -- | Methods for working with File resources on Google Drive. -- -- https://developers.google.com/drive/v2/reference/files -- -- See Network.Google.Drive.Upload for uploading files. module Network.Google.Drive.File data File -- | A File that exists File :: FileId -> FileData -> File -- | A File you intend to create New :: FileData -> File type FileId = Text -- | Metadata about Files on your Drive data FileData FileData :: !Text -> !UTCTime -> ![FileId] -> !Bool -> !(Maybe Int) -> !(Maybe Text) -> !Text -> FileData fileTitle :: FileData -> !Text fileModified :: FileData -> !UTCTime fileParents :: FileData -> ![FileId] fileTrashed :: FileData -> !Bool fileSize :: FileData -> !(Maybe Int) fileDownloadUrl :: FileData -> !(Maybe Text) fileMimeType :: FileData -> !Text -- | N.B. it is an error to ask for the fileId of a new file fileId :: File -> FileId fileData :: File -> FileData isFolder :: File -> Bool -- | What to name this file if downloaded -- -- Currently just the fileTitle localPath :: File -> FilePath -- | HTTP Method to use for uploading content for this file uploadMethod :: File -> Method -- | Path to use for uploading content for this file uploadPath :: File -> Path -- | HTTP Body to send when uploading content for this file -- -- Currently a synonym for fileData. uploadData :: File -> FileData -- | Search query parameter -- -- Currently only a small subset of queries are supported data Query TitleEq :: Text -> Query ParentEq :: FileId -> Query Untrashed :: Query And :: Query -> Query -> Query Or :: Query -> Query -> Query newtype Items Items :: [File] -> Items -- | Perform a search as specified by the Query listFiles :: Query -> Api [File] -- | Get File data by FileId -- -- "root" can be used to get information on the Drive itself getFile :: FileId -> Api File -- | Delete a File deleteFile :: File -> Api () -- | Build a new File -- -- N.B. This does not create the file. -- -- The file is defined as within the given parent, and has some -- information (currently title and modified) taken from the local file newFile :: FileId -> FilePath -> Api File -- | Create a new remote folder createFolder :: FileId -> Text -> Api File instance FromJSON Items instance ToJSON FileData instance FromJSON File instance FromJSON FileData instance Show File instance Eq File -- | Resumable uploads -- -- -- https://developers.google.com/drive/web/manage-uploads#resumable -- -- Note: actual resuming of uploads on errors is currently untested. module Network.Google.Drive.Upload -- | Uploads use sources for space efficiency and so that callers can -- implement things like throttling or progress output themselves. Since -- uploads are resumable, each invocation will give your -- UploadSource the bytes completed so far, so you may create an -- appropriately offset source (i.e. into a file). type UploadSource = Int -> Source (ResourceT IO) ByteString -- | Simple UploadSource for uploading from a file uploadSourceFile :: FilePath -> UploadSource uploadFile :: File -> Int -> UploadSource -> Api File -- | A convenient re-exporting of all modules module Network.Google.Drive driveScopes :: [String]