Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienDeepgram committed Jul 14, 2024
1 parent 4cc02af commit e06c401
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/speak/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use options::{Options, SerializableOptions};
use reqwest::RequestBuilder;
use serde_json::json;
use serde_json::Value;
use std::fs::File;
use std::io::copy;
use std::path::Path;
Expand All @@ -26,12 +26,19 @@ impl<'a> Speak<'a> {
options: &Options,
output_file: &Path,
) -> crate::Result<()> {
let payload = Value::Object(
[("text".to_string(), Value::String(text.to_string()))]
.iter()
.cloned()
.collect(),
);

let request_builder = self
.0
.client
.post(self.speak_url())
.query(&SerializableOptions(options))
.json(&json!({ "text": text }));
.json(&payload);

self.send_and_translate_response(request_builder, output_file)
.await
Expand Down

0 comments on commit e06c401

Please sign in to comment.