diff --git a/Cargo.toml b/Cargo.toml
index 3edd898..0ebcf98 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ byteorder = "1"
bytes = "1"
cpal = "0.15"
crossbeam = "0.8"
-deepgram = {path = "deepgram-rust-sdk"}
eframe = {version = "0.27", default-features = false, features = ["default_fonts", "glow", "persistence"]}
egui = "0.27"
egui_extras = {version = "0.27", features = ["image"]}
diff --git a/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/bug_report.md b/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index a68b46a..0000000
--- a/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-name: Bug report
-about: Something is occurring that I think is wrong
-title: ''
-labels: "bug"
-assignees: ''
-
----
-
-## What is the current behavior?
-
-
-
-## Steps to reproduce
-
-
-
-## Expected behavior
-
-
-
-## Please tell us about your environment
-
-- **`deepgram` Package Version:**
-- **Operating System/Version:**
-- **Rust Version:**
-
-## Other information
-
-
diff --git a/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/config.yml b/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/config.yml
deleted file mode 100644
index 422e244..0000000
--- a/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/config.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-blank_issues_enabled: false
-contact_links:
- - name: DeepgramAI on Twitter
- url: https://twitter.com/DeepgramAI
diff --git a/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/feature_request.md b/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/feature_request.md
deleted file mode 100644
index f99ae59..0000000
--- a/deepgram-rust-sdk/.github/ISSUE_TEMPLATE/feature_request.md
+++ /dev/null
@@ -1,24 +0,0 @@
----
-name: Feature Request
-about: I think X would be a cool addition or change.
-title: ''
-labels: "enhancement"
-assignees: ''
-
----
-
-## Proposed changes
-
-
-
-## Context
-
-
-
-## Possible Implementation
-
-
-
-## Other information
-
-
diff --git a/deepgram-rust-sdk/.github/PULL_REQUEST_TEMPLATE.md b/deepgram-rust-sdk/.github/PULL_REQUEST_TEMPLATE.md
deleted file mode 100644
index d4b6aed..0000000
--- a/deepgram-rust-sdk/.github/PULL_REQUEST_TEMPLATE.md
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-## Proposed changes
-
-
-
-## Types of changes
-
-
-
-
-- [ ] Bugfix (non-breaking change which fixes an issue)
-- [ ] New feature (non-breaking change which adds functionality)
-- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
-- [ ] Documentation update or tests (if none of the other choices apply)
-
-## Checklist
-
-
-
-
-- [ ] I have read the [CONTRIBUTING.md](../CONTRIBUTING.md) doc
-- [ ] I have added tests and/or examples that prove my fix is effective or that my feature works
-- [ ] I have added necessary documentation (if appropriate)
-
-## Further comments
-
-
diff --git a/deepgram-rust-sdk/.github/workflows/ci.yaml b/deepgram-rust-sdk/.github/workflows/ci.yaml
deleted file mode 100644
index 42dab37..0000000
--- a/deepgram-rust-sdk/.github/workflows/ci.yaml
+++ /dev/null
@@ -1,93 +0,0 @@
-on: [push, pull_request]
-
-name: CI
-env:
- CARGO_TERM_COLOR: always
- RUSTFLAGS: -D warnings
- RUSTDOCFLAGS: -D warnings
-
-jobs:
- Build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Install libasound2-dev
- run: |
- sudo apt-get update
- sudo apt-get install libasound2-dev
- - name: Cargo Build
- run: cargo build --all-targets --all-features
- Clippy:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Install libasound2-dev
- run: |
- sudo apt-get update
- sudo apt-get install libasound2-dev
- - name: Cargo Clippy
- run: cargo clippy --all-targets --all-features
- Test:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Install libasound2-dev
- run: |
- sudo apt-get update
- sudo apt-get install libasound2-dev
- - name: Cargo Test
- run: cargo test --all --all-features
- Format:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Cargo Fmt
- run: cargo fmt --check --all
- Documentation:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Cargo Doc
- run: cargo doc --workspace --all-features
- Audit:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Install cargo-audit
- run: cargo install --locked cargo-audit
- - name: Remove Dev Dependencies
- run: |
- cargo install --locked cargo-hack
- cargo hack --remove-dev-deps
- cargo generate-lockfile
- - name: Cargo Audit
- run: cargo audit
- Minimal-Versions:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Install libasound2-dev
- run: |
- sudo apt-get update
- sudo apt-get install libasound2-dev
- - name: Install Rust Nightly
- run: rustup toolchain install nightly
- - name: Cargo Build
- run: rustup run nightly cargo build --all-targets --all-features -Z minimal-versions
- - name: Cargo Test
- run: rustup run nightly cargo test --all --all-features -Z minimal-versions
- - name: Remove Dev Dependencies
- run: |
- cargo install --locked cargo-hack
- cargo hack --remove-dev-deps
- rustup run nightly cargo generate-lockfile -Z minimal-versions
- - name: Cargo Build Without Dev Dependencies
- run: rustup run nightly cargo build --all-features -Z minimal-versions
- SemVer:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Install cargo-semver-checks
- run: cargo install --locked cargo-semver-checks
- - name: Cargo SemVer Checks
- run: cargo semver-checks check-release --verbose
diff --git a/deepgram-rust-sdk/.gitignore b/deepgram-rust-sdk/.gitignore
deleted file mode 100644
index 4fffb2f..0000000
--- a/deepgram-rust-sdk/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/target
-/Cargo.lock
diff --git a/deepgram-rust-sdk/CHANGELOG.md b/deepgram-rust-sdk/CHANGELOG.md
deleted file mode 100644
index 6b686bc..0000000
--- a/deepgram-rust-sdk/CHANGELOG.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Changelog
-All notable changes to this project will be documented in this file.
-
-The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
-and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-
-## [Unreleased]
-
-## [0.4.0] - 2023-11-01
-
-### Added
-- `detect_language` option.
-
-### Changed
-- Remove generic from `Deepgram` struct.
-- Upgrade dependencies: `tungstenite`, `tokio-tungstenite`, `reqwest`.
-
-## [0.3.0]
-
-### Added
-- Derive `Serialize` for all response types.
-
-### Fixed
-- Use the users builder options when building a streaming URL.
-- Make sure that `Future` returned from `StreamRequestBuilder::start()` is `Send`.
-
-### Changed
-- Use Rustls instead of OpenSSL.
-
-[Unreleased]: https://github.com/deepgram-devs/deepgram-rust-sdk/compare/0.4.0...HEAD
-[0.4.0]: https://github.com/deepgram-devs/deepgram-rust-sdk/compare/0.3.0...0.4.0
-[0.3.0]: https://github.com/deepgram-devs/deepgram-rust-sdk/compare/0.2.1...0.3.0
diff --git a/deepgram-rust-sdk/CODE_OF_CONDUCT.md b/deepgram-rust-sdk/CODE_OF_CONDUCT.md
deleted file mode 100644
index 72005d0..0000000
--- a/deepgram-rust-sdk/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Community Code of Conduct
-
-The Deepgram Community Code of Conduct can be found at
\ No newline at end of file
diff --git a/deepgram-rust-sdk/CONTRIBUTING.md b/deepgram-rust-sdk/CONTRIBUTING.md
deleted file mode 100644
index f804f09..0000000
--- a/deepgram-rust-sdk/CONTRIBUTING.md
+++ /dev/null
@@ -1,49 +0,0 @@
-**NOTICE**: *For the majority of situations, please use the dev branch as the base for your pull request.
-We only update the main branch when we release a new version of the package.
-[More info](https://github.com/deepgram-devs/deepgram-rust-sdk/wiki/Branches).*
-
-# Contributing Guidelines
-
-Want to contribute to this project? We ❤️ it!
-
-Here are a few types of contributions that we would be interested in hearing about.
-
-* Bug fixes
- * If you find a bug, please first report it using GitHub Issues.
- * Issues that have already been identified as a bug will be labeled `bug`.
- * If you'd like to submit a fix for a bug, send a Pull Request from your own fork and mention the Issue number.
- * Include a test that isolates the bug and verifies that it was fixed.
-* New Features
- * If you'd like to accomplish something in the extension that it doesn't already do, describe the problem in a new GitHub Issue.
- * Issues that have been identified as a feature request will be labeled `enhancement`.
- * If you'd like to implement the new feature, please wait for feedback from the project maintainers before spending
- too much time writing the code. In some cases, `enhancement`s may not align well with the project objectives at
- the time.
-* Tests, Documentation, Miscellaneous
- * If you think the test coverage could be improved, the documentation could be clearer, you've got an alternative
- implementation of something that may have more advantages, or any other change we would still be glad hear about
- it.
- * If it's a trivial change, go ahead and send a Pull Request with the changes you have in mind.
- * If not, open a GitHub Issue to discuss the idea first.
-
-We also welcome anyone to work on any existing issues with the `good first issue` tag.
-
-## Requirements
-
-For a contribution to be accepted:
-
-* The test suite must be complete and pass
-* Code must follow existing styling conventions
-* Commit messages must be descriptive. Related issues should be mentioned by number.
-
-If the contribution doesn't meet these criteria, a maintainer will discuss it with you. You can still
-continue to add more commits to the branch you have sent the Pull Request from.
-
-## How To
-
-1. Fork this repository on GitHub.
-2. Clone/fetch your fork to your local development machine.
-3. Create a new branch and check it out.
-4. Make your changes and commit them. (Did the tests pass? No linting errors?)
-5. Push your new branch to your fork.
-6. Open a Pull Request from your new branch to the [`deepgram-devs/deepgram-rust-sdk`](https://github.com/deepgram-devs/deepgram-rust-sdk)'s `dev` branch.
diff --git a/deepgram-rust-sdk/Cargo.toml b/deepgram-rust-sdk/Cargo.toml
deleted file mode 100644
index 4d36654..0000000
--- a/deepgram-rust-sdk/Cargo.toml
+++ /dev/null
@@ -1,36 +0,0 @@
-[package]
-name = "deepgram"
-version = "0.4.0"
-authors = ["Deepgram "]
-edition = "2021"
-description = "Official Rust SDK for Deepgram's automated speech recognition APIs."
-license = "MIT"
-repository = "https://github.com/deepgram-devs/deepgram-rust-sdk"
-keywords = ["deepgram", "asr", "transcription", "ai", "speech-to-text"]
-categories = ["api-bindings", "multimedia::audio"]
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-# TODO Investigate which of these dependencies can go behind features.
-bytes = "1"
-futures = "0.3"
-http = "1"
-pin-project = "1"
-reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] }
-serde = { version = "1", features = ["derive"] }
-serde_json = "1"
-thiserror = "1"
-tokio = { version = "1", features = ["full"] }
-tokio-tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"] }
-tokio-util = { version = "0.7.1", features = ["codec", "io"] }
-tungstenite = "0.21"
-url = "2"
-uuid = { version = "1", features = ["serde"] }
-# Dependencies below are specified only to satisfy minimal-versions.
-proc-macro2 = "1.0.60"
-
-[dev-dependencies]
-pkg-config = "0.3.27"
-cpal = "0.14"
-crossbeam = "0.8"
diff --git a/deepgram-rust-sdk/LICENSE b/deepgram-rust-sdk/LICENSE
deleted file mode 100644
index 6aa6f9d..0000000
--- a/deepgram-rust-sdk/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2022 Deepgram
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/deepgram-rust-sdk/README.md b/deepgram-rust-sdk/README.md
deleted file mode 100644
index beb5f4b..0000000
--- a/deepgram-rust-sdk/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# Deepgram Rust SDK
-
-[](https://github.com/deepgram-devs/deepgram-rust-sdk/actions/workflows/ci.yaml)
-[](https://crates.io/crates/deepgram)
-[](https://crates.io/crates/deepgram)
-[](https://docs.rs/deepgram)
-[](./LICENSE)
-
-Experimental Rust SDK for [Deepgram](https://www.deepgram.com/). Power your apps with world-class speech and Language AI models.
-
-> This SDK only supports hosted usage of api.deepgram.com.
-
-## Getting an API Key
-
-🔑 To access the Deepgram API you will need a [free Deepgram API Key](https://console.deepgram.com/signup?jump=keys).
-## Documentation
-
-You can learn more about the Deepgram API at [developers.deepgram.com](https://developers.deepgram.com/docs).
-
-## Current Status
-
-This SDK is still very much work-in-progress. The interface is subject to rapid change.
-## Install
-
-From within your Cargo project directory, run the following command:
-
-```sh
-cargo add deepgram
-```
-
-You will also probably need to install [`tokio`](https://crates.io/crates/tokio):
-
-```sh
-cargo add tokio --features full
-```
-
-## Documentation and Examples
-
-Documentation and examples can be found on our [Docs.rs page](https://docs.rs/deepgram/latest/deepgram/).
-
-## Development and Contributing
-
-Interested in contributing? We ❤️ pull requests!
-
-To make sure our community is safe for all, be sure to review and agree to our
-[Code of Conduct](./CODE_OF_CONDUCT.md). Then see the
-[Contributing Guidelines](./CONTRIBUTING.md) for more information.
-
-## Getting Help
-
-We love to hear from you so if you have questions, comments or find a bug in the
-project, let us know! You can either:
-
-- [Open an issue in this repository](https://github.com/deepgram-devs/deepgram-rust-sdk/issues/new)
-- [Join the Deepgram Github Discussions Community](https://github.com/orgs/deepgram/discussions)
-- [Join the Deepgram Discord Community](https://discord.gg/xWRaCDBtW4)
-
-[license]: LICENSE.txt
\ No newline at end of file
diff --git a/deepgram-rust-sdk/examples/billing.rs b/deepgram-rust-sdk/examples/billing.rs
deleted file mode 100644
index 73cc0c8..0000000
--- a/deepgram-rust-sdk/examples/billing.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-use deepgram::{Deepgram, DeepgramError};
-use std::env;
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let deepgram_api_key =
- env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
-
- let project_id =
- env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
-
- let balance_id =
- env::var("DEEPGRAM_BALANCE_ID").expect("DEEPGRAM_BALANCE_ID environmental variable");
-
- let dg_client = Deepgram::new(&deepgram_api_key);
-
- let all_balances = dg_client.billing().list_balance(&project_id).await?;
- println!("{:#?}", all_balances);
-
- let specific_balance = dg_client
- .billing()
- .get_balance(&project_id, &balance_id)
- .await?;
- println!("{:#?}", specific_balance);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/callback.rs b/deepgram-rust-sdk/examples/callback.rs
deleted file mode 100644
index 5533c31..0000000
--- a/deepgram-rust-sdk/examples/callback.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-use std::env;
-
-use deepgram::{
- transcription::prerecorded::{
- audio_source::AudioSource,
- options::{Language, Options},
- },
- Deepgram, DeepgramError,
-};
-
-static AUDIO_URL: &str = "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav";
-
-#[tokio::main]
-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 source = AudioSource::from_url(AUDIO_URL);
-
- let options = Options::builder()
- .punctuate(true)
- .language(Language::en_US)
- .build();
-
- let callback_url =
- env::var("DEEPGRAM_CALLBACK_URL").expect("DEEPGRAM_CALLBACK_URL environmental variable");
-
- let response = dg_client
- .transcription()
- .prerecorded_callback(source, &options, &callback_url)
- .await?;
-
- println!("{}", response.request_id);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/invitations.rs b/deepgram-rust-sdk/examples/invitations.rs
deleted file mode 100644
index 8bbf088..0000000
--- a/deepgram-rust-sdk/examples/invitations.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-use std::env;
-
-use deepgram::{Deepgram, DeepgramError};
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let deepgram_api_key =
- env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
-
- let project_id =
- env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
-
- let dg_client = Deepgram::new(&deepgram_api_key);
-
- let message = dg_client.invitations().leave_project(&project_id).await?;
- println!("{:#?}", message);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/keys.rs b/deepgram-rust-sdk/examples/keys.rs
deleted file mode 100644
index 463a44f..0000000
--- a/deepgram-rust-sdk/examples/keys.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-use std::env;
-
-use deepgram::{keys::options::Options, Deepgram, DeepgramError};
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let deepgram_api_key =
- env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
-
- let project_id =
- env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
-
- let key_id = env::var("DEEPGRAM_KEY_ID").expect("DEEPGRAM_KEY_ID environmental variable");
-
- let dg_client = Deepgram::new(&deepgram_api_key);
-
- let keys = dg_client.keys().list(&project_id).await?;
- println!("{:#?}", keys);
-
- let key = dg_client.keys().get(&project_id, &key_id).await?;
- println!("{:#?}", key);
-
- let options = Options::builder("New Key", ["member"]).build();
- let new_key = dg_client.keys().create(&project_id, &options).await?;
- println!("{:#?}", new_key);
-
- let message = dg_client.keys().delete(&project_id, &key_id).await?;
- println!("{}", message.message);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/make_prerecorded_request_builder.rs b/deepgram-rust-sdk/examples/make_prerecorded_request_builder.rs
deleted file mode 100644
index 53ceb26..0000000
--- a/deepgram-rust-sdk/examples/make_prerecorded_request_builder.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-use std::env;
-
-use deepgram::{
- transcription::prerecorded::{
- audio_source::AudioSource,
- options::{Language, Options},
- response::Response,
- },
- Deepgram,
-};
-
-static AUDIO_URL: &str = "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav";
-
-#[tokio::main]
-async fn main() -> reqwest::Result<()> {
- let deepgram_api_key =
- env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
-
- let dg_client = Deepgram::new(&deepgram_api_key);
-
- let source = AudioSource::from_url(AUDIO_URL);
-
- let options = Options::builder()
- .punctuate(true)
- .language(Language::en_US)
- .build();
-
- let request_builder = dg_client
- .transcription()
- .make_prerecorded_request_builder(source, &options);
-
- // Customize the RequestBuilder here
- let customized_request_builder = request_builder
- .query(&[("custom_query_key", "custom_query_value")])
- .header("custom_header_key", "custom_header_value");
-
- // It is necessary to annotate the type of response here
- // That way it knows what type to deserialize the JSON into
- let response: Response = customized_request_builder.send().await?.json().await?;
-
- let transcript = &response.results.channels[0].alternatives[0].transcript;
- println!("{}", transcript);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/members.rs b/deepgram-rust-sdk/examples/members.rs
deleted file mode 100644
index 27de3fd..0000000
--- a/deepgram-rust-sdk/examples/members.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-use std::env;
-
-use deepgram::{Deepgram, DeepgramError};
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let deepgram_api_key =
- env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
-
- let project_id =
- env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
-
- let member_id =
- env::var("DEEPGRAM_MEMBER_ID").expect("DEEPGRAM_MEMBER_ID environmental variable");
-
- let dg_client = Deepgram::new(&deepgram_api_key);
-
- let members = dg_client.members().list_members(&project_id).await?;
- println!("{:#?}", members);
-
- let message = dg_client
- .members()
- .remove_member(&project_id, &member_id)
- .await?;
- println!("{}", message.message);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/microphone_stream.rs b/deepgram-rust-sdk/examples/microphone_stream.rs
deleted file mode 100644
index 9165226..0000000
--- a/deepgram-rust-sdk/examples/microphone_stream.rs
+++ /dev/null
@@ -1,112 +0,0 @@
-use std::env;
-use std::thread;
-
-use bytes::{BufMut, Bytes, BytesMut};
-use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
-use cpal::Sample;
-use crossbeam::channel::RecvError;
-use futures::channel::mpsc::{self, Receiver as FuturesReceiver};
-use futures::stream::StreamExt;
-use futures::SinkExt;
-
-use deepgram::{Deepgram, DeepgramError};
-
-fn microphone_as_stream() -> FuturesReceiver> {
- let (sync_tx, sync_rx) = crossbeam::channel::unbounded();
- let (mut async_tx, async_rx) = mpsc::channel(1);
-
- thread::spawn(move || {
- let host = cpal::default_host();
- let device = host.default_input_device().unwrap();
-
- // let config = device.supported_input_configs().unwrap();
- // for config in config {
- // dbg!(&config);
- // }
-
- let config = device.default_input_config().unwrap();
-
- // dbg!(&config);
-
- let stream = match config.sample_format() {
- cpal::SampleFormat::F32 => device
- .build_input_stream(
- &config.into(),
- move |data: &[f32], _: &_| {
- let mut bytes = BytesMut::with_capacity(data.len() * 2);
- for sample in data {
- bytes.put_i16_le(sample.to_i16());
- }
- sync_tx.send(bytes.freeze()).unwrap();
- },
- |_| panic!(),
- )
- .unwrap(),
- cpal::SampleFormat::I16 => device
- .build_input_stream(
- &config.into(),
- move |data: &[i16], _: &_| {
- let mut bytes = BytesMut::with_capacity(data.len() * 2);
- for sample in data {
- bytes.put_i16_le(*sample);
- }
- sync_tx.send(bytes.freeze()).unwrap();
- },
- |_| panic!(),
- )
- .unwrap(),
- cpal::SampleFormat::U16 => device
- .build_input_stream(
- &config.into(),
- move |data: &[u16], _: &_| {
- let mut bytes = BytesMut::with_capacity(data.len() * 2);
- for sample in data {
- bytes.put_i16_le(sample.to_i16());
- }
- sync_tx.send(bytes.freeze()).unwrap();
- },
- |_| panic!(),
- )
- .unwrap(),
- };
-
- stream.play().unwrap();
-
- loop {
- thread::park();
- }
- });
-
- tokio::spawn(async move {
- loop {
- let data = sync_rx.recv();
- async_tx.send(data).await.unwrap();
- }
- });
-
- async_rx
-}
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let dg = Deepgram::new(env::var("DEEPGRAM_API_KEY").unwrap());
-
- let mut results = dg
- .transcription()
- .stream_request()
- .stream(microphone_as_stream())
- // TODO Enum.
- .encoding("linear16".to_string())
- // TODO Specific to my machine, not general enough example.
- .sample_rate(44100)
- // TODO Specific to my machine, not general enough example.
- .channels(2)
- .start()
- .await?;
-
- while let Some(result) = results.next().await {
- println!("got: {:?}", result);
- }
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/prerecorded_from_file/Bueller-Life-moves-pretty-fast.mp3 b/deepgram-rust-sdk/examples/prerecorded_from_file/Bueller-Life-moves-pretty-fast.mp3
deleted file mode 100644
index 0de454c..0000000
Binary files a/deepgram-rust-sdk/examples/prerecorded_from_file/Bueller-Life-moves-pretty-fast.mp3 and /dev/null differ
diff --git a/deepgram-rust-sdk/examples/prerecorded_from_file/main.rs b/deepgram-rust-sdk/examples/prerecorded_from_file/main.rs
deleted file mode 100644
index c80872c..0000000
--- a/deepgram-rust-sdk/examples/prerecorded_from_file/main.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-use std::env;
-
-use deepgram::{
- transcription::prerecorded::{
- audio_source::AudioSource,
- options::{Language, Options},
- },
- Deepgram, DeepgramError,
-};
-use tokio::fs::File;
-
-static PATH_TO_FILE: &str = "examples/prerecorded_from_file/Bueller-Life-moves-pretty-fast.mp3";
-
-#[tokio::main]
-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 file = File::open(PATH_TO_FILE).await.unwrap();
-
- let source = AudioSource::from_buffer_with_mime_type(file, "audio/mpeg3");
-
- let options = Options::builder()
- .punctuate(true)
- .language(Language::en_US)
- .build();
-
- let response = dg_client
- .transcription()
- .prerecorded(source, &options)
- .await?;
-
- let transcript = &response.results.channels[0].alternatives[0].transcript;
- println!("{}", transcript);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/prerecorded_from_url.rs b/deepgram-rust-sdk/examples/prerecorded_from_url.rs
deleted file mode 100644
index d7de33e..0000000
--- a/deepgram-rust-sdk/examples/prerecorded_from_url.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-use std::env;
-
-use deepgram::{
- transcription::prerecorded::{
- audio_source::AudioSource,
- options::{Language, Options},
- },
- Deepgram, DeepgramError,
-};
-
-static AUDIO_URL: &str = "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav";
-
-#[tokio::main]
-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 source = AudioSource::from_url(AUDIO_URL);
-
- let options = Options::builder()
- .punctuate(true)
- .language(Language::en_US)
- .build();
-
- let response = dg_client
- .transcription()
- .prerecorded(source, &options)
- .await?;
-
- let transcript = &response.results.channels[0].alternatives[0].transcript;
- println!("{}", transcript);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/projects.rs b/deepgram-rust-sdk/examples/projects.rs
deleted file mode 100644
index bd0c784..0000000
--- a/deepgram-rust-sdk/examples/projects.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-use std::env;
-
-use deepgram::{projects::options::Options, Deepgram, DeepgramError};
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let deepgram_api_key =
- env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
-
- let project_id =
- env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
-
- let dg_client = Deepgram::new(&deepgram_api_key);
-
- let projects = dg_client.projects().list().await?;
- println!("{:#?}", projects);
-
- let project = dg_client.projects().get(&project_id).await?;
- println!("{:#?}", project);
-
- let options = Options::builder()
- .name("The Transcribinator")
- .company("Doofenshmirtz Evil Incorporated")
- .build();
- let message = dg_client.projects().update(&project_id, &options).await?;
- println!("{}", message.message);
-
- let message = dg_client.projects().delete(&project_id).await?;
- println!("{}", message.message);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/scopes.rs b/deepgram-rust-sdk/examples/scopes.rs
deleted file mode 100644
index 3d376b4..0000000
--- a/deepgram-rust-sdk/examples/scopes.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-use std::env;
-
-use deepgram::{Deepgram, DeepgramError};
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let deepgram_api_key =
- env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
-
- let project_id =
- env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
-
- let member_id =
- env::var("DEEPGRAM_MEMBER_ID").expect("DEEPGRAM_MEMBER_ID environmental variable");
-
- let dg_client = Deepgram::new(&deepgram_api_key);
-
- let scopes = dg_client
- .scopes()
- .get_scope(&project_id, &member_id)
- .await?;
- println!("{:#?}", scopes);
-
- let message = dg_client
- .scopes()
- .update_scope(&project_id, &member_id, "member")
- .await?;
- println!("{}", message.message);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/simple_stream.rs b/deepgram-rust-sdk/examples/simple_stream.rs
deleted file mode 100644
index 424dc7a..0000000
--- a/deepgram-rust-sdk/examples/simple_stream.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-use std::env;
-use std::time::Duration;
-
-use futures::stream::StreamExt;
-
-use deepgram::{Deepgram, DeepgramError};
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let dg = Deepgram::new(env::var("DEEPGRAM_API_KEY").unwrap());
-
- let mut results = dg
- .transcription()
- .stream_request()
- .file(
- env::var("FILENAME").unwrap(),
- 3174,
- Duration::from_millis(16),
- )
- .await?
- .start()
- .await?;
-
- while let Some(result) = results.next().await {
- println!("got: {:?}", result);
- }
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/examples/usage.rs b/deepgram-rust-sdk/examples/usage.rs
deleted file mode 100644
index 8f20891..0000000
--- a/deepgram-rust-sdk/examples/usage.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-use std::env;
-
-use deepgram::{
- usage::{get_fields_options, get_usage_options, list_requests_options},
- Deepgram, DeepgramError,
-};
-
-#[tokio::main]
-async fn main() -> Result<(), DeepgramError> {
- let deepgram_api_key =
- env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
-
- let project_id =
- env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
-
- let request_id =
- env::var("DEEPGRAM_REQUEST_ID").expect("DEEPGRAM_REQUEST_ID environmental variable");
-
- let dg_client = Deepgram::new(&deepgram_api_key);
-
- let options = list_requests_options::Options::builder().build();
- let requests = dg_client
- .usage()
- .list_requests(&project_id, &options)
- .await?;
- println!("{:#?}", requests);
-
- let request = dg_client
- .usage()
- .get_request(&project_id, &request_id)
- .await?;
- println!("{:#?}", request);
-
- let options = get_usage_options::Options::builder().build();
- let summary = dg_client.usage().get_usage(&project_id, &options).await?;
- println!("{:#?}", summary);
-
- let options = get_fields_options::Options::builder().build();
- let summary = dg_client.usage().get_fields(&project_id, &options).await?;
- println!("{:#?}", summary);
-
- Ok(())
-}
diff --git a/deepgram-rust-sdk/rustfmt.toml b/deepgram-rust-sdk/rustfmt.toml
deleted file mode 100644
index 8b13789..0000000
--- a/deepgram-rust-sdk/rustfmt.toml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/deepgram-rust-sdk/src/billing.rs b/deepgram-rust-sdk/src/billing.rs
deleted file mode 100644
index a3d775d..0000000
--- a/deepgram-rust-sdk/src/billing.rs
+++ /dev/null
@@ -1,135 +0,0 @@
-//! Get the outstanding balances for a Deepgram Project.
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#billing
-
-use crate::{send_and_translate_response, Deepgram};
-
-pub mod response;
-
-use response::{Balance, Balances};
-
-/// Get the outstanding balances for a Deepgram Project.
-///
-/// Constructed using [`Deepgram::billing`].
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#billing
-#[derive(Debug, Clone)]
-pub struct Billing<'a>(&'a Deepgram);
-
-impl Deepgram {
- /// Construct a new [`Billing`] from a [`Deepgram`].
- pub fn billing(&self) -> Billing<'_> {
- self.into()
- }
-}
-
-impl<'a> From<&'a Deepgram> for Billing<'a> {
- /// Construct a new [`Billing`] from a [`Deepgram`].
- fn from(deepgram: &'a Deepgram) -> Self {
- Self(deepgram)
- }
-}
-
-impl Billing<'_> {
- /// Get the outstanding balances for the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#billing-all
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use deepgram::{Deepgram, DeepgramError};
- /// # use std::env;
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let balances = dg_client
- /// .billing()
- /// .list_balance(&project_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn list_balance(&self, project_id: &str) -> crate::Result {
- let url = format!(
- "https://api.deepgram.com/v1/projects/{}/balances",
- project_id,
- );
-
- send_and_translate_response(self.0.client.get(url)).await
- }
-
- /// Get the details of a specific balance.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#billing-get
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use deepgram::{Deepgram, DeepgramError};
- /// # use std::env;
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// # let balance_id =
- /// # env::var("DEEPGRAM_BALANCE_ID").expect("DEEPGRAM_BALANCE_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let balance = dg_client
- /// .billing()
- /// .get_balance(&project_id, &balance_id)
- /// .await?;
- ///
- /// assert_eq!(balance_id, balance.balance_id.to_string());
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn get_balance(&self, project_id: &str, balance_id: &str) -> crate::Result {
- let url = format!(
- "https://api.deepgram.com/v1/projects/{}/balances/{}",
- project_id, balance_id,
- );
-
- send_and_translate_response(self.0.client.get(url)).await
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::{response::BillingUnits, *};
-
- #[test]
- fn test() {
- assert_eq!(
- serde_json::from_str::(
- "{\"balance_id\":\"a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8\",\"amount\":1,\"units\":\"usd\",\"purchase_order_id\":\"a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8\"}",
- ).unwrap().units,
- BillingUnits::Usd
- );
- }
-}
diff --git a/deepgram-rust-sdk/src/billing/response.rs b/deepgram-rust-sdk/src/billing/response.rs
deleted file mode 100644
index 3068c6e..0000000
--- a/deepgram-rust-sdk/src/billing/response.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-//! Deepgram billing API response types.
-
-use serde::{Deserialize, Serialize};
-use uuid::Uuid;
-
-/// The balances for a Deepgram Project.
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#billing
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Balances {
- #[allow(missing_docs)]
- pub balances: Vec,
-}
-
-/// Information about a specific balance.
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#billing
-#[allow(missing_docs)] // Struct fields are documented in the API reference
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Balance {
- #[allow(missing_docs)]
- pub balance_id: Uuid,
-
- #[allow(missing_docs)]
- pub amount: f64,
-
- #[allow(missing_docs)]
- pub units: BillingUnits,
-
- #[allow(missing_docs)]
- pub purchase_order_id: Uuid,
-}
-
-/// Units for the [`Balance::amount`] field.
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#billing
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Serialize, Deserialize)]
-#[non_exhaustive]
-pub enum BillingUnits {
- #[allow(missing_docs)]
- #[serde(rename = "usd")]
- Usd,
-
- #[allow(missing_docs)]
- #[serde(rename = "hour")]
- Hour,
-}
diff --git a/deepgram-rust-sdk/src/invitations.rs b/deepgram-rust-sdk/src/invitations.rs
deleted file mode 100644
index fae53b6..0000000
--- a/deepgram-rust-sdk/src/invitations.rs
+++ /dev/null
@@ -1,74 +0,0 @@
-//! Manage the invitations to a Deepgram Project.
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#invitations
-
-use crate::{send_and_translate_response, Deepgram};
-
-pub mod response;
-
-use response::Message;
-
-/// Manage the invitations to a Deepgram Project.
-///
-/// Constructed using [`Deepgram::invitations`].
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#invitations
-#[derive(Debug, Clone)]
-pub struct Invitations<'a>(&'a Deepgram);
-
-impl Deepgram {
- /// Construct a new [`Invitations`] from a [`Deepgram`].
- pub fn invitations(&self) -> Invitations<'_> {
- self.into()
- }
-}
-
-impl<'a> From<&'a Deepgram> for Invitations<'a> {
- /// Construct a new [`Invitations`] from a [`Deepgram`].
- fn from(deepgram: &'a Deepgram) -> Self {
- Self(deepgram)
- }
-}
-
-impl Invitations<'_> {
- /// Remove the authenticated account from the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#invitations
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// dg_client
- /// .invitations()
- /// .leave_project(&project_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn leave_project(&self, project_id: &str) -> crate::Result {
- let url = format!("https://api.deepgram.com/v1/projects/{}/leave", project_id,);
-
- send_and_translate_response(self.0.client.delete(url)).await
- }
-}
diff --git a/deepgram-rust-sdk/src/invitations/response.rs b/deepgram-rust-sdk/src/invitations/response.rs
deleted file mode 100644
index 657f8ab..0000000
--- a/deepgram-rust-sdk/src/invitations/response.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//! Deepgram invitations API response types.
-
-use serde::{Deserialize, Serialize};
-
-/// Success message.
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#invitations
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Message {
- #[allow(missing_docs)]
- pub message: String,
-}
diff --git a/deepgram-rust-sdk/src/keys.rs b/deepgram-rust-sdk/src/keys.rs
deleted file mode 100644
index 3b76b1c..0000000
--- a/deepgram-rust-sdk/src/keys.rs
+++ /dev/null
@@ -1,205 +0,0 @@
-//! Manage the keys for a Deepgram Project.
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#keys
-
-use crate::{send_and_translate_response, Deepgram};
-
-pub mod options;
-pub mod response;
-
-use options::{Options, SerializableOptions};
-use response::{MemberAndApiKey, MembersAndApiKeys, Message, NewApiKey};
-
-/// Manage the keys for a Deepgram Project.
-///
-/// Constructed using [`Deepgram::keys`].
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#keys
-#[derive(Debug, Clone)]
-pub struct Keys<'a>(&'a Deepgram);
-
-impl Deepgram {
- /// Construct a new [`Keys`] from a [`Deepgram`].
- pub fn keys(&self) -> Keys<'_> {
- self.into()
- }
-}
-
-impl<'a> From<&'a Deepgram> for Keys<'a> {
- /// Construct a new [`Keys`] from a [`Deepgram`].
- fn from(deepgram: &'a Deepgram) -> Self {
- Self(deepgram)
- }
-}
-
-impl Keys<'_> {
- /// Get keys for the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#keys-get-keys
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{keys::options::Options, Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let keys = dg_client
- /// .keys()
- /// .list(&project_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn list(&self, project_id: &str) -> crate::Result {
- let url = format!("https://api.deepgram.com/v1/projects/{}/keys", project_id);
-
- send_and_translate_response(self.0.client.get(url)).await
- }
-
- /// Get details of the specified key.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#keys-get-key
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{keys::options::Options, Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// # let key_id = env::var("DEEPGRAM_KEY_ID").expect("DEEPGRAM_KEY_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let key = dg_client
- /// .keys()
- /// .get(&project_id, &key_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn get(&self, project_id: &str, key_id: &str) -> crate::Result {
- let url = format!(
- "https://api.deepgram.com/v1/projects/{}/keys/{}",
- project_id, key_id,
- );
-
- send_and_translate_response(self.0.client.get(url)).await
- }
-
- /// Create a new key in the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#keys-create
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{keys::options::Options, Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// # let key_id = env::var("DEEPGRAM_KEY_ID").expect("DEEPGRAM_KEY_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let options = Options::builder("New Key", ["member"]).build();
- /// let new_key = dg_client
- /// .keys()
- /// .create(&project_id, &options)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn create(&self, project_id: &str, options: &Options) -> crate::Result {
- let url = format!("https://api.deepgram.com/v1/projects/{}/keys", project_id);
- let request = self
- .0
- .client
- .post(url)
- .json(&SerializableOptions::from(options));
-
- send_and_translate_response(request).await
- }
-
- /// Delete the specified key in the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#keys-delete
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{keys::options::Options, Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// # let key_id = env::var("DEEPGRAM_KEY_ID").expect("DEEPGRAM_KEY_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// dg_client
- /// .keys()
- /// .delete(&project_id, &key_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn delete(&self, project_id: &str, key_id: &str) -> crate::Result {
- let url = format!(
- "https://api.deepgram.com/v1/projects/{}/keys/{}",
- project_id, key_id,
- );
-
- send_and_translate_response(self.0.client.delete(url)).await
- }
-}
diff --git a/deepgram-rust-sdk/src/keys/options.rs b/deepgram-rust-sdk/src/keys/options.rs
deleted file mode 100644
index 9ded59e..0000000
--- a/deepgram-rust-sdk/src/keys/options.rs
+++ /dev/null
@@ -1,259 +0,0 @@
-//! Set options for [`Keys::create`](super::Keys::create).
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#keys-create
-
-use serde::Serialize;
-
-/// Used as a parameter for [`Keys::create`](super::Keys::create).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#keys-create
-#[derive(Debug, PartialEq, Clone)]
-pub struct Options {
- comment: String,
- tags: Vec,
- scopes: Vec,
- expiration: Option,
-}
-
-#[derive(Debug, PartialEq, Clone)]
-enum Expiration {
- ExpirationDate(String),
- TimeToLiveInSeconds(usize),
-}
-
-/// Builds an [`Options`] object using [the Builder pattern][builder].
-///
-/// [builder]: https://rust-unofficial.github.io/patterns/patterns/creational/builder.html
-#[derive(Debug, PartialEq, Clone)]
-pub struct OptionsBuilder(Options);
-
-#[derive(Serialize)]
-pub(super) struct SerializableOptions<'a> {
- comment: &'a String,
-
- #[serde(skip_serializing_if = "Vec::is_empty")]
- tags: &'a Vec,
-
- scopes: &'a Vec,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- expiration_date: Option<&'a String>,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- time_to_live_in_seconds: Option,
-}
-
-impl Options {
- /// Construct a new [`OptionsBuilder`].
- pub fn builder<'a>(
- comment: impl Into,
- scopes: impl IntoIterator- ,
- ) -> OptionsBuilder {
- OptionsBuilder::new(comment, scopes)
- }
-}
-
-impl OptionsBuilder {
- /// Construct a new [`OptionsBuilder`].
- pub fn new<'a>(comment: impl Into, scopes: impl IntoIterator
- ) -> Self {
- Self(Options {
- comment: comment.into(),
- tags: Vec::new(),
- scopes: scopes.into_iter().map(String::from).collect(),
- expiration: None,
- })
- }
-
- /// Set the comment.
- ///
- /// This will overwrite any previously set comment,
- /// including the one set in [`OptionsBuilder::new`] for [`Options::builder`].
- ///
- /// # Examples
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options1 = Options::builder("Old comment", ["member"])
- /// .comment("New comment")
- /// .build();
- ///
- /// let options2 = Options::builder("New comment", ["member"]).build();
- ///
- /// assert_eq!(options1, options2);
- /// ```
- pub fn comment(mut self, comment: impl Into) -> Self {
- self.0.comment = comment.into();
- self
- }
-
- /// Set the tags.
- ///
- /// Calling this when already set will append to the existing tags, not overwrite them.
- ///
- /// # Examples
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options = Options::builder("New Key", ["member"])
- /// .tag(["Tag 1", "Tag 2"])
- /// .build();
- /// ```
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options1 = Options::builder("New Key", ["member"])
- /// .tag(["Tag 1"])
- /// .tag(["Tag 2"])
- /// .build();
- ///
- /// let options2 = Options::builder("New Key", ["member"])
- /// .tag(["Tag 1", "Tag 2"])
- /// .build();
- ///
- /// assert_eq!(options1, options2);
- /// ```
- pub fn tag<'a>(mut self, tags: impl IntoIterator
- ) -> Self {
- self.0.tags.extend(tags.into_iter().map(String::from));
- self
- }
-
- /// Set additional scopes.
- ///
- /// Calling this when already set will append to the existing scopes, not overwrite them.
- ///
- /// # Examples
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options = Options::builder("New Key", ["member"])
- /// .scopes(["admin"])
- /// .build();
- /// ```
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options1 = Options::builder("New Key", ["member"])
- /// .scopes(["admin"])
- /// .build();
- ///
- /// let options2 = Options::builder("New Key", ["member", "admin"]).build();
- ///
- /// assert_eq!(options1, options2);
- /// ```
- pub fn scopes<'a>(mut self, scopes: impl IntoIterator
- ) -> Self {
- self.0.scopes.extend(scopes.into_iter().map(String::from));
- self
- }
-
- /// Set the expiration date.
- ///
- /// This will unset the time to live in seconds.
- ///
- /// # Examples
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options = Options::builder("New Key", ["member"])
- /// .expiration_date("2038-01-19")
- /// .build();
- /// ```
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options1 = Options::builder("New Key", ["member"])
- /// .time_to_live_in_seconds(7776000)
- /// .expiration_date("2038-01-19")
- /// .build();
- ///
- /// let options2 = Options::builder("New Key", ["member"])
- /// .expiration_date("2038-01-19")
- /// .build();
- ///
- /// assert_eq!(options1, options2);
- /// ```
- pub fn expiration_date(mut self, expiration_date: impl Into) -> Self {
- self.0.expiration = Some(Expiration::ExpirationDate(expiration_date.into()));
- self
- }
-
- /// Set the time to live in seconds.
- ///
- /// This will unset the expiration date.
- ///
- /// # Examples
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options = Options::builder("New Key", ["member"])
- /// .time_to_live_in_seconds(7776000)
- /// .build();
- /// ```
- ///
- /// ```
- /// # use deepgram::keys::options::Options;
- /// #
- /// let options1 = Options::builder("New Key", ["member"])
- /// .expiration_date("2038-01-19")
- /// .time_to_live_in_seconds(7776000)
- /// .build();
- ///
- /// let options2 = Options::builder("New Key", ["member"])
- /// .time_to_live_in_seconds(7776000)
- /// .build();
- ///
- /// assert_eq!(options1, options2);
- /// ```
- pub fn time_to_live_in_seconds(mut self, time_to_live_in_seconds: usize) -> Self {
- self.0.expiration = Some(Expiration::TimeToLiveInSeconds(time_to_live_in_seconds));
- self
- }
-
- /// Finish building the [`Options`] object.
- pub fn build(self) -> Options {
- self.0
- }
-}
-
-impl<'a> From<&'a Options> for SerializableOptions<'a> {
- fn from(options: &'a Options) -> Self {
- // Destructuring it makes sure that we don't forget to use any of it
- let Options {
- comment,
- tags,
- scopes,
- expiration,
- } = options;
-
- let mut serializable_options = Self {
- comment,
- tags,
- scopes,
- expiration_date: None,
- time_to_live_in_seconds: None,
- };
-
- match expiration {
- Some(Expiration::ExpirationDate(expiration_date)) => {
- serializable_options.expiration_date = Some(expiration_date);
- }
- Some(Expiration::TimeToLiveInSeconds(time_to_live_in_seconds)) => {
- serializable_options.time_to_live_in_seconds = Some(*time_to_live_in_seconds);
- }
- None => {}
- };
-
- serializable_options
- }
-}
diff --git a/deepgram-rust-sdk/src/keys/response.rs b/deepgram-rust-sdk/src/keys/response.rs
deleted file mode 100644
index 7b3a885..0000000
--- a/deepgram-rust-sdk/src/keys/response.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-//! Deepgram keys API response types.
-
-use serde::{Deserialize, Serialize};
-use uuid::Uuid;
-
-pub use crate::response::Message;
-
-/// Returned by [`Keys::list`](super::Keys::list).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#keys-get-keys
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct MembersAndApiKeys {
- #[allow(missing_docs)]
- pub api_keys: Vec,
-}
-
-/// Returned by [`Keys::get`](super::Keys::get).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#keys-get-key
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct MemberAndApiKey {
- #[allow(missing_docs)]
- pub member: Member,
-
- #[allow(missing_docs)]
- pub api_key: ApiKey,
-}
-
-/// Details of a single member.
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#keys-get-key
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Member {
- #[allow(missing_docs)]
- pub member_id: Uuid,
-
- #[allow(missing_docs)]
- pub first_name: Option,
-
- #[allow(missing_docs)]
- pub last_name: Option,
-
- #[allow(missing_docs)]
- pub email: String,
-}
-
-/// Details of a single API key.
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#keys-get-key
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct ApiKey {
- #[allow(missing_docs)]
- pub api_key_id: Uuid,
-
- #[allow(missing_docs)]
- pub comment: String,
-
- #[allow(missing_docs)]
- pub scopes: Vec,
-
- #[allow(missing_docs)]
- pub tags: Option>,
-
- #[allow(missing_docs)]
- pub created: String,
-
- #[allow(missing_docs)]
- pub expiration_date: Option,
-}
-
-/// Returned by [`Keys::create`](super::Keys::create).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#keys-create
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct NewApiKey {
- #[allow(missing_docs)]
- pub api_key_id: Uuid,
-
- #[allow(missing_docs)]
- pub key: String,
-
- #[allow(missing_docs)]
- pub comment: String,
-
- #[allow(missing_docs)]
- pub scopes: Vec,
-
- #[allow(missing_docs)]
- pub tags: Option>,
-
- #[allow(missing_docs)]
- pub created: String,
-
- #[allow(missing_docs)]
- pub expiration_date: Option,
-}
diff --git a/deepgram-rust-sdk/src/lib.rs b/deepgram-rust-sdk/src/lib.rs
deleted file mode 100644
index a10ad53..0000000
--- a/deepgram-rust-sdk/src/lib.rs
+++ /dev/null
@@ -1,136 +0,0 @@
-#![forbid(unsafe_code)]
-#![warn(missing_debug_implementations, clippy::cargo)]
-#![allow(clippy::multiple_crate_versions, clippy::derive_partial_eq_without_eq)]
-
-//! Official Rust SDK for Deepgram's automated speech recognition APIs.
-//!
-//! Get started transcribing with a [`Transcription`](transcription::Transcription) object.
-
-use std::io;
-
-use reqwest::{
- header::{HeaderMap, HeaderValue},
- RequestBuilder,
-};
-use serde::de::DeserializeOwned;
-use thiserror::Error;
-
-pub mod billing;
-pub mod invitations;
-pub mod keys;
-pub mod members;
-pub mod projects;
-pub mod scopes;
-pub mod transcription;
-pub mod usage;
-
-mod response;
-
-/// A client for the Deepgram API.
-///
-/// Make transcriptions requests using [`Deepgram::transcription`].
-#[derive(Debug, Clone)]
-pub struct Deepgram {
- api_key: String,
- client: reqwest::Client,
-}
-
-/// Errors that may arise from the [`deepgram`](crate) crate.
-// TODO sub-errors for the different types?
-#[derive(Debug, Error)]
-pub enum DeepgramError {
- /// No source was provided to the request builder.
- #[error("No source was provided to the request builder.")]
- NoSource,
-
- /// The Deepgram API returned an error.
- #[error("The Deepgram API returned an error.")]
- DeepgramApiError {
- /// Error message from the Deepgram API.
- body: String,
-
- /// Underlying [`reqwest::Error`] from the HTTP request.
- err: reqwest::Error,
- },
-
- /// Something went wrong when generating the http request.
- #[error("Something went wrong when generating the http request: {0}")]
- HttpError(#[from] http::Error),
-
- /// Something went wrong when making the HTTP request.
- #[error("Something went wrong when making the HTTP request: {0}")]
- ReqwestError(#[from] reqwest::Error),
-
- /// Something went wrong during I/O.
- #[error("Something went wrong during I/O: {0}")]
- IoError(#[from] io::Error),
-
- /// Something went wrong with WS.
- #[error("Something went wrong with WS: {0}")]
- WsError(#[from] tungstenite::Error),
-
- /// Something went wrong during serialization/deserialization.
- #[error("Something went wrong during serialization/deserialization: {0}")]
- SerdeError(#[from] serde_json::Error),
-}
-
-type Result = std::result::Result;
-
-impl Deepgram {
- /// Construct a new Deepgram client.
- ///
- /// Create your first API key on the [Deepgram Console][console].
- ///
- /// [console]: https://console.deepgram.com/
- ///
- /// # Panics
- ///
- /// Panics under the same conditions as [`reqwest::Client::new`].
- pub fn new>(api_key: K) -> Self {
- static USER_AGENT: &str = concat!(
- env!("CARGO_PKG_NAME"),
- "/",
- env!("CARGO_PKG_VERSION"),
- " rust",
- );
-
- let authorization_header = {
- let mut header = HeaderMap::new();
- header.insert(
- "Authorization",
- HeaderValue::from_str(&format!("Token {}", api_key.as_ref()))
- .expect("Invalid API key"),
- );
- header
- };
- let api_key = api_key.as_ref().to_owned();
-
- Deepgram {
- api_key,
- client: reqwest::Client::builder()
- .user_agent(USER_AGENT)
- .default_headers(authorization_header)
- .build()
- // Even though `reqwest::Client::new` is not used here, it will always panic under the same conditions
- .expect("See reqwest::Client::new docs for cause of panic"),
- }
- }
-}
-
-/// Sends the request and checks the response for an error.
-///
-/// If there is an error, it translates it into a [`DeepgramError::DeepgramApiError`].
-/// Otherwise, it deserializes the JSON accordingly.
-async fn send_and_translate_response(
- request_builder: RequestBuilder,
-) -> crate::Result {
- let response = request_builder.send().await?;
-
- match response.error_for_status_ref() {
- Ok(_) => Ok(response.json().await?),
- Err(err) => Err(DeepgramError::DeepgramApiError {
- body: response.text().await?,
- err,
- }),
- }
-}
diff --git a/deepgram-rust-sdk/src/members.rs b/deepgram-rust-sdk/src/members.rs
deleted file mode 100644
index 8651da5..0000000
--- a/deepgram-rust-sdk/src/members.rs
+++ /dev/null
@@ -1,122 +0,0 @@
-//! Manage the members of a Deepgram Project.
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#members
-
-use crate::{send_and_translate_response, Deepgram};
-
-pub mod response;
-
-/// Manage the members of a Deepgram Project.
-///
-/// Constructed using [`Deepgram::members`].
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#members
-#[derive(Debug, Clone)]
-pub struct Members<'a>(&'a Deepgram);
-
-impl Deepgram {
- /// Construct a new [`Members`] from a [`Deepgram`].
- pub fn members(&self) -> Members<'_> {
- self.into()
- }
-}
-
-impl<'a> From<&'a Deepgram> for Members<'a> {
- /// Construct a new [`Members`] from a [`Deepgram`].
- fn from(deepgram: &'a Deepgram) -> Self {
- Self(deepgram)
- }
-}
-
-impl Members<'_> {
- /// Get all members of the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#members-get-members
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let members = dg_client
- /// .members()
- /// .list_members(&project_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn list_members(&self, project_id: &str) -> crate::Result {
- let url = format!(
- "https://api.deepgram.com/v1/projects/{}/members",
- project_id,
- );
-
- send_and_translate_response(self.0.client.get(url)).await
- }
-
- /// Remove the specified member from the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#members-delete
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// # let member_id =
- /// # env::var("DEEPGRAM_MEMBER_ID").expect("DEEPGRAM_MEMBER_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// dg_client
- /// .members()
- /// .remove_member(&project_id, &member_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn remove_member(
- &self,
- project_id: &str,
- member_id: &str,
- ) -> crate::Result {
- let url = format!(
- "https://api.deepgram.com/v1/projects/{}/members/{}",
- project_id, member_id,
- );
-
- send_and_translate_response(self.0.client.delete(url)).await
- }
-}
diff --git a/deepgram-rust-sdk/src/members/response.rs b/deepgram-rust-sdk/src/members/response.rs
deleted file mode 100644
index 578bc6d..0000000
--- a/deepgram-rust-sdk/src/members/response.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-//! Deepgram members API response types.
-
-use serde::{Deserialize, Serialize};
-use uuid::Uuid;
-
-pub use crate::response::Message;
-
-/// Returned by [`Members::list_members`](super::Members::list_members).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#members-get-members
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Members {
- #[allow(missing_docs)]
- pub members: Vec,
-}
-
-/// Returned by [`Members::list_members`](super::Members::list_members).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#members-get-members
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Member {
- #[allow(missing_docs)]
- pub member_id: Uuid,
-
- #[allow(missing_docs)]
- pub first_name: Option,
-
- #[allow(missing_docs)]
- pub last_name: Option,
-
- #[allow(missing_docs)]
- pub scopes: Vec,
-
- #[allow(missing_docs)]
- pub email: String,
-}
diff --git a/deepgram-rust-sdk/src/projects.rs b/deepgram-rust-sdk/src/projects.rs
deleted file mode 100644
index 64a170e..0000000
--- a/deepgram-rust-sdk/src/projects.rs
+++ /dev/null
@@ -1,198 +0,0 @@
-//! Manage Deepgram Projects.
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#projects
-
-use crate::{send_and_translate_response, Deepgram};
-
-pub mod options;
-pub mod response;
-
-use options::{Options, SerializableOptions};
-use response::{Message, Project};
-
-/// Manage Deepgram Projects.
-///
-/// Constructed using [`Deepgram::projects`].
-///
-/// You can create new Deepgram Projects on the [Deepgram Console][console].
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [console]: https://console.deepgram.com/
-/// [api]: https://developers.deepgram.com/api-reference/#projects
-#[derive(Debug, Clone)]
-pub struct Projects<'a>(&'a Deepgram);
-
-impl Deepgram {
- /// Construct a new [`Projects`] from a [`Deepgram`].
- pub fn projects(&self) -> Projects<'_> {
- self.into()
- }
-}
-
-impl<'a> From<&'a Deepgram> for Projects<'a> {
- /// Construct a new [`Projects`] from a [`Deepgram`].
- fn from(deepgram: &'a Deepgram) -> Self {
- Self(deepgram)
- }
-}
-
-impl Projects<'_> {
- /// Get all projects.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#projects-get-projects
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{projects::options::Options, Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # 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 projects = dg_client
- /// .projects()
- /// .list()
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn list(&self) -> crate::Result {
- let request = self.0.client.get("https://api.deepgram.com/v1/projects");
-
- send_and_translate_response(request).await
- }
-
- /// Get a specific project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#projects-get-project
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{projects::options::Options, Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let project = dg_client
- /// .projects()
- /// .get(&project_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn get(&self, project_id: &str) -> crate::Result {
- let url = format!("https://api.deepgram.com/v1/projects/{}", project_id);
-
- send_and_translate_response(self.0.client.get(url)).await
- }
-
- /// Update the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#projects-update
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{projects::options::Options, Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let options = Options::builder()
- /// .name("The Transcribinator")
- /// .company("Doofenshmirtz Evil Incorporated")
- /// .build();
- ///
- /// dg_client
- /// .projects()
- /// .update(&project_id, &options)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn update(&self, project_id: &str, options: &Options) -> crate::Result {
- let url = format!("https://api.deepgram.com/v1/projects/{}", project_id);
- let request = self
- .0
- .client
- .patch(url)
- .json(&SerializableOptions::from(options));
-
- send_and_translate_response(request).await
- }
-
- /// Delete the specified project.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#projects-get-delete
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{projects::options::Options, Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// dg_client
- /// .projects()
- /// .delete(&project_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn delete(&self, project_id: &str) -> crate::Result {
- let url = format!("https://api.deepgram.com/v1/projects/{}", project_id);
- let request = self.0.client.delete(url);
-
- send_and_translate_response(request).await
- }
-}
diff --git a/deepgram-rust-sdk/src/projects/options.rs b/deepgram-rust-sdk/src/projects/options.rs
deleted file mode 100644
index 133d69a..0000000
--- a/deepgram-rust-sdk/src/projects/options.rs
+++ /dev/null
@@ -1,102 +0,0 @@
-//! Set options for [`Projects::update`](super::Projects::update).
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#projects-update
-
-use serde::Serialize;
-
-/// Used as a parameter for [`Projects::update`](super::Projects::update).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#projects-update
-#[derive(Debug, PartialEq, Eq, Clone, Hash)]
-pub struct Options {
- name: Option,
- company: Option,
-}
-
-/// Builds an [`Options`] object using [the Builder pattern][builder].
-///
-/// [builder]: https://rust-unofficial.github.io/patterns/patterns/creational/builder.html
-#[derive(Debug, PartialEq, Clone)]
-pub struct OptionsBuilder(Options);
-
-#[derive(Serialize)]
-pub(super) struct SerializableOptions<'a> {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub(super) name: &'a Option,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- pub(super) company: &'a Option,
-}
-
-impl Options {
- /// Construct a new [`OptionsBuilder`].
- pub fn builder() -> OptionsBuilder {
- OptionsBuilder::new()
- }
-}
-
-impl OptionsBuilder {
- /// Construct a new [`OptionsBuilder`].
- pub fn new() -> Self {
- Self(Options {
- name: None,
- company: None,
- })
- }
-
- /// Set the project name.
- ///
- /// # Examples
- ///
- /// ```
- /// # use deepgram::projects::options::Options;
- /// #
- /// let options = Options::builder()
- /// .name("The Transcribinator")
- /// .build();
- /// ```
- pub fn name(mut self, name: impl Into) -> Self {
- self.0.name = Some(name.into());
- self
- }
-
- /// Set the project company.
- ///
- /// # Examples
- ///
- /// ```
- /// # use deepgram::projects::options::Options;
- /// #
- /// let options = Options::builder()
- /// .company("Doofenshmirtz Evil Incorporated")
- /// .build();
- /// ```
- pub fn company(mut self, company: impl Into) -> Self {
- self.0.company = Some(company.into());
- self
- }
-
- /// Finish building the [`Options`] object.
- pub fn build(self) -> Options {
- self.0
- }
-}
-
-impl Default for OptionsBuilder {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl<'a> From<&'a Options> for SerializableOptions<'a> {
- fn from(options: &'a Options) -> Self {
- // Destructuring it makes sure that we don't forget to use any of it
- let Options { name, company } = options;
-
- Self { name, company }
- }
-}
diff --git a/deepgram-rust-sdk/src/projects/response.rs b/deepgram-rust-sdk/src/projects/response.rs
deleted file mode 100644
index 18c9e21..0000000
--- a/deepgram-rust-sdk/src/projects/response.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-//! Deepgram projects API response types.
-
-use serde::{Deserialize, Serialize};
-use uuid::Uuid;
-
-pub use crate::response::Message;
-
-/// Returned by [`Projects::list`](super::Projects::list).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#projects-get-projects
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Projects {
- #[allow(missing_docs)]
- pub projects: Vec,
-}
-
-/// Returned by [`Projects::get`](super::Projects::get).
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#projects-get-project
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Project {
- #[allow(missing_docs)]
- pub project_id: Uuid,
-
- #[allow(missing_docs)]
- pub name: String,
-
- #[allow(missing_docs)]
- pub company: Option,
-}
diff --git a/deepgram-rust-sdk/src/response.rs b/deepgram-rust-sdk/src/response.rs
deleted file mode 100644
index 6f58b50..0000000
--- a/deepgram-rust-sdk/src/response.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//! Response types that are shared by multiple parts of the API.
-
-use serde::{Deserialize, Serialize};
-
-/// A success message.
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Message {
- #[allow(missing_docs)]
- pub message: String,
-}
diff --git a/deepgram-rust-sdk/src/scopes.rs b/deepgram-rust-sdk/src/scopes.rs
deleted file mode 100644
index aa75c99..0000000
--- a/deepgram-rust-sdk/src/scopes.rs
+++ /dev/null
@@ -1,140 +0,0 @@
-//! Manage the permissions of a Deepgram Project.
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#scopes
-
-use serde::Serialize;
-
-use crate::{send_and_translate_response, Deepgram};
-
-pub mod response;
-
-use response::Message;
-
-/// Manage the permissions of a Deepgram Project.
-///
-/// Constructed using [`Deepgram::scopes`].
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#scopes
-#[derive(Debug, Clone)]
-pub struct Scopes<'a>(&'a Deepgram);
-
-impl Deepgram {
- /// Construct a new [`Scopes`] from a [`Deepgram`].
- pub fn scopes(&self) -> Scopes<'_> {
- self.into()
- }
-}
-
-impl<'a> From<&'a Deepgram> for Scopes<'a> {
- /// Construct a new [`Scopes`] from a [`Deepgram`].
- fn from(deepgram: &'a Deepgram) -> Self {
- Self(deepgram)
- }
-}
-
-impl Scopes<'_> {
- /// Get the specified project scopes assigned to the specified member.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#scopes-get
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// # let member_id =
- /// # env::var("DEEPGRAM_MEMBER_ID").expect("DEEPGRAM_MEMBER_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// let scopes = dg_client
- /// .scopes()
- /// .get_scope(&project_id, &member_id)
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn get_scope(
- &self,
- project_id: &str,
- member_id: &str,
- ) -> crate::Result {
- let url = format!(
- "https://api.deepgram.com/v1/projects/{}/members/{}/scopes ",
- project_id, member_id
- );
-
- send_and_translate_response(self.0.client.get(url)).await
- }
-
- /// Update the specified project scopes assigned to the specified member.
- ///
- /// See the [Deepgram API Reference][api] for more info.
- ///
- /// [api]: https://developers.deepgram.com/api-reference/#scopes-update
- ///
- /// # Examples
- ///
- /// ```no_run
- /// # use std::env;
- /// #
- /// # use deepgram::{Deepgram, DeepgramError};
- /// #
- /// # #[tokio::main]
- /// # async fn main() -> Result<(), DeepgramError> {
- /// # let deepgram_api_key =
- /// # env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY environmental variable");
- /// #
- /// # let project_id =
- /// # env::var("DEEPGRAM_PROJECT_ID").expect("DEEPGRAM_PROJECT_ID environmental variable");
- /// #
- /// # let member_id =
- /// # env::var("DEEPGRAM_MEMBER_ID").expect("DEEPGRAM_MEMBER_ID environmental variable");
- /// #
- /// let dg_client = Deepgram::new(&deepgram_api_key);
- ///
- /// dg_client
- /// .scopes()
- /// .update_scope(&project_id, &member_id, "member")
- /// .await?;
- /// #
- /// # Ok(())
- /// # }
- /// ```
- pub async fn update_scope(
- &self,
- project_id: &str,
- member_id: &str,
- scope: &str,
- ) -> crate::Result {
- #[derive(Serialize)]
- struct Scope<'a> {
- scope: &'a str,
- }
-
- let url = format!(
- "https://api.deepgram.com/v1/projects/{}/members/{}/scopes",
- project_id, member_id
- );
- let request = self.0.client.put(url).json(&Scope { scope });
-
- send_and_translate_response(request).await
- }
-}
diff --git a/deepgram-rust-sdk/src/scopes/response.rs b/deepgram-rust-sdk/src/scopes/response.rs
deleted file mode 100644
index 993874a..0000000
--- a/deepgram-rust-sdk/src/scopes/response.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-//! Deepgram TODO API response types.
-
-use serde::{Deserialize, Serialize};
-
-pub use crate::response::Message;
-
-/// Scopes associated with the member.
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#scopes-get
-#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
-#[non_exhaustive]
-pub struct Scopes {
- #[allow(missing_docs)]
- pub scopes: Vec,
-}
diff --git a/deepgram-rust-sdk/src/transcription.rs b/deepgram-rust-sdk/src/transcription.rs
deleted file mode 100644
index 6a576e7..0000000
--- a/deepgram-rust-sdk/src/transcription.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-//! Transcribe audio using Deepgram's automated speech recognition.
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#transcription
-
-use crate::Deepgram;
-
-pub mod live;
-pub mod prerecorded;
-
-/// Transcribe audio using Deepgram's automated speech recognition.
-///
-/// Constructed using [`Deepgram::transcription`].
-///
-/// See the [Deepgram API Reference][api] for more info.
-///
-/// [api]: https://developers.deepgram.com/api-reference/#transcription
-#[derive(Debug, Clone)]
-pub struct Transcription<'a>(&'a Deepgram);
-
-impl Deepgram {
- /// Construct a new [`Transcription`] from a [`Deepgram`].
- pub fn transcription(&self) -> Transcription<'_> {
- self.into()
- }
-}
-
-impl<'a> From<&'a Deepgram> for Transcription<'a> {
- /// Construct a new [`Transcription`] from a [`Deepgram`].
- fn from(deepgram: &'a Deepgram) -> Self {
- Self(deepgram)
- }
-}
diff --git a/deepgram-rust-sdk/src/transcription/live.rs b/deepgram-rust-sdk/src/transcription/live.rs
deleted file mode 100644
index eed1ea1..0000000
--- a/deepgram-rust-sdk/src/transcription/live.rs
+++ /dev/null
@@ -1,305 +0,0 @@
-// TODO: Remove this lint
-// Currently not documented because interface of this module is still changing
-#![allow(missing_docs)]
-
-//! Types used for live audio transcription.
-//!
-//! See the [Deepgram API Reference][api] for more info.
-//!
-//! [api]: https://developers.deepgram.com/api-reference/#transcription-streaming
-
-use std::path::Path;
-use std::pin::Pin;
-use std::task::{Context, Poll};
-use std::time::Duration;
-
-use bytes::{Bytes, BytesMut};
-use futures::channel::mpsc::{self, Receiver};
-use futures::stream::StreamExt;
-use futures::{SinkExt, Stream};
-use http::Request;
-use pin_project::pin_project;
-use serde::{Deserialize, Serialize};
-use tokio::fs::File;
-use tokio_tungstenite::tungstenite::protocol::Message;
-use tokio_util::io::ReaderStream;
-use tungstenite::handshake::client;
-use url::Url;
-
-use crate::{Deepgram, DeepgramError, Result};
-
-use super::Transcription;
-
-#[derive(Debug)]
-pub struct StreamRequestBuilder<'a, S, E>
-where
- S: Stream
- >,
-{
- config: &'a Deepgram,
- source: Option
,
- encoding: Option,
- sample_rate: Option,
- channels: Option,
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct Word {
- pub word: String,
- pub start: f64,
- pub end: f64,
- pub confidence: f64,
- pub speaker: u8,
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-pub struct Alternatives {
- pub transcript: String,
- pub words: Vec,
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-pub struct Channel {
- pub alternatives: Vec,
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-#[serde(untagged)]
-pub enum StreamResponse {
- TranscriptResponse {
- duration: f64,
- is_final: bool,
- channel: Channel,
- },
- TerminalResponse {
- request_id: String,
- created: String,
- duration: f64,
- channels: u32,
- },
-}
-
-#[pin_project]
-struct FileChunker {
- chunk_size: usize,
- buf: BytesMut,
- #[pin]
- file: ReaderStream,
-}
-
-impl Transcription<'_> {
- pub fn stream_request>>(
- &self,
- ) -> StreamRequestBuilder {
- StreamRequestBuilder {
- config: self.0,
- source: None,
- encoding: None,
- sample_rate: None,
- channels: None,
- }
- }
-}
-
-impl FileChunker {
- fn new(file: File, chunk_size: usize) -> Self {
- FileChunker {
- chunk_size,
- buf: BytesMut::with_capacity(2 * chunk_size),
- file: ReaderStream::new(file),
- }
- }
-}
-
-impl Stream for FileChunker {
- type Item = Result;
-
- fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll