speechmatics 0.3.0.0 → 0.3.1.0
raw patch · 4 files changed
+8/−45 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Speechmatics.JSON.PeekJob: [jobCreatedAt] :: Job -> Text
- Speechmatics.JSON.PeekJob: [jobDuration] :: Job -> Double
- Speechmatics.JSON.PeekJob: [jobId] :: Job -> Double
- Speechmatics.JSON.PeekJob: [jobJobStatus] :: Job -> Text
- Speechmatics.JSON.PeekJob: [jobJobType] :: Job -> Text
- Speechmatics.JSON.PeekJob: [jobLang] :: Job -> Text
- Speechmatics.JSON.PeekJob: [jobMeta] :: Job -> (Maybe Value)
- Speechmatics.JSON.PeekJob: [jobName] :: Job -> Text
- Speechmatics.JSON.PeekJob: [jobNextCheck] :: Job -> Double
- Speechmatics.JSON.PeekJob: [jobNotification] :: Job -> Text
- Speechmatics.JSON.PeekJob: [jobTranscription] :: Job -> Maybe Text
- Speechmatics.JSON.PeekJob: [jobUrl] :: Job -> Text
- Speechmatics.JSON.PeekJob: [jobUserId] :: Job -> Double
- Speechmatics.JSON.PeekJob: Job :: (Maybe Integer) -> Text -> Text -> Text -> Double -> Text -> Text -> Text -> Text -> Double -> (Maybe Value) -> Double -> Double -> Maybe Text -> Job
+ Speechmatics.JSON.PeekJob: Job :: (Maybe Integer) -> Job
Files
- speechmatics.cabal +2/−2
- src/Speechmatics/Client.hs +2/−0
- src/Speechmatics/JSON/PeekJob.hs +2/−15
- test/PeekJobSpec.hs +2/−28
speechmatics.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 63fe41e6b9c568c093582034f99bea7eb1a9275cd7369a231b24601f6ee2d16b+-- hash: 824e37b823d1a54f6601ecae18db2ec21ab2646cf2e9e09a330bb53ae3fa49ba name: speechmatics-version: 0.3.0.0+version: 0.3.1.0 synopsis: Speechmatics api client description: Upload audio files to speechmatics to get a transcription category: API
src/Speechmatics/Client.hs view
@@ -96,6 +96,7 @@ transcribe uri userID token options parts = do session <- Sess.newSession response <- Sess.postWith auth session postUri parts+ -- print $ response ^. responseBody case Post.parse (response ^. responseBody) of Left message -> return $ Left $ ParseError message Right parsed -> do@@ -123,6 +124,7 @@ pollStatus' Nothing url userID token session jobID = do let statusUri = (jobsUri url userID $ show $ jobID) <> (tokenUri token) statusResponse <- Sess.getWith makeOpts session statusUri+ -- print statusResponse let body = statusResponse ^. responseBody case second Peek.jobCheckWait (Peek.parse body) of Left error -> return $ Just $ ParseError error
src/Speechmatics/JSON/PeekJob.hs view
@@ -27,25 +27,12 @@ o .:?? val = fmap join (o .:? val) data Job = Job { - jobCheckWait :: (Maybe Integer),- jobNotification :: Text,- jobJobType :: Text,- jobUrl :: Text,- jobNextCheck :: Double,- jobLang :: Text,- jobJobStatus :: Text,- jobName :: Text,- jobCreatedAt :: Text,- jobId :: Double,- jobMeta :: (Maybe Value),- jobUserId :: Double,- jobDuration :: Double,- jobTranscription :: Maybe Text+ jobCheckWait :: (Maybe Integer) } deriving (Show,Eq,GHC.Generics.Generic) instance FromJSON Job where- parseJSON (Object v) = Job <$> v .:?? "check_wait" <*> v .: "notification" <*> v .: "job_type" <*> v .: "url" <*> v .: "next_check" <*> v .: "lang" <*> v .: "job_status" <*> v .: "name" <*> v .: "created_at" <*> v .: "id" <*> v .:?? "meta" <*> v .: "user_id" <*> v .: "duration" <*> v .: "transcription"+ parseJSON (Object v) = Job <$> v .:?? "check_wait" parseJSON _ = mzero
test/PeekJobSpec.hs view
@@ -13,20 +13,7 @@ progressExpected :: Job progressExpected = Job {- jobCheckWait = Just 30,- jobNotification = "email",- jobJobType = "transcription",- jobUrl = "/v1.0/user/42578/jobs/8221819/audio",- jobNextCheck = 1.527572657e9,- jobLang = "en-US",- jobJobStatus = "transcribing",- jobName = "file.mp3",- jobCreatedAt = "Tue, 29 May 2018 05:43:46 GMT",- jobId = 8221819.0,- jobMeta = Nothing,- jobUserId = 42578.0,- jobDuration = 4.0,- jobTranscription = Nothing+ jobCheckWait = Just 30 } progressFixture :: ByteString@@ -53,20 +40,7 @@ doneExpected :: Job doneExpected = Job {- jobCheckWait = Nothing,- jobNotification = "email",- jobJobType = "transcription",- jobUrl = "/v1.0/user/42578/jobs/8220130/audio",- jobNextCheck = 0.0,- jobLang = "en-US",- jobJobStatus = "done",- jobName = "zero.wav",- jobCreatedAt = "Tue, 29 May 2018 04:21:48 GMT",- jobId = 8220130.0,- jobMeta = Nothing,- jobUserId = 42578.0,- jobDuration = 0.0,- jobTranscription = Just "zero.json"+ jobCheckWait = Nothing } doneFixture :: ByteString doneFixture = fromStrict $ encodeUtf8 [text|