gopro-plus 0.3.0.0 → 0.3.0.1
raw patch · 5 files changed
+21/−7 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- GoPro.Plus.Internal.AuthHTTP: authOptsM :: HasGoProAuth m => m Options
- GoPro.Plus.Internal.AuthHTTP: jgetAuth :: (HasGoProAuth m, MonadIO m, FromJSON a) => String -> m a
- GoPro.Plus.Internal.AuthHTTP: jgetWithAuth :: (HasGoProAuth m, MonadIO m, FromJSON a) => Options -> String -> m a
- GoPro.Plus.Internal.AuthHTTP: jpostAuth :: (HasGoProAuth m, MonadIO m, Postable a, FromJSON r) => String -> a -> m r
- GoPro.Plus.Internal.AuthHTTP: jputAuth :: (HasGoProAuth m, MonadIO m, FromJSON j, Putable a) => String -> a -> m j
- GoPro.Plus.Internal.AuthHTTP: proxyAuth :: (HasGoProAuth m, MonadIO m) => String -> m ByteString
- GoPro.Plus.Internal.HTTP: authOpts :: Text -> Options
- GoPro.Plus.Internal.HTTP: defOpts :: Options
- GoPro.Plus.Internal.HTTP: jget :: (MonadIO m, FromJSON a) => Text -> String -> m a
- GoPro.Plus.Internal.HTTP: jgetWith :: (MonadIO m, FromJSON a) => Options -> String -> m a
- GoPro.Plus.Internal.HTTP: jpostWith :: (MonadIO m, Postable a, FromJSON r) => Options -> String -> a -> m r
- GoPro.Plus.Internal.HTTP: jsonOpts :: Options
- GoPro.Plus.Internal.HTTP: proxy :: MonadIO m => Text -> String -> m ByteString
- GoPro.Plus.Internal.HTTP: userAgent :: ByteString
Files
- gopro-plus.cabal +2/−2
- src/GoPro/Plus/Auth.hs +10/−1
- src/GoPro/Plus/Internal/AuthHTTP.hs +2/−0
- src/GoPro/Plus/Internal/HTTP.hs +2/−0
- src/GoPro/Plus/Upload.hs +5/−4
gopro-plus.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 4bb7255d2a4a022d5784c1045d89a42542f454252c098c0e9cd6953c1255c7a7+-- hash: aad6d39dfff268773a2546434545e5c4ef4a88e542724369091bd0a343e5f2e6 name: gopro-plus-version: 0.3.0.0+version: 0.3.0.1 synopsis: GoPro Plus Client API. description: Please see the README on GitHub at <https://github.com/dustin/gopro-plus#readme> category: Web
src/GoPro/Plus/Auth.hs view
@@ -48,7 +48,10 @@ , _resource_owner_id :: Text } deriving(Generic, Show) +-- | A Monad may have a 'HasGoProAuth' instance to indicate it knows+-- how to authenticate against the GoPro Plus service. class Monad m => HasGoProAuth m where+ -- | Get the GoPro 'AuthInfo' to use. goproAuth :: m AuthInfo instance FromJSON AuthInfo where@@ -56,6 +59,7 @@ makeLenses ''AuthInfo +-- | Authenticate against the GoPro Plus service. authenticate :: MonadIO m => String -- ^ Email/username -> String -- ^ Password@@ -76,13 +80,18 @@ "client_secret" := apiClientSecret, "refresh_token" := _refresh_token] +-- | AuthReader is a convenience type that's useful for doing small+-- experiments where you don't already have your own Reader or+-- similar. e.g., in ghci you might type:+--+-- > (m :: Medium) <- withAuth (AuthInfo accessToken 0 "" "") $ medium mediumID type AuthReader = ReaderT AuthInfo instance Monad m => HasGoProAuth (AuthReader m) where goproAuth = ask -- | Convenient function for passing around auth info. You probably--- don't want to use this, but it can be convenient when+-- don't want to uset his, but it can be convenient when -- experimenting. withAuth :: AuthInfo -> AuthReader m a -> m a withAuth = flip runReaderT
src/GoPro/Plus/Internal/AuthHTTP.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-}+ module GoPro.Plus.Internal.AuthHTTP where import Control.Lens
src/GoPro/Plus/Internal/HTTP.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-}+ module GoPro.Plus.Internal.HTTP where import Control.Lens
src/GoPro/Plus/Upload.hs view
@@ -216,11 +216,12 @@ jpost :: (HasGoProAuth m, MonadIO m) => String -> J.Value -> m J.Value jpost u p = (_access_token <$> goproAuth) >>= \tok -> jpostVal (popts tok) u p +-- | Retreive an Upload with the given upload and derivative ID. getUpload :: (HasGoProAuth m, MonadIO m)- => UploadID- -> DerivativeID- -> Int- -> Int+ => UploadID -- ^ ID of the upload to retrieve+ -> DerivativeID -- ^ ID of the derivative to which the upload belongs+ -> Int -- ^ Part number within the derivative.+ -> Int -- ^ Size of this part. -> Uploader m Upload getUpload upid did part fsize = do Env{..} <- get