| Copyright | (c) Dustin Sallings 2020 |
|---|---|
| License | BSD3 |
| Maintainer | dustin@spy.net |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
GoPro.Plus.Upload
Description
GoPro Plus media upload client.
Synopsis
- uploadMedium :: (HasGoProAuth m, MonadMask m, MonadFail m, MonadIO m) => [FilePath] -> m MediumID
- runUpload :: (HasGoProAuth m, MonadFail m, MonadIO m) => [FilePath] -> Uploader m a -> m a
- resumeUpload :: (HasGoProAuth m, MonadFail m, MonadIO m) => [FilePath] -> MediumID -> Uploader m a -> m a
- createMedium :: (HasGoProAuth m, MonadIO m) => Uploader m MediumID
- createSource :: (HasGoProAuth m, MonadIO m) => Int -> Uploader m DerivativeID
- createDerivative :: (HasGoProAuth m, MonadIO m) => Int -> Text -> Text -> Uploader m DerivativeID
- createUpload :: (HasGoProAuth m, MonadIO m) => DerivativeID -> Int -> Int -> Uploader m Upload
- completeUpload :: (HasGoProAuth m, MonadIO m) => UploadID -> DerivativeID -> Int -> Integer -> Uploader m ()
- getUpload :: (HasGoProAuth m, MonadIO m) => UploadID -> DerivativeID -> Int -> Int -> Uploader m Upload
- uploadChunk :: (MonadMask m, MonadIO m) => FilePath -> UploadPart -> Uploader m ()
- markAvailable :: (HasGoProAuth m, MonadIO m) => DerivativeID -> Uploader m ()
- type UploadID = Text
- type DerivativeID = Text
- data UploadPart = UploadPart {}
- uploadLength :: Lens' UploadPart Integer
- uploadPart :: Lens' UploadPart Integer
- uploadURL :: Lens' UploadPart String
- data Upload = Upload {
- _uploadID :: UploadID
- _uploadParts :: [UploadPart]
- uploadID :: Lens' Upload UploadID
- uploadParts :: Lens' Upload [UploadPart]
- type Uploader m = StateT (Env m) m
- setMediumType :: Monad m => MediumType -> Uploader m ()
- setLogAction :: (Monad m, MonadMask m) => (String -> m ()) -> Uploader m ()
- listUploading :: (HasGoProAuth m, MonadIO m) => m [Medium]
High level upload all-in-one convenience.
Arguments
| :: (HasGoProAuth m, MonadMask m, MonadFail m, MonadIO m) | |
| => [FilePath] | Parts of a single medium to upload (e.g., a video file). |
| -> m MediumID |
Convenience action to upload a single medium.
Low-level upload parts.
Arguments
| :: (HasGoProAuth m, MonadFail m, MonadIO m) | |
| => [FilePath] | The list of files to include in the medium. |
| -> Uploader m a | The action to perform. |
| -> m a | The result of the inner action. |
Run an Uploader monad to create a single medium and upload the content for it.
resumeUpload :: (HasGoProAuth m, MonadFail m, MonadIO m) => [FilePath] -> MediumID -> Uploader m a -> m a Source #
Run an Uploader monad for which we already know the MediumID (i.e., we're resuming an upload we previously began).
createMedium :: (HasGoProAuth m, MonadIO m) => Uploader m MediumID Source #
Create a new medium (e.g., video, photo, etc...) and return its ID.
createSource :: (HasGoProAuth m, MonadIO m) => Int -> Uploader m DerivativeID Source #
Convenient action for creating a Source derivative.
Arguments
| :: (HasGoProAuth m, MonadIO m) | |
| => Int | The number of parts this derivative contains. |
| -> Text | The "type" of this derivative. |
| -> Text | The label of this derivative. |
| -> Uploader m DerivativeID |
Create a new derivative of the current medium containing the given number of parts.
Arguments
| :: (HasGoProAuth m, MonadIO m) | |
| => DerivativeID | The derivative into which we're uploading. |
| -> Int | The part number (1-based) being uploaded. |
| -> Int | The size of the file being uploaded in this part. |
| -> Uploader m Upload |
Create a new upload for a derivative.
Arguments
| :: (HasGoProAuth m, MonadIO m) | |
| => UploadID | The upload ID. |
| -> DerivativeID | The derivative ID. |
| -> Int | The part number within the derivative. |
| -> Integer | The size of the file that was uploaded. |
| -> Uploader m () |
Mark the given upload for the given derivative as complete.
Arguments
| :: (HasGoProAuth m, MonadIO m) | |
| => 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 |
Retreive an Upload with the given upload and derivative ID.
Arguments
| :: (MonadMask m, MonadIO m) | |
| => FilePath | The path being uploaded. |
| -> UploadPart | The UploadPart describing the chunk of upload being transferred |
| -> Uploader m () |
Upload a chunk of of the given file as specified by this UploadPart.
markAvailable :: (HasGoProAuth m, MonadIO m) => DerivativeID -> Uploader m () Source #
Mark the given derivative as availble to use. This also updates the medium record marking it as having completed its upload.
Data Types
type DerivativeID = Text Source #
data UploadPart Source #
Constructors
| UploadPart | |
Fields
| |
Instances
| Show UploadPart Source # | |
Defined in GoPro.Plus.Upload Methods showsPrec :: Int -> UploadPart -> ShowS # show :: UploadPart -> String # showList :: [UploadPart] -> ShowS # | |
Constructors
| Upload | |
Fields
| |
uploadParts :: Lens' Upload [UploadPart] Source #
Uploader monad.
setMediumType :: Monad m => MediumType -> Uploader m () Source #
Override the detected medium type.
setLogAction :: (Monad m, MonadMask m) => (String -> m ()) -> Uploader m () Source #
Set the logging action to report retries (or whatever other interesting things might happen).
For your convenience.
listUploading :: (HasGoProAuth m, MonadIO m) => m [Medium] Source #
List all media in uploading state.