Skip to content

Commit

Permalink
fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdyer committed Aug 9, 2024
1 parent bdeb141 commit a9035fc
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/common/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,10 +1023,10 @@ impl OptionsBuilder {
/// #
/// # static AUDIO_URL: &str = "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav";
/// #
/// # fn main() -> Result<(), reqwest::Error> {
/// # fn main() -> Result<(), deepgram::DeepgramError> {
/// # let deepgram_api_key = env::var("DEEPGRAM_API_KEY").unwrap_or_default();
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
/// let dg_transcription = dg_client.transcription();
///
/// let options1 = Options::builder()
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl Deepgram {
client: reqwest::Client::builder()
.user_agent(USER_AGENT)
.default_headers(authorization_header)
.build()?
.build()?,
})
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/listen/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Transcription<'_> {
/// # let deepgram_api_key =
/// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let source = AudioSource::from_url(AUDIO_URL);
///
Expand Down Expand Up @@ -97,7 +97,7 @@ impl Transcription<'_> {
/// # let deepgram_api_key =
/// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let source = AudioSource::from_url(AUDIO_URL);
///
Expand Down Expand Up @@ -153,12 +153,12 @@ impl Transcription<'_> {
/// # static AUDIO_URL: &str = "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav";
/// #
/// # #[tokio::main]
/// # async fn main() -> reqwest::Result<()> {
/// # async fn main() -> Result<(), DeepgramError> {
/// #
/// # let deepgram_api_key =
/// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
/// #
/// # let dg_client = Deepgram::new(&deepgram_api_key);
/// # let dg_client = Deepgram::new(&deepgram_api_key)?;
/// #
/// # let source = AudioSource::from_url(AUDIO_URL);
/// #
Expand Down Expand Up @@ -221,12 +221,12 @@ impl Transcription<'_> {
/// # static AUDIO_URL: &str = "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav";
/// #
/// # #[tokio::main]
/// # async fn main() -> reqwest::Result<()> {
/// # async fn main() -> Result<(), DeepgramError> {
/// #
/// # let deepgram_api_key =
/// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
/// #
/// # let dg_client = Deepgram::new(&deepgram_api_key);
/// # let dg_client = Deepgram::new(&deepgram_api_key)?;
/// #
/// # let source = AudioSource::from_url(AUDIO_URL);
/// #
Expand Down
6 changes: 3 additions & 3 deletions src/listen/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Transcription<'_> {
/// listen::websocket::WebsocketBuilder,
/// };
///
/// let dg = Deepgram::new(std::env::var("DEEPGRAM_API_TOKEN").unwrap_or_default());
/// let dg = Deepgram::new(std::env::var("DEEPGRAM_API_TOKEN").unwrap_or_default()).unwrap();
/// let transcription = dg.transcription();
/// let builder: WebsocketBuilder<'_> = transcription
/// .stream_request()
Expand Down Expand Up @@ -114,7 +114,7 @@ impl Transcription<'_> {
/// },
/// };
///
/// let dg = Deepgram::new(std::env::var("DEEPGRAM_API_TOKEN").unwrap_or_default());
/// let dg = Deepgram::new(std::env::var("DEEPGRAM_API_TOKEN").unwrap_or_default()).unwrap();
/// let transcription = dg.transcription();
/// let options = Options::builder()
/// .model(Model::Nova2)
Expand Down Expand Up @@ -180,7 +180,7 @@ impl<'a> WebsocketBuilder<'a> {
/// },
/// };
///
/// let dg = Deepgram::new(std::env::var("DEEPGRAM_API_TOKEN").unwrap_or_default());
/// let dg = Deepgram::new(std::env::var("DEEPGRAM_API_TOKEN").unwrap_or_default()).unwrap();
/// let transcription = dg.transcription();
/// let options = Options::builder()
/// .model(Model::Nova2)
Expand Down
4 changes: 2 additions & 2 deletions src/manage/billing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Billing<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let balances = dg_client
/// .billing()
Expand Down Expand Up @@ -98,7 +98,7 @@ impl Billing<'_> {
/// # let balance_id =
/// # env::var("DEEPGRAM_BALANCE_ID").expect("DEEPGRAM_BALANCE_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let balance = dg_client
/// .billing()
Expand Down
2 changes: 1 addition & 1 deletion src/manage/invitations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Invitations<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// dg_client
/// .invitations()
Expand Down
8 changes: 4 additions & 4 deletions src/manage/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Keys<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let keys = dg_client
/// .keys()
Expand Down Expand Up @@ -102,7 +102,7 @@ impl Keys<'_> {
/// #
/// # let key_id = env::var("DEEPGRAM_KEY_ID").expect("DEEPGRAM_KEY_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let key = dg_client
/// .keys()
Expand Down Expand Up @@ -144,7 +144,7 @@ impl Keys<'_> {
/// #
/// # let key_id = env::var("DEEPGRAM_KEY_ID").expect("DEEPGRAM_KEY_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let options = Options::builder("New Key", ["member"]).build();
/// let new_key = dg_client
Expand Down Expand Up @@ -189,7 +189,7 @@ impl Keys<'_> {
/// #
/// # let key_id = env::var("DEEPGRAM_KEY_ID").expect("DEEPGRAM_KEY_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// dg_client
/// .keys()
Expand Down
4 changes: 2 additions & 2 deletions src/manage/members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Members<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let members = dg_client
/// .members()
Expand Down Expand Up @@ -99,7 +99,7 @@ impl Members<'_> {
/// # let member_id =
/// # env::var("DEEPGRAM_MEMBER_ID").expect("DEEPGRAM_MEMBER_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// dg_client
/// .members()
Expand Down
8 changes: 4 additions & 4 deletions src/manage/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Projects<'_> {
/// # let deepgram_api_key =
/// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let projects = dg_client
/// .projects()
Expand Down Expand Up @@ -96,7 +96,7 @@ impl Projects<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let project = dg_client
/// .projects()
Expand Down Expand Up @@ -133,7 +133,7 @@ impl Projects<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let options = Options::builder()
/// .name("The Transcribinator")
Expand Down Expand Up @@ -180,7 +180,7 @@ impl Projects<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// dg_client
/// .projects()
Expand Down
4 changes: 2 additions & 2 deletions src/manage/scopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Scopes<'_> {
/// # let member_id =
/// # env::var("DEEPGRAM_MEMBER_ID").expect("DEEPGRAM_MEMBER_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let scopes = dg_client
/// .scopes()
Expand Down Expand Up @@ -108,7 +108,7 @@ impl Scopes<'_> {
/// # let member_id =
/// # env::var("DEEPGRAM_MEMBER_ID").expect("DEEPGRAM_MEMBER_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// dg_client
/// .scopes()
Expand Down
8 changes: 4 additions & 4 deletions src/manage/usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Usage<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let options = list_requests_options::Options::builder().build();
/// let requests = dg_client
Expand Down Expand Up @@ -118,7 +118,7 @@ impl Usage<'_> {
/// # let request_id =
/// # env::var("DEEPGRAM_REQUEST_ID").expect("DEEPGRAM_REQUEST_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let request = dg_client
/// .usage()
Expand Down Expand Up @@ -161,7 +161,7 @@ impl Usage<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let options = get_usage_options::Options::builder().build();
/// let summary = dg_client
Expand Down Expand Up @@ -211,7 +211,7 @@ impl Usage<'_> {
/// # let project_id =
/// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
/// #
/// let dg_client = Deepgram::new(&deepgram_api_key);
/// let dg_client = Deepgram::new(&deepgram_api_key)?;
///
/// let options = get_fields_options::Options::builder().build();
/// let summary = dg_client
Expand Down

0 comments on commit a9035fc

Please sign in to comment.